private void InvalidCPO_Load(object sender, System.EventArgs e) { const string METHOD_NAME = THIS + ".InvalidCPO_Load()"; const string STARTDATE_COL = "StartDate"; const string DUEDATE_COL = "DueDate"; const string QUANTITY_COL = "Quantity"; const string ERRORCODE_COL = "ErrorCode"; const string ERRORREASON_COL = "ErrorReason"; try { Security objSecurity = new Security(); this.Name = THIS; if (objSecurity.SetRightForUserOnForm(this, SystemProperty.UserName) == 0) { this.Close(); return; } if (m_dtbInvalidWOLineAndCPO != null) { m_dtbInvalidWOLineAndCPO.Columns.Add(ERRORREASON_COL, typeof(string)); foreach (DataRow drow in m_dtbInvalidWOLineAndCPO.Rows) { drow[ERRORREASON_COL] = ErrorMessageBO.GetErrorMessage(Convert.ToInt32(drow[ERRORCODE_COL])); } DataTable dtbLayout = FormControlComponents.StoreGridLayout(tgridOverCapacityWC); tgridOverCapacityWC.DataSource = m_dtbInvalidWOLineAndCPO; FormControlComponents.RestoreGridLayout(tgridOverCapacityWC, dtbLayout); tgridOverCapacityWC.Columns[STARTDATE_COL].NumberFormat = Constants.DATETIME_FORMAT_HOUR; tgridOverCapacityWC.Columns[DUEDATE_COL].NumberFormat = Constants.DATETIME_FORMAT_HOUR; tgridOverCapacityWC.Columns[QUANTITY_COL].NumberFormat = Constants.DECIMAL_NUMBERFORMAT; } } 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 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); }
/// <summary> /// SOAvoidDupleSaleOrdersDelivery_Load /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <author>Trada</author> /// <date>Friday, Feb 17 2006</date> private void SOAvoidDupleSaleOrdersDelivery_Load(object sender, System.EventArgs e) { const string METHOD_NAME = THIS + ".SOAvoidDupleSaleOrdersDelivery_Load()"; try { //Set form security Security objSecurity = new Security(); if (objSecurity.SetRightForUserOnForm(this, SystemProperty.UserName) == 0) { // You don't have the right to view this item PCSMessageBox.Show(ErrorCode.MESSAGE_YOU_HAVE_NO_RIGHT_TO_VIEW, MessageBoxIcon.Warning); this.Close(); return; } //Init Combo box cboMonth.Items.Clear(); cboMonth.Items.Add(string.Empty); for (int i = 1; i < 13; i++) { cboMonth.Items.Add(i.ToString()); } cboMonth.SelectedIndex = -1; cboYear.Items.Clear(); cboYear.Items.Add(string.Empty); for (int i = 2000; i < 2051; i++) { cboYear.Items.Add(i.ToString()); } cboYear.SelectedIndex = -1; //get grid layout dtbGridLayOut = FormControlComponents.StoreGridLayout(dgrdData); } 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 MessageBoxFormForItems_Load(object sender, System.EventArgs e) { // Code Inserted Automatically #region Code Inserted Automatically this.Cursor = Cursors.WaitCursor; #endregion Code Inserted Automatically new Security().SetRightForUserOnForm(this, SystemProperty.UserName); DataTable dtbGridLayOut = FormControlComponents.StoreGridLayout(dgrdData); dgrdData.DataSource = BugReason; //Restore layout FormControlComponents.RestoreGridLayout(dgrdData, dtbGridLayOut); this.MaximizeBox = false; this.FormBorderStyle = FormBorderStyle.FixedSingle; // Code Inserted Automatically #region Code Inserted Automatically this.Cursor = Cursors.Default; #endregion Code Inserted Automatically }
/// <summary> /// ValidateDataToSearch /// </summary> /// <returns></returns> /// <author>Trada</author> /// <date>Friday, Feb 17 2006</date> private bool ValidateDataToSearch() { const string METHOD_NAME = THIS + ".ValidateDataToSearch()"; try { if (FormControlComponents.CheckMandatory(cboYear)) { PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Exclamation); cboYear.Focus(); return(false); } if (FormControlComponents.CheckMandatory(cboMonth)) { PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Exclamation); cboMonth.Focus(); return(false); } if (FormControlComponents.CheckMandatory(txtCustomer)) { PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Exclamation); txtCustomer.Focus(); return(false); } return(true); } catch (PCSException ex) { throw new PCSException(ex.mCode, METHOD_NAME, ex); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
/// <summary> /// Init variables /// </summary> /// <author>Trada</author> /// <date>Friday, June 10 2005</date> private void InitVariable() { // Load combo box UtilsBO boUtil = new UtilsBO(); DataSet dstCCN = boUtil.ListCCN(); cboCCN.DataSource = dstCCN.Tables[MST_CCNTable.TABLE_NAME]; cboCCN.DisplayMember = MST_CCNTable.CODE_FLD; cboCCN.ValueMember = MST_CCNTable.CCNID_FLD; FormControlComponents.PutDataIntoC1ComboBox(cboCCN, dstCCN.Tables[MST_CCNTable.TABLE_NAME], MST_CCNTable.CODE_FLD, MST_CCNTable.CCNID_FLD, MST_CCNTable.TABLE_NAME); if (SystemProperty.CCNID != 0) { cboCCN.SelectedValue = SystemProperty.CCNID; } // Load combo box displays approving date PRO_WorkOrderDetailVO voWorkOrderDetail = new PRO_WorkOrderDetailVO(); voWorkOrderDetail.MfgCloseDate = boUtil.GetDBDate(); if ((DateTime.MinValue < voWorkOrderDetail.MfgCloseDate) && (voWorkOrderDetail.MfgCloseDate < DateTime.MaxValue)) { dtmPostDate.Value = voWorkOrderDetail.MfgCloseDate; } else { dtmPostDate.Value = DBNull.Value; } }
private void dgrdData_KeyDown(object sender, KeyEventArgs e) { const string METHOD_NAME = THIS + ".dgrdData_KeyDown()"; try { switch (e.KeyCode) { case Keys.F4: if (btnSave.Enabled) { dgrdData_ButtonClick(sender, null); } break; case Keys.Delete: if ((e.KeyCode == Keys.Delete) && (dgrdData.SelectedRows.Count > 0)) { if (btnSave.Enabled) { dgrdData.AllowDelete = true; FormControlComponents.DeleteMultiRowsOnTrueDBGrid(dgrdData); for (int i = 0; i < dgrdData.RowCount; i++) { if (dgrdData[i, ITM_ProductTable.PRODUCTID_FLD].ToString() != string.Empty) { dgrdData[i, SEQUENCE_FLD] = i + 1; } } } } break; } } catch (PCSException ex) { PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error); try { Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION); } } catch (Exception ex) { PCSMessageBox.Show(ErrorCode.OTHER_ERROR); try { Logger.LogMessage(ex, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION); } } }
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> /// ManufacturingClose_Load /// </summary> /// <author>Trada</author> /// <date>Thursday, June 9 2005</date> /// <param name="sender"></param> /// <param name="e"></param> private void ManufacturingClose_Load(object sender, System.EventArgs e) { const string METHOD_NAME = THIS + ".ManufacturingClose_Load()"; try { //Set authorization for user Security objSecurity = new Security(); this.Name = THIS; if (objSecurity.SetRightForUserOnForm(this, SystemProperty.UserName) == 0) { this.Close(); // You don't have the right to view this item PCSMessageBox.Show(ErrorCode.MESSAGE_YOU_HAVE_NO_RIGHT_TO_VIEW); return; } //StoreGrid(); dtbGridLayOut = FormControlComponents.StoreGridLayout(gridWOClose); InitVariable(); //Fill Default Master Location FormControlComponents.SetDefaultMasterLocation(txtMasLoc); voMasLoc.MasterLocationID = SystemProperty.MasterLocationID; //Set focus to dtmPostDate dtmPostDate.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 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 SelectWorkOrders_Load(object sender, EventArgs e) { const string METHOD_NAME = THIS + ".MultiWOIssueMaterial_Load()"; try { //Set form security Security objSecurity = new Security(); this.Name = THIS; if (objSecurity.SetRightForUserOnForm(this, SystemProperty.UserName) == 0) { // You don't have the right to view this item PCSMessageBox.Show(ErrorCode.MESSAGE_YOU_HAVE_NO_RIGHT_TO_VIEW, MessageBoxIcon.Warning); this.Close(); return; } //check if the Location and the CCN has data if (mMasterLocationID <= 0 || mCCNID <= 0) { //MessageBox.Show("Please select the Master Location and CCN id"); PCSMessageBox.Show(ErrorCode.MSG_WOISSUE_MATERIAL_SELECT_MASLOC_AND_CCN, MessageBoxIcon.Warning); this.Close(); return; } //Format DateTime control dtmFromStartDate.CustomFormat = Constants.DATETIME_FORMAT_HOUR; dtmToStartDate.CustomFormat = Constants.DATETIME_FORMAT_HOUR; var workingPeriod = Utilities.Instance.GetWorkingPeriod(); dtmFromStartDate.Value = workingPeriod.FromDate; dtmToStartDate.Value = Utilities.Instance.GetServerDate(); //store the gridlayout dtStoreGridLayout = FormControlComponents.StoreGridLayout(dgrdData); //Display the data on form lblMasLocValue.Text = mMasterLocCode; lblCCNValue.Text = mCCNCode; } 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); } } }
/// <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 OutOfCapacityWC_Load(object sender, System.EventArgs e) { const string OVERDAYS_COL = "OverDays"; const string OVERPERCENT_COL = "OverPercent"; const string METHOD_NAME = THIS + ".OutOfCapacityWC_Load()"; try { Security objSecurity = new Security(); this.Name = THIS; if (objSecurity.SetRightForUserOnForm(this, SystemProperty.UserName) == 0) { this.Close(); return; } if (m_dtbOverCapacityWC != null) { DataTable dtbLayout = FormControlComponents.StoreGridLayout(tgridOverCapacityWC); tgridOverCapacityWC.DataSource = m_dtbOverCapacityWC; FormControlComponents.RestoreGridLayout(tgridOverCapacityWC, dtbLayout); tgridOverCapacityWC.Columns[OVERDAYS_COL].NumberFormat = Constants.DECIMAL_NUMBERFORMAT; tgridOverCapacityWC.Columns[OVERPERCENT_COL].NumberFormat = Constants.DECIMAL_NUMBERFORMAT; } } 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 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 ProductProductionOrder_Load(object sender, EventArgs e) { const string METHOD_NAME = THIS + ".ManualProductionPlanning_Load()"; try { Security objSecurity = new Security(); this.Name = THIS; if (objSecurity.SetRightForUserOnForm(this, SystemProperty.UserName) == 0) { this.Close(); PCSMessageBox.Show(ErrorCode.MESSAGE_YOU_HAVE_NO_RIGHT_TO_VIEW, MessageBoxIcon.Warning); return; } //get grid layout dtbGridLayOut = FormControlComponents.StoreGridLayout(dgrdData); FillDataToGrid(0); txtProductionLine.Focus(); btnSave.Enabled = false; } catch (PCSException ex) { PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error); try { Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION); } } catch (Exception ex) { PCSMessageBox.Show(ErrorCode.OTHER_ERROR); try { Logger.LogMessage(ex, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION); } } }
private void NotSetupSTDItems_Load(object sender, System.EventArgs e) { const string METHOD_NAME = THIS + ".NotSetupSTDItems_Load()"; try { Security objSecurity = new Security(); this.Name = THIS; if (objSecurity.SetRightForUserOnForm(this, SystemProperty.UserName) == 0) { this.Close(); return; } if (m_dtbNotSTDCost != null) { DataTable dtbLayout = FormControlComponents.StoreGridLayout(dgrdData); dgrdData.DataSource = m_dtbNotSTDCost; FormControlComponents.RestoreGridLayout(dgrdData, dtbLayout); } } 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 SelectItems_Load(object sender, EventArgs e) { const string METHOD_NAME = THIS + ".SelectItems_Load()"; try { BomBO boBOM = new BomBO(); DataSet dstAllItem = boBOM.ListComponents(); DataTable dtbComponents = boBOM.ListComponents(intProductID).Tables[0]; dstData.Tables.Add(BuildSchema()); DataRow drowItem = boBOM.GetItemInfo(intProductID); dstData.Tables[0].ImportRow(drowItem); foreach (DataRow drowData in dtbComponents.Rows) { BuildData(dstData.Tables[0], dstAllItem.Tables[0], drowData); } dtbGridLayout = FormControlComponents.StoreGridLayout(dgrdData); BindData(); FilterData(); } 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 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 } }
private void FillDataToGrid(int pintProductionLineID) { dstData = boOption.GetProductSequence(pintProductionLineID); dgrdData.DataSource = dstData.Tables[0]; FormControlComponents.RestoreGridLayout(dgrdData, dtbGridLayOut); dgrdData.Splits[0].DisplayColumns[ITM_ProductTable.CODE_FLD].Button = true; dgrdData.Splits[0].DisplayColumns[ITM_ProductTable.DESCRIPTION_FLD].Button = true; dgrdData.Splits[0].DisplayColumns[ITM_ProductTable.REVISION_FLD].Locked = true; dgrdData.Splits[0].DisplayColumns[SEQUENCE_FLD].Locked = true; dgrdData.Columns[SEQUENCE_FLD].NumberFormat = Constants.INTERGER_NUMBERFORMAT; if (pintProductionLineID > 0) { dgrdData.AllowAddNew = true; dstData.Tables[0].Columns[ITM_ProductTable.PRODUCTIONLINEID_FLD].DefaultValue = pintProductionLineID; } }
/// <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> /// Display the detail data after searching into the grid /// //set layout for the grid /// </summary> /// <param name="pdtbData"></param> private void LoadDataDetail(DataSet pdtbData) { //load this data into the grid dgrdData.DataSource = pdtbData.Tables[0]; //Restore the gridLayout FormControlComponents.RestoreGridLayout(dgrdData, dtStoreGridLayout); //HACK: added by Tuan TQ. Lock columns for (int i = 0; i < dgrdData.Splits[0].DisplayColumns.Count; i++) { dgrdData.Splits[0].DisplayColumns[i].Locked = true; } dgrdData.Splits[0].DisplayColumns[SELECTED_COL].Locked = false; //End hack //set the column to be check box //Align center for date dgrdData.Splits[0].DisplayColumns[PRO_WorkOrderDetailTable.STARTDATE_FLD].Style.HorizontalAlignment = AlignHorzEnum.Center; dgrdData.Splits[0].DisplayColumns[PRO_WorkOrderDetailTable.DUEDATE_FLD].Style.HorizontalAlignment = AlignHorzEnum.Center; //align right for Quantity dgrdData.Splits[0].DisplayColumns[PRO_WorkOrderDetailTable.ORDERQUANTITY_FLD].Style.HorizontalAlignment = AlignHorzEnum.Far; dgrdData.Splits[0].DisplayColumns[PRO_WorkOrderDetailTable.TABLE_NAME + PRO_WorkOrderDetailTable.LINE_FLD].Style.HorizontalAlignment = AlignHorzEnum.Far; //Align center for the Selected Column dgrdData.Splits[0].DisplayColumns[SELECTED_COL].Style.HorizontalAlignment = AlignHorzEnum.Center; //Set format for the Quantity dgrdData.Columns[PRO_WorkOrderDetailTable.ORDERQUANTITY_FLD].NumberFormat = Constants.DECIMAL_NUMBERFORMAT; dgrdData.Columns[PRO_WorkOrderDetailTable.STARTDATE_FLD].NumberFormat = Constants.DATETIME_FORMAT_HOUR; dgrdData.Columns[PRO_WorkOrderDetailTable.DUEDATE_FLD].NumberFormat = Constants.DATETIME_FORMAT_HOUR; //set the selected to be the check box dgrdData.Columns[SELECTED_COL].ValueItems.Presentation = PresentationEnum.CheckBox; }
private void OnLeaveControl(object sender, System.EventArgs e) { const string METHOD_NAME = THIS + ". OnLeaveControl()"; try { FormControlComponents.OnLeaveControl(sender, e); } catch (Exception ex) { // displays the error message. PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); // log message. try { Logger.LogMessage(ex, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
/// <summary> /// Process onleave control event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <author> Son HT, Jan 20, 2005</author> private void OnLeaveControl(object sender, System.EventArgs e) { const string METHOD_NAME = THIS + ".txtCode_Leave()"; //Only use when users use this to search for existing product try { FormControlComponents.OnLeaveControl(sender, e); } 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 tgridViewTable_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F9) { ExportDataToExcel(); return; } if (e.KeyCode == Keys.F2) { iCurrentPage = 1; strCondition = strOnlyHashTable; MST_SearchPartyBO objBO = new MST_SearchPartyBO(); TotalRecord = objBO.GetRowCount(strTable, strCondition); GetNumberOfPage(); InitCombobox(); dset = objBO.GetList(strTable, strKeyWord, SelectMultiRow, strCondition, iCurrentPage, PCSComUtils.Common.Constants.CountPage); BindData(); ValueFilter = string.Empty; return; } if (GetTotalPage > 1 && (e.KeyCode == Keys.PageDown || e.KeyCode == Keys.PageUp || e.KeyCode == Keys.Home || e.KeyCode == Keys.End)) { bool bContinue = false; if (e.KeyCode == Keys.PageDown && GetTotalPage > iCurrentPage) { iCurrentPage++; bContinue = true; } if (e.KeyCode == Keys.PageUp && iCurrentPage > 1) { iCurrentPage--; bContinue = true; } if (e.KeyCode == Keys.Home && iCurrentPage > 1) { iCurrentPage = 1; bContinue = true; } if (e.KeyCode == Keys.End && iCurrentPage < GetTotalPage) { iCurrentPage = GetTotalPage; bContinue = true; } if (bContinue) { cmbPage.SelectedIndex = iCurrentPage - 1; MST_SearchPartyBO objBO = new MST_SearchPartyBO(); dset = objBO.GetList(strTable, strKeyWord, SelectMultiRow, strCondition, iCurrentPage, PCSComUtils.Common.Constants.CountPage); BindData(); } } //MessageBox.Show(tgridViewTable.Row.ToString()); //e.KeyCode == Keys.F4 if (tgridViewTable.FilterBar == true && !string.IsNullOrEmpty(ValueFilter) && e.KeyCode == Keys.Enter) { const string METHOD_NAME = ".tgridViewTable_KeyDown()"; try { if (sender.Equals(mniContain)) { enmLike = LikeCondition.Contain; } else { enmLike = sender.Equals(mniEndWith) ? LikeCondition.EndWith : LikeCondition.StartWith; } string strColoumName = tgridViewTable.Columns[tgridViewTable.Col].Caption; if (tgridViewTable.Col == 0) { return; } string strColoumValue = string.Empty; strCondition = strOnlyHashTable; if (strCondition != null && strCondition.Length > 0) { strCondition += " AND "; } strCondition += strColoumName + " like N'%" + ValueFilter + "%' "; iCurrentPage = 1; strCondition = FormControlComponents.KillInjectionInLikeClause(strCondition); MST_SearchPartyBO objBO = new MST_SearchPartyBO(); TotalRecord = objBO.GetRowCount(strTable, strCondition); GetNumberOfPage(); InitCombobox(); dset = objBO.GetList(strTable, strKeyWord, SelectMultiRow, strCondition, iCurrentPage, PCSComUtils.Common.Constants.CountPage); BindData(); ValueFilter = string.Empty; } 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); } } return; } if (e.KeyCode == Keys.Enter) { GetDataRow(); } }
private string GenerateFilterConditionToSQL(string strFilterFieldValue, string strFilterFieldName, Hashtable htbOrtherFilterCondition) { StringBuilder strFilterCondition = new StringBuilder(); if (htbOrtherFilterCondition != null) { var myEnumerator = htbOrtherFilterCondition.GetEnumerator(); while (myEnumerator.MoveNext()) { if (myEnumerator.Value == DBNull.Value) { if (strFilterCondition.Length > 0) { strFilterCondition.Append(" AND "); } strFilterCondition.Append(strTable + "." + myEnumerator.Key.ToString().Trim()); strFilterCondition.Append("IS NULL"); } else if (myEnumerator.Value.ToString().ToUpper().Contains("IS NOT NULL")) { if (strFilterCondition.Length > 0) { strFilterCondition.Append(" AND "); } strFilterCondition.Append(strTable + "." + myEnumerator.Key.ToString().Trim()); strFilterCondition.Append("IS NOT NULL"); } else { if (strFilterCondition.Length > 0) { strFilterCondition.Append(" AND "); } strFilterCondition.Append(strTable + "." + myEnumerator.Key.ToString().Trim()); strFilterCondition.Append("=N'"); strFilterCondition.Append(myEnumerator.Value); strFilterCondition.Append("'"); } } strOnlyHashTable = strFilterCondition.ToString(); } strFilterFieldValue = FormControlComponents.KillInjection(strFilterFieldValue); if (!string.IsNullOrEmpty(strFilterFieldName) && strFilterFieldValue != string.Empty) { if (strFilterCondition.Length > 0) { strFilterCondition.Append(" AND "); } strFilterCondition.Append(strTable + "." + strFilterFieldName); strFilterCondition.Append(" LIKE N'%"); strFilterCondition.Append(strFilterFieldValue.Replace("'", "''")); strFilterCondition.Append("%'"); } #region /// HACKED: Thachnn: fix bug injection StringBuilder sql = new StringBuilder(); sql.Append(FormControlComponents.KillInjectionInLikeClause(strFilterCondition.ToString())); #endregion /// ENDHACKED: Thachnn: fix bug injection //var strConditionByRecord = Utilities.Instance.GetConditionByRecord(SystemProperty.UserName, strTableNameOrView); //sql.Append(strConditionByRecord); return(sql.ToString()); }
/// <summary> /// Event for Ok click /// If user's information is correct then login system else then messages /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <Author> Tuan DM, Jan 10, 2005</Author> private void btnOk_Click(object sender, System.EventArgs e) { // Code Inserted Automatically #region Code Inserted Automatically this.Cursor = Cursors.WaitCursor; #endregion Code Inserted Automatically const string METHOD_NAME = THIS + "btnOk_Click()"; const string HOME_CURRENCY = "HomeCurrency"; const string EMPLOYEE_NAME = "EmployeeName"; const string MASTERLOCATIONCODE = "MasterLocationCode"; const string MASTERLOCATIONNAME = "MasterLocationName"; const string PCSMAIN = "PCSMain.Exe"; pObjobjecVO = new Sys_UserVO(); if (ValidateData()) { pObjobjecVO.UserName = txtUser.Text.Trim(); pObjobjecVO.Pwd = txtPwd.Text.Trim(); try { DataSet dstData = (new UtilsBO()).GetDefaultInfomation(); ErrorMessage.dsErrorMessage = dstData.Tables[Sys_Error_MsgTable.TABLE_NAME]; Sys_UserVO sysUserVO = new Sys_UserVO(); sysUserVO = CheckAuthenticate(pObjobjecVO); CommonBO boCommon = new CommonBO(); // HACK: Trada 14-12-2005 DataSet dstRoleAndParam = boCommon.ListRoleAndSysParam(sysUserVO.UserID, pObjobjecVO.UserName); //check if no-right assigned if (dstRoleAndParam.Tables[0].Rows.Count == 0) { PCSMessageBox.Show(ErrorCode.MESSAGE_NORIGHT_LOGIN, MessageBoxButtons.OK); txtUser.SelectionStart = 0; txtUser.SelectionLength = txtUser.Text.Length; txtUser.Focus(); // Code Inserted Automatically #region Code Inserted Automatically this.Cursor = Cursors.Default; #endregion Code Inserted Automatically return; } pObjobjecVO = new Sys_UserVO(); pObjobjecVO = sysUserVO; SystemProperty.ExecutablePath = Application.StartupPath; SystemProperty.UserID = pObjobjecVO.UserID; SystemProperty.UserName = pObjobjecVO.UserName; // Get the first Role SystemProperty.RoleID = int.Parse(dstRoleAndParam.Tables[0].Rows[0][Sys_RoleTable.ROLEID_FLD].ToString()); //Set SystemProperties DataRow drowMST_CCN = dstRoleAndParam.Tables[1].Rows[0]; SystemProperty.CCNID = int.Parse(drowMST_CCN[MST_CCNTable.CCNID_FLD].ToString()); SystemProperty.CCNCode = drowMST_CCN[MST_CCNTable.CODE_FLD].ToString(); SystemProperty.CCNDescription = drowMST_CCN[MST_CCNTable.DESCRIPTION_FLD].ToString(); if (drowMST_CCN[MST_CCNTable.CITYID_FLD].ToString() != string.Empty) { SystemProperty.CityID = int.Parse(drowMST_CCN[MST_CCNTable.CITYID_FLD].ToString()); } else { SystemProperty.CityID = 0; } SystemProperty.Code = drowMST_CCN[MST_CCNTable.CODE_FLD].ToString(); if (drowMST_CCN[MST_CCNTable.CITYID_FLD].ToString() != string.Empty) { SystemProperty.CountryID = int.Parse(drowMST_CCN[MST_CCNTable.COUNTRYID_FLD].ToString()); } else { SystemProperty.CountryID = 0; } if (drowMST_CCN[MST_CCNTable.DEFAULTCURRENCYID_FLD].ToString() != string.Empty) { SystemProperty.DefaultCurrencyID = int.Parse(drowMST_CCN[MST_CCNTable.DEFAULTCURRENCYID_FLD].ToString()); } SystemProperty.Description = drowMST_CCN[MST_CCNTable.DESCRIPTION_FLD].ToString(); SystemProperty.Email = drowMST_CCN[MST_CCNTable.EMAIL_FLD].ToString(); if (drowMST_CCN[MST_CCNTable.EXCHANGERATE_FLD].ToString() != string.Empty) { SystemProperty.ExchangeRate = float.Parse(drowMST_CCN[MST_CCNTable.EXCHANGERATE_FLD].ToString()); } else { SystemProperty.ExchangeRate = 0; } SystemProperty.ExchangeRateOperator = drowMST_CCN[MST_CCNTable.EXCHANGERATEOPERATOR_FLD].ToString(); SystemProperty.Fax = drowMST_CCN[MST_CCNTable.FAX_FLD].ToString(); if (drowMST_CCN[MST_CCNTable.HOMECURRENCYID_FLD].ToString() != string.Empty) { SystemProperty.HomeCurrencyID = int.Parse(drowMST_CCN[MST_CCNTable.HOMECURRENCYID_FLD].ToString()); } else { SystemProperty.HomeCurrencyID = 0; } SystemProperty.HomeCurrency = drowMST_CCN[HOME_CURRENCY].ToString(); SystemProperty.Name = drowMST_CCN[MST_CCNTable.NAME_FLD].ToString(); SystemProperty.Phone = drowMST_CCN[MST_CCNTable.PHONE_FLD].ToString(); SystemProperty.State = drowMST_CCN[MST_CCNTable.STATE_FLD].ToString(); SystemProperty.VAT = drowMST_CCN[MST_CCNTable.VAT_FLD].ToString(); SystemProperty.WebSite = drowMST_CCN[MST_CCNTable.WEBSITE_FLD].ToString(); SystemProperty.ZipCode = drowMST_CCN[MST_CCNTable.ZIPCODE_FLD].ToString(); if (drowMST_CCN[MST_EmployeeTable.EMPLOYEEID_FLD].ToString() != string.Empty) { SystemProperty.EmployeeID = int.Parse(drowMST_CCN[MST_EmployeeTable.EMPLOYEEID_FLD].ToString()); } else { SystemProperty.EmployeeID = 0; } SystemProperty.EmployeeName = drowMST_CCN[EMPLOYEE_NAME].ToString(); SystemProperty.MasterLocationID = int.Parse(drowMST_CCN[MST_MasterLocationTable.MASTERLOCATIONID_FLD].ToString()); SystemProperty.MasterLocationCode = drowMST_CCN[MASTERLOCATIONCODE].ToString(); SystemProperty.MasterLocationName = drowMST_CCN[MASTERLOCATIONNAME].ToString(); // HACK: dungla 10-21-2005 // get all system parameters NameValueCollection objParam = new NameValueCollection(); // put to Collection foreach (DataRow drowData in dstRoleAndParam.Tables[2].Rows) { objParam.Add(drowData[Sys_ParamTable.NAME_FLD].ToString().Trim(), drowData[Sys_ParamTable.VALUE_FLD].ToString().Trim()); } SystemProperty.SytemParams = objParam; // set the report logo file name SystemProperty.LogoFile = Application.StartupPath + @"\logo.jpg"; // END: dungla 10-21-2005 this.DialogResult = DialogResult.OK; // HACKED: 23/05/2006 Thachnn : Delete Temporary PCS Report File string mstrReportDefFolder = Application.StartupPath + "\\" + Constants.REPORT_DEFINITION_STORE_LOCATION; FormControlComponents.DeletePCSTempReportFile(mstrReportDefFolder); // ENDHACKED: 23/05/2006 Thachnn : Delete Temporary PCS Report File this.Close(); } catch (PCSException ex) { PCSMessageBox.Show(ex.mCode); try { Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION); } txtUser.SelectionStart = 0; txtUser.SelectionLength = txtUser.Text.Length; txtUser.Focus(); } catch (Exception ex) { PCSMessageBox.Show(ErrorCode.OTHER_ERROR); try { Logger.LogMessage(ex, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION); } } } // Code Inserted Automatically #region Code Inserted Automatically this.Cursor = Cursors.Default; #endregion Code Inserted Automatically }
/// <summary> /// btnSearch_Click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <author>Trada</author> /// <date>Friday, Feb 17 2006</date> private void btnSearch_Click(object sender, System.EventArgs e) { // Code Inserted Automatically #region Code Inserted Automatically this.Cursor = Cursors.WaitCursor; #endregion Code Inserted Automatically const string METHOD_NAME = THIS + ".btnSearch_Click()"; try { if (ValidateDataToSearch()) { DateTime dtmDateToSearch = new DateTime(int.Parse(cboYear.SelectedItem.ToString()), int.Parse(cboMonth.SelectedItem.ToString()), 1); AvoidDupleSODeliveryBO boAvoidDupleSODelivery = new AvoidDupleSODeliveryBO(); dtbData = boAvoidDupleSODelivery.SearchDupleSO(dtmDateToSearch, int.Parse(txtCustomer.Tag.ToString())); dtbData.Columns.Add(SELECT, typeof(bool)); dgrdData.DataSource = dtbData; for (int i = 0; i < dgrdData.RowCount; i++) { dgrdData[i, SELECT] = false; dgrdData[i, PRO_WorkOrderDetailTable.LINE_FLD] = i + 1; } //Restore layout FormControlComponents.RestoreGridLayout(dgrdData, dtbGridLayOut); ConfigGrid(true); } } 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); } } // Code Inserted Automatically #region Code Inserted Automatically this.Cursor = Cursors.Default; #endregion Code Inserted Automatically }
private void BindData() { dgrdData.DataSource = dstData.Tables[0]; FormControlComponents.RestoreGridLayout(dgrdData, dtbGridLayout); }
/// <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); } } }