| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using Microsoft.Office.Interop.Excel;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Data.SqlClient;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Швейная_фабрика
- {
- public partial class FormGetMaterial : Form
- {
- public FormGetMaterial()
- {
- InitializeComponent();
- }
- SqlConnection con = new SqlConnection("Data Source=213.155.192.79,3002;Initial Catalog=СlothesFactoryLG;Persist Security Info=True;User ID=u21lebed;Password=hgm8");
- private void FormGetMaterial_Load(object sender, EventArgs e)
- {
- // TODO: данная строка кода позволяет загрузить данные в таблицу "сlothesFactoryLGDataSet.Furnitura". При необходимости она может быть перемещена или удалена.
- this.furnituraTableAdapter.Fill(this.сlothesFactoryLGDataSet.Furnitura);
- // TODO: данная строка кода позволяет загрузить данные в таблицу "сlothesFactoryLGDataSet.Tkan". При необходимости она может быть перемещена или удалена.
- this.tkanTableAdapter.Fill(this.сlothesFactoryLGDataSet.Tkan);
- }
- private void TbxL_TextChanged(object sender, KeyPressEventArgs e)
- {
- if (!char.IsDigit(e.KeyChar))
- e.Handled = true;
- if ((Keys)e.KeyChar == Keys.Back || (Keys)e.KeyChar == Keys.Delete)
- e.Handled = false;
- }
- private void BtnSave_Click(object sender, EventArgs e)
- {
- if (TbxNameTkan.Text.Trim() != "" && TbxColor.Text.Trim() != "" && TbxComment.Text.Trim() != "" && TbxL.Text.Trim() != "" && TbxW.Text.Trim() != "")
- {
- string Queri = $@"Insert Into Color
- values ('{TbxColor.Text}')";
- con.Open();
- SqlCommand cmd = new SqlCommand(Queri, con);
- cmd.ExecuteNonQuery();
- con.Close();
- Queri = $"Select id_colors From Color where Title = '{TbxColor.Text}'";
- con.Open();
- cmd = new SqlCommand(Queri, con);
- SqlDataReader Rez = cmd.ExecuteReader();
- Rez.Read();
- ((DataRowView)BSTkan.Current)["id_color"] = Rez["id_colors"];
- con.Close();
- BSTkan.EndEdit();
- this.tkanTableAdapter.Update(this.сlothesFactoryLGDataSet.Tkan);
- }
- if (TbxNameFur.Text.Trim() != "" && TbxCountFur.Text.Trim() != "")
- {
- BSFurnitura.EndEdit();
- this.furnituraTableAdapter.Update(this.сlothesFactoryLGDataSet.Furnitura);
- }
- this.DialogResult = DialogResult.OK;
- this.Close();
- }
- }
- }
|