private void btAdd_Click(object sender, EventArgs e) { string factQuery; FormWorkHours fwh = new FormWorkHours(); factQuery = "(`employees_id_employee`, `dates_of_month`) VALUES('" + currentIdEmployee + "', '" + currentDate + "');"; db.Add("work_hours", factQuery, fwh.dgvWorkHours); Hide(); }
private void btAdd_Click(object sender, EventArgs e) { if (tbSurname.Text == "" || tbName.Text == "" || tbPatronimyc.Text == "" || tbPhone.Text == "" || cbPosition.Text == "") { MessageBox.Show("Заполните все поля!", "Ошибка"); } else { string factQuery; if (!edit) { factQuery = "(`surname`, `name`, `patronimyc`, `phone_number`,`position_position`, " + "`rating`) VALUES('" + tbSurname.Text + "', '" + tbName.Text + "', '" + tbPatronimyc.Text + "', '" + tbPhone.Text.Replace(" ", "").Replace("(", "").Replace(")", "") + "', '" + cbPosition.Text + "', '" + tbRating.Text + "');"; db.Add("employees", factQuery); } else { factQuery = "`surname` = '" + tbSurname.Text + "', `name` = '" + tbName.Text + "', `patronimyc` = '" + tbPatronimyc.Text + "', `phone_number` = '" + tbPhone.Text.Replace(" ", "").Replace("(", "").Replace(")", "") + "',`position_position` = '" + cbPosition.Text + "', `rating` = '" + tbRating.Text + "'"; db.Edit("employees", "id_employee", idEmployee, factQuery); } Hide(); } }
private void btAdd_Click(object sender, EventArgs e) { if (tbIDRepair.Text == "" || tbName.Text == "" || tbCost.Text == "" || cbCategory.Text == "" || cbPosition.Text == "") { MessageBox.Show("Заполните все поля!", "Ошибка"); } else { string factQuery; if (!edit) { factQuery = "(`id_repair`, `name`, `category`, `cost`, `position_position`) VALUES('" + tbIDRepair.Text + "', '" + tbName.Text + "', '" + cbCategory.Text + "', '" + tbCost.Text + "', '" + cbPosition.Text + "');"; db.Add("repairs", factQuery); } else { factQuery = "`name` = '" + tbName.Text + "', `category` = '" + cbCategory.Text + "', " + "`cost` = '" + tbCost.Text + "', `position_position` = '" + cbPosition.Text + "'"; db.Edit("repairs", "id_repair", tbIDRepair.Text, factQuery); } Hide(); } }
private void btAdd_Click(object sender, EventArgs e) { string factQuery; FormActions fa = new FormActions(); factQuery = "(`name`, `text`) VALUES('" + tbNameAction.Text + "', '" + tbTextAction.Text + "');"; db.Add("actions", factQuery, fa.dataGridView1); Hide(); }
private void btAdd_Click(object sender, EventArgs e) { string factQuery; FormWorkHoursRepairs fwhr = new FormWorkHoursRepairs(); factQuery = "(`work_hours_id_work_hours`, `repairs_id_repair`, `clients_id_client`, `time_start`, `time_finish`) VALUES('" + idWorkHours + "', '" + idRepair + "', '" + idClient + "', '" + textBox4.Text + "', '" + textBox5.Text + "');"; db.Add("current_repairs", factQuery, fwhr.dgvWorkHoursRepairs); Hide(); }
private void btAdd_Click(object sender, EventArgs e) { string factQuery; FormRepairs fc = new FormRepairs(); factQuery = "(`id_repair`, `name`, `category`, `cost`, `position_position`) VALUES('" + textBox1.Text + "', '" + textBox2.Text + "', '" + cbCategory.Text + "', '" + textBox4.Text + "', '" + cbPosition.Text + "');"; db.Add("repairs", factQuery, fc.dataGridView1); this.Hide(); }
private void btAdd_Click(object sender, EventArgs e) { string factQuery; if (tbNumSTS.Text == "" || tbBrand.Text == "" || tbModel.Text == "" || cbYear.Text == "") { MessageBox.Show("Заполните все поля!", "Ошибка"); } else { if (!edit) { if (!checkBoxIsDateEmpty.Checked) { factQuery = "(number_sts, brand, model, year_created, date_to) VALUES('" + tbNumSTS.Text.Replace(" ", "") + "', '" + tbBrand.Text + "', '" + tbModel.Text + "', '" + cbYear.Text + "', '" + dtpDateTO.Value.ToString("yyyy-MM-dd") + "');"; } else { factQuery = "(number_sts, brand, model, year_created) VALUES('" + tbNumSTS.Text.Replace(" ", "") + "', '" + tbBrand.Text + "', '" + tbModel.Text + "', '" + cbYear.Text + "');"; } db.Add("cars", factQuery); } else { factQuery = "brand = '" + tbBrand.Text + "', " + "model = '" + tbModel.Text + "', year_created = '" + cbYear.Text + "', date_to = '" + dtpDateTO.Value.ToString("yyyy-MM-dd") + "'"; db.Edit("cars", "number_sts", tbNumSTS.Text.Replace(" ", ""), factQuery); } Hide(); } }
private void btAdd_Click(object sender, EventArgs e) { if (tbNameAction.Text != "") { string factQuery; if (!edit) { factQuery = "(name, text) VALUES('" + tbNameAction.Text + "', '" + tbTextAction.Text + "');"; db.Add("actions", factQuery); } else { factQuery = "name = '" + tbNameAction.Text + "', text = '" + tbTextAction.Text + "'"; db.Edit("actions", "id_action", idAction, factQuery); } Hide(); } else { MessageBox.Show("Заполните поле \"Название акции\"!", "Ошибка"); } }
private void btAdd_Click(object sender, EventArgs e) { if (idWorkHours == -1 || cbCategoryRepair.Text == "" || idRepair == -1 || idClient == -1) { MessageBox.Show("Заполните все поля!", "Ошибка"); } else { string factQuery; if (!cbTimeStartIsEmpty.Checked && !cbTimeFinishIsEmpty.Checked) { factQuery = "(`work_hours_id_work_hours`, `repairs_id_repair`, `clients_id_client`, " + "`time_start`, `time_finish`, `status_repair`) " + "VALUES('" + idWorkHours + "', '" + idRepair + "', '" + idClient + "', '" + dtpStart.Text + "', '" + dtpFinish.Text + "', '" + cbStatusRepair.Text + "');"; } else if (cbTimeStartIsEmpty.Checked && !cbTimeFinishIsEmpty.Checked) { factQuery = "(`work_hours_id_work_hours`, `repairs_id_repair`, `clients_id_client`, " + "`time_finish`, `status_repair`) " + "VALUES('" + idWorkHours + "', '" + idRepair + "', '" + idClient + "', '" + dtpFinish.Text + "', '" + cbStatusRepair.Text + "');"; } else { factQuery = "(`work_hours_id_work_hours`, `repairs_id_repair`, `clients_id_client`, " + "`time_start`, `status_repair`) " + "VALUES('" + idWorkHours + "', '" + idRepair + "', '" + idClient + "', '" + dtpStart.Text + "', '" + cbStatusRepair.Text + "');"; } db.Add("current_repairs", factQuery); Hide(); } }
private void btAddRegularity_Click(object sender, EventArgs e) { if (cbSurnameEmployeeRegularity.Text == "" || cbRegularity.Text == "" || cbDateStart.Text == "") { MessageBox.Show("Заполните все поля!", "Ошибка"); } else { string factQuery; List <DateTime> datesRegularity = new List <DateTime>(); int checkRegularity = 1; string values = ""; switch (cbRegularity.SelectedItem) { case "2 через 2": for (int i = cbDateStart.SelectedIndex; i < globalDates.Count; i++) { if (checkRegularity < 3) { datesRegularity.Add(globalDates[i]); checkRegularity++; } else { checkRegularity = 1; i++; } } for (int i = 0; i < datesRegularity.Count() - 1; i++) { values += "('" + currentIdEmployee + "' , '" + datesRegularity[i].ToString("yyyy-MM-dd") + "'), "; } values += "('" + currentIdEmployee + "' , '" + datesRegularity[datesRegularity.Count() - 1].ToString("yyyy-MM-dd") + "')"; break; case "2 через 1": for (int i = cbDateStart.SelectedIndex; i < globalDates.Count; i++) { if (checkRegularity < 3) { datesRegularity.Add(globalDates[i]); checkRegularity++; } else { checkRegularity = 1; } } for (int i = 0; i < datesRegularity.Count() - 1; i++) { values += "('" + currentIdEmployee + "' , '" + datesRegularity[i].ToString("yyyy-MM-dd") + "'), "; } values += "('" + currentIdEmployee + "' , '" + datesRegularity[datesRegularity.Count() - 1].ToString("yyyy-MM-dd") + "')"; break; case "3 через 3": for (int i = cbDateStart.SelectedIndex; i < globalDates.Count; i++) { if (checkRegularity < 4) { datesRegularity.Add(globalDates[i]); checkRegularity++; } else { checkRegularity = 1; i = i + 2; } } for (int i = 0; i < datesRegularity.Count() - 1; i++) { values += "('" + currentIdEmployee + "' , '" + datesRegularity[i].ToString("yyyy-MM-dd") + "'), "; } values += "('" + currentIdEmployee + "' , '" + datesRegularity[datesRegularity.Count() - 1].ToString("yyyy-MM-dd") + "')"; break; } factQuery = "(`employees_id_employee`, `dates_of_month`) VALUES" + values + ";"; db.Add("work_hours", factQuery); Hide(); } }