private void btnSave_Click(object sender, EventArgs e) { try { NZString menuSubCD = new NZString(txtSubMenuCode, txtSubMenuCode.Text.Trim()); NZString menuSubName = new NZString(txtSubMenuName, txtSubMenuName.Text.Trim()); MenuSubValidator validator = new MenuSubValidator(); validator.ValidateBeforeSaveAdd(menuSubCD, menuSubName); MessageDialogResult dr = MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9001.ToString())); if (dr == MessageDialogResult.No) { DialogResult = DialogResult.Cancel; return; } if (dr == MessageDialogResult.Cancel) { return; } m_subMenuController.SaveNewMenuSub(menuSubCD, menuSubName); DialogResult = DialogResult.OK; } catch (ValidateException err) { MessageDialog.ShowBusiness(this, err.ErrorResults[0].Message); err.ErrorResults[0].FocusOnControl(); } catch (BusinessException err) { MessageDialog.ShowBusiness(this, err.Error.Message); err.Error.FocusOnControl(); } catch (Exception err) { MessageDialog.ShowBusiness(this, err.Message); } }
private void tsbSave_Click(object sender, EventArgs e) { MessageDialogResult dr = MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9001.ToString())); if (dr == MessageDialogResult.Cancel) { return; } if (dr == MessageDialogResult.Yes) { if (AddCheck == 1) { UpdateData(); AddCheck = 0; } else { AddData(); tsbAdd.Enabled = true; tsbEdit.Enabled = true; tsbDelete.Enabled = true; fpView.Enabled = true; loadData(); } } }
private void LoadData(NZDateTime from, NZDateTime to) { if (dtPeriodBegin.NZValue.IsNull || dtPeriodEnd.NZValue.IsNull) { if (dtPeriodBegin.NZValue.IsNull && dtPeriodEnd.NZValue.IsNull) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0105.ToString(), new object[] { "Return date begin and Delivery date end" })); } else if (dtPeriodBegin.NZValue.IsNull) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0105.ToString(), new object[] { "Return date begin" })); } else { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0105.ToString(), new object[] { "Return date end" })); } return; } DataTable dt = m_controller.Load_ReturnProductionList(from, to, false); //DataTable dt = DTOUtility.ConvertListToDataTable(list); m_dtAllData = dt; shtReturnProductList.RowCount = 0; shtReturnProductList.DataSource = null; FindDataFromMemory(); //shtReturnProductList.DataSource = m_dtAllData; CtrlUtil.SpreadUpdateColumnSorting(shtReturnProductList); }
private void miDeleteGroup_Click(object sender, EventArgs e) { if (shtCustomerOrderList.RowCount > 0) { int rowIndex = shtCustomerOrderList.ActiveRowIndex; InventoryBIZ biz = new InventoryBIZ(); InventoryTransactionDTO dto = new InventoryTransactionDTO(); dto.REF_NO = shtCustomerOrderList.GetValue(rowIndex, (int)eColView.ORDER_NO).ToString().ToNZString(); dto.TRANS_CLS = DataDefine.eTRANS_TYPE_string.Shipment.ToNZString(); //CustomerOrderDDTO LoadCustomerOrderDetail(String Order_No, NZString Order_Detail_No) List <InventoryTransactionDTO> listDTO = biz.LoadInventoryTrans(dto); decimal ShipQTY = 0; foreach (InventoryTransactionDTO dtos in listDTO) { if (!dtos.QTY.IsNull && dtos.QTY.StrongValue > 0) { ShipQTY += dtos.QTY.StrongValue; } } if (ShipQTY > 0) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0205.ToString())); return; } } OnDeleteGroup(); }
private void LoadData() { //ShipmentListController ctl = new ShipmentListController(); //m_AllShipTransData = ctl.LoadAllShipTransByPeriod(dtPeriodBegin.NZValue, dtPeriodEnd.NZValue); if (dtPeriodBegin.NZValue.IsNull || dtPeriodEnd.NZValue.IsNull) { if (dtPeriodBegin.NZValue.IsNull && dtPeriodEnd.NZValue.IsNull) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0105.ToString(), new object[] { "Delivery date begin and Delivery date end" })); } else if (dtPeriodBegin.NZValue.IsNull) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0105.ToString(), new object[] { "Delivery date begin" })); } else { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0105.ToString(), new object[] { "Delivery date end" })); } return; } DeliveryController ctl = new DeliveryController(); m_AllShipTransData = ctl.Load_DeliveryList(dtPeriodBegin.NZValue, dtPeriodEnd.NZValue); //shtView.DataSource = m_AllShipTransData; FindDataFromMemory(); //CtrlUtil.SpreadUpdateColumnSorting(shtView); }
private void btnClearAll_Click(object sender, EventArgs e) { try { MessageDialogResult dialog = MessageDialog.ShowConfirmation(this, Message.LoadMessage(TKPMessages.eConfirm.CFM0006.ToString())); if (dialog == MessageDialogResult.Cancel || dialog == MessageDialogResult.No) { return; } m_controller.ClearImportStockTaking(); MessageDialog.ShowInformation(this, null, Message.LoadMessage(Messages.eInformation.INF9001.ToString()).MessageDescription); InitialScreen(); } catch (ValidateException err) { for (int i = 0; i < err.ErrorResults.Count; i++) { MessageDialog.ShowBusiness(this, err.ErrorResults[i].Message); err.ErrorResults[i].FocusOnControl(); } } catch (BusinessException err) { MessageDialog.ShowBusiness(this, err.Error.Message); err.Error.FocusOnControl(); } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }
private void mnuRemoveScreen_Click(object sender, EventArgs e) { if (MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9002.ToString()), MessageDialogButtons.YesNo) == MessageDialogResult.No) { return; } List <NZString> listSCREEN_CD = new List <NZString>(); for (int i = 0; i < shtScreen.RowCount; i++) { object objSEL = shtScreen.GetValue(i, (int)eColScreen.SEL); if (objSEL == null || Convert.ToBoolean(objSEL) == false) { continue; } listSCREEN_CD.Add(new NZString(null, shtScreen.GetValue(i, (int)eColScreen.SCREEN_CD).ToString())); } MenuRegisterUIDM.MenuSub menuSub = trvMenu.SelectedNode.Tag as MenuRegisterUIDM.MenuSub; if (menuSub == null) { return; } try { m_menuRegisterController.RemoveScreen(menuSub.MENU_SUB_CD, listSCREEN_CD.ToArray()); LoadScreens(menuSub.MENU_SUB_CD); } catch (Exception err) { MessageDialog.ShowBusiness(this, err.Message); } UpdateButtonMoveEnable(); }
private void btnPrintTag_Click(object sender, EventArgs e) { try { ErrorItem err = CheckCanRunProcess(); if (err != null) { MessageDialog.ShowBusiness(this, err.Message); this.Close(); return; } try { if (txtPreProcessBy.Text.Trim().Length == 0) { MessageDialog.ShowBusiness(this , new EVOFramework.Message(TKPMessages.eValidate.VLM0086.ToString())); return; } ReportBIZ biz = new ReportBIZ(); DataSet ds = biz.LoadStockTakingTagSummary(); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { string strReportFileName = @"Report\STR040_StockTakingTagSummary.rpt"; RPT999_PreviewReport preview = new RPT999_PreviewReport( Path.Combine(Application.StartupPath, strReportFileName) ); preview.SetDataSource(ds); preview.ReportDoc.SetParameterValue("USER", Common.CurrentUserInfomation.Username.ToString().ToUpper()); preview.ShowPreview(); } else { MessageDialog.ShowInformation(this, null, Message.LoadMessage(TKPMessages.eInformation.INF0001.ToString()).MessageDescription); } } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }
void m_keyboardSpread_RowRemoving(object sender, EventRowRemoving e) { MessageDialogResult dr = MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9002.ToString()), MessageDialogButtons.YesNo); if (dr == MessageDialogResult.No) { e.Cancel = true; } }
public override void OnSaveAndClose() { fpView.StopCellEditing(); if (m_bRowHasModified) { // ถ้า Row กำลังแก้ไขอยู่ if (!ValidateRowSpread(shtView.ActiveRowIndex, false)) { return; } } // ต้องเรียกก่อน Save เสมอ เพื่อ Commit ข้อมูลการแก้ไขล่าสุดบน Grid // ใช้ได้เฉพาะกับ Sheet ที่ผูก DataSource CtrlUtil.SpreadSheetRowEndEdit(shtView, shtView.ActiveRowIndex); RemoveRowUnused(shtView); ////if (txtItemCode.SelectedItemData != null) //// numWorkResultQty_KeyPress(numWorkResultQty, new KeyPressEventArgs((char)Keys.Return)); if (txtNumberOfBox.Int <= 0) { txtNumberOfBox.Int = 1; } try { ValidateBeforeSave(); MessageDialogResult dr = MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9001.ToString())); if (dr == MessageDialogResult.Cancel) { return; } if (dr == MessageDialogResult.Yes) { SaveData(); } m_dialogResult = DialogResult.OK; this.Close(); } catch (ValidateException err) { for (int i = 0; i < err.ErrorResults.Count; i++) { MessageDialog.ShowBusiness(this, err.ErrorResults[i].Message); err.ErrorResults[i].FocusOnControl(); } } catch (BusinessException err) { MessageDialog.ShowBusiness(this, err.Error.Message); err.Error.FocusOnControl(); } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }
public override void OnSaveAndNew() { fpView.StopCellEditing(); if (m_bRowHasModified) { // ถ้า Row กำลังแก้ไขอยู่ if (!ValidateRowSpread(shtView.ActiveRowIndex, false)) { return; } } // ต้องเรียกก่อน Save เสมอ เพื่อ Commit ข้อมูลการแก้ไขล่าสุดบน Grid // ใช้ได้เฉพาะกับ Sheet ที่ผูก DataSource CtrlUtil.SpreadSheetRowEndEdit(shtView, shtView.ActiveRowIndex); RemoveRowUnused(shtView); if (txtNumberOfBox.Int <= 0) { txtNumberOfBox.Int = 1; } try { ValidateBeforeSave(); MessageDialogResult dr = MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9001.ToString())); if (dr == MessageDialogResult.Cancel) { return; } if (dr == MessageDialogResult.Yes) { SaveData(); SetScreenMode(eScreenMode.ADD); CtrlUtil.FocusControl(txtMasterNo); m_dialogResult = DialogResult.OK; } } catch (ValidateException err) { for (int i = 0; i < err.ErrorResults.Count; i++) { MessageDialog.ShowBusiness(this, err.ErrorResults[i].Message); err.ErrorResults[i].FocusOnControl(); } } catch (BusinessException err) { MessageDialog.ShowBusiness(this, err.Error.Message); err.Error.FocusOnControl(); } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }
/// <summary> /// Validate spread row. /// </summary> /// <param name="row"></param> /// <param name="forceValidate">force to validate.</param> /// <returns></returns> private bool ValidateRowSpread(int row, bool forceValidate) { string LotNo = shtView.Cells[row, (int)eColView.LOT_NO].Text; if (String.IsNullOrEmpty(LotNo)) { ErrorItem error = new ErrorItem(null, TKPMessages.eValidate.VLM0011.ToString()); MessageDialog.ShowBusiness(this, error.Message); return(false); } string Qty = shtView.Cells[row, (int)eColView.QTY].Text; if (String.IsNullOrEmpty(Qty)) { ErrorItem error = new ErrorItem(null, TKPMessages.eValidate.VLM0175.ToString()); MessageDialog.ShowBusiness(this, error.Message); return(false); } //check format lotno if (!(string.Empty.Equals(shtView.Cells[row, (int)eColView.LOT_NO].Text))) { try { FormatUtil.CheckFormatLotNo(new NZString(null, shtView.Cells[row, (int)eColView.LOT_NO].Text)); } catch (ValidateException ex) { MessageDialog.ShowBusiness(this, ex.ErrorResults[0].Message); return(false); } } //Check dupllicate lot for (int iRow = 0; iRow < shtView.Rows.Count; iRow++) { if (iRow == row) { continue; } // Check key duplidate. string lot_no = shtView.Cells[iRow, (int)eColView.LOT_NO].Text; if (Equals(LotNo, lot_no)) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0189.ToString())); return(false); } } // ถ้า Validate Row ผ่าน แสดงว่า แถวนั้นไม่จำเป็นต้องเช็คอีกรอบ m_bRowHasModified = false; return(true); }
private void tsbDelete_Click(object sender, EventArgs e) { MessageDialogResult dr = MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9002.ToString())); if (dr == MessageDialogResult.Cancel) { return; } if (dr == MessageDialogResult.Yes) { DeleteData(); } }
/// <summary> /// Add button into favorite. /// </summary> /// <param name="data"></param> /// <returns></returns> private bool AddButtonFavorite(ScreenFavoriteData data) { // Check duplicate control on container. for (int i = 0; i < flowFavorite.Controls.Count; i++) { ScreenFavoriteData tagData = (ScreenFavoriteData)flowFavorite.Controls[i].Tag; if (tagData.SCREEN_CD == data.SCREEN_CD) { MessageDialog.ShowBusiness(this, Message.LoadMessage(Messages.eValidate.VLM9017.ToString())); return(false); } } // Save favorite into Container. try { FavoriteButton button = new FavoriteButton(); button.Tag = data; button.Size = m_defaultButtonSize; button.BackColor = flowFavorite.BackColor; button.BorderColor = ColorHelper.ShiftBrighness(button.BackColor, -100); DatabaseScreen dbScreen = m_databaseScreenCache.Get(data.SCREEN_CD); if (dbScreen != null) { button.Text = dbScreen.ScreenDescription.NVL(string.Empty); ImageItem imageItem = m_imageCache[dbScreen.ImageCD.StrongValue]; if (imageItem == null) { button.Image = Properties.Resources.img_not_found; } else { button.Image = imageItem.ImageBin; } } button.MouseDown += new MouseEventHandler(btnFavorite_MouseDown); button.MouseMove += new MouseEventHandler(btnFavorite_MouseMove); button.MouseUp += new MouseEventHandler(btnFavorite_MouseUp); button.Click += new EventHandler(btnFavorite_Click); flowFavorite.Controls.Add(button); return(true); } catch (Exception err) { MessageDialog.ShowBusiness(this, "Can't add favorite. " + err.Message); return(false); } }
public override void OnSaveAndClose() { base.OnSaveAndClose(); try { UpdateOnhandQtyText(); ValidateBeforeSave(); MessageDialogResult dr = MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9001.ToString())); if (dr == MessageDialogResult.Cancel || dr == MessageDialogResult.No) { return; } if (dr == MessageDialogResult.Yes) { AdjustmentEntryUIDM model = dmcAdjust.SaveData(new AdjustmentEntryUIDM()); if (m_screenMode == eScreenMode.ADD) { m_controller.SaveAdd(model); } else { m_controller.SaveEdit(m_editTransactionID, model); } } MessageDialog.ShowInformation(this, null, new Message(Messages.eInformation.INF9003.ToString()).MessageDescription); m_isSelected = true; this.Close(); } catch (ValidateException err) { MessageDialog.ShowBusiness(this, err.ErrorResults[0].Message); } catch (BusinessException err) { MessageDialog.ShowBusiness(this, err.Error.Message); } catch (Exception err) { MessageDialog.ShowBusiness(this, null, err.Message); } }
private void tsbCancel_Click(object sender, EventArgs e) { MessageDialogResult dr = MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9003.ToString())); if (dr == MessageDialogResult.Cancel) { return; } if (dr == MessageDialogResult.Yes) { fpView.Enabled = true; loadData(); tsbEdit.Enabled = true; } }
private void DeleteItem(NZString transactionID) { if (MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9002.ToString()), MessageDialogButtons.YesNo) == MessageDialogResult.No) { return; } InventoryBIZ biz = new InventoryBIZ(); biz.DeleteInventoryTransaction(Common.CurrentDatabase, transactionID); //LoadData(dtPeriodBegin.NZValue, dtPeriodEnd.NZValue); shtView.RemoveRows(shtView.ActiveRowIndex, 1); CtrlUtil.SpreadUpdateColumnSorting(shtView); }
private void btnRun_Click(object sender, EventArgs e) { try { ErrorItem err = CheckCanRunProcess(); if (err != null) { MessageDialog.ShowBusiness(this, err.Message); return; } StockTakingDTO dtoStockTaking = new StockTakingDTO(); dtoStockTaking.STOCK_TAKING_DATE = Convert.ToDateTime(dtpLastSTKDate.DateValue); dtoStockTaking.YEAR_MONTH = txtYearMonth.Text; dtoStockTaking.LOCATION_CODE = Convert.ToString(cboProcess.SelectedValue); StockTakingBIZ bizStockTaking = new StockTakingBIZ(); string strTextEffectInventory = bizStockTaking.GetTextEffectInventory(dtoStockTaking); MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new Message(SystemMaintenance.Messages.eConfirm.CFM9009.ToString(), new object[] { strTextEffectInventory }).MessageDescription, MessageDialogButtons.YesNo); if (dr == MessageDialogResult.Yes) { if (RunProcess()) { MessageDialog.ShowBusiness(this, Message.LoadMessage(SystemMaintenance.Messages.eInformation.INF9003.ToString())); } this.cboProcess.SelectedIndex = -1; LoadCurrentStockTakingData(); } } catch (ValidateException ex) { MessageDialog.ShowBusiness(this, ex.ErrorResults[0].Message); } catch (BusinessException ex) { MessageDialog.ShowBusiness(this, ex.Error.Message); } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }
private void btnGetTemplate_Click(object sender, EventArgs e) { try { string strFilePath = SaveDialogUtil.GetBrowseFileDialogForExport(); if (string.Empty.Equals(strFilePath)) { return; } string strReportPath = @"Report\STK060_ImportStockTakingTemplate.xls"; File.Copy(Path.Combine(Application.StartupPath, strReportPath), strFilePath); MessageDialog.ShowInformation(this, null, Message.LoadMessage(Messages.eInformation.INF0006.ToString()).MessageDescription); } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message, ex.StackTrace); } }
private void tsbCancel_Click(object sender, EventArgs e) { // Do you want to save? if (MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9003.ToString()), MessageDialogButtons.YesNo) == MessageDialogResult.No) { return; } m_rootBOMNode.Nodes.Clear(); m_rootBOMNode = new BOMNode(); shtView.RowCount = 0; shtView.DataSource = null; CtrlUtil.ClearControlData(txtItemCD, txtItemDesc); CtrlUtil.FocusControl(txtItemCD); UpdateUpDownButton(); }
private void fpView_Change(object sender, ChangeEventArgs e) { if (Convert.ToInt32(shtView.Cells[shtView.ActiveRowIndex, (int)eColumns.Shipment].Value) > Convert.ToInt32(shtView.Cells[shtView.ActiveRowIndex, (int)eColumns.ON_HAND_QTY].Value)) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0104.ToString()).MessageDescription); shtView.Cells[shtView.ActiveRowIndex, (int)eColumns.Shipment].Value = shtView.Cells[shtView.ActiveRowIndex, (int)eColumns.ON_HAND_QTY].Value; shtView.Cells[shtView.ActiveRowIndex, (int)eColumns.EDIT_FLAG].Value = true; return; } if (shtView.Cells[shtView.ActiveRowIndex, (int)eColumns.Shipment].Value != null) { shtView.Cells[shtView.ActiveRowIndex, (int)eColumns.EDIT_FLAG].Value = true; } else { shtView.Cells[shtView.ActiveRowIndex, (int)eColumns.EDIT_FLAG].Value = false; } }
private void tsbOk_Click(object sender, EventArgs e) { for (int i = 0; i < shtView.Rows.Count; i++) { if (Convert.ToInt32(shtView.Cells[i, (int)eColumns.Shipment].Value) > Convert.ToInt32(shtView.Cells[i, (int)eColumns.ON_HAND_QTY].Value)) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0104.ToString()).MessageDescription); return; } /* else if ((Convert.ToBoolean(shtView.Cells[i, (int)eColumns.EDIT_FLAG].Value) == true) * (Convert.ToInt32(shtView.Cells[i,(int)eColumns.Shipment].Value == null))) * { * MessageDialog.ShowBusiness(this, * Message.LoadMessage(TKPMessages.eValidate.VLM0103.ToString()).MessageDescription); * return; * } */ } DialogResult = DialogResult.OK; }
private void UpdateData() { SystemConfigurationUIDM datamodel = dmc.SaveData(new SystemConfigurationUIDM()); try { SystemConfigController ctlsys = new SystemConfigController(); int check = ctlsys.UpdateConfig(datamodel); if (check == 0) { MessageDialog.ShowInformation(this, null, Message.LoadMessage(TKPMessages.eValidate.VLM0100.ToString()).MessageDescription); return; } else { loadData(); } } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }
private void DeleteData() { ClassListUIDM datamodel = dmc.SaveData(new ClassListUIDM()); try { ClassListController ctlsys = new ClassListController(); int check = ctlsys.DeleteClassList(datamodel); if (check == 0) { MessageDialog.ShowInformation(this, null, Message.LoadMessage(TKPMessages.eValidate.VLM0068.ToString()).MessageDescription); return; } else { loadData(); } } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }
private void LoadData(NZDateTime from, NZDateTime to, NZInt filterType) { if (dtPeriodBegin.NZValue.IsNull || dtPeriodEnd.NZValue.IsNull) { if (dtPeriodBegin.NZValue.IsNull && dtPeriodEnd.NZValue.IsNull) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0105.ToString(), new object[] { "Period date begin and Delivery date end" })); } else if (dtPeriodBegin.NZValue.IsNull) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0105.ToString(), new object[] { "Period date begin" })); } else { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0105.ToString(), new object[] { "Period date end" })); } return; } CustomerOrderBIZ biz = new CustomerOrderBIZ(); DataTable dt = DTOUtility.ConvertListToDataTable <CustomerOrderViewDTO>(biz.LoadCustomerOrderList(from, to, filterType, false)); shtCustomerOrderList.RowCount = 0; shtCustomerOrderList.DataSource = null; m_dtAllData = dt; FindDataFromMemory(); CalculateTotal(); //List<InventoryTransactionViewDTO> list = m_controller.LoadReceivingList(from, to); ////DataTable dt = DTOUtility.ConvertListToDataTable(list); //m_dtAllData = DTOUtility.ConvertListToDataTable(list); //shtCustomerOrderList.RowCount = 0; //shtCustomerOrderList.DataSource = null; //FindDataFromMemory(); //shtView.DataSource = m_dtAllData; // CtrlUtil.SpreadUpdateColumnSorting(shtView); }
private void miDeleteOrder_Click(object sender, EventArgs e) { if (CheckReturnQTY(eReturnType.ORDER, null, shtDelivery.GetValue(shtDelivery.ActiveRowIndex, (int)eColView.ORDER_DETAIL_NO).ToString(), null)) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0202.ToString())); return; } MessageDialogResult dr = MessageDialog.ShowConfirmation(this, Message.LoadMessage(TKPMessages.eConfirm.CFM0008.ToString())); switch (dr) { case MessageDialogResult.Cancel: return; case MessageDialogResult.No: return; case MessageDialogResult.Yes: break; } OnDeleteOrder(); CalTotatValue(); LoadData(); }
private void button1_Click(object sender, EventArgs e) { if (cboFromLoc.SelectedValue == null) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0103.ToString())); return; } else { //ถ้าไม่มี row ให้ add ได้ แต่ถ้ามี row ให้ check ว่า row สุดท้ายไม่ใช่ blank if ((shtIssueList.RowCount == 0) || (shtIssueList.RowCount > 0 && ValidateRowSpread(shtIssueList.RowCount - 1, true))) { string loc = Convert.ToString(cboFromLoc.SelectedValue); TRN171_LotMaintenance trn171 = new TRN171_LotMaintenance(loc); if (DialogResult.OK == trn171.ShowDialog()) { ItemNo = trn171.ItemNo.ToString(); for (int i = 0; i < trn171.shtData.Rows.Count; i++) { if (Convert.ToBoolean(trn171.shtData.Cells[i, (int)eColumns.EDIT_FLAG].Value) == true) { int j = shtIssueList.RowCount; m_keyboardSpread.OnActionAddNewRow(); shtIssueList.Cells[j, (int)eColView.ITEM_CODE].Value = trn171.ItemNo.ToString(); shtIssueList.Cells[j, (int)eColView.ITEM_DESC].Value = trn171.ItemName.ToString(); shtIssueList.Cells[j, (int)eColView.LOT_NO].Value = trn171.shtData.Cells[i, (int)eColumns.LOT_NO].Value; // shtIssueList.Cells[j, (int)eColView.REQUEST_QTY].Value = trn171.shtData.Cells[i, (int)eColumns.ON_HAND_QTY].Value; shtIssueList.Cells[j, (int)eColView.ISSUE_QTY].Value = trn171.shtData.Cells[i, (int)eColumns.Shipment].Value; shtIssueList.Cells[j, (int)eColView.ONHAND_QTY].Value = trn171.shtData.Cells[i, (int)eColumns.ON_HAND_QTY].Value; } } } } } }
private void tsbSave_Click(object sender, EventArgs e) { try { // Do you want to save? MessageDialogResult dr = MessageDialog.ShowConfirmation(this, Message.LoadMessage(Messages.eConfirm.CFM9001.ToString())); if (dr == MessageDialogResult.Cancel) { return; } if (dr == MessageDialogResult.Yes) { m_executeScript.ExecuteScript(); m_executeScript.Clear(); MessageDialog.ShowInformation(this, null, Message.LoadMessage(Messages.eInformation.INF9003.ToString()).MessageDescription); return; } } catch (Exception err) { MessageDialog.ShowBusiness(this, null, err.Message); } }
/// <summary> /// Validate spread row. /// </summary> /// <param name="row"></param> /// <param name="forceValidate">force to validate.</param> /// <returns></returns> private bool ValidateRowSpread(int row, bool forceValidate) { if (!forceValidate && !m_bRowHasModified) { return(true); } if (shtView.RowCount <= 0) { return(true); } object src_lot_no = shtView.Cells[row, (int)eColView.LOT_NO].Value; object src_cust_lot_no = shtView.Cells[row, (int)eColView.EXTERNAL_LOT_NO].Value; object src_qty = shtView.Cells[row, (int)eColView.QTY].Value; if (src_lot_no == null && src_cust_lot_no == null && src_qty == null) { return(false); } if (string.Empty.Equals(shtView.Cells[row, (int)eColView.LOT_NO].Text.Trim())) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0011.ToString())); return(false); } //check format lotno if (!(string.Empty.Equals(shtView.Cells[row, (int)eColView.LOT_NO].Text))) { try { FormatUtil.CheckFormatLotNo(new NZString(null, shtView.Cells[row, (int)eColView.LOT_NO].Text)); } catch (ValidateException ex) { MessageDialog.ShowBusiness(this, ex.ErrorResults[0].Message); return(false); } } //Check dupllicate lot //for (int iRow = 0; iRow < shtView.Rows.Count; iRow++) //{ // if (iRow == row) // continue; // // Check key duplidate. // object lot_no = shtView.Cells[iRow, (int)eColView.LOT_NO].Value; // if (Equals(src_lot_no, lot_no)) // { // MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0189.ToString())); // return false; // } //} //Check Qty > 0 if (src_qty == null || Convert.ToInt32(src_qty) <= 0) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0175.ToString())); return(false); } // ถ้า Validate Row ผ่าน แสดงว่า แถวนั้นไม่จำเป็นต้องเช็คอีกรอบ m_bRowHasModified = false; return(true); }
private void btnImport_Click(object sender, EventArgs e) { try { if (string.Empty.Equals(txtLastPreProcessBy.Text)) { MessageDialog.ShowBusiness(this, Message.LoadMessage(TKPMessages.eValidate.VLM0086.ToString())); return; } MessageDialogResult dialog = MessageDialog.ShowConfirmation(this, Message.LoadMessage(TKPMessages.eConfirm.CFM0005.ToString())); if (dialog == MessageDialogResult.Cancel || dialog == MessageDialogResult.No) { return; } string strFilePath = txtFileName.Text.Trim(); //Check found data in file DataTable dt = ImportUtil.ImportExcel(strFilePath, CONST_B_DATA_INCLUDE_HEADER, 0); if (dt == null || dt.Rows.Count == 0) { ErrorItem error = new ErrorItem(null, TKPMessages.eValidate.VLM0156.ToString()); ValidateException.ThrowErrorItem(error); } if (dt.Columns.Count < ((int)eImportFile.Remark) + 1) { ErrorItem error = new ErrorItem(null, TKPMessages.eValidate.VLM0178.ToString()); ValidateException.ThrowErrorItem(error); } List <ImportStockTakingDTO> dtoList = new List <ImportStockTakingDTO>(); int iLineNo = CONST_B_DATA_INCLUDE_HEADER ? CONST_INT_START_RECORD_NO : 0; foreach (DataRow dr in dt.Rows) { if (("".Equals(dr[(int)eImportFile.Process]) && "".Equals(dr[(int)eImportFile.MasterNo]) && "".Equals(dr[(int)eImportFile.Weight]) && "".Equals(dr[(int)eImportFile.Qty]) && "".Equals(dr[(int)eImportFile.TagNo]) && "".Equals(dr[(int)eImportFile.Remark])) || (DBNull.Value.Equals(dr[(int)eImportFile.Process]) && DBNull.Value.Equals(dr[(int)eImportFile.MasterNo]) && DBNull.Value.Equals(dr[(int)eImportFile.Weight]) && DBNull.Value.Equals(dr[(int)eImportFile.Qty]) && DBNull.Value.Equals(dr[(int)eImportFile.TagNo]) && DBNull.Value.Equals(dr[(int)eImportFile.Remark]) )) { continue; } iLineNo = iLineNo + 1; ImportStockTakingDTO dto = new ImportStockTakingDTO(); dto.CREATE_BY = Common.CurrentUserInfomation.UserCD; dto.CREATE_MACHINE = Common.CurrentUserInfomation.Machine; dto.IMPORT_FILE_NAME = new NZString(txtFileName, txtFileName.Text.Trim()); dto.LINE_NO = new NZInt(null, iLineNo); dto.PROCESS_CD = new NZString(null, dr[(int)eImportFile.Process]); dto.ITEM_CD = new NZString(null, dr[(int)eImportFile.MasterNo]); dto.WEIGHT = new NZString(null, dr[(int)eImportFile.Weight]); dto.QTY = new NZString(null, dr[(int)eImportFile.Qty]); dto.TAG_NO = new NZString(null, dr[(int)eImportFile.TagNo]); dto.REMARK = new NZString(null, dr[(int)eImportFile.Remark]); dtoList.Add(dto); } bool bSuccess = m_controller.ImportStockTakingTemp(strFilePath, ((int)eImportFile.Remark) + 1, dtoList); if (bSuccess) { MessageDialog.ShowInformation(this, null, Message.LoadMessage(Messages.eInformation.INF9003.ToString()).MessageDescription); InitialScreen(); return; } } catch (ValidateException err) { for (int i = 0; i < err.ErrorResults.Count; i++) { MessageDialog.ShowBusiness(this, err.ErrorResults[i].Message); err.ErrorResults[i].FocusOnControl(); } } catch (BusinessException err) { MessageDialog.ShowBusiness(this, err.Error.Message); err.Error.FocusOnControl(); } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }