private bool SelectProductionLine(bool pblnAlwaysShowDialog) { Hashtable htbCriteria = new Hashtable(); //Call OpenSearchForm for selecting Production Line DataRowView drwResult = FormControlComponents.OpenSearchForm(PRO_ProductionLineTable.TABLE_NAME, PRO_ProductionLineTable.CODE_FLD, txtProductionLine.Text.Trim(), htbCriteria, pblnAlwaysShowDialog); //If has Production Line matched searching condition, fill values to form's controls if (drwResult != null) { txtProductionLine.Text = drwResult[PRO_ProductionLineTable.CODE_FLD].ToString(); txtProductionLine.Tag = drwResult[PRO_ProductionLineTable.PRODUCTIONLINEID_FLD]; //Reset Modified status txtProductionLine.Modified = false; FillDataToGrid(Convert.ToInt32(drwResult[PRO_ProductionLineTable.PRODUCTIONLINEID_FLD])); } else if (!pblnAlwaysShowDialog) { txtProductionLine.Focus(); return(false); } return(true); }
private void dgrdData_ButtonClick(object sender, ColEventArgs e) { const string METHOD_NAME = THIS + ".dgrdData_ButtonClick()"; try { DataRowView drwResult = null; Hashtable htbCondition = new Hashtable(); if (txtProductionLine.Text.Trim() != string.Empty) { htbCondition.Add(PRO_WorkOrderMasterTable.PRODUCTIONLINEID_FLD, int.Parse(txtProductionLine.Tag.ToString())); } else { String[] strParam = new string[2]; strParam[0] = lblProductionLine.Text; strParam[1] = dgrdData.Columns[dgrdData.Col].Caption; PCSMessageBox.Show(ErrorCode.MESSAGE_SELECT_ONE_BEFORE_SELECT_ONE, MessageBoxIcon.Warning, strParam); txtProductionLine.Focus(); return; } if (dgrdData.AddNewMode == AddNewModeEnum.AddNewCurrent) { drwResult = FormControlComponents.OpenSearchForm(PRODUCT_IN_PRODUCTIONLINE_VIEWNAME, dgrdData.Columns[dgrdData.Col].DataField, dgrdData[dgrdData.Row, dgrdData.Col].ToString(), htbCondition, true); } else { drwResult = FormControlComponents.OpenSearchForm(PRODUCT_IN_PRODUCTIONLINE_VIEWNAME, dgrdData.Columns[dgrdData.Col].DataField, dgrdData.Columns[dgrdData.Col].Text.Trim(), htbCondition, true); } if (drwResult != null) { FillItemData(drwResult.Row); } } catch (PCSException ex) { PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error); try { Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error); } } catch (Exception ex) { PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error); try { Logger.LogMessage(ex, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error); } } }
private void VendorCodeText_Validating(object sender, System.ComponentModel.CancelEventArgs e) { const string methodName = This + ".VendorCodeText_Validating()"; try { if (!VendorCodeText.Modified) { return; } if (VendorCodeText.Text.Trim() == string.Empty) { FillVendor(null); return; } var htbCriteria = new Hashtable { { "Vendor", 1 } }; var drvResult = FormControlComponents.OpenSearchForm("V_VendorCustomer", MST_PartyTable.CODE_FLD, VendorCodeText.Text.Trim(), htbCriteria, false); if (drvResult != null) { FillVendor(drvResult); } else { e.Cancel = true; } } catch (PCSException ex) { // displays the error message. PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error); // log message. try { Logger.LogMessage(ex.CauseException, methodName, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error); } } catch (Exception ex) { // displays the error message. PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error); // log message. try { Logger.LogMessage(ex, methodName, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error); } } }
/// <summary> /// Search for specific WORK Order /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSearchBeginWO_Click(object sender, EventArgs e) { const string METHOD_NAME = THIS + ".btnSearchBeginWO_Click()"; try { DataRowView drwResult = null; //search for master location id Hashtable hashCondition = new Hashtable(); hashCondition.Add(PRO_WorkOrderMasterTable.MASTERLOCATIONID_FLD, mMasterLocationID); //HACK: added by Tuan TQ. 19 Jan, 2006. Apply To Location for issuing hashCondition.Add(MST_LocationTable.LOCATIONID_FLD, mToLocationID); //End Hack drwResult = FormControlComponents.OpenSearchForm(REMAIN_WO_FOR_ISSUE_VIEW, PRO_WorkOrderMasterTable.WORKORDERNO_FLD, txtBeginWO.Text.Trim(), hashCondition, true); if (drwResult != null) { intWorkOrderMasterID = int.Parse(drwResult[PRO_WorkOrderMasterTable.WORKORDERMASTERID_FLD].ToString()); txtBeginWO.Text = drwResult[PRO_WorkOrderMasterTable.WORKORDERNO_FLD].ToString(); } } catch (PCSException ex) { // displays the error message. PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error); // log message. try { Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error); } } catch (Exception ex) { // displays the error message. PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error); // log message. try { Logger.LogMessage(ex, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error); } } }
private void btnSelectPeriod_Click(object sender, System.EventArgs e) { const string METHOD_NAME = THIS + ".btnSelectPeriod_Click()"; try { Hashtable htCondition = new Hashtable(); htCondition.Add(Sys_PeriodTable.ACTIVATE_FLD, 1); DataRowView drwResult = null; drwResult = FormControlComponents.OpenSearchForm(Sys_PeriodTable.TABLE_NAME, string.Empty, "", htCondition, true); if (drwResult != null) { dtmFromDate.Value = drwResult[Sys_PeriodTable.FROMDATE_FLD]; dtmToDate.Value = drwResult[Sys_PeriodTable.TODATE_FLD]; txtYear.Text = Convert.ToDateTime(dtmFromDate.Value).Year.ToString("0000"); txtYear.Tag = drwResult[Sys_PeriodTable.PERIODID_FLD].ToString(); txtMonth.Text = Convert.ToDateTime(dtmFromDate.Value).Month.ToString(); btnCloseOpen.Enabled = true; } } catch (PCSException ex) { // Displays the error message if throwed from PCSException. PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error); try { // Log error message into log file. Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR); } catch { // Show message if logger has an error. PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error); } } catch (Exception ex) { // Displays the error message if throwed from system. PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error); try { // Log error message into log file. Logger.LogMessage(ex, METHOD_NAME, Level.ERROR); } catch { // Show message if logger has an error. PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error); } } }
private void VendorCodeButton_Click(object sender, EventArgs e) { const string methodName = This + ".VendorCodeButton_Click()"; try { var htbCriteria = new Hashtable { { "Vendor", 1 } }; var drvResult = FormControlComponents.OpenSearchForm("V_VendorCustomer", MST_PartyTable.CODE_FLD, VendorCodeText.Text.Trim(), htbCriteria, true); if (drvResult != null) { FillVendor(drvResult); } else { VendorCodeText.Focus(); } } catch (PCSException ex) { // displays the error message. PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error); // log message. try { Logger.LogMessage(ex.CauseException, methodName, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error); } } catch (Exception ex) { // displays the error message. PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error); // log message. try { Logger.LogMessage(ex, methodName, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error); } } }
private void dgrdData_BeforeColUpdate(object sender, BeforeColUpdateEventArgs e) { const string METHOD_NAME = THIS + ".dgrdData_BeforeColUpdate()"; try { if (e.Column.DataColumn.Value.ToString() == string.Empty) { return; } Hashtable htbCriteria = new Hashtable(); DataRowView drwResult = null; if (e.Column.DataColumn.DataField == ITM_ProductTable.CODE_FLD || e.Column.DataColumn.DataField == ITM_ProductTable.DESCRIPTION_FLD) { # region open Product search form if (dgrdData.Columns[e.Column.DataColumn.DataField].Text.Trim() != string.Empty) { if (txtProductionLine.Text.Trim() != string.Empty) { htbCriteria.Add(PRO_WorkOrderMasterTable.PRODUCTIONLINEID_FLD, int.Parse(txtProductionLine.Tag.ToString())); } else { String[] strParam = new string[2]; strParam[0] = lblProductionLine.Text; strParam[1] = e.Column.DataColumn.Caption; PCSMessageBox.Show(ErrorCode.MESSAGE_SELECT_ONE_BEFORE_SELECT_ONE, MessageBoxIcon.Warning, strParam); txtProductionLine.Focus(); return; } drwResult = FormControlComponents.OpenSearchForm(PRODUCT_IN_PRODUCTIONLINE_VIEWNAME, e.Column.DataColumn.DataField, dgrdData.Columns[e.Column.DataColumn.DataField].Text.Trim(), htbCriteria, false); if (drwResult != null) { e.Column.DataColumn.Tag = drwResult.Row; } else { e.Cancel = true; } } #endregion } }
/// <summary> /// OpenSearchForm for selecting Customer /// </summary> /// <param name="pstrMethodName"></param> /// <param name="pblnAlwaysShowDialog"></param> /// <returns></returns> /// <author>Trada</author> /// <date>Friday, Feb 17 2006</date> private bool SelectCustomer(string pstrMethodName, bool pblnAlwaysShowDialog) { try { Hashtable htbCriteria = new Hashtable(); DataRowView drwResult = null; const string VIEW_VENDOR = "V_VendorCustomer"; const string CUSTOMER_COLUMN = "Customer"; //Add condition for customer htbCriteria.Add(CUSTOMER_COLUMN, 0); //Call OpenSearchForm for selecting Customer drwResult = FormControlComponents.OpenSearchForm(VIEW_VENDOR, MST_PartyTable.CODE_FLD, txtCustomer.Text, htbCriteria, pblnAlwaysShowDialog); // If has Master location matched searching condition, fill values to form's controls if (drwResult != null) { txtCustomer.Text = drwResult[MST_PartyTable.CODE_FLD].ToString(); txtCustomer.Tag = int.Parse(drwResult[MST_PartyTable.PARTYID_FLD].ToString()); txtCustomerName.Text = drwResult[MST_PartyTable.NAME_FLD].ToString(); //Reset modify status txtCustomer.Modified = false; } else if (!pblnAlwaysShowDialog) { txtCustomer.Tag = null; txtCustomer.Focus(); return(false); } return(true); } catch (PCSException ex) { throw new PCSException(ex.mCode, pstrMethodName, ex); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
/// <summary> /// txtMasLoc_Leave /// </summary> /// <author>Trada</author> /// <date>Friday, June 10 2005</date> /// <param name="sender"></param> /// <param name="e"></param> private void txtMasLoc_Leave(object sender, System.EventArgs e) { const string METHOD_NAME = THIS + ".txtMasLoc_Leave()"; try { Hashtable htbCriteria = new Hashtable(); DataRowView drwResult = null; //User has selected CCN if (txtMasLoc.Text.Trim() == string.Empty) { return; } if (cboCCN.SelectedIndex != -1) { htbCriteria.Add(MST_MasterLocationTable.CCNID_FLD, cboCCN.SelectedValue); } else //User has not selected CCN { htbCriteria.Add(MST_MasterLocationTable.CCNID_FLD, 0); } drwResult = FormControlComponents.OpenSearchForm(MST_MasterLocationTable.TABLE_NAME, MST_MasterLocationTable.CODE_FLD, txtMasLoc.Text, htbCriteria, false); if (drwResult != null) { if (voMasLoc.MasterLocationID != int.Parse(drwResult[MST_MasterLocationTable.MASTERLOCATIONID_FLD].ToString())) { txtMasLoc.Text = drwResult[MST_MasterLocationTable.CODE_FLD].ToString(); voMasLoc.MasterLocationID = int.Parse(drwResult[MST_MasterLocationTable.MASTERLOCATIONID_FLD].ToString()); CreateDataSet(); gridWOClose.DataSource = dstGridData.Tables[0]; FormControlComponents.RestoreGridLayout(gridWOClose, dtbGridLayOut); } txtMasLoc.Text = drwResult[MST_MasterLocationTable.CODE_FLD].ToString(); voMasLoc.MasterLocationID = int.Parse(drwResult[MST_MasterLocationTable.MASTERLOCATIONID_FLD].ToString()); } else { txtMasLoc.Focus(); } } catch (PCSException ex) { // Displays the error message if throwed from PCSException. PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error); try { // Log error message into log file. Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR); } catch { // Show message if logger has an error. PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error); } } catch (Exception ex) { // displays the error message. PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error); // log message. try { Logger.LogMessage(ex, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error); } } }