Example #1
0
        private void PosFill()
        {
            Action action = () =>
            {
                Table_Class pos = new Table_Class("SELECT [ID_Position] as \'Номер\',[PositionName] as \'Название\',[Salary] as \'Оклад\' FROM [dbo].[Position]");
                dgPosition.ItemsSource = pos.table.DefaultView;
            };

            action.Invoke();
        }
        private void ProductFill()
        {
            Action action = () =>
            {
                Table_Class product = new Table_Class(CurProductQuerry);
                dgProduct.ItemsSource = product.table.DefaultView;
            };

            action.Invoke();
        }
Example #3
0
        private void BtSelect_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog save = new SaveFileDialog();

            save.ShowDialog();
            Table_Class    table    = new Table_Class("select [SchemeName] as \'Название\', [Basis] as \'Основание\', [Reality] as \'Реализация\' from [dbo].[MarkScheme] WHERE [LogDelete] = 0");
            Document_class document = new Document_class();

            document.Document_Create(Document_class.Document_Type.MarkSchemes, save.FileName, table.table);
        }
Example #4
0
        private void ProductFill()
        {
            Action action = () =>
            {
                Table_Class product = new Table_Class("SELECT [ID_Product] as \'Артикул\',[Name] as \'Название\',[Storage] as \'Количество\',[Price] as \'Цена\' FROM [dbo].[Product] WHERE [ID_Product]>0 and [LogDelete] = 0 and [Storage]>0");
                dgProduct.ItemsSource = product.table.DefaultView;
            };

            action.Invoke();
        }
        private void SellFill()
        {
            Action action = () =>
            {
                Table_Class sell = new Table_Class(CurSellQuerry + String.Format("AND [Staff_ID] = 0", App.intID));
                dgSell.ItemsSource = sell.table.DefaultView;
            };

            action.Invoke();
        }
        private void StaffFill()
        {
            Action action = () =>
            {
                Table_Class staff = new Table_Class(CurStaffQuerry);
                dgEmployee.ItemsSource = staff.table.DefaultView;
            };

            action.Invoke();
        }
        private void NamingSelect()
        {
            Action action = () =>
            {
                Table_Class name = new Table_Class(String.Format("select [Surname],[Name],[Firstname] from [dbo].[Staff] where [ID_Staff] = {0}", App.intID));
                lblTitle.Content = String.Format("Интерфейс управления личными данными: {0} {1} {2}", name.table.Rows[0][0].ToString(), name.table.Rows[0][1].ToString(), name.table.Rows[0][2].ToString());
            };

            action.Invoke();
        }
Example #8
0
        private void NamingSelect()
        {
            Action action = () =>
            {
                Table_Class name = new Table_Class(String.Format("select [Surname],[Name],[Firstname] from [dbo].[Staff] where [ID_Staff] = {0}", SelectedID));
                lblCurStaff.Content = String.Format("{0} {1} {2}", name.table.Rows[0][0].ToString(), name.table.Rows[0][1].ToString(), name.table.Rows[0][2].ToString());
            };

            action.Invoke();
        }
        private void NamingSelect()
        {
            Action action = () =>
            {
                Table_Class name = new Table_Class(String.Format("select [Surname],[Name],[Firstname] from [dbo].[Staff] where [ID_Staff] = {0}", App.intID));
                this.Title = String.Format("Интерфейс менеджера по работе с персоналом: {0} {1} {2}", name.table.Rows[0][0].ToString(), name.table.Rows[0][1].ToString(), name.table.Rows[0][2].ToString());
            };

            action.Invoke();
        }
        private void BtSelect_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog save = new SaveFileDialog();

            save.ShowDialog();
            Table_Class    table    = new Table_Class("SELECT [Name],(select [TypeNAme] from [dbo].[ProductType] WHERE [Type_ID] = [ID_ProductType]),[Storage],[FirstDec],[Price] FROM [dbo].[Product] WHERE [ID_Product] >0 and [LogDelete] = 0");
            Document_class document = new Document_class();

            document.Document_Create(Document_class.Document_Type.Storage, save.FileName, table.table);
        }
        private void ProductFill()
        {
            Action action = () =>
            {
                Table_Class product = new Table_Class(CurProductQuerry);
                product.Dependency.OnChange += ProductDependency_OnChange;
                dgProduct.ItemsSource        = product.table.DefaultView;
            };

            action.Invoke();
        }
        private void TypeProductFill()
        {
            Action action = () =>
            {
                Table_Class type = new Table_Class(CurTypeQuerry);
                type.Dependency.OnChange += TypeProductDependency_OnChange;
                dgType.ItemsSource        = type.table.DefaultView;
            };

            action.Invoke();
        }
Example #13
0
        private void SchemeFill()
        {
            Action action = () =>
            {
                Table_Class scheme = new Table_Class(CurSchemeQuerry);
                scheme.Dependency.OnChange += SchemeDependency_OnChange;
                dgScheme.ItemsSource        = scheme.table.DefaultView;
            };

            action.Invoke();
        }
Example #14
0
        ///<summary>
        ///Перегрузка для процедур с параметрами.
        ///</summary>
        ///<param name = "Function_Name">Название процедуры</param>
        ///<param name = "Type_function">Тип функции</param>
        ///<param name = "Parameters">Параметры</param>
        public Function_class(string Function_Name, Function_Result Type_function, ArrayList Parameters)
        {
            string querry = "";

            try
            {
                switch (Type_function)
                {
                case Function_Result.scalar:
                    //Вывод данныхиз скалаярной функции
                    querry = string.Format(@"select [dbo].[{0}](", Function_Name);
                    break;

                case Function_Result.table:
                    querry = string.Format(@"select * from [dbo].[{0}](", Function_Name);
                    break;
                }
                //Переменная списка параметров
                string list_parameters = "";

                //switch (Parameters.Count)
                //{
                //    case 1:
                //        //Вывод данныхиз скалаярной функции
                //        list_parameters += Parameters[0].ToString() + ")";
                //        break;
                //    default:
                //        foreach (object parameter in Parameters)
                //        {
                //            list_parameters += parameter + ",";
                //        }
                //        list_parameters = list_parameters.Remove(list_parameters.Length-1, 1);
                //        list_parameters += ")";
                //        break;
                //}

                //Заполнение списка из листа параметров
                foreach (object parameter in Parameters)
                {
                    list_parameters += "\'" + parameter.ToString() + "\',";
                }
                list_parameters  = list_parameters.Remove(list_parameters.Length - 1, 1);
                list_parameters += ")";
                //Оформление запроса
                querry += list_parameters;
                //Заполнение таблицы
                Table_Class table = new Table_Class(querry);
                Regtable = table.table;
            }
            catch
            {
            }
        }
Example #15
0
        private void PosFill()
        {
            Action action = () =>
            {
                Table_Class pos = new Table_Class("SELECT [ID_Position],[PositionName] FROM [dbo].[Position] WHERE [ID_Position]>0 and [LogDelete] = 0");
                cbPosition.ItemsSource       = pos.table.DefaultView;
                cbPosition.DisplayMemberPath = "PositionName";
                cbPosition.SelectedValuePath = "ID_Position";
            };

            action.Invoke();
        }
Example #16
0
        private void BtEnter_Click(object sender, RoutedEventArgs e)
        {
            Action action = () =>
            {
                Procedure_Class procedure = new Procedure_Class();
                ArrayList       array     = new ArrayList();
                Table_Class     number    = new Table_Class(String.Format("select count (*) +1 from [dbo].[Order] where [Staff_ID] = {0}", SelectedID));
                switch (cbType.SelectedIndex)
                {
                case (0):
                    array.Add(String.Format("Увольнение сотрудника {0}", SelectedID));
                    array.Add(String.Format("Уволить сотрудника {0} по причине: {1}. Дата (местная): {2}", lblCurStaff.Content, tbText.Text, DateTime.Now.ToString()));
                    array.Add(SelectedID);
                    procedure.procedure_Execution("Order_Insert", array);
                    array.Clear();
                    array.Add(SelectedID);
                    array.Add("1");
                    procedure.procedure_Execution("Staff_LogDelete", array);
                    array.Clear();
                    break;

                case (1):
                    Table_Class pos = new Table_Class(String.Format("select [PositionName] from [dbo].[Position] where [ID_Position] = \'{0}\'", cbPosition.SelectedValue.ToString()));
                    array.Add(String.Format("Перевод сотрудника {0} (№ {1})", SelectedID, number.table.Rows[0][0].ToString()));
                    array.Add(String.Format("Перевести сотрудника {0} на должность {1} по причине: {2}. Дата (местная): {3}", lblCurStaff.Content, pos.table.Rows[0][0].ToString(), tbText.Text, DateTime.Now.ToString()));
                    array.Add(SelectedID);
                    procedure.procedure_Execution("Order_Insert", array);
                    array.Clear();
                    array.Add(SelectedID);
                    array.Add(cbPosition.SelectedValue.ToString());
                    procedure.procedure_Execution("Staff_Reposition", array);
                    array.Clear();
                    break;

                case (2):
                    array.Add(String.Format("Особый приказ для сотрудника {0} (№ {1})", SelectedID, number.table.Rows[0][0].ToString()));
                    array.Add(String.Format("{1}. Сотрудник: {0}. Дата (местная): {2}", lblCurStaff.Content, tbText.Text, DateTime.Now.ToString()));
                    array.Add(SelectedID);
                    procedure.procedure_Execution("Order_Insert", array);
                    break;
                }
                cbType.SelectedIndex     = -1;
                cbPosition.SelectedIndex = -1;
                tbText.Clear();
            };

            action.Invoke();
            this.Hide();
            (Owner as ManagerInterface).TableRefresh();
            Owner.Show();
        }
        private void BtSelect_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog save = new SaveFileDialog();

            save.ShowDialog();
            Table_Class    table    = new Table_Class(String.Format("SELECT [Check] as \'Чек\',(select [Surname] from [dbo].[Staff] where [ID_Staff] = [Staff_ID]) as \'Фамилия\',(select [Name] from [dbo].[Staff] where [ID_Staff] = [Staff_ID]) as \'Имя\',(select [FirstName] from [dbo].[Staff] where [ID_Staff] = [Staff_ID]) as \'Отчество\', (select [Name] from [dbo].[Product] where [ID_Product] = [Product_ID]) as \'Товар\', (select [SchemeName] from [dbo].[MarkScheme] where [ID_Scheme] = (select [Scheme_ID] from [dbo].[Product] where [ID_Product] = [Product_ID])) as \'Схема\',[Amount] as \'Количество\',[SellDate] as \'Дата\',[Price] as \'Сумма\' FROM [dbo].[Sell] WHERE [Check] = \'{0}\'", tbCheck.Text));
            Document_class document = new Document_class();

            document.Document_Create(Document_class.Document_Type.Check, save.FileName, table.table);
            ArrayList array = new ArrayList();

            array.Add(tbCheck.Text);
            array.Add(save.FileName);
            Procedure_Class procedure = new Procedure_Class();

            procedure.procedure_Execution("Sell_Doc_Create", array);
            tbCheck.Clear();
        }
Example #18
0
        private void BtEnter_Click(object sender, RoutedEventArgs e)
        {
            Action action = () =>
            {
                Table_Class table = new Table_Class(String.Format("select count (*) from [dbo].[Staff] where [Login] = \'{0}\'", tbLogin.Text));
                if (table.table.Rows[0][0].ToString() != "0")
                {
                    MessageBox.Show("Этот логин использовать нельзя!", "ParawosoffApp", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    ArrayList staff = new ArrayList();
                    staff.Add(tbFirstName.Text);
                    staff.Add(tbName.Text);
                    staff.Add(tbPatronymic.Text);
                    staff.Add(tbExp.Text);
                    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.Text, des);
                    staff.Add(Convert.ToBase64String(login));
                    staff.Add(Convert.ToBase64String(passwd));
                    staff.Add(cbPosition.SelectedValue.ToString());
                    Procedure_Class procedure = new Procedure_Class();
                    procedure.procedure_Execution("Staff_Insert", staff);
                    Table_Class ID    = new Table_Class("select [ID_Staff],[Timestamp] from [dbo].[Staff] WHERE [Timestamp] = (select MAX([Timestamp]) from [dbo].[Staff])");
                    ArrayList   array = new ArrayList();
                    array.Add(String.Format("Приём на работу ({0})", ID.table.Rows[0][0].ToString()));
                    Table_Class pos = new Table_Class(String.Format("select [PositionName] from [dbo].[Position] where [ID_Position] = \'{0}\'", cbPosition.SelectedValue.ToString()));
                    array.Add(String.Format("Принять сотрудника {0} {1} {2} на должность {3}. Дата: {4}", tbFirstName.Text, tbName.Text, tbPatronymic.Text, pos.table.Rows[0][0].ToString(), ID.table.Rows[0][1].ToString()));
                    array.Add(ID.table.Rows[0][0].ToString());
                    procedure.procedure_Execution("Order_Insert", array);
                    this.Hide();
                    (Owner as ManagerInterface).TableRefresh();
                    Owner.Show();
                }
            };

            action.Invoke();
        }
        private void OrderFill()
        {
            Action action = () =>
            {
                string SelectedStaff = "";
                if (tbStaffID.Text.Length > 0)
                {
                    SelectedStaff = tbStaffID.Text;
                }
                else
                {
                    SelectedStaff = App.intID;
                }
                Table_Class order = new Table_Class(CurOrderQuerry + String.Format(" [Staff_ID] = {0}", SelectedStaff));
                dgOrder.ItemsSource = order.table.DefaultView;
            };

            action.Invoke();
        }
        private void BtSelect_Click(object sender, RoutedEventArgs e)
        {
            Action action = () =>
            {
                SaveFileDialog save = new SaveFileDialog();
                save.ShowDialog();
                Table_Class    table    = new Table_Class(String.Format("select [OrderName],[OrderText] from [dbo].[Order] WHERE [ID_Order] = {0}", tbOrderID.Text));
                Document_class document = new Document_class();
                document.Document_Create(Document_class.Document_Type.Order, save.FileName, table.table);
                ArrayList array = new ArrayList();
                array.Add(tbOrderID.Text);
                array.Add(save.FileName);
                Procedure_Class procedure = new Procedure_Class();
                procedure.procedure_Execution("Order_Doc_Create", array);
                tbOrderID.Clear();
            };

            action.Invoke();
        }
        private void BtUpdate_Click(object sender, RoutedEventArgs e)
        {
            Action action = () =>
            {
                ArrayList array = new ArrayList();
                array.Add(tbProductID.Text);
                array.Add(tbName.Text);
                array.Add(tbPrice.Text);
                Table_Class table = new Table_Class(String.Format("SELECT [FirstDec],[Scheme_ID]FROM [dbo].[Product] WHERE [ID_Product] = {0}", tbProductID.Text));
                if (MessageBox.Show("Изменить дату первого добавления?", "ParawosoffApp", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    string Day = DateTime.Now.Day.ToString();
                    if (Day.Length < 2)
                    {
                        Day = "0" + Day;
                    }
                    string Month = DateTime.Now.Month.ToString();
                    if (Month.Length < 2)
                    {
                        Month = "0" + Month;
                    }
                    array.Add(Day + "." + Month + "." + DateTime.Now.Year.ToString());
                }
                else
                {
                    array.Add(table.table.Rows[0][0].ToString());
                }
                array.Add(table.table.Rows[0][1].ToString());
                array.Add(tbTypeID.Text);
                Procedure_Class procedure = new Procedure_Class();
                procedure.procedure_Execution("Product_Update", array);
                tbProductID.Clear();
                tbName.Clear();
                tbPrice.Clear();
                tbTypeID.Clear();
                tbTypeName.Clear();
                tbTerms.Clear();
                ProductFill();
            };

            action.Invoke();
        }
 private void TbStaffID_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (tbStaffID.Text.Length > 0)
     {
         Table_Class table = new Table_Class(String.Format("select [LogDelete] from [dbo].[Staff] where [ID_Staff] = {0}", tbStaffID.Text));
         if (table.table.Rows[0][0].ToString() == "False")
         {
             btForCurEmployee.IsEnabled = true;
         }
         else
         {
             btForCurEmployee.IsEnabled = false;
         }
     }
     else
     {
         btForCurEmployee.IsEnabled = false;
     }
     OrderFill();
 }
        private void BasicsSelect()
        {
            Action action = () =>
            {
                Table_Class basics = new Table_Class(String.Format("SELECT [Surname],[Name],[Firstname],[Recruitment],[Exp],[Login],[Position_ID] FROM [dbo].[Staff] WHERE [ID_Staff] = {0}", App.intID));
                Surname     = basics.table.Rows[0][0].ToString();
                Name        = basics.table.Rows[0][1].ToString();
                Firstname   = basics.table.Rows[0][2].ToString();
                Recruitment = basics.table.Rows[0][3].ToString();
                Exp         = basics.table.Rows[0][4].ToString();
                Pos         = basics.table.Rows[0][6].ToString();
                DES    des = DES.Create();
                byte[] key = Convert.FromBase64String("WdbWuvWCHPc=");
                byte[] IV  = Convert.FromBase64String("RuBs2bQBW58=");
                des.Key = key;
                des.IV  = IV;
                string login = Crypt_Class.SymmetricDecrypt(Convert.FromBase64String(basics.table.Rows[0][5].ToString()), des);
                tbLogin.Text = login;
                tbPassword.Clear();
            };

            action.Invoke();
        }
Example #24
0
        private void TbCurSellID_TextChanged(object sender, TextChangedEventArgs e)
        {
            Action action = () =>
            {
                if (tbReamount.Text.Length == 0)
                {
                    tbReamount.Text = "1";
                }
                else
                if (Convert.ToInt32(tbReamount.Text) <= 0)
                {
                    tbReamount.Text = "1";
                }
                if (tbCurSellID.Text.Length > 0)
                {
                    btDelete.IsEnabled = true;
                    Table_Class table    = new Table_Class(String.Format("select [Storage] from [dbo].[Product] where [ID_Product] = {0}", tbCurSellID.Text));
                    int         Storage  = Convert.ToInt32(table.table.Rows[0][0].ToString());
                    int         Selected = Convert.ToInt32(tbReamount.Text);
                    if (Storage >= Selected)
                    {
                        btReamount.IsEnabled = true;
                    }
                    else
                    {
                        btReamount.IsEnabled = false;
                    }
                }
                else
                {
                    btReamount.IsEnabled = false;
                    btDelete.IsEnabled   = false;
                }
            };

            action.Invoke();
        }
        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();
        }