private void btnSave_Click(object sender, EventArgs e) { _task.Description = txtDescription.Text; _task.ProjectID = _projectId; TaskLog taskLog = new TaskLog(); taskLog.TaskDate = DateTime.Now; taskLog.TaskStatusID = (int)cmbTaskStatus.SelectedValue; if (taskLog.TaskStatusID != 1) { taskLog.EmployeeID = (int)cmbTaskEmployee.SelectedValue; } if (_taskID < 0) { _task.CreatedDate = DateTime.Now; } _task.TaskLogs.Add(taskLog); bool result = false; try { result = (_taskID < 0) ? _taskBuss.Add(_task) : _taskBuss.Update(_task); } catch (Exception ex) { MessageBox.Show(ex.Message); } MessageBox.Show(result ? "İşlem başarılı" : "İşlem başarısız"); this.Close(); }
private void btnSave_Click(object sender, EventArgs e) { _taskBusiness = new TaskBusiness(); try { if (this.taskID < 1) { task = new Entities.Task(); task.BeginDate = dtpBeginDate.Value; task.FinalDate = dtpFinalDate.Value; task.Description = txtDescription.Text; if (rdbNotStarted.Checked) { task.Status = "Başlanmadı"; } else if (rdbDevelop.Checked) { task.Status = "Geliştirilcek"; } else if (rdbTested.Checked) { task.Status = "Test Edilcek"; } task.EmloyeeId = (int)cmbEmployee.SelectedValue; task.ProjectId = (int)cmbProje.SelectedValue; _taskBusiness.Add(task); } else { task = new Entities.Task(); task.ID = this.taskID; task.BeginDate = dtpBeginDate.Value; task.FinalDate = dtpFinalDate.Value; task.Description = txtDescription.Text; if (rdbNotStarted.Checked) { task.Status = "Başlanmadı"; } else if (rdbDevelop.Checked) { task.Status = "Geliştirilcek"; } else if (rdbTested.Checked) { task.Status = "Test Edilcek"; } task.EmloyeeId = (int)cmbEmployee.SelectedValue; task.ProjectId = (int)cmbProje.SelectedValue; _taskBusiness.Update(task); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
// POST: api/Employee public void Post(TaskDetail item) { obj.Add(item); }