private void TecAdd() { Action action = () => { if (tbTecName.Text.Length == 0) { tbTecName.BackColor = Color.Red; } else { tbTecName.BackColor = Color.White; ArrayList Checkarray = new ArrayList(); Checkarray.Add("\'" + tbTecName.Text + "\'"); Function_class UQCheck = new Function_class("Tec_Name_UQ_Check", Function_class.Function_Result.scalar, Checkarray); if (UQCheck.Regtable.Rows[0][0].ToString() == "False") { MessageBox.Show("Технология с таким названием уже существует!", "Arizona Database", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { ArrayList array = new ArrayList(); Procedure_Class tecInsert = new Procedure_Class(); array.Add(tbTecName.Text); array.Add(nudTecEfficiency.Value.ToString()); array.Add(tbTecAbout.Text); tecInsert.procedure_Execution("Tec_Insert", array); TecLoad(); } } }; Invoke(action); }
private void ClReg() { Action action = () => { if (tbFirstname.Text.Length == 0) { tbFirstname.BackColor = Color.Red; } else { tbFirstname.BackColor = Color.White; if (tbName.Text.Length == 0) { tbName.BackColor = Color.Red; } else { tbName.BackColor = Color.White; if ((tbLogin.Text.Length == 0) | (tbLogin.Text.IndexOf('@') == -1) | (tbLogin.Text.IndexOf('.') == -1) | (tbLogin.Text.IndexOf('@') > tbLogin.Text.IndexOf('.'))) { tbLogin.BackColor = Color.Red; } else { tbLogin.BackColor = Color.White; ArrayList Checkarray = new ArrayList(); DES des = DES.Create(); byte[] key = Convert.FromBase64String("ybqAS+sVBLY="); byte[] IV = Convert.FromBase64String("1mbClpyz5bU="); des.Key = key; des.IV = IV; byte[] login = Crypt_Class.SymmetricEncrypt(tbLogin.Text, des); Checkarray.Add("\'" + Convert.ToBase64String(login) + "\'"); Function_class UQCheck = new Function_class("Client_Face_Adress_UQ_Check", Function_class.Function_Result.scalar, Checkarray); if (UQCheck.Regtable.Rows[0][0].ToString() == "False") { tbLogin.BackColor = Color.Red; } else { tbLogin.BackColor = Color.White; if ((tbPassword.Text.Length < 6) | (tbPassword.Text.IndexOfAny(numbers) == -1) | (tbPassword.Text.IndexOfAny(ruLetters) != -1) | (tbPassword.Text != tbConfirm.Text)) { tbPassword.BackColor = Color.Red; } else { tbPassword.BackColor = Color.Red; ArrayList array = new ArrayList(); array.Add(tbName.Text); array.Add(tbFirstname.Text); array.Add(tbPatronymic.Text); DES indes = DES.Create(); byte[] inkey = Convert.FromBase64String("ybqAS+sVBLY="); byte[] inIV = Convert.FromBase64String("1mbClpyz5bU="); indes.Key = inkey; indes.IV = inIV; byte[] inlogin = Crypt_Class.SymmetricEncrypt(tbLogin.Text, indes); byte[] inpasswd = Crypt_Class.SymmetricEncrypt(tbPassword.Text, indes); array.Add(Convert.ToBase64String(inlogin)); array.Add(Convert.ToBase64String(inpasswd)); array.Add(cbClient.SelectedValue); array.Add("0"); Procedure_Class procedure = new Procedure_Class(); procedure.procedure_Execution("Client_Face_Insert", array); this.Hide(); this.Owner.Show(); } } } } } }; Invoke(action); }
private void ClReg() { Action action = () => { if ((tbLogin.Text.Length == 0) | (tbLogin.Text.IndexOf('@') == -1) | (tbLogin.Text.IndexOf('.') == -1) | (tbLogin.Text.IndexOf('@') > tbLogin.Text.IndexOf('.'))) { tbLogin.BackColor = Color.Red; } else { tbLogin.BackColor = Color.White; ArrayList Checkarray = new ArrayList(); DES des = DES.Create(); byte[] key = Convert.FromBase64String("ybqAS+sVBLY="); byte[] IV = Convert.FromBase64String("1mbClpyz5bU="); des.Key = key; des.IV = IV; byte[] login = Crypt_Class.SymmetricEncrypt(tbLogin.Text, des); Checkarray.Add("\'" + Convert.ToBase64String(login) + "\'"); Function_class UQCheck = new Function_class("Client_Face_Adress_UQ_Check", Function_class.Function_Result.scalar, Checkarray); if ((UQCheck.Regtable.Rows[0][0].ToString() == "False") & (tbLogin.Text == Login)) { tbLogin.BackColor = Color.Red; } else { tbLogin.BackColor = Color.White; if ((tbPassword.Text.Length < 6) | (tbPassword.Text.IndexOfAny(numbers) == -1) | (tbPassword.Text.IndexOfAny(ruLetters) != -1) | (tbPassword.Text != tbConfirm.Text)) { tbPassword.BackColor = Color.Red; if ((tbPassword.Text == tbConfirm.Text) & ((tbPassword.Text == Password) | (tbPassword.Text != ""))) { tbPassword.BackColor = Color.White; ArrayList array = new ArrayList(); array.Add(Program.intID); Table_Class tableClient = new Table_Class(String.Format("SELECT [Client_Face_Name],[Client_Face_Firstname],[Client_Face_Patronymic],[Client_ID] FROM [dbo].[Client_Face] WHERE [ID_Client_Face] = {0}", Program.intID)); array.Add(tableClient.table.Rows[0][0].ToString()); array.Add(tableClient.table.Rows[0][1].ToString()); array.Add(tableClient.table.Rows[0][2].ToString()); DES indes = DES.Create(); byte[] inkey = Convert.FromBase64String("ybqAS+sVBLY="); byte[] inIV = Convert.FromBase64String("1mbClpyz5bU="); indes.Key = inkey; indes.IV = inIV; byte[] inlogin = Crypt_Class.SymmetricEncrypt(tbLogin.Text, indes); byte[] inpasswd = Crypt_Class.SymmetricEncrypt(Password, indes); array.Add(Convert.ToBase64String(inlogin)); array.Add(Convert.ToBase64String(inpasswd)); array.Add(tableClient.table.Rows[0][3].ToString()); array.Add("0"); Procedure_Class procedure = new Procedure_Class(); procedure.procedure_Execution("Client_Face_Update", array); ClMainLoad(); } } else { tbPassword.BackColor = Color.White; ArrayList array = new ArrayList(); array.Add(Program.intID); Table_Class tableClient = new Table_Class(String.Format("SELECT [Client_Face_Name],[Client_Face_Firstname],[Client_Face_Patronymic],[Client_ID] FROM [dbo].[Client_Face] WHERE [ID_Client_Face] = {0}", Program.intID)); array.Add(tableClient.table.Rows[0][0].ToString()); array.Add(tableClient.table.Rows[0][1].ToString()); array.Add(tableClient.table.Rows[0][2].ToString()); DES indes = DES.Create(); byte[] inkey = Convert.FromBase64String("ybqAS+sVBLY="); byte[] inIV = Convert.FromBase64String("1mbClpyz5bU="); indes.Key = inkey; indes.IV = inIV; byte[] inlogin = Crypt_Class.SymmetricEncrypt(tbLogin.Text, indes); byte[] inpasswd = Crypt_Class.SymmetricEncrypt(tbPassword.Text, indes); array.Add(Convert.ToBase64String(inlogin)); array.Add(Convert.ToBase64String(inpasswd)); array.Add(tableClient.table.Rows[0][3].ToString()); array.Add("0"); Procedure_Class procedure = new Procedure_Class(); procedure.procedure_Execution("Client_Face_Update", array); ClMainLoad(); } } } }; Invoke(action); }
private void OrderInsert() { Action action = () => { if (orderList.Rows.Count > 0) { Table_Class before = new Table_Class("SELECT [ID_Order] FROM [dbo].[Order]"); ArrayList array = new ArrayList(); Table_Class client = new Table_Class(String.Format("SELECT [Client_ID] FROM [dbo].[Client_Face] WHERE [ID_Client_Face] = {0}", Program.intID)); string start = ""; if (dtpStart.Value.Day.ToString().Length > 1) { start += dtpStart.Value.Day.ToString(); } else { start += "0" + dtpStart.Value.Day.ToString(); } start += "."; if (dtpStart.Value.Month.ToString().Length > 1) { start += dtpStart.Value.Month.ToString(); } else { start += "0" + dtpStart.Value.Month.ToString(); } start += "."; start += dtpStart.Value.Year.ToString(); string end = ""; if (dtpEnd.Value.Day.ToString().Length > 1) { end += dtpEnd.Value.Day.ToString(); } else { end += "0" + dtpEnd.Value.Day.ToString(); } end += "."; if (dtpEnd.Value.Month.ToString().Length > 1) { end += dtpEnd.Value.Month.ToString(); } else { end += "0" + dtpEnd.Value.Month.ToString(); } end += "."; end += dtpEnd.Value.Year.ToString(); array.Add(start); array.Add(end); array.Add(client.table.Rows[0][0].ToString()); array.Add(Program.intID); Procedure_Class insert = new Procedure_Class(); insert.procedure_Execution("Order_Insert", array); Table_Class after = new Table_Class("SELECT [ID_Order] FROM [dbo].[Order]"); foreach (DataRow row in before.table.Rows) { DataRow deleterow = after.table.Select(String.Format("ID_Order = {0}", row[0]))[0]; after.table.Rows.Remove(deleterow); } foreach (DataRow row in orderList.Rows) { ArrayList insertComp = new ArrayList(); insertComp.Add(row[2]); insertComp.Add(row[0]); insertComp.Add(after.table.Rows[0][0].ToString()); Procedure_Class compinsert = new Procedure_Class(); compinsert.procedure_Execution("Order_Comp_Insert", insertComp); insertComp.Clear(); } } else { MessageBox.Show("Добавьте товары к заказу!", "Arizona Client", MessageBoxButtons.OK, MessageBoxIcon.Error); } }; Invoke(action); }