Example #1
0
        private void SaveB_Click(object sender, EventArgs e)
        {
            if (Lgn.Text != "" && NewPass.Text != "")
            {
                string pass = NewPass.Text;
                string ps   = "";
                for (int i = 0; i < pass.Length; i++)
                {
                    ps += (char)(pass[i] ^ 'k');
                }
                if (Lgn.Text != "" && NewPass.Text != "")
                {
                    switch (Lgn.Text)
                    {
                    case "Начальник отдела":
                    {
                        Admins.Rows[1][2] = ps;
                    }
                    break;

                    case "Администратор":
                    {
                        Admins.Rows[0][2] = ps;
                    }
                    break;
                    }
                    SLDataDB.SaveData(queryOrd, Admins);
                    NewPass.Text = "Сохранено";
                }
            }
        }
Example #2
0
        private void SaveOrd_Click(object sender, EventArgs e)
        {
            if (OrdStat.Text != "")
            {
                switch (OrdStat.Text)
                {
                case "Получен":
                {
                    Orders.Rows[Convert.ToInt32(OrdN.Text)][4] = 1;
                }
                break;

                case "Выполняется":
                {
                    Orders.Rows[Convert.ToInt32(OrdN.Text)][4] = 2;
                }
                break;

                case "Завершен":
                {
                    Orders.Rows[Convert.ToInt32(OrdN.Text)][4] = 3;
                }
                break;
                }
                SLDataDB.SaveData(query, Orders);
                Description.Text = "Изменения сохранены.";
            }
        }
Example #3
0
 private void DelB_Click(object sender, EventArgs e)
 {
     if (MangrN.Text != "")
     {
         MngrsIsh.Rows[Convert.ToInt32(MangrN.Text)].Delete();
         SLDataDB.SaveData(queryMng, MngrsIsh);
         MangrN.Text = "Удалено";
     }
 }
Example #4
0
 private void DelSvcB_Click(object sender, EventArgs e)
 {
     if (IdSvc.Text != "")
     {
         Svcs.Rows[Convert.ToInt32(IdSvc.Text) - 1].Delete();
         SLDataDB.SaveData(queryClnt, Svcs);
         IdSvc.Text = "Удалено";
     }
 }
Example #5
0
 private void DiscountChngB_Click(object sender, EventArgs e)
 {
     if (IDClient.Text != "" && DiscChng.Text != "")
     {
         for (int i = 0; i < Clnts.Rows.Count; i++)
         {
             if (Convert.ToInt32(Clnts.Rows[i][0]) == Convert.ToInt32(IDClient.Text))
             {
                 Clnts.Rows[i][6] = DiscChng.Text;
                 break;
             }
         }
         SLDataDB.SaveData(queryClnt, Clnts);
     }
 }
Example #6
0
 private void Add_Click(object sender, EventArgs e)
 {
     if (Nam.Text != "")
     {
         DataRow row;
         row              = Svcs.NewRow();
         row["Id"]        = Svcs.Rows.Count + 1;
         row["Название"]  = Nam.Text;
         row["Стоимость"] = Price.Text;
         row["Описание"]  = Description.Text;
         Svcs.Rows.Add(row);
         SLDataDB.SaveData(queryClnt, Svcs);
         Description.Text = "Cохранено.";
         Nam.Text         = "";
         Price.Text       = "";
     }
 }
Example #7
0
 private void SendTArchive_Click(object sender, EventArgs e)
 {
     if (OrdNArh.Text != "")
     {
         for (int i = 0; i < Orders.Rows.Count; i++)
         {
             if (Convert.ToInt32(OrdNArh.Text) == Convert.ToInt32(Orders.Rows[i][0]))
             {
                 DataRow row;
                 row       = Archive.NewRow();
                 row["Id"] = Orders.Rows[i][0];
                 row["Название заказа"] = Orders.Rows[i][1];
                 row["Описание"]        = Orders.Rows[i][2];
                 row["Стоимость"]       = Orders.Rows[i][8];
                 for (int k = 0; k < Clients.Rows.Count; k++)
                 {
                     if (Convert.ToInt32(Orders.Rows[i][7]) == Convert.ToInt32(Clients.Rows[k][0]))
                     {
                         row["Фамилия"]        = Clients.Rows[k][1];
                         row["Имя"]            = Clients.Rows[k][2];
                         row["Номер телефона"] = Clients.Rows[k][4];
                     }
                 }
                 for (int k = 0; k < Managers.Rows.Count; k++)
                 {
                     if (Convert.ToInt32(Orders.Rows[i][5]) == Convert.ToInt32(Managers.Rows[k][0]))
                     {
                         row["Фамилия менеджера"] = Managers.Rows[k][1];
                         row["Имя менеджера"]     = Managers.Rows[k][2];
                     }
                 }
                 Archive.Rows.Add(row);
                 Orders.Rows[i].Delete();
                 break;
             }
         }
         SLDataDB.SaveData(queryArchive, Archive);
         SLDataDB.SaveData(queryOrd, Orders);
         OrdNArh.Text = "Сохранено";
     }
 }
Example #8
0
 private void Add_Click(object sender, EventArgs e)
 {
     if (PhoneN.Text != "" && Add.Text != "")
     {
         DataRow row;
         row                   = Clnts.NewRow();
         row["Id"]             = Clnts.Rows.Count + 1;
         row["Фамилия"]        = Srnam.Text;
         row["Имя"]            = Nam.Text;
         row["Отчество"]       = Patrn.Text;
         row["Номер телефона"] = PhoneN.Text;
         row["Адрес"]          = Adress.Text;
         row["Скидка, %"]      = Discount.Text;
         Clnts.Rows.Add(row);
         SLDataDB.SaveData(queryClnt, Clnts);
         Srnam.Text    = "Cохранено.";
         Nam.Text      = "";
         Patrn.Text    = "";
         PhoneN.Text   = "";
         Adress.Text   = "";
         Discount.Text = "";
     }
 }
Example #9
0
 private void AddB_Click(object sender, EventArgs e)
 {
     if (SrNam.Text != "" && Nam.Text != "" && Pass.Text != "")
     {
         DataRow row;
         string  pass = "";
         row            = MngrsIsh.NewRow();
         row["Id"]      = MngrsIsh.Rows.Count + 1;
         row["Surname"] = SrNam.Text;
         row["Name"]    = Nm.Text;
         for (int i = 0; i < Pass.Text.Length; i++)
         {
             pass += (char)(Pass.Text[i] ^ 'k');
         }
         row["Pass"] = pass;
         MngrsIsh.Rows.Add(row);
         SLDataDB.SaveData(queryMng, MngrsIsh);
         SrNam.Text = "Cохранено.";
         Nm.Text    = "";
         Pass.Text  = "";
         Mng        = MngrsIsh.Copy();
         UnXor();
     }
 }
Example #10
0
 private void AddNwOrd_Click(object sender, EventArgs e)
 {
     if (NamOrd.Text != "" && DateSt.Text != "" && ClientsBx.Text != "" && ManagerBx.Text != "")
     {
         DataRow row;
         row                = Orders.NewRow();
         row["Id"]          = Orders.Rows.Count + 1;
         row["Name"]        = NamOrd.Text;
         row["Description"] = Description.Text;
         row["Order_stage"] = 0;
         row["Deadline"]    = DeadLn.Text;
         row["Date"]        = DateSt.Text;
         row["Price"]       = Convert.ToInt32(Price.Text);
         for (int i = 0; i < Managers.Rows.Count; i++)
         {
             bool chk = false;
             for (int k = 0; k < ManagerBx.Text.Length; k++)
             {
                 string a = Convert.ToString(Managers.Rows[i][1]);
                 if (a[k] == ManagerBx.Text[k])
                 {
                     chk = true;
                 }
                 else
                 {
                     chk = false;
                     break;
                 }
             }
             if (chk)
             {
                 row["ManagerID"] = Managers.Rows[i][0];
             }
         }
         for (int i = 0; i < Clients.Rows.Count; i++)
         {
             bool chk = false;
             for (int k = 0; k < ClientsBx.Text.Length; k++)
             {
                 string a = Convert.ToString(Clients.Rows[i][1]);
                 if (a[k] == ClientsBx.Text[k])
                 {
                     chk = true;
                 }
                 else
                 {
                     chk = false;
                     break;
                 }
             }
             if (chk)
             {
                 row["ClientID"] = Clients.Rows[i][0];
             }
         }
         Orders.Rows.Add(row);
         SLDataDB.SaveData(queryOrd, Orders);
         NamOrd.Text      = "";
         DeadLn.Text      = "";
         DateSt.Text      = "";
         ClientsBx.Text   = "";
         Description.Text = "Заказ добавлен.";
         ManagerBx.Text   = "";
         Price.Text       = "";
     }
 }