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 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 }
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 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 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> /// 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; }
/// <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); } } }
/// <summary> /// Bind data to grid /// </summary> /// <author>Trada</author> /// <date>Monday, June 13 2005</date> protected virtual void BindDataToGrid() { int pintCCN = int.Parse(cboCCN.SelectedValue.ToString()); int pintMasLoc = voMasLoc.MasterLocationID; DateTime pdtmFromDueDate = DateTime.MinValue; DateTime pdtmToDueDate = DateTime.MinValue; if (dtmFromDueDate.Value != null && !dtmFromDueDate.ValueIsDbNull) { pdtmFromDueDate = (DateTime)dtmFromDueDate.Value; } if (dtmToDueDate.Value != null && !dtmToDueDate.ValueIsDbNull) { pdtmToDueDate = (DateTime)dtmToDueDate.Value; } //List release WOs ManufacturingCloseBO boManufacturingClose = new ManufacturingCloseBO(); dstReleaseWO = boManufacturingClose.SearchReleasedWO(pintCCN, pintMasLoc, pdtmFromDueDate, pdtmToDueDate); foreach (DataRow drow in dstReleaseWO.Tables[0].Rows) { drow[SELECT] = false; } gridWOClose.DataSource = dstReleaseWO.Tables[0]; FormControlComponents.RestoreGridLayout(gridWOClose, dtbGridLayOut); gridWOClose.Splits[0].DisplayColumns[SELECT].DataColumn.ValueItems.Presentation = C1.Win.C1TrueDBGrid.PresentationEnum.CheckBox; gridWOClose.Splits[0].DisplayColumns[SELECT].Style.HorizontalAlignment = AlignHorzEnum.Center; //Lock all columns in grid gridWOClose.Splits[0].DisplayColumns[PRO_WorkOrderMasterTable.WORKORDERNO_FLD].Locked = true; gridWOClose.Splits[0].DisplayColumns[PRO_WorkOrderDetailTable.LINE_FLD].Locked = true; gridWOClose.Splits[0].DisplayColumns[OPENQUANTITY].Locked = true; gridWOClose.Splits[0].DisplayColumns[ITM_CategoryTable.TABLE_NAME + ITM_CategoryTable.CODE_FLD].Locked = true; gridWOClose.Columns[OPENQUANTITY].NumberFormat = Constants.EDIT_NUM_MASK; gridWOClose.Splits[0].DisplayColumns[PARTNUMBER].Locked = true; gridWOClose.Splits[0].DisplayColumns[CAPTION_UM].Locked = true; gridWOClose.Splits[0].DisplayColumns[PRO_WorkOrderDetailTable.STARTDATE_FLD].Locked = true; gridWOClose.Columns[PRO_WorkOrderDetailTable.STARTDATE_FLD].NumberFormat = Constants.DATETIME_FORMAT_HOUR; gridWOClose.Splits[0].DisplayColumns[PRO_WorkOrderDetailTable.DUEDATE_FLD].Locked = true; gridWOClose.Columns[PRO_WorkOrderDetailTable.DUEDATE_FLD].NumberFormat = Constants.DATETIME_FORMAT_HOUR; gridWOClose.Splits[0].DisplayColumns[ITM_ProductTable.DESCRIPTION_FLD].Locked = true; gridWOClose.Splits[0].DisplayColumns[ITM_ProductTable.REVISION_FLD].Locked = true; //Invisible some columns gridWOClose.Splits[0].DisplayColumns[PRO_WorkOrderDetailTable.WORKORDERDETAILID_FLD].Visible = false; dstReleaseWO.AcceptChanges(); //Set new status for chkSelectAll if (gridWOClose.RowCount == 0) { chkSelectAllManuf.Checked = false; } else { for (int i = 0; i < gridWOClose.RowCount; i++) { if (gridWOClose[i, SELECT].ToString().Trim() != TRUE) { chkSelectAllManuf.Checked = false; return; } } chkSelectAllManuf.Checked = true; } }
private void IgnoreProductionLine_Load(object sender, EventArgs e) { const string METHOD_NAME = THIS + ".IgnoreProductionLine_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); //load all production line ProductionLineBO boProductionLine = new ProductionLineBO(); dstData = boProductionLine.List(); if (dtbIgnoreList.Rows.Count > 0) { foreach (DataRow drowData in dtbIgnoreList.Rows) { dstData.Tables[0].Select(PRO_ProductionLineTable.PRODUCTIONLINEID_FLD + "=" + drowData[PRO_ProductionLineTable.PRODUCTIONLINEID_FLD].ToString().Trim())[0][IGNORED_FLD] = true; } } dgrdData.DataSource = dstData.Tables[0]; FormControlComponents.RestoreGridLayout(dgrdData, dtbGridLayOut); foreach (C1DisplayColumn c1Col in dgrdData.Splits[0].DisplayColumns) { if (c1Col.DataColumn.DataField != IGNORED_FLD) { c1Col.Locked = 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); } } catch (Exception ex) { PCSMessageBox.Show(ErrorCode.OTHER_ERROR); try { Logger.LogMessage(ex, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION); } } }