private void fpsCowType_CellDoubleClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e) { frmEditCowStatus frmEditType = new frmEditCowStatus(pIsNewMode: false); frmEditType.DataCode = this.fpsData_Sheet1.Cells.Get(e.Row, _col_code).Text; frmEditType.DataName = this.fpsData_Sheet1.Cells.Get(e.Row, _col_name).Text; frmEditType.Remark = this.fpsData_Sheet1.Cells.Get(e.Row, _col_remark).Text; frmEditType.InActive = (this.fpsData_Sheet1.Cells.Get(e.Row, _col_inactive).Text == "ใช้งาน" ? false : true); if (frmEditType.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fpsData_Sheet1.RowCount += 1; int rowIndex = this.fpsData_Sheet1.RowCount - 1; this.fpsData_Sheet1.Cells.Get(rowIndex, _col_check).Value = false; this.fpsData_Sheet1.Cells.Get(rowIndex, _col_code).Text = frmEditType.DataCode; this.fpsData_Sheet1.Cells.Get(rowIndex, _col_name).Text = frmEditType.DataName; this.fpsData_Sheet1.Cells.Get(rowIndex, _col_remark).Text = frmEditType.Remark; if (frmEditType.InActive == true) { this.fpsData_Sheet1.Rows.Get(rowIndex).ForeColor = Color.Red; this.fpsData_Sheet1.Cells.Get(rowIndex, _col_inactive).Text = "ยกเลิกใช้งาน"; } else { this.fpsData_Sheet1.Rows.Get(rowIndex).ForeColor = Color.FromKnownColor(KnownColor.ControlText); this.fpsData_Sheet1.Cells.Get(rowIndex, _col_inactive).Text = "ใช้งาน"; } } frmEditType.Dispose(); frmEditType = null; }
private void tsbAddNew_Click(object sender, EventArgs e) { frmEditCowStatus frmEditData = new frmEditCowStatus(pIsNewMode: true); if (frmEditData.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fpsData_Sheet1.RowCount += 1; int rowIndex = this.fpsData_Sheet1.RowCount - 1; this.fpsData_Sheet1.Cells.Get(rowIndex, _col_check).Value = false; this.fpsData_Sheet1.Cells.Get(rowIndex, _col_code).Text = frmEditData.DataCode; this.fpsData_Sheet1.Cells.Get(rowIndex, _col_name).Text = frmEditData.DataName; this.fpsData_Sheet1.Cells.Get(rowIndex, _col_remark).Text = frmEditData.Remark; if (frmEditData.InActive == true) { this.fpsData_Sheet1.Rows.Get(rowIndex).ForeColor = Color.Red; this.fpsData_Sheet1.Cells.Get(rowIndex, _col_inactive).Text = "ยกเลิกใช้งาน"; } else { this.fpsData_Sheet1.Rows.Get(rowIndex).ForeColor = Color.FromKnownColor(KnownColor.ControlText); this.fpsData_Sheet1.Cells.Get(rowIndex, _col_inactive).Text = "ใช้งาน"; } } frmEditData.Dispose(); frmEditData = null; }