Exemple #1
0
        private void CheckNumber_Get()
        {
            Function_class function = new Function_class("CheckGet", Function_class.Function_Result.scalar);

            CurCheck         = function.Regtable.Rows[0][0].ToString();
            lblCheck.Content = "Номер чека: " + CurCheck;
        }
        private void Autorization()
        {
            Action action = () =>
            {
                DES    des = DES.Create();
                byte[] key = Convert.FromBase64String("WdbWuvWCHPc=");
                byte[] IV  = Convert.FromBase64String("RuBs2bQBW58=");
                des.Key = key;
                des.IV  = IV;
                byte[]    login  = Crypt_Class.SymmetricEncrypt(tbLogin.Text, des);
                byte[]    passwd = Crypt_Class.SymmetricEncrypt(tbPassword.Password, des);
                ArrayList array  = new ArrayList();
                array.Add(Convert.ToBase64String(login));
                array.Add(Convert.ToBase64String(passwd));
                tbLogin.Clear();
                tbPassword.Clear();
                Function_class autoriz = new Function_class("Autorization", Function_class.Function_Result.scalar, array);
                if (autoriz.Regtable.Rows[0][0].ToString() == "-1")
                {
                    MessageBox.Show("Учётная запись с такими параметрами не существует или является заблокированной!", "ParawosoffApp", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    App.intID = autoriz.Regtable.Rows[0][0].ToString();
                    Table_Class tablePos = new Table_Class(String.Format("select [Position_ID] from [dbo].[Staff] where [ID_Staff] = {0}", autoriz.Regtable.Rows[0][0].ToString()));
                    switch (tablePos.table.Rows[0][0].ToString())
                    {
                    case ("0"):
                        Selector selector = new Selector();
                        selector.Owner = this;
                        selector.Show();
                        this.Hide();
                        break;

                    case ("1"):
                        SaleInterface sale = new SaleInterface();
                        sale.Owner = this;
                        sale.Show();
                        this.Hide();
                        break;

                    case ("2"):
                        ManagerInterface manager = new ManagerInterface();
                        manager.Owner = this;
                        manager.Show();
                        this.Hide();
                        break;

                    case ("3"):
                        StoragerInterface storager = new StoragerInterface();
                        storager.Owner = this;
                        storager.Show();
                        this.Hide();
                        break;

                    case ("4"):
                        MarketerInterface marketer = new MarketerInterface();
                        marketer.Owner = this;
                        marketer.Show();
                        this.Hide();
                        break;
                    }
                }
            };

            action.Invoke();
        }