public PriceCalc() { InitializeComponent(); SLDataDB.LoadData(queryOrd, out Orders); SLDataDB.LoadData(queryClnt, out Clients); ClntListLd(); }
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 = "Изменения сохранены."; } }
public ManagersW() { InitializeComponent(); SLDataDB.LoadData(queryMng, out MngrsIsh); Mng = MngrsIsh.Copy(); UnXor(); }
private void Upd() { SLDataDB.LoadData(queryOrd, out Orders); SLDataDB.LoadData(queryMng, out Managers); SLDataDB.LoadData(queryClnt, out Clients); SLDataDB.LoadData(queryArchive, out Archive); }
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 = "Сохранено"; } } }
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 = "Удалено"; } }
private void DelB_Click(object sender, EventArgs e) { if (MangrN.Text != "") { MngrsIsh.Rows[Convert.ToInt32(MangrN.Text)].Delete(); SLDataDB.SaveData(queryMng, MngrsIsh); MangrN.Text = "Удалено"; } }
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); } }
private void UpdInfo() { SLDataDB.LoadData(queryOrd, out Orders); SLDataDB.LoadData(queryMng, out Managers); SLDataDB.LoadData(queryClnt, out Clients); ManagerBx.Items.Clear(); ClientsBx.Items.Clear(); for (int i = 0; i < Managers.Rows.Count; i++) { ManagerBx.Items.Add(Managers.Rows[i][1]); } for (int i = 0; i < Clients.Rows.Count; i++) { ClientsBx.Items.Add(Clients.Rows[i][1]); } }
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 = ""; } }
public Manager() { int p = 0; MngID = Authorization.MngID; InitializeComponent(); SLDataDB.LoadData(query, out Orders); SLDataDB.LoadData(queryClnts, out Clients); OrdersId = new int[Orders.Rows.Count]; for (int i = 0; i < Orders.Rows.Count; i++) { if (MngID == Convert.ToInt32(Orders.Rows[i][5])) { NumbersOrd.Text += Orders.Rows[i][0] + "\n"; OrdersId[p] = Convert.ToInt32(Orders.Rows[i][0]); p++; } } }
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 = "Сохранено"; } }
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 = ""; } }
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(); } }
private void Auth_Click(object sender, EventArgs e) { if (Log.Text != "") { DataTable Table = new DataTable(); if (Log.Text == "Администратор" || Log.Text == "Начальник отдела") { string pss; string query = "SELECT * FROM Admins ORDER BY id"; string chkpas = Pass.Text; SLDataDB.LoadData(query, out Table); int p; bool chk = false; switch (Log.Text) { case "Администратор": { p = 0; pss = Convert.ToString(Table.Rows[p][2]); PasCheck(chkpas, pss, out chk); if (chk) { this.Hide(); Admin g = new Admin(); g.ShowDialog(); this.Close(); } } break; case "Начальник отдела": { p = 1; pss = Convert.ToString(Table.Rows[p][2]); PasCheck(chkpas, pss, out chk); if (chk) { this.Hide(); Head_of_Dep g = new Head_of_Dep(); g.ShowDialog(); this.Close(); } } break; } } else { if (Log.Text != "") { string pss = ""; string query = "SELECT * FROM Managers ORDER BY Id"; string chkpas = Pass.Text; SLDataDB.LoadData(query, out Table); bool chk = false; int p = 0; for (int i = 0; i < Table.Rows.Count; i++) { string LT = Log.Text; string BDSrnm = Convert.ToString(Table.Rows[i][1]); for (int k = 0; k < LT.Length; k++) { if (LT[k] == BDSrnm[k]) { chk = true; } else { chk = false; break; } } if (chk) { pss = Convert.ToString(Table.Rows[i][3]); p = i; break; } } if (chk == false) { WrongPass g = new WrongPass(); g.ShowDialog(); } if (chk) { PasCheck(chkpas, pss, out chk); } ; if (chk) { MngID = Convert.ToInt32(Table.Rows[p][0]); this.Hide(); Manager g = new Manager(); g.ShowDialog(); this.Close(); } } } } }
public SvcManager() { InitializeComponent(); SLDataDB.LoadData(queryClnt, out Svcs); dataGridView1.DataSource = Svcs; }
public Services() { InitializeComponent(); SLDataDB.LoadData(queryClnt, out Svcs); dGV1.DataSource = Svcs; }
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 = ""; } }
public Clients() { InitializeComponent(); SLDataDB.LoadData(queryClnt, out Clnts); dGV1.DataSource = Clnts; }
public Arhve() { InitializeComponent(); SLDataDB.LoadData(queryArch, out Archive); dGV1.DataSource = Archive; }
public ChangePassword() { InitializeComponent(); SLDataDB.LoadData(queryOrd, out Admins); }