private void btnRemoveRequest_Click(object sender, EventArgs e) { if (dgvRequest.SelectedRows.Count <= 0) { MessageBox.Show("Кого кикаем?", "Упс", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { string strId = dgvRequest.SelectedCells[0].Value.ToString(); string strValue = dgvRequest.SelectedCells[1].Value.ToString(); string strUser = dgvRequest.SelectedCells[2].Value.ToString(); string strDate = dgvRequest.SelectedCells[3].Value.ToString(); DialogResult result = MessageBox.Show ("Удалить запись?\n\n" + "'" + strValue + "'\n\n" + "Созданная: " + "'" + strDate + "'\n" + "Пользователем: " + "'" + strUser + "'", "Ты уверен?", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { UseDB.DeleteDB("RequestList", "Id", strId); dgvRequest.Rows.RemoveAt(dgvRequest.CurrentRow.Index); //удаляет строку из DataGridView lblQuantity.Text = "Количество заявок: " + dgvRequest.Rows.Count.ToString(); // -1 заявка в lbl после удаления из dgv } } }
public override void DisplayFooter(int option) { while (true) { if (option == 1) { Customer cust = AddCustomer(); if (ConfirmAdd(cust)) { UseDB.InsertCustomer(cust.FName, cust.LName); } Console.Clear(); this.DisplayScreen(); } else if (option == 2) { int custID = RemoveCustomer(); if (ConfirmRemove(custID)) { UseDB.DeleteCustomer(custID); } Console.Clear(); this.DisplayScreen(); } } }
public override void DisplayFooter(int option) { while (true) { if (option == 1) { Service service = AddService(); if (ConfirmAdd(service)) { UseDB.InsertService(service.Name, service.Description); } Console.Clear(); this.DisplayScreen(); } else if (option == 2) { int serviceID = RemoveService(); if (ConfirmRemove(serviceID)) { UseDB.DeleteService(serviceID); } Console.Clear(); this.DisplayScreen(); } } }
private void btnClearAllRequest_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show ("Почистить весь список с заявками?", "Ты уверен?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { //Проверяем наличие строк в Заявках if (dgvRequest.Rows.Count > 0) { //Перебираем все строки в Заявках while (dgvRequest.Rows.Count > 0) { UseDB.DeleteDB("RequestList", "Id", dgvRequest[0, 0].Value.ToString()); dgvRequest.Rows.RemoveAt(0); } lblQuantity.Text = "0"; } else { MessageBox.Show("Там и так все пусто. Если мы будем тереть дальше, то протрем дырень...", "А зачем?", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void lbShare_DoubleClick(object sender, EventArgs e) { if (lbShare.SelectedItem != null) { Process.Start("explorer", UseDB.SelectDBLike("ServiceShare", "Name", "Title", lbShare.SelectedItem.ToString())); } }
public override void DisplayFooter(int option) { while (true) { if (option == 1) { Employee emp = AddEmployee(); if (ConfirmAdd(emp)) { int empID = UseDB.InsertEmployee(emp.FName, emp.LName); var daysOfWeek = new string[] { "DailyDefault", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; foreach (string day in daysOfWeek) { UseDB.InsertUpdateDailyAvailability(day, empID, new TimeSpan(8, 0, 0), new TimeSpan(17, 0, 0)); } } Console.Clear(); this.DisplayScreen(); } else if (option == 2) { int empID = RemoveEmployee(); if (ConfirmRemove(empID)) { UseDB.DeleteEmployee(empID); UseDB.DeleteDailyAvailability(empID); } Console.Clear(); this.DisplayScreen(); } } }
private void lbRDP_DoubleClick(object sender, EventArgs e) { if (lbRDP.SelectedItem != null) { Process.Start("mstsc", @"/admin /f /v:" + UseDB.SelectDBLike("ServiceRDP", "Name", "Title", lbRDP.SelectedItem.ToString())); } }
async void Find(string path = null) { int g; if (!InternetGetConnectedState(out g, 0)) { await this.ShowMessageAsync("Ошибка", "Отсутсвует подключение к интернету"); return; } List <Product> items = new List <Product>(); DataGrid1.ItemsSource = items; ProgressRing.IsActive = true; items = await Task.Factory.StartNew(() => { List <Product> prod = new List <Product>(); Request r = Purser.Start(new Request(cfg.findProduct, new List <Product>(), minPrice, maxPrice), path); UseDB.Add(r); prod = r.ListProduct; return(prod); }); ProgressRing.IsActive = false; if (items.Count == 0) { await this.ShowMessageAsync("Ошибка", "Товары не найдены"); } DataGrid1.ItemsSource = items; if (Purser.CategoryList.Count > 0) { CB.IsEnabled = true; DefaultNameComboBox.Content = "-- Выберите категорию --"; foreach (var node in Purser.CategoryList) { if (node.Key != "") { CB.Items.Add(node.Key); } } } else { CB.IsEnabled = false; DefaultNameComboBox.Content = ""; RangeSlider.Minimum = 0; RangeSlider.Maximum = 20000; } RangeSlider.Minimum = Purser.Minimum; RangeSlider.Maximum = Purser.Maximum; }
public void RefreshLBRDPShare(ListBox lb, string tableDB) { lb.Items.Clear(); foreach (var item in UseDB.SelectDB(tableDB, "Title")) { lb.Items.Add(item); } }
public void RefreshProgList(ListBox lb) { lb.Items.Clear(); foreach (var item in UseDB.SelectDB("ProgList", "Name")) { lb.Items.Add(item); } }
public ActionResult DelStaff(int?id) { if (id == null) { return(HttpNotFound()); } UseDB.DelStaff(id.GetValueOrDefault()); return(RedirectToAction("Index")); }
public void DisplayEmployees() { var employees = UseDB.SelectEmployees(); Console.WriteLine("{0, -15} {1, -15} {2, -15}", "Employee ID", "First Name", "Last Name"); foreach (Employee emp in employees) { Console.WriteLine("{0, -15} {1, -15} {2, -15}", emp.ID, emp.FName, emp.LName); } }
public override void DisplayBody() { var customers = UseDB.SelectCustomers(); Console.WriteLine("{0, -20} {1, -20} {2, -20}", "Customer ID", "First Name", "Last Name"); foreach (Customer cust in customers) { Console.WriteLine("{0, -20} {1, -20} {2, -20}", cust.ID, cust.FName, cust.LName); } }
public void DisplayServices() { var services = UseDB.SelectServices(); Console.WriteLine("{0, -15} {1, -30} {2, -30}", "Service ID", "Service Name", "Description"); foreach (Service service in services) { Console.WriteLine("{0, -15} {1, -30} {2, -30}", service.ID, service.Name, service.Description); } }
public ActionResult SearchStaff(string address) { if (address == null) { return(RedirectToAction("Index")); } if (address != null) { return(View(UseDB.SearchStaff(address))); } return(HttpNotFound()); }
public bool IsAny(int serviceID) { var services = UseDB.SelectService(serviceID); if (services.Any()) { return(true); } else { return(false); } }
public bool IsAny(int empID) { var employees = UseDB.SelectEmployee(empID); if (employees.Any()) { return(true); } else { return(false); } }
public void DisplayAppointments() { var appointments = UseDB.SelectAppointments(); appointments.OrderBy(appointment => appointment.StartTime); appointments.OrderBy(appointment => appointment.EmployeeID); Console.WriteLine("There are {0} appointments", appointments.Count); Console.WriteLine("{0, -30} {1, -25} {2, -30} {3, -30} {4, -30}", "Employee", "Service", "Customer", "Start Time", "End Time"); foreach (Appointment apt in appointments) { Console.WriteLine("{0, -30} {1, -25} {2, -30} {3, -30} {4, -30}", apt.EmployeeName, apt.ServiceName, apt.CustomerName, apt.StartTime, apt.EndTime); } }
private void btnAddProg_Click(object sender, EventArgs e) { if (tbAddProg.Text == "") { MessageBox.Show("Такого ПО не существует!", "Вбей ПО'шечку", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { UseDB.InsertDB("ProgList", "Name", tbAddProg.Text); lbProgList.Items.Add(tbAddProg.Text); tbAddProg.Text = null; } }
private async void btnPR1_Click(object sender, EventArgs e) { string bName = (sender as Button).Name; //Получает имя нажатой кнопки string str = UseDB.SelectDBLike("ProfRab", "btn_value", "btn_name", bName); lblPR.Text = str; Clipboard.SetText(str); await Task.Delay(Properties.Settings.Default.timeClean); lblPR.Text = string.Empty; }
public bool IsAny(int custID) { var customers = UseDB.SelectCustomer(custID); if (customers.Any()) { return(true); } else { return(false); } }
private void btnPrintAdd_Click(object sender, EventArgs e) { if (tbPrintName.Text == "") { MessageBox.Show("Что забыл?", "Атата...", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { UseDB.InsertDB("Printers", "Name", "NetName", "Location", "InvNumber", tbPrintName.Text, tbPrintNetName.Text, tbPrintLocation.Text, tbPrintInvNumber.Text); MethodsPrinters mp = new MethodsPrinters(); mp.RefreshPrinters(dgvPrinters); mp.ClearPrintTB(tbPrintName, tbPrintNetName, tbPrintLocation, tbPrintInvNumber); } }
public ActionResult EditStaff(int?id) { if (id == null) { return(HttpNotFound()); } Staff staff = UseDB.FindStaff(id.GetValueOrDefault()); if (staff != null) { return(View(staff)); } return(HttpNotFound()); }
public bool IsEmployeeAvailable(int empID, DateTime startTime, DateTime endTime) { string dayOfWeek = startTime.DayOfWeek.ToString(); var dayAvailability = UseDB.SelectDailyAvailabily(empID, dayOfWeek); if (startTime.TimeOfDay >= dayAvailability.StartTime && endTime.TimeOfDay <= dayAvailability.EndTime) { return(true); } else { return(false); } }
private void btnPrintChange_Click(object sender, EventArgs e) { if (tbPrintName.TextLength > 0) { UseDB.UpdateDB("Printers", "Name", "id", tbPrintName.Text, dgvPrinters.SelectedCells[0].Value.ToString()); UseDB.UpdateDB("Printers", "NetName", "id", tbPrintNetName.Text, dgvPrinters.SelectedCells[0].Value.ToString()); UseDB.UpdateDB("Printers", "Location", "id", tbPrintLocation.Text, dgvPrinters.SelectedCells[0].Value.ToString()); UseDB.UpdateDB("Printers", "InvNumber", "id", tbPrintInvNumber.Text, dgvPrinters.SelectedCells[0].Value.ToString()); dgvPrinters.SelectedCells[1].Value = tbPrintName.Text; dgvPrinters.SelectedCells[2].Value = tbPrintNetName.Text; dgvPrinters.SelectedCells[3].Value = tbPrintLocation.Text; dgvPrinters.SelectedCells[4].Value = tbPrintInvNumber.Text; } }
private void btnAddRequest_Click(object sender, EventArgs e) { if (tbAddRequest.Text == "") { MessageBox.Show("Что будем добавлять?", "Не заполнил!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { UseDB.InsertDB("RequestList", "Prefix", "Value", "User", "DateCreate", tbPrefixRequest.Text, tbAddRequest.Text, Environment.UserName, DateTime.Now.ToString()); MethodsRequests mr = new MethodsRequests(); mr.RefreshRequestsList(dgvRequest, lblQuantity, chkbPrefixShow); tbAddRequest.Clear(); } }
public void LoadListNameAndListTitle() { //Чистим листы listTitle.Clear(); listName.Clear(); foreach (var item in UseDB.SelectDB("PingList", "Title")) { listTitle.Add(item); } foreach (var item in listTitle) { listName.Add(UseDB.SelectDBLike("PingList", "Name", "Title", item)); } }
private void btnRemoveProg_Click(object sender, EventArgs e) { if (lbProgList.SelectedItem != null) { DialogResult result = MessageBox.Show("Удалить запись '" + lbProgList.SelectedItem + "'?", "Ты уверен?", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { UseDB.DeleteDB("ProgList", "Name", lbProgList.SelectedItem.ToString()); lbProgList.Items.RemoveAt(lbProgList.SelectedIndex); } } else { MessageBox.Show("Шо те нада?", "Ну и дурак...", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void Refresh_btnPR(Control where) { int count = UseDB.SelectDB("ProfRab", "btn_name").Length; for (int i = 1; i <= count; i++) { try { var btn = GetControl(where, "btnPR" + i); //метод поиска контролов (записывем имя кнопки в переменную) btn.Text = UseDB.SelectDBLike("ProfRab", "btn_title", "btn_name", "btnPR" + i.ToString()); //задаем Text кнопке } catch (Exception) { //MessageBox.Show(ex.Message, "Что-то пошло не так", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } } }
private async void btnAddRequestDB_Click(object sender, EventArgs e) { if (lbProgList.SelectedItem != null && tbAddFIORequest.Text != "") { string str = null; if (rdbtnAddRequest1.Checked) { str = "Установить "; } if (rdbtnAddRequest2.Checked) { str = "Переустановить "; } if (rdbtnAddRequest3.Checked) { str = "Обновить "; } if (rdbtnAddRequest4.Checked) { str = "Настроить "; } if (rdbtnAddRequest5.Checked) { str = "Удалить "; } str += lbProgList.SelectedItem + ". " + tbAddFIORequest.Text; UseDB.InsertDB("RequestList", "Prefix", "Value", "User", "DateCreate", Properties.Settings.Default.prefixRequest, str, Environment.UserName, DateTime.Now.ToString()); lblAddRequestDB.Text = "Улетело в БД:\n" + str; await Task.Delay(Properties.Settings.Default.timeClean); lblAddRequestDB.Text = string.Empty; } else { MessageBox.Show("Что ты упустил?", "IQ тест", MessageBoxButtons.OK, MessageBoxIcon.Information); } }