private void btnSave_Click(object sender, EventArgs e) { if (txtPosition.Text.Trim() == "") { MessageBox.Show("Please fill the position name"); } else if (cmbDepartment.SelectedIndex == -1) { MessageBox.Show("Please select a department"); } else { if (!isUpdated) { POSITION position = new POSITION(); position.Position1 = txtPosition.Text; position.DepID = Convert.ToInt32(cmbDepartment.SelectedValue); PositionBLL.AddPosition(position); MessageBox.Show("Position added"); txtPosition.Clear(); cmbDepartment.SelectedIndex = -1; } else { POSITION position = new POSITION(); position.ID = detail.ID; position.Position1 = txtPosition.Text; position.DepID = Convert.ToInt32(cmbDepartment.SelectedValue); bool control = false; if (Convert.ToInt32(cmbDepartment.SelectedValue) != detail.OldDepartmentID) { control = true; } PositionBLL.UpdatePosition(position, control); MessageBox.Show("Position updated!"); this.Close(); } } }
private void btnSave_Click(object sender, EventArgs e) { if (txtPosition.Text.Trim() == "") { MessageBox.Show("Please fill the position name"); } else if (cmbDeparment.SelectedIndex == -1) { MessageBox.Show("Please select a department"); } else { POSITION position = new POSITION(); position.PositionName = txtPosition.Text; position.DepartmentID = Convert.ToInt32(cmbDeparment.SelectedValue); PositionBLL.AddPosition(position); MessageBox.Show("Position was added"); txtPosition.Clear(); cmbDeparment.SelectedIndex = -1; } }
private void btnLayoutSaveNew_Click(object sender, EventArgs e) { Layout layout = layoutBindingSource.Current as Layout; if (layout == null) { return; } bllPos.DropPositionBelongLayout(layout.Id); dgvPosition.SelectAll(); foreach (DataGridViewCell cell in dgvPosition.SelectedCells) { Position p = cell.Value as Position; if (p == null) { continue; } p.LayoutId = layout.Id; p.Id = bllPos.AddPosition(p); } }
public HttpResponseMessage AddPosition([FromBody] Position pos) { return(new HttpResponseMessage { Content = new StringContent(posBll.AddPosition(pos), Encoding.GetEncoding("UTF-8"), "text/json") }); }