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); } }