Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private void GetDates()
        {
            Action action = () =>
            {
                if (orderList.Rows.Count > 0)
                {
                    min = dtpStart.Value;
                    max = dtpStart.Value;
                    foreach (DataRow row in orderList.Rows)
                    {
                        ArrayList mintime = new ArrayList();
                        mintime.Add(row[0]);
                        mintime.Add(row[2]);
                        Function_class minTimeCount = new Function_class("Order_Count_Check_MAX", Function_class.Function_Result.scalar, mintime);
                        Double         minAdd       = Convert.ToDouble(minTimeCount.Regtable.Rows[0][0]);
                        min = min.AddDays(minAdd);
                        mintime.Clear();
                    }
                    foreach (DataRow row in orderList.Rows)
                    {
                        ArrayList maxtime = new ArrayList();
                        maxtime.Add(row[0]);
                        maxtime.Add(row[2]);
                        Function_class maxTimeCount = new Function_class("Order_Count_Check_MIN", Function_class.Function_Result.scalar, maxtime);
                        max = max.AddDays(Convert.ToDouble(maxTimeCount.Regtable.Rows[0][0]));
                        maxtime.Clear();
                    }
                }
                lblDate.Text = String.Format("Минимальная дата = {0}, Оптимальная дата = {1}", (min.Day.ToString() + "." + min.Month.ToString() + "." + min.Year.ToString()), (max.Day.ToString() + "." + max.Month.ToString() + "." + max.Year.ToString()));
                dtpEnd.Value = min;
            };

            Invoke(action);
        }
Exemplo n.º 3
0
        private void BtEnter_Click(object sender, EventArgs e)
        {
            //Проверка
            switch (tbUserLogin.Text == "")
            {
            case true:
                tbUserLogin.BackColor = Color.Red;
                break;

            case false:
                tbUserLogin.BackColor = Color.White;
                switch (tbUserPassword.Text == "")
                {
                case true:
                    tbUserPassword.BackColor = Color.Red;
                    break;

                case false:
                    //Авторизация
                    tbUserPassword.BackColor = Color.White;
                    ArrayList AutorizData = 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(tbUserLogin.Text, des);
                    byte[] passwd = Crypt_Class.SymmetricEncrypt(tbUserPassword.Text, des);
                    AutorizData.Add("\'" + Convert.ToBase64String(login) + "\'");
                    AutorizData.Add("\'" + Convert.ToBase64String(passwd) + "\'");
                    tbUserLogin.Clear();
                    tbUserPassword.Clear();
                    Function_class function = new Function_class("Authorization", Function_class.Function_Result.table, AutorizData);
                    if (function.Regtable.Rows.Count > 0)
                    {
                        if ((function.Regtable.Rows[0][2].ToString() == "False") & (function.Regtable.Rows[0][3].ToString() == "False"))
                        {
                            Program.intID = function.Regtable.Rows[0][0].ToString();
                            Client_Interface client_Interface = new Client_Interface();
                            client_Interface.Owner = this;
                            client_Interface.Show();
                            this.Hide();
                        }
                        else
                        {
                            MessageBox.Show("Данный пользователь не найден. Пожалуйста, зарегестрируйтесь или введите правильные данные для продолжения.", "Arizona Client", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Данный пользователь не найден. Пожалуйста, зарегестрируйтесь или введите правильные данные для продолжения.", "Arizona Client", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    break;
                }
                break;
            }
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }