/// <summary> /// Close WOs has been selected /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <author>Trada</author> /// <date>Friday, June 10 2005</date> protected virtual void btnCloseWO_Click(object sender, System.EventArgs e) { const string METHOD_NAME = THIS + ".btnCloseWO_Click()"; try { if (dtmPostDate.Value == null) { PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Error); dtmPostDate.Focus(); dtmPostDate.Select(); return; } //Check date in period if (!FormControlComponents.CheckDateInCurrentPeriod(DateTime.Parse(dtmPostDate.Value.ToString()))) { PCSMessageBox.Show(ErrorCode.MESSAGE_RGV_POSTDATE_PERIOD); dtmPostDate.Focus(); dtmPostDate.Select(); return; } if (dtmPostDate.Text == string.Empty) { PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Error); dtmPostDate.Focus(); return; } if (gridWOClose.RowCount == 0) { throw new PCSException(ErrorCode.MESSAGE_PO_APPROVE_NO_DATA_IN_GRID, METHOD_NAME, null); } if (CheckDataGridToRelease()) { StoreSelectedLines(); ManufacturingCloseBO boManuf = new ManufacturingCloseBO(); boManuf.CloseWorkOrderLines(DateTime.Parse(dtmPostDate.Value.ToString()), arrSelectedLines); if (PCSMessageBox.Show(ErrorCode.MESSAGE_AFTER_SAVE_DATA) == DialogResult.OK) { BindDataToGrid(); } } else { PCSMessageBox.Show(ErrorCode.MESSAGE_RELEASE_WO_SELECT_WOLINE, MessageBoxIcon.Error); } } 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> /// btnSearch_Click /// </summary> /// <author>Trada</author> /// <date>Thursday, June 9 2005</date> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void btnSearch_Click(object sender, System.EventArgs e) { try { if (dtmPostDate.Value.ToString() == string.Empty) { PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Warning); dtmPostDate.Focus(); dtmPostDate.Select(); return; } //Check date in period if (!FormControlComponents.CheckDateInCurrentPeriod(DateTime.Parse(dtmPostDate.Value.ToString()))) { PCSMessageBox.Show(ErrorCode.MESSAGE_RGV_POSTDATE_PERIOD, MessageBoxIcon.Warning); dtmPostDate.Focus(); dtmPostDate.Select(); return; } DateTime pdtmFromDueDate = new DateTime(); DateTime pdtmToDueDate = new DateTime(); if (dtmFromDueDate.Value.ToString() != string.Empty) { pdtmFromDueDate = DateTime.Parse(dtmFromDueDate.Value.ToString()); } if (dtmToDueDate.Value.ToString() != string.Empty) { pdtmToDueDate = DateTime.Parse(dtmToDueDate.Value.ToString()); } if ((dtmFromDueDate.Value.ToString() != string.Empty) && (dtmToDueDate.Value.ToString() != string.Empty)) { if (pdtmFromDueDate > pdtmToDueDate) { PCSMessageBox.Show(ErrorCode.MESSAGE_MANUFACTURING_CLOSE_FROMDATE_SMALLER_TODATE, MessageBoxIcon.Warning); dtmFromDueDate.Focus(); return; } } if (txtMasLoc.Text == string.Empty) { PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Warning); txtMasLoc.Focus(); return; } //Bind data to grid BindDataToGrid(); } catch (PCSException ex) { // Displays the error message if throwed from PCSException. PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error); _logger.Error(ex.CauseException.Message, ex.CauseException); } catch (Exception ex) { // displays the error message. PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error); _logger.Error(ex.Message, ex); } }