private void save_button_Click(object sender, EventArgs e) { Task21_security detail = new Task21_security(this.DetailID); bool existFlag = detail.Init_from_DB(); if (!existFlag) { detail = new Task21_security(); detail.SecurityID.Value = this.SecurityID; } detail.TaskName.Value = this.taskName_textBox.Text; detail.Status.Value = Helper_hssStatus.Str_to_Status(this.status_comboBox.Text).ToString(); bool successFlag = false; if (existFlag) { successFlag = detail.Update_to_DB(); } else { successFlag = detail.Insert_to_DB(); } if (successFlag) { Task21_secMaster.Reset(); this.Refresh_UI(); } this.Close(); }
private void main_ultraGrid_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { int detailID = (int)e.Cell.Row.Cells[Form_task21_sec.ID_colName].Value; if (e.Cell.Value.Equals(Form_task21_sec.edit_colName)) { Form_task21_detail detailForm = new Form_task21_detail(this.secID, detailID); this.Pop_detailForm(detailForm); } else if (e.Cell.Value.Equals(Form_task21_sec.del_colName)) { if (MessageBox.Show("Are you sure to Delete Task " + detailID + "?", "Msg", MessageBoxButtons.OKCancel) == DialogResult.OK) { Task21_security detail = new Task21_security(detailID); if (detail == null) { return; } detail.Delete_from_DB(); Task21_secMaster.Reset(); this.Refresh_parentUI(); this.BindData(); } } }
public Form_task21_detail(int secID, int detID = -1) { this.InitializeComponent(); this.SecurityID = secID; this.DetailID = detID; this.secID_label.Text = "Security #:" + secID; Task21_security sec21 = new Task21_security(this.DetailID); if (sec21.Init_from_DB()) { this.taskName_textBox.Text = sec21.TaskName.Value; this.status_comboBox.Text = sec21.Status.Value; } }