/// <summary> /// Generate PO Header. /// </summary> /// <param name="strPONo">PO No of PO Header.</param> /// <returns>PO Header</returns> private PurchaseOrderHDTO GeneratePurchaseOrderHDTO(NZString strPONo) { NZDateTime dtmPO = new NZDateTime(dtmPODate, dtmPODate.Value); NZString strSupplierCD = new NZString(cboSupplierCode, cboSupplierCode.SelectedValue); NZString strDeliveryTo = chkOurFactory.Checked ? new NZString(cboDelivery, cboDelivery.Text) : new NZString(cboDelivery, cboDelivery.SelectedValue); NZString strCurrency = new NZString(cboCurrency, cboCurrency.SelectedValue); NZString strVatRate = new NZString(txtVatRate, txtVatRate.Text); string strVatType = (Convert.ToInt32(strVatRate) > 0) ? "02" : "01"; #region validation ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckDateTimeValue(dtmPO, Messages.eValidate.VLM0116)); ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckEmptyString(strSupplierCD, Messages.eValidate.VLM0118)); if (!chkOurFactory.Checked) { ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckEmptyString((NZString)strDeliveryTo, Messages.eValidate.VLM0119)); } ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckEmptyString((NZString)strCurrency, Messages.eValidate.VLM0121)); if (this.m_ScreenStateEnum == eScreenState.Add) { ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckPurchaseOrderItem((NZInt)shtView.Rows.Count)); } #endregion PurchaseOrderHDTO hDTO = new PurchaseOrderHDTO { CRT_BY = CommonLib.Common.CurrentUserInfomation.UserCD, CRT_DATE = (NZDateTime)DateTime.UtcNow, CRT_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine, UPD_BY = CommonLib.Common.CurrentUserInfomation.UserCD, UPD_DATE = (NZDateTime)DateTime.UtcNow, UPD_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine, PO_NO = strPONo, PO_DATE = (NZDateTime)dtmPO, IS_ACTIVE = (NZBoolean)m_bIsActived, //(NZBoolean)((m_iPOStatus == 1) ? true : false), PO_TYPE = (NZString)"01", //(NZString)(cboPOType.SelectedValue.ToString()), IS_EXPORT = (NZBoolean)false, //(NZBoolean)chkExport.Checked, ADDRESS = (NZString)"", // (NZString)txtAddress.Text, SUPPLIER_CD = (NZString)strSupplierCD, DELIVERY_TO = (NZString)strDeliveryTo, TERM_OF_PAYMENT = (NZString)(Convert.ToString(cboTermOfPayment.SelectedValue)), STATUS = (NZString)"0", VAT_TYPE = (NZString)strVatType, VAT_RATE = (NZDecimal)Convert.ToDecimal(strVatRate), CURRENCY = (NZString)(cboCurrency.SelectedValue.ToString()), REMARK = (NZString)txtRemark.Text, }; return(hDTO); }
/// <summary> /// Validate Value of rows in SpreadSheet. /// </summary> private void ValidateAllRows() { for (int iRow = 0; iRow < shtView.RowCount; iRow++) { NZString strItemCD = new NZString(null, shtView.Cells[iRow, (int)eColumn.ITEM_CD].Value, null); NZString strItemDesc = new NZString(null, shtView.Cells[iRow, (int)eColumn.ITEM_DESC].Value, null); NZDateTime dtmRequireDate = new NZDateTime(null, shtView.Cells[iRow, (int)eColumn.DUE_DATE].Value, null); NZDecimal decUnitPrice = new NZDecimal(null, shtView.Cells[iRow, (int)eColumn.UNIT_PRICE].Value, null); NZDecimal decQty = new NZDecimal(null, shtView.Cells[iRow, (int)eColumn.PO_QTY].Value, null); NZString strUnit = new NZString(null, shtView.Cells[iRow, (int)eColumn.UNIT].Value, null); NZDecimal decAmount = new NZDecimal(null, shtView.Cells[iRow, (int)eColumn.AMOUNT].Value, null); NZDecimal decReceiveQty = new NZDecimal(null, shtView.Cells[iRow, (int)eColumn.RECEIVE_QTY].Value, 0); NZString strStatus = new NZString(null, shtView.Cells[iRow, (int)eColumn.STATUS].Value, null); #region Validateion before Generate DDTO ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckEmptyString(strItemDesc, Messages.eValidate.VLM0129)); ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckDateTimeValue(dtmRequireDate, Messages.eValidate.VLM0130)); ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckDecimalValue(decUnitPrice, Messages.eValidate.VLM0131)); ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckEmptyString(strUnit, Messages.eValidate.VLM0133)); ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckDecimalValue(decQty, Messages.eValidate.VLM0132)); ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckEmptyString(strStatus, Messages.eValidate.VLM0137)); #endregion } }