private void btnSave_Click(object sender, EventArgs e) { _project.CustomerID = (int)cmbCustomer.SelectedValue; _project.Name = txtName.Text; _project.StartDate = dtpStartDate.Value; _project.EndDate = dtpEndDate.Value; bool result = false; try { if (_projectId > 0) { result = _pBuss.Update(_project); } else { result = _pBuss.Add(_project); } } catch (Exception ex) { MessageBox.Show(ex.Message); } MessageBox.Show((result) ? "İşlem başarılı": "İşlem başarısız"); this.Close(); }
private void button1_Click(object sender, EventArgs e) { _projectBusiness = new ProjectBusiness(); try { if (projectId < 1) { _project = new Project(); _project.EndDate = DtpEndDate.Value; _project.StartDate = DtpPlanStartDate.Value; _project.PlanningEndDate = dtpPlanEndDate.Value; _project.PlanningStartDate = DtpPlanStartDate.Value; _project.CustomerID = (int)cmbCustomer.SelectedValue; _project.Name = txtProjectName.Text; _projectBusiness.Add(_project); } else { _project.ID = projectId; _project.EndDate = DtpEndDate.Value; _project.StartDate = DtpPlanStartDate.Value; _project.PlanningEndDate = dtpPlanEndDate.Value; _project.PlanningStartDate = DtpPlanStartDate.Value; _project.CustomerID = (int)cmbCustomer.SelectedValue; _project.Name = txtProjectName.Text; _projectBusiness.Update(_project); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnSave_Click(object sender, EventArgs e) { _project.ProjectName = txtProjectName.Text; _project.Description = txtDescription.Text; _project.StartingDate = dtpStartDate.Value; _project.FinishDate = dtpEndDate.Value; _project.CustomerId = (int)cmbCustomer.SelectedValue; if (_projectBusiness.Add(_project)) { MessageBox.Show("Proje Eklendi"); } else { MessageBox.Show("Proje Eklenemedi ! "); } dgvAllProject.DataSource = null; dgvAllProject.DataSource = _projectBusiness.GetAll(); }
public int AddProject(Project element, string username, string password) { IManager<Project> business = new ProjectBusiness(); return business.Add(element, username, password); }