public ActionResult MAS090_GetInstrumentDetail(string InstrumentCode) { ObjectResultData res = new ObjectResultData(); try { IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; dtInstrumentDetail detail = null; List <dtInstrumentDetail> list = hand.GetInstrumentDetail(InstrumentCode, MiscType.C_LINE_UP_TYPE, CurrencyUtil.C_CURRENCY_LOCAL, CurrencyUtil.C_CURRENCY_US); if (list.Count > 0) { detail = list[0]; MAS090_ScreenParameter MAS090Param = GetScreenObject <MAS090_ScreenParameter>(); if (detail.UpdateDate.HasValue) { MAS090Param.updateDate = detail.UpdateDate.Value; } } res.ResultData = detail; return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(null); } }
/// <summary> /// Get instrument name of given instrument code. /// </summary> /// <param name="InstrumentCode"></param> /// <returns></returns> public ActionResult IVS160_GetInstrumentName(string InstrumentCode) { ObjectResultData res = new ObjectResultData(); try { IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; List <tbm_Instrument> list = hand.GetTbm_Instrument(InstrumentCode); tbm_Instrument item = new tbm_Instrument(); if (list.Count > 0) { res.ResultData = new IVS160_InstrumetInfo() { InstrumentCode = list[0].InstrumentCode, InstrumentName = list[0].InstrumentName }; } else { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4037); } return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Search instrument data by instrumentcode /// </summary> /// <param name="InstrumentCode"></param> /// <returns></returns> public ActionResult CTS230_GetInstrumentDataForSearch(string InstrumentCode) { if (!CommonUtil.IsNullOrEmpty(InstrumentCode)) { IInstrumentMasterHandler InstHand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; doInstrumentSearchCondition Cond = new doInstrumentSearchCondition(); Cond.InstrumentCode = InstrumentCode; //====================== TRS update 17/07/2012 ============================ //Cond.ExpansionType = new List<string>() { ExpansionType.C_EXPANSION_TYPE_PARENT }; //Cond.InstrumentType = new List<string>() { InstrumentType.C_INST_TYPE_GENERAL }; Cond.ExpansionType = null; Cond.InstrumentType = null; //========================================================================= List <doInstrumentData> dtNewInstrument = InstHand.GetInstrumentDataForSearch(Cond); if (dtNewInstrument.Count > 0) { return(Json(dtNewInstrument[0])); } else { return(Json("")); } } return(Json("")); }
/// <summary> /// Get instrument data for search. /// </summary> /// <param name="InstrumentCode"></param> /// <returns></returns> public ActionResult IVS250_GetInstrumentDataForSearch(string InstrumentCode) { if (!CommonUtil.IsNullOrEmpty(InstrumentCode)) { ObjectResultData res = new ObjectResultData(); IInstrumentMasterHandler InstHand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; doInstrumentSearchCondition Cond = new doInstrumentSearchCondition(); Cond.InstrumentCode = InstrumentCode; Cond.ExpansionType = new List <string>() { ExpansionType.C_EXPANSION_TYPE_CHILD }; Cond.InstrumentType = new List <string>() { InstrumentType.C_INST_TYPE_GENERAL, InstrumentType.C_INST_TYPE_MATERIAL }; List <doInstrumentData> dtNewInstrument = InstHand.GetInstrumentDataForSearch(Cond); if (dtNewInstrument.Count > 0) { return(Json(dtNewInstrument[0])); } else { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4037); res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; return(Json(res)); } } return(Json("")); }
/// <summary> /// Check require field.<br /> /// - ParentInstrumentCode must not null or empty.<br /> /// - Check exist ParentInstrumentCode.<br /> /// - Get information of ParentInstrumentCode. /// </summary> /// <param name="ParentInstrumentCode"></param> /// <returns></returns> public ActionResult MAS100_CheckReqField(String ParentInstrumentCode) { ObjectResultData res = new ObjectResultData(); try { if (CommonUtil.IsNullOrEmpty(ParentInstrumentCode)) { res.AddErrorMessage(MessageUtil.MODULE_MASTER, MAS100_Screen, MessageUtil.MODULE_MASTER, MessageUtil.MessageList.MSG1040, new string[] { "lblParentinstrumentcode" }, new string[] { "ParentInstrumentCode" }); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } //Check exist parent instrument IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; List <doParentInstrument> doParentInst = hand.GetParentInstrument(ParentInstrumentCode); if (doParentInst.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_MASTER, MAS100_Screen, MessageUtil.MODULE_MASTER, MessageUtil.MessageList.MSG1043, new string[] { "lblParentinstrumentcode" }, new string[] { "ParentInstrumentCode" }); return(Json(res)); } //Load data GetInstrumentExpansion List <doInstrumentExpansion> lst = hand.GetInstrumentExpansion(ParentInstrumentCode); MAS100_ScreenParameter MAS100Param = GetScreenObject <MAS100_ScreenParameter>(); MAS100Param.ParentInstrumentCode = doParentInst[0].ParentInstruementCode; MAS100Param.ParentInstrumentName = doParentInst[0].ParentInstruementName; MAS100Param.SearchInstrumentExpansion = lst; //Clear AddInstrumentExpansion & DelInstrumentExpansion MAS100Param.AddInstrumentExpansion = new List <doInstrumentExpansion>(); MAS100Param.DelInstrumentExpansion = new List <doInstrumentExpansion>(); UpdateScreenObject(MAS100Param); res.ResultData = MAS100Param.ParentInstrumentName; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Retrieve parent instrument data.<br /> /// - If ParentInstrumentCode is null or empty get information from session.<br /> /// - If ParentInstrumentCode is not null or empty get information of ParentInstrumentCode. /// </summary> /// <param name="ParentInstrumentCode"></param> /// <returns></returns> public ActionResult MAS100_Retrieve(String ParentInstrumentCode) { ObjectResultData res = new ObjectResultData(); try { MAS100_ScreenParameter MAS100Param = GetScreenObject <MAS100_ScreenParameter>(); List <doInstrumentExpansion> lst = new List <doInstrumentExpansion>(); if (CommonUtil.IsNullOrEmpty(ParentInstrumentCode)) //from click retrieve { lst = MAS100Param.SearchInstrumentExpansion; } else //from click search parent instrument { //Check exist parent instrument IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; List <doParentInstrument> doParentInst = hand.GetParentInstrument(ParentInstrumentCode); if (doParentInst.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_MASTER, MAS100_Screen, MessageUtil.MODULE_MASTER, MessageUtil.MessageList.MSG1043, new string[] { "lblParentinstrument" }, new string[] { "ParentInstrumentCode" }); return(Json(res)); } lst = hand.GetInstrumentExpansion(ParentInstrumentCode); MAS100Param.ParentInstrumentCode = doParentInst[0].ParentInstruementCode; MAS100Param.ParentInstrumentName = doParentInst[0].ParentInstruementName; MAS100Param.SearchInstrumentExpansion = lst; //Clear AddInstrumentExpansion & DelInstrumentExpansion MAS100Param.AddInstrumentExpansion = new List <doInstrumentExpansion>(); MAS100Param.DelInstrumentExpansion = new List <doInstrumentExpansion>(); UpdateScreenObject(MAS100Param); } res.ResultData = CommonUtil.ConvertToXml <doInstrumentExpansion>(lst, "Master\\MAS100", CommonUtil.GRID_EMPTY_TYPE.INSERT); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
public ActionResult MAS090_Search(string txtInstrumentCodeSearch, string txtInstrumentNameSearch, string cboLineUpTypeSearch) { ObjectResultData res = new ObjectResultData(); try { txtInstrumentCodeSearch = (txtInstrumentCodeSearch == "" ? null : txtInstrumentCodeSearch); txtInstrumentNameSearch = (txtInstrumentNameSearch == "" ? null : txtInstrumentNameSearch); cboLineUpTypeSearch = (cboLineUpTypeSearch == "" ? null : cboLineUpTypeSearch); if (txtInstrumentCodeSearch == null && txtInstrumentNameSearch == null && cboLineUpTypeSearch == null) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006); } if (res.IsError) { return(Json(res)); } IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; List <dtInstrument> list = hand.GetInstrument(txtInstrumentCodeSearch, txtInstrumentNameSearch, cboLineUpTypeSearch, MiscType.C_LINE_UP_TYPE); foreach (var item in list) { if (CommonUtil.GetCurrentLanguage() == CommonValue.DEFAULT_LANGUAGE_EN) { item.LineUpTypeCode = item.LineUpTypeNameEN; } else if (CommonUtil.GetCurrentLanguage() == CommonValue.DEFAULT_LANGUAGE_JP) { item.LineUpTypeCode = item.LineUpTypeNameJP; } else { item.LineUpTypeCode = item.LineUpTypeNameLC; } } string xml = CommonUtil.ConvertToXml <dtInstrument>(list, "Master\\MAS090", CommonUtil.GRID_EMPTY_TYPE.SEARCH); res.ResultData = xml; return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(null); } }
/// <summary> /// Load instrument data in case of sale online to grid /// </summary> /// <returns></returns> public ActionResult QUS012_GetOnlineInstrumentDetailData() { ObjectResultData res = new ObjectResultData(); List <doInstrumentDetail> lst = null; try { doRentalQuotationData rqData = QUS012_RentalQuotationDataSession; if (rqData != null) { if (rqData.doLinkageSaleContractData != null) { lst = rqData.doLinkageSaleContractData.SaleInstrumentDetailList; } } if (lst != null) { if (lst.Count > 0) { InstrumentMappingList instMappingLst = new InstrumentMappingList(); instMappingLst.AddInstrument(lst.ToArray()); IInstrumentMasterHandler ihandler = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; ihandler.InstrumentListMapping(instMappingLst); lst = ( from x in lst orderby x.ControllerFlag descending, x.InstrumentCode select x).ToList(); } } } catch (Exception ex) { res.AddErrorMessage(ex); } res.ResultData = CommonUtil.ConvertToXml <doInstrumentDetail>(lst, "Quotation\\QUS012_InstrumentDetail_Online"); return(Json(res)); }
/// <summary> /// Get instrument name. /// </summary> /// <param name="InstrumentCode"></param> /// <returns></returns> public ActionResult IVS250_getInstrumentName(string InstrumentCode) { ObjectResultData res = new ObjectResultData(); try { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; IInventoryHandler invH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; IInstrumentMasterHandler InsH = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; List <tbm_Instrument> lstInst = InsH.GetTbm_Instrument(InstrumentCode.Trim()); if (lstInst == null || lstInst.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4037); } else if (lstInst[0].InstrumentTypeCode != InstrumentType.C_INST_TYPE_GENERAL && lstInst[0].InstrumentTypeCode != InstrumentType.C_INST_TYPE_MATERIAL) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4123, new string[] { lstInst[0].InstrumentCode }); } else if (lstInst[0].LineUpTypeCode == LineUpType.C_LINE_UP_TYPE_LOGICAL_DELETE) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4140, new string[] { lstInst[0].InstrumentCode }); } else if (invH.CheckInstrumentExpansion(lstInst[0].InstrumentCode)) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4124, new string[] { lstInst[0].InstrumentCode }); } else { doInstrumentData dtNewInstrument = CommonUtil.CloneObject <tbm_Instrument, doInstrumentData>(lstInst[0]); res.ResultData = dtNewInstrument; } return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Get instrument data /// </summary> /// <param name="InstrumentCodeSearch"></param> /// <returns></returns> public ActionResult MAS130_GetInstrumentName(string InstrumentCodeSearch) { ObjectResultData res = new ObjectResultData(); try { IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; List <tbm_Instrument> list = hand.GetTbm_Instrument(InstrumentCodeSearch); string InstumentName = ""; if (list.Count > 0) { InstumentName = list[0].InstrumentName; } res.ResultData = InstumentName; return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Get entire draft sale contract /// </summary> /// <param name="cond"></param> /// <param name="mode"></param> /// <param name="procType"></param> /// <returns></returns> public doDraftSaleContractData GetEntireDraftSaleContract(doDraftSaleContractCondition cond, doDraftSaleContractData.SALE_CONTRACT_MODE mode, doDraftSaleContractData.PROCESS_TYPE procType) { try { doDraftSaleContractData saleData = null; if (mode == doDraftSaleContractData.SALE_CONTRACT_MODE.QUOTATION) { CommonUtil cmm = new CommonUtil(); doGetQuotationDataCondition qcond = new doGetQuotationDataCondition(); qcond.QuotationTargetCode = cond.QuotationTargetCodeLong; qcond.Alphabet = cond.Alphabet; qcond.ServiceTypeCode = ServiceType.C_SERVICE_TYPE_SALE; if (procType == doDraftSaleContractData.PROCESS_TYPE.NEW) { qcond.TargetCodeTypeCode = TargetCodeType.C_TARGET_CODE_TYPE_QTN_CODE; } else { qcond.TargetCodeTypeCode = TargetCodeType.C_TARGET_CODE_TYPE_CONTRACT_CODE; } qcond.ContractFlag = true; IQuotationHandler qhandler = ServiceContainer.GetService <IQuotationHandler>() as IQuotationHandler; dsQuotationData qData = qhandler.GetQuotationData(qcond); if (qData != null) { #region Check Authority bool hasAuthority = false; List <OfficeDataDo> officeLst = CommonUtil.dsTransData.dtOfficeData; if (qData.dtTbt_QuotationTarget != null && officeLst.Count > 0) { foreach (OfficeDataDo office in officeLst) { if (office.OfficeCode == qData.dtTbt_QuotationTarget.QuotationOfficeCode || office.OfficeCode == qData.dtTbt_QuotationTarget.OperationOfficeCode) { hasAuthority = true; break; } } } if (hasAuthority == false) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0063); } #endregion saleData = new doDraftSaleContractData(); if (qData.dtTbt_QuotationTarget.UpdateDate != null) { saleData.LastUpdateDateQuotationData = qData.dtTbt_QuotationTarget.UpdateDate.Value; } #region Set Draft Sale Contract saleData.doTbt_DraftSaleContract = CommonUtil.CloneObject <tbt_QuotationBasic, tbt_DraftSaleContract>(qData.dtTbt_QuotationBasic); if (saleData.doTbt_DraftSaleContract != null) { saleData.doTbt_DraftSaleContract.QuotationTargetCode = cond.QuotationTargetCodeLong; saleData.doTbt_DraftSaleContract.Alphabet = cond.Alphabet; saleData.doTbt_DraftSaleContract.ProductTypeCode = qData.dtTbt_QuotationTarget.ProductTypeCode; saleData.doTbt_DraftSaleContract.BranchNameEN = qData.dtTbt_QuotationTarget.BranchNameEN; saleData.doTbt_DraftSaleContract.BranchNameLC = qData.dtTbt_QuotationTarget.BranchNameLC; saleData.doTbt_DraftSaleContract.BranchAddressEN = qData.dtTbt_QuotationTarget.BranchAddressEN; saleData.doTbt_DraftSaleContract.BranchAddressLC = qData.dtTbt_QuotationTarget.BranchAddressLC; saleData.doTbt_DraftSaleContract.PurchaserMemo = qData.dtTbt_QuotationTarget.ContractTargetMemo; saleData.doTbt_DraftSaleContract.RealCustomerMemo = qData.dtTbt_QuotationTarget.RealCustomerMemo; foreach (tbt_QuotationCustomer cust in qData.dtTbt_QuotationCustomer) { if (cust.CustPartTypeCode == CustPartType.C_CUST_PART_TYPE_CONTRACT_TARGET) { saleData.doTbt_DraftSaleContract.PurchaserCustCode = cust.CustCode; } else if (cust.CustPartTypeCode == CustPartType.C_CUST_PART_TYPE_REAL_CUST) { saleData.doTbt_DraftSaleContract.RealCustomerCustCode = cust.CustCode; } } if (qData.dtTbt_QuotationSite != null) { saleData.doTbt_DraftSaleContract.SiteCode = qData.dtTbt_QuotationSite.SiteCode; } saleData.doTbt_DraftSaleContract.ConnectTargetCode = qData.dtTbt_QuotationBasic.SaleOnlineContractCode; if (CommonUtil.IsNullOrEmpty(saleData.doTbt_DraftSaleContract.ConnectTargetCode) == false) { saleData.doTbt_DraftSaleContract.ConnectionFlag = FlagType.C_FLAG_ON; } else { saleData.doTbt_DraftSaleContract.ConnectionFlag = FlagType.C_FLAG_OFF; } saleData.doTbt_DraftSaleContract.NormalProductPriceCurrencyType = qData.dtTbt_QuotationBasic.ProductPriceCurrencyType; saleData.doTbt_DraftSaleContract.NormalProductPrice = qData.dtTbt_QuotationBasic.ProductPrice; saleData.doTbt_DraftSaleContract.NormalProductPriceUsd = qData.dtTbt_QuotationBasic.ProductPriceUsd; saleData.doTbt_DraftSaleContract.NormalInstallFeeCurrencyType = qData.dtTbt_QuotationBasic.InstallationFeeCurrencyType; saleData.doTbt_DraftSaleContract.NormalInstallFee = qData.dtTbt_QuotationBasic.InstallationFee; saleData.doTbt_DraftSaleContract.NormalInstallFeeUsd = qData.dtTbt_QuotationBasic.InstallationFeeUsd; if (CommonUtil.IsNullOrEmpty(saleData.doTbt_DraftSaleContract.NormalProductPrice) == false || CommonUtil.IsNullOrEmpty(saleData.doTbt_DraftSaleContract.NormalInstallFee) == false) { saleData.doTbt_DraftSaleContract.NormalSalePrice = 0; //if (CommonUtil.IsNullOrEmpty(saleData.doTbt_DraftSaleContract.NormalProductPrice) == false) // saleData.doTbt_DraftSaleContract.NormalSalePrice += saleData.doTbt_DraftSaleContract.NormalProductPrice; //if (CommonUtil.IsNullOrEmpty(saleData.doTbt_DraftSaleContract.NormalInstallFee) == false) // saleData.doTbt_DraftSaleContract.NormalSalePrice += saleData.doTbt_DraftSaleContract.NormalInstallFee; } saleData.doTbt_DraftSaleContract.NormalSpecialItemPrice = 0; saleData.doTbt_DraftSaleContract.NormalOtherProdPrice = 0; saleData.doTbt_DraftSaleContract.NormalOtherInstallFee = 0; //saleData.doTbt_DraftSaleContract.OrderProductPrice = qData.dtTbt_QuotationBasic.ProductPrice; //saleData.doTbt_DraftSaleContract.OrderInstallFee = qData.dtTbt_QuotationBasic.InstallationFee; //saleData.doTbt_DraftSaleContract.OrderSalePrice = saleData.doTbt_DraftSaleContract.NormalSalePrice; saleData.doTbt_DraftSaleContract.OrderProductPriceCurrencyType = qData.dtTbt_QuotationBasic.ProductPriceCurrencyType; saleData.doTbt_DraftSaleContract.OrderProductPrice = null; saleData.doTbt_DraftSaleContract.OrderProductPriceUsd = null; saleData.doTbt_DraftSaleContract.OrderInstallFeeCurrencyType = qData.dtTbt_QuotationBasic.InstallationFeeCurrencyType; saleData.doTbt_DraftSaleContract.OrderInstallFee = null; saleData.doTbt_DraftSaleContract.OrderInstallFeeUsd = null; saleData.doTbt_DraftSaleContract.OrderSalePrice = null; saleData.doTbt_DraftSaleContract.TotalSaleBilingAmt_Agreed = 0; saleData.doTbt_DraftSaleContract.QuotationStaffEmpNo = qData.dtTbt_QuotationTarget.QuotationStaffEmpNo; saleData.doTbt_DraftSaleContract.QuotationOfficeCode = qData.dtTbt_QuotationTarget.QuotationOfficeCode; saleData.doTbt_DraftSaleContract.OperationOfficeCode = qData.dtTbt_QuotationTarget.OperationOfficeCode; saleData.doTbt_DraftSaleContract.AcquisitionTypeCode = qData.dtTbt_QuotationTarget.AcquisitionTypeCode; saleData.doTbt_DraftSaleContract.IntroducerCode = qData.dtTbt_QuotationTarget.IntroducerCode; saleData.doTbt_DraftSaleContract.MotivationTypeCode = qData.dtTbt_QuotationTarget.MotivationTypeCode; saleData.doTbt_DraftSaleContract.ApproveNo1 = null; saleData.doTbt_DraftSaleContract.ApproveNo2 = null; saleData.doTbt_DraftSaleContract.ApproveNo3 = null; saleData.doTbt_DraftSaleContract.ApproveNo4 = null; saleData.doTbt_DraftSaleContract.ApproveNo5 = null; saleData.doTbt_DraftSaleContract.CreateBy = null; saleData.doTbt_DraftSaleContract.CreateDate = null; saleData.doTbt_DraftSaleContract.UpdateBy = null; saleData.doTbt_DraftSaleContract.UpdateDate = null; List <tbt_DraftSaleContract> contractLst = this.GetTbt_DraftSaleContract(cond.QuotationTargetCodeLong); if (contractLst.Count > 0) { saleData.doTbt_DraftSaleContract.CreateBy = contractLst[0].CreateBy; saleData.doTbt_DraftSaleContract.CreateDate = contractLst[0].CreateDate; saleData.doTbt_DraftSaleContract.UpdateBy = contractLst[0].UpdateBy; saleData.doTbt_DraftSaleContract.UpdateDate = contractLst[0].UpdateDate; } if (saleData.doTbt_DraftSaleContract.ProductTypeCode == ProductType.C_PROD_TYPE_ONLINE) { ISaleContractHandler shandler = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler; if (qData.dtTbt_QuotationBasic.SaleOnlineContractCode != null) { doSaleContractData doSaleContract = shandler.GetSaleContractData(qData.dtTbt_QuotationBasic.SaleOnlineContractCode, null); if (doSaleContract != null) { saleData.doTbt_DraftSaleContract.SecurityAreaFrom = doSaleContract.dtTbt_SaleBasic.SecurityAreaFrom; saleData.doTbt_DraftSaleContract.SecurityAreaTo = doSaleContract.dtTbt_SaleBasic.SecurityAreaTo; } } } } #endregion #region Set Draft Sale Customer MiscTypeMappingList cmLst = new MiscTypeMappingList(); ICustomerMasterHandler chandler = ServiceContainer.GetService <ICustomerMasterHandler>() as ICustomerMasterHandler; foreach (tbt_QuotationCustomer cust in qData.dtTbt_QuotationCustomer) { doCustomerWithGroup icust = null; if (cust.CustCode != null) { List <doCustomerWithGroup> lst = chandler.GetCustomerWithGroup(cust.CustCode); if (lst.Count > 0) { icust = lst[0]; } } else { icust = CommonUtil.CloneObject <tbt_QuotationCustomer, doCustomerWithGroup>(cust); if (icust != null) { icust.CustomerGroupData = new List <dtCustomeGroupData>(); } IMasterHandler mhandler = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler; if (icust.BusinessTypeCode != null) { List <tbm_BusinessType> btLst = mhandler.GetTbm_BusinessType(); foreach (tbm_BusinessType bt in btLst) { if (bt.BusinessTypeCode == icust.BusinessTypeCode) { icust.BusinessTypeName = bt.BusinessTypeName; break; } } } if (icust.RegionCode != null) { List <tbm_Region> rLst = mhandler.GetTbm_Region(); foreach (tbm_Region r in rLst) { if (r.RegionCode == icust.RegionCode) { icust.Nationality = r.Nationality; break; } } } if (icust.CustTypeCode != null) { cmLst.AddMiscType(icust); } } if (icust != null) { if (cust.CustPartTypeCode == CustPartType.C_CUST_PART_TYPE_CONTRACT_TARGET) { saleData.doPurchaserCustomer = icust; } else if (cust.CustPartTypeCode == CustPartType.C_CUST_PART_TYPE_REAL_CUST) { saleData.doRealCustomer = icust; } } } ICommonHandler cmmhandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; cmmhandler.MiscTypeMappingList(cmLst); #endregion #region Set Draft Sale Site if (qData.dtTbt_QuotationSite != null) { if (qData.dtTbt_QuotationSite.SiteCode != null) { ISiteMasterHandler shandler = ServiceContainer.GetService <ISiteMasterHandler>() as ISiteMasterHandler; List <doSite> lst = shandler.GetSite(qData.dtTbt_QuotationSite.SiteCode, null); if (lst.Count > 0) { saleData.doSite = lst[0]; } } else { saleData.doSite = CommonUtil.CloneObject <tbt_QuotationSite, doSite>(qData.dtTbt_QuotationSite); IMasterHandler mhandler = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler; List <tbm_BuildingUsage> blst = mhandler.GetTbm_BiuldingUsage(); foreach (tbm_BuildingUsage b in blst) { if (b.BuildingUsageCode == saleData.doSite.BuildingUsageCode) { saleData.doSite.BuildingUsageName = b.BuildingUsageName; break; } } } } #endregion #region Set Draft Sale Instrument saleData.doTbt_DraftSaleInstrument = new List <tbt_DraftSaleInstrument>(); if (qData.dtTbt_QuotationInstrumentDetails != null) { foreach (tbt_QuotationInstrumentDetails inst in qData.dtTbt_QuotationInstrumentDetails) { tbt_DraftSaleInstrument dInst = new tbt_DraftSaleInstrument(); dInst.QuotationTargetCode = cond.QuotationTargetCodeLong; dInst.InstrumentCode = inst.InstrumentCode; dInst.InstrumentQty = inst.InstrumentQty; dInst.InstrumentTypeCode = InstrumentType.C_INST_TYPE_GENERAL; if (CommonUtil.IsNullOrEmpty(dInst.InstrumentQty) == false) { if (CommonUtil.IsNullOrEmpty(inst.AddQty) == false) { dInst.InstrumentQty += inst.AddQty; } if (CommonUtil.IsNullOrEmpty(inst.RemoveQty) == false) { dInst.InstrumentQty -= inst.RemoveQty; } } saleData.doTbt_DraftSaleInstrument.Add(dInst); } } if (qData.dtTbt_QuotationFacilityDetails != null) { foreach (tbt_QuotationFacilityDetails facility in qData.dtTbt_QuotationFacilityDetails) { tbt_DraftSaleInstrument dInst = new tbt_DraftSaleInstrument(); dInst.QuotationTargetCode = cond.QuotationTargetCode; dInst.InstrumentCode = facility.FacilityCode; dInst.InstrumentQty = facility.FacilityQty; dInst.InstrumentTypeCode = InstrumentType.C_INST_TYPE_MONITOR; saleData.doTbt_DraftSaleInstrument.Add(dInst); } } if (saleData.doTbt_DraftSaleInstrument.Count > 0) { InstrumentMappingList instMappingLst = new InstrumentMappingList(); instMappingLst.AddInstrument(saleData.doTbt_DraftSaleInstrument.ToArray()); IInstrumentMasterHandler ihandler = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; ihandler.InstrumentListMapping(instMappingLst); } #endregion #region Set Draft Relation Type saleData.doTbt_RelationType = new List <tbt_RelationType>(); /* -- Sale Online --- */ if (CommonUtil.IsNullOrEmpty(qData.dtTbt_QuotationBasic.SaleOnlineContractCode) == false) { saleData.doTbt_RelationType.Add(new tbt_RelationType() { RelatedContractCode = qData.dtTbt_QuotationBasic.SaleOnlineContractCode, RelatedOCC = qData.dtTbt_QuotationBasic.LastOccNo, OCC = null, RelationType = RelationType.C_RELATION_TYPE_SALE }); } #endregion } } else if (mode == doDraftSaleContractData.SALE_CONTRACT_MODE.DRAFT || mode == doDraftSaleContractData.SALE_CONTRACT_MODE.APPROVE) { saleData = new doDraftSaleContractData(); #region Set Draft Sale Contract List <tbt_DraftSaleContract> contractLst = this.GetTbt_DraftSaleContract(cond.QuotationTargetCodeLong); if (contractLst.Count > 0) { saleData.doTbt_DraftSaleContract = contractLst[0]; } else { return(null); } #endregion #region Check Authority bool hasAuthority = false; List <OfficeDataDo> officeLst = CommonUtil.dsTransData.dtOfficeData; if (saleData.doTbt_DraftSaleContract != null && officeLst.Count > 0) { foreach (OfficeDataDo office in officeLst) { if (office.OfficeCode == saleData.doTbt_DraftSaleContract.QuotationOfficeCode || office.OfficeCode == saleData.doTbt_DraftSaleContract.OperationOfficeCode) { hasAuthority = true; break; } } } if (hasAuthority == false) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0063); } #endregion #region Check Contract status if (mode == doDraftSaleContractData.SALE_CONTRACT_MODE.DRAFT && saleData.doTbt_DraftSaleContract.DraftSaleContractStatus != ApprovalStatus.C_APPROVE_STATUS_RETURNED) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3100); } else if (mode == doDraftSaleContractData.SALE_CONTRACT_MODE.APPROVE) { if (saleData.doTbt_DraftSaleContract.DraftSaleContractStatus == ApprovalStatus.C_APPROVE_STATUS_APPROVED) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3246); } else if (saleData.doTbt_DraftSaleContract.DraftSaleContractStatus == ApprovalStatus.C_APPROVE_STATUS_REJECTED) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3244); } else if (saleData.doTbt_DraftSaleContract.DraftSaleContractStatus == ApprovalStatus.C_APPROVE_STATUS_RETURNED) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3245); } } #endregion #region Set Draft Sale E-mail saleData.doTbt_DraftSaleEmail = this.GetTbt_DraftSaleEmail(cond.QuotationTargetCodeLong); if (saleData.doTbt_DraftSaleEmail != null) { IEmployeeMasterHandler empHandler = ServiceContainer.GetService <IEmployeeMasterHandler>() as IEmployeeMasterHandler; List <tbm_Employee> emps = new List <tbm_Employee>(); foreach (tbt_DraftSaleEmail email in saleData.doTbt_DraftSaleEmail) { emps.Add(new tbm_Employee() { EmpNo = email.ToEmpNo }); } List <tbm_Employee> empList = empHandler.GetEmployeeList(emps); if (empList.Count > 0) { foreach (tbt_DraftSaleEmail email in saleData.doTbt_DraftSaleEmail) { foreach (tbm_Employee emp in empList) { if (emp.EmpNo == email.ToEmpNo) { email.EmailAddress = emp.EmailAddress; break; } } } } } #endregion #region Set Draft Sale Instrument saleData.doTbt_DraftSaleInstrument = this.GetTbt_DraftSaleInstrument(cond.QuotationTargetCodeLong); if (saleData.doTbt_DraftSaleInstrument.Count > 0) { InstrumentMappingList instMappingLst = new InstrumentMappingList(); instMappingLst.AddInstrument(saleData.doTbt_DraftSaleInstrument.ToArray()); IInstrumentMasterHandler ihandler = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; ihandler.InstrumentListMapping(instMappingLst); } #endregion #region Set Draft Sale Billing Target saleData.doTbt_DraftSaleBillingTarget = this.GetTbt_DraftSaleBillingTarget(cond.QuotationTargetCodeLong); #endregion #region Set Contract Customer ICustomerMasterHandler custhandler = ServiceContainer.GetService <ICustomerMasterHandler>() as ICustomerMasterHandler; if (CommonUtil.IsNullOrEmpty(saleData.doTbt_DraftSaleContract.PurchaserCustCode) == false) { List <doCustomerWithGroup> custLst = custhandler.GetCustomerWithGroup(saleData.doTbt_DraftSaleContract.PurchaserCustCode); if (custLst.Count > 0) { saleData.doPurchaserCustomer = custLst[0]; } } if (CommonUtil.IsNullOrEmpty(saleData.doTbt_DraftSaleContract.RealCustomerCustCode) == false) { List <doCustomerWithGroup> custLst = custhandler.GetCustomerWithGroup(saleData.doTbt_DraftSaleContract.RealCustomerCustCode); if (custLst.Count > 0) { saleData.doRealCustomer = custLst[0]; } } #endregion #region Set Site ISiteMasterHandler shandler = ServiceContainer.GetService <ISiteMasterHandler>() as ISiteMasterHandler; List <doSite> siteLst = shandler.GetSite(saleData.doTbt_DraftSaleContract.SiteCode, saleData.doTbt_DraftSaleContract.RealCustomerCustCode); if (siteLst.Count > 0) { saleData.doSite = siteLst[0]; } #endregion doGetQuotationDataCondition qcond = new doGetQuotationDataCondition(); qcond.QuotationTargetCode = cond.QuotationTargetCodeLong; qcond.Alphabet = saleData.doTbt_DraftSaleContract.Alphabet;//cond.Alphabet; qcond.ServiceTypeCode = ServiceType.C_SERVICE_TYPE_SALE; if (saleData.doTbt_DraftSaleContract.SaleProcessType == SaleProcessType.C_SALE_PROCESS_TYPE_ADD_SALE) { qcond.TargetCodeTypeCode = TargetCodeType.C_TARGET_CODE_TYPE_CONTRACT_CODE; } else { qcond.TargetCodeTypeCode = TargetCodeType.C_TARGET_CODE_TYPE_QTN_CODE; } qcond.ContractFlag = true; IQuotationHandler qhandler = ServiceContainer.GetService <IQuotationHandler>() as IQuotationHandler; dsQuotationData qData = qhandler.GetQuotationData(qcond); if (qData != null) { if (qData.dtTbt_QuotationTarget.UpdateDate != null) { saleData.LastUpdateDateQuotationData = qData.dtTbt_QuotationTarget.UpdateDate.Value; } } } if (saleData != null) { if (saleData.doTbt_DraftSaleContract != null) { #region Set Product Name IProductMasterHandler mhandler = ServiceContainer.GetService <IProductMasterHandler>() as IProductMasterHandler; List <View_tbm_Product> pLst = mhandler.GetTbm_ProductByLanguage( saleData.doTbt_DraftSaleContract.ProductCode, saleData.doTbt_DraftSaleContract.ProductTypeCode); if (pLst.Count > 0) { saleData.doTbt_DraftSaleContract.ProductName = pLst[0].ProductName; } #endregion #region Set Misc Name MiscTypeMappingList miscLst = new MiscTypeMappingList(); miscLst.AddMiscType(saleData.doTbt_DraftSaleContract); miscLst.AddMiscType(saleData.doTbt_DraftSaleInstrument.ToArray()); ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; chandler.MiscTypeMappingList(miscLst); #endregion #region Set Employee Name EmployeeMappingList empLst = new EmployeeMappingList(); empLst.AddEmployee(saleData.doTbt_DraftSaleContract); IEmployeeMasterHandler emphandler = ServiceContainer.GetService <IEmployeeMasterHandler>() as IEmployeeMasterHandler; emphandler.EmployeeListMapping(empLst); #endregion } } return(saleData); } catch (Exception) { throw; } }
/// <summary> /// Update operation to database.<br /> /// - Check is ChildInstrumentCode already register.<br /> /// - Check system suspending.<br /> /// - Add all added instrument to database.<br /> /// - Remove all removed instrument from database. /// </summary> /// <param name="ChildInstrumentCode"></param> /// <returns></returns> public ActionResult MAS100_Confirm() { ObjectResultData res = new ObjectResultData(); try { MAS100_ScreenParameter MAS100Param = GetScreenObject <MAS100_ScreenParameter>(); IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; if (MAS100Param.AddInstrumentExpansion.Count > 0) { List <tbm_InstrumentExpansion> list = hand.CheckExistInstrumentExpansion(MAS100Param.ParentInstrumentCode, MAS100Param.AddInstrumentExpansion); if (list.Count > 0) { StringBuilder sbChildInstrumentCode = new StringBuilder(""); foreach (tbm_InstrumentExpansion inst in list) { sbChildInstrumentCode.AppendFormat("\'{0}\',", inst.ChildInstrumentCode); } string param = sbChildInstrumentCode.Remove(sbChildInstrumentCode.Length - 1, 1).ToString(); res.AddErrorMessage(MessageUtil.MODULE_MASTER, MessageUtil.MessageList.MSG1021, new string[] { param }); return(Json(res)); } } res = this.checkSystemSuspending(); if (res.IsError) { return(Json(res)); } using (TransactionScope scope = new TransactionScope()) { //Insert instrument expansion data foreach (doInstrumentExpansion doInst in MAS100Param.AddInstrumentExpansion) { tbm_InstrumentExpansion tbmInst = new tbm_InstrumentExpansion(); tbmInst.InstrumentCode = MAS100Param.ParentInstrumentCode; tbmInst.ChildInstrumentCode = doInst.InstrumentCode; hand.InsertInstrumentExpansion(tbmInst); } //Delete instrument expansion data foreach (doInstrumentExpansion doInst in MAS100Param.DelInstrumentExpansion) { tbm_InstrumentExpansion tbmInst = new tbm_InstrumentExpansion(); tbmInst.InstrumentCode = MAS100Param.ParentInstrumentCode; tbmInst.ChildInstrumentCode = doInst.InstrumentCode; tbmInst.UpdateDate = doInst.UpdateDate; tbmInst.UpdateBy = doInst.UpdateBy; hand.DeleteInstrumentExpansion(tbmInst); } //clear data in session MAS100Param.SearchInstrumentExpansion = new List <doInstrumentExpansion>(); MAS100Param.AddInstrumentExpansion = new List <doInstrumentExpansion>(); MAS100Param.DelInstrumentExpansion = new List <doInstrumentExpansion>(); UpdateScreenObject(MAS100Param); //when finish with out error res.ResultData = MessageUtil.GetMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0046); scope.Complete(); } } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Add child instrument.<br /> /// - ChildInstrumentCode must not null or empty.<br /> /// - Check is ChildInstrumentCode already register.<br /> /// - Add to child instrument. /// </summary> /// <param name="ChildInstrumentCode"></param> /// <returns></returns> public ActionResult MAS100_Add(String ChildInstrumentCode) { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; try { if (CommonUtil.IsNullOrEmpty(ChildInstrumentCode)) { res.AddErrorMessage(MessageUtil.MODULE_MASTER, MAS100_Screen, MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, new string[] { "lblChildInstrumentCode" }, new string[] { "ChildInstrumentCode" }); return(Json(res)); } MAS100_ScreenParameter MAS100Param = GetScreenObject <MAS100_ScreenParameter>(); doInstrumentExpansion doInstSearch = MAS100Param.SearchInstrumentExpansion.Find(i => i.InstrumentCode.Trim().ToLower() == ChildInstrumentCode.Trim().ToLower()); if (!CommonUtil.IsNullOrEmpty(doInstSearch)) { res.AddErrorMessage(MessageUtil.MODULE_MASTER, MAS100_Screen, MessageUtil.MODULE_MASTER, MessageUtil.MessageList.MSG1026, new string[] { "lblChildInstrumentCode" }, new string[] { "ChildInstrumentCode" }); res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; return(Json(res)); } else { doInstrumentExpansion doInstDel = MAS100Param.DelInstrumentExpansion.Find(i => i.InstrumentCode.Trim().ToLower() == ChildInstrumentCode.Trim().ToLower()); if (!CommonUtil.IsNullOrEmpty(doInstDel)) { MAS100Param.DelInstrumentExpansion.Remove(doInstDel); MAS100Param.SearchInstrumentExpansion.Add(doInstDel); UpdateScreenObject(MAS100Param); res.ResultData = doInstDel; } else { IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; List <doInstrumentExpansion> doInstAdd = hand.GetChildInstrument(ChildInstrumentCode); if (doInstAdd.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_MASTER, MAS100_Screen, MessageUtil.MODULE_MASTER, MessageUtil.MessageList.MSG1020, new string[] { "lblChildInstrumentCode" }, new string[] { "ChildInstrumentCode" }); res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; return(Json(res)); } else { MAS100Param.AddInstrumentExpansion.Add(doInstAdd[0]); MAS100Param.SearchInstrumentExpansion.Add(doInstAdd[0]); UpdateScreenObject(MAS100Param); res.ResultData = doInstAdd[0]; } } } } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Validate before register.<br /> /// - Validate require field.<br /> /// - Check system suspending.<br /> /// - Check permission.<br /> /// - Check purchase order type.<br /> /// - Check memo.<br /> /// - Check total amount.<br /> /// - Check added instrument not empty. /// </summary> /// <param name="Cond"></param> /// <returns></returns> public ActionResult IVS250_ValidateRegis(doSpecifyPOrder250_Domes Cond) { ObjectResultData res = new ObjectResultData(); try { IVS250_ScreenParameter prm = GetScreenObject <IVS250_ScreenParameter>(); if (prm.lstInstrument == null) { prm.lstInstrument = new List <doInstrument250>(); } ICommonHandler ComH = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (ComH.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } if (!CheckUserPermission(ScreenID.C_INV_SCREEN_ID_REGISTER_PURCHASE_ORDER, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } if (Cond.PurchaseOrderType == PurchaseOrderType.C_PURCHASE_ORDER_TYPE_DOMESTIC) { ValidatorUtil.BuildErrorMessage(res, this, null); if (res.IsError) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } } else { doSpecifyPOrder250 Porder = CommonUtil.CloneObject <doSpecifyPOrder250_Domes, doSpecifyPOrder250>(Cond); ValidatorUtil.BuildErrorMessage(res, new object[] { Porder }, null); if (res.IsError) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } } //14.4.2 if (CommonUtil.IsNullOrEmpty(Cond.Memo)) { Cond.Memo = ""; } if (Cond.Memo.Replace(" ", "").Contains("\n\n\n\n")) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4022); res.ResultData = "4022"; return(Json(res)); } if (Cond.TotalAmount > Convert.ToDecimal(CommonValue.C_MAX_AMOUNT)) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4132); return(Json(res)); } decimal totalAmtBeforeDisc = prm.lstInstrument.Sum(d => d.Amount); if (Cond.Discount > totalAmtBeforeDisc) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4144, null, new string[] { "Discount" }); return(Json(res)); } if ((Cond.TotalAmount - Cond.WHT + Cond.Vat) < 0 && Cond.TotalAmount > 0) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4114, null, new string[] { "Vat", "WHT" }); return(Json(res)); } if (prm.lstInstrument.Count <= 0) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4133); return(Json(res)); } foreach (var i in prm.lstInstrument) { IInstrumentMasterHandler InsH = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; List <tbm_Instrument> lstInst = InsH.GetTbm_Instrument(i.InstrumentCode); if (lstInst[0].LineUpTypeCode == LineUpType.C_LINE_UP_TYPE_LOGICAL_DELETE) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4140, new string[] { lstInst[0].InstrumentCode }); return(Json(res)); } } foreach (var i in Cond.InstrumentData) { if (CommonUtil.IsNullOrEmpty(i.Unit)) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4145, null, new string[] { i.UnitCtrlID }); return(Json(res)); } } prm.Supplier.BankName = Cond.BankName; prm.Supplier.AccountNo = Cond.AccountNo; prm.Supplier.AccountName = Cond.AccountName; // get data from param to session prm.SpecifyPOrder250 = Cond; UpdateScreenObject(prm); res.ResultData = true; return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Using when Inventory stock-out intrument by project code /// </summary> /// <param name="strProjectCode"></param> /// <param name="doInstrumentList"></param> /// <param name="strStockOutMemo"></param> public void UpdateStockOutInstrument(string strProjectCode, List <doInstrument> doInstrumentList, string strStockOutMemo) { try { //1. Check mandatory data //strProjectCode and instrument at least 1 are require fields. doUpdateStockOutInstrumentData updateDo = new doUpdateStockOutInstrumentData(); updateDo.ProjectCode = strProjectCode; ApplicationErrorException.CheckMandatoryField(updateDo); if (CommonUtil.IsNullOrEmpty(strProjectCode)) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, "Project Code"); } if (doInstrumentList.Count <= 0) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, "Instrument"); } //2. Begin tran; //3. Validate business //3.1 Project code must exist in project table List <tbt_Project> projectList = base.GetTbt_Project(strProjectCode); //3.1.2. Check project exist //If doTbt_Project is null Then if (projectList.Count <= 0 || projectList[0] == null) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0011, strProjectCode); } //3.2 Project status must not be ‘Last completed’ or ‘Canceled’ //3.2.1. Project status must not be ‘Last completed’ if (projectList[0].ProjectStatus == ProjectStatus.C_PROJECT_STATUS_LASTCOMPLETE) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3075); } //3.2.2. Project status must not be ‘Canceled’ if (projectList[0].ProjectStatus == ProjectStatus.C_PROJECT_STATUS_CANCEL) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3076); } //3.3 Check exist in instrument master for all instruments in doInstrumentList //3.3.1. Loop all instrument in doInstrumentList IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; foreach (doInstrument doIn in doInstrumentList) { //3.3.1.1. Set local variable // blnExistInstrument = False //3.3.1.2. Check exist instrument in master List <bool?> blnExistInstrument = hand.CheckExistInstrument(doIn.InstrumentCode); //3.3.1.3. If blnExistInstrument = False Then if (blnExistInstrument[0].Value == false) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0011, doIn.InstrumentCode); } } using (TransactionScope scope = new TransactionScope()) { //Prepare insert data tbt_ProjectStockoutInstrument doInsert = new tbt_ProjectStockoutInstrument(); doInsert.ProjectCode = strProjectCode; //4. Insert/update data in project stock-out intrument table //4.1.1. Loop all instrument in doInstrumentList foreach (doInstrument doIn in doInstrumentList) { //4.1.1.2. Check exist project stock-out intrument table List <tbt_ProjectStockoutInstrument> doTbt_ProjectStockoutIntrument = this.GetTbt_ProjectStockoutInstrument(strProjectCode, doIn.InstrumentCode); if (doTbt_ProjectStockoutIntrument.Count <= 0) { //4.1.1.3. In case not exist: insert data to project stock-out intrument table doInsert.InstrumentCode = doIn.InstrumentCode; doInsert.InstrumentQty = doIn.InstrumentQty; this.InsertTbt_ProjectStockoutInstrument(doInsert); } else { //4.1.1.4. In case exist: update data to project stock-out intrument table doTbt_ProjectStockoutIntrument[0].InstrumentQty = doTbt_ProjectStockoutIntrument[0].InstrumentQty + doIn.InstrumentQty; this.UpdateTbt_ProjectStockoutInstrument(doTbt_ProjectStockoutIntrument[0]); } } //=============== TRS update 11/06/2012 ======================= tbt_ProjectStockOutMemo doStockoutMemo = new tbt_ProjectStockOutMemo(); doStockoutMemo.ProjectCode = strProjectCode; doStockoutMemo.Memo = strStockOutMemo; InsertTbt_ProjectStockOutMemo(doStockoutMemo); //============================================================= scope.Complete(); } } catch (Exception) { throw; } }
/// <summary> /// Get instrument data list by search condition /// </summary> /// <param name="cond"></param> /// <returns></returns> public ActionResult CMS170_Search(CMS170_SearchCondition cond) { ObjectResultData res = new ObjectResultData(); try { IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; ICommonHandler comHand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doMiscTypeCode> tmpCurrencies = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = MiscType.C_CURRENCT, ValueCode = "%" } }).ToList(); doInstrumentSearchCondition searchCon = new doInstrumentSearchCondition(); //Start: Prepare search condition---------------------------------------------------------- //Set parameter value for partial matching search textbox searchCon.InstrumentCode = (cond.InstrumentCode != null) ? cond.InstrumentCode.Replace('*', '%') : null; searchCon.InstrumentName = (cond.InstrumentName != null) ? cond.InstrumentName.Replace('*', '%') : null; searchCon.Maker = (cond.Maker != null) ? cond.Maker.Replace('*', '%') : null; searchCon.SupplierCode = cond.SupplierCode; searchCon.LineUpTypeCode = cond.LineUpTypeCode; searchCon.InstrumentFlag = new List <int?>(); if (cond.InstFlagMain) { searchCon.InstrumentFlag.Add(1); } if (cond.InstFlagOption) { searchCon.InstrumentFlag.Add(0); } searchCon.ExpansionType = new List <string>(); if (cond.ExpTypeHas) { searchCon.ExpansionType.Add(ExpansionType.C_EXPANSION_TYPE_PARENT); } if (cond.ExpTypeNo) { searchCon.ExpansionType.Add(ExpansionType.C_EXPANSION_TYPE_CHILD); } if (cond.ProdTypeSale) { searchCon.SaleFlag = 1; } if (cond.ProdTypeAlarm) { searchCon.RentalFlag = 1; } searchCon.InstrumentType = new List <string>(); if (cond.InstTypeGen) { searchCon.InstrumentType.Add(InstrumentType.C_INST_TYPE_GENERAL); } if (cond.InstTypeMon) { searchCon.InstrumentType.Add(InstrumentType.C_INST_TYPE_MONITOR); } if (cond.InstTypeMat) { searchCon.InstrumentType.Add(InstrumentType.C_INST_TYPE_MATERIAL); } //End: Prepare search condition---------------------------------------------------------- List <doInstrumentData> list = hand.GetInstrumentDataForSearch(searchCon); for (int i = 0; i < list.Count(); i++) { list[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } res.ResultData = CommonUtil.ConvertToXml <doInstrumentData>(list, "Common\\CMS170", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
public ActionResult MAS090_UpdateInstrument(MAS090_SaveInstrument instrument) { ObjectResultData res = new ObjectResultData(); try { #region Check system suspending res = checkSystemSuspending(); if (res.IsError) { return(Json(res)); } #endregion res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; #region Validate require field ValidatorUtil validator = new ValidatorUtil(this); if (!instrument.SaleFlag.HasValue) { instrument.SaleFlag = false; } if (!instrument.RentalFlag.HasValue) { instrument.RentalFlag = false; } if (!instrument.InstrumentFlag.HasValue) { instrument.InstrumentFlag = false; } if (!instrument.ZeroBahtAssetFlag.HasValue) { instrument.ZeroBahtAssetFlag = false; } if (!instrument.MaintenanceFlag.HasValue) { instrument.MaintenanceFlag = false; } if (!instrument.ControllerFlag.HasValue) { instrument.ControllerFlag = false; } if (InstrumentType.C_INST_TYPE_GENERAL.Equals(instrument.InstrumentTypeCode)) { if (instrument.LineUpTypeCode == null) { validator.AddErrorMessage(MessageUtil.MODULE_MASTER, MAS090_Screen, MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, "RLineUpTypeCode", "lblLineUpType", "LineUpTypeCode"); } if (instrument.ExpansionTypeCode == null) { validator.AddErrorMessage(MessageUtil.MODULE_MASTER, MAS090_Screen, MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, "RExpansionTypeCode", "lblExpansionType", "ExpansionTypeCode"); } } ValidatorUtil.BuildErrorMessage(res, validator); if (res.IsError) { return(Json(res)); } #endregion #region If Have change expansion type instrument.currentExpansionTypeCode = instrument.currentExpansionTypeCode == "" ? null : instrument.currentExpansionTypeCode; IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; if ((instrument.currentExpansionTypeCode == null && instrument.ExpansionTypeCode != null) || (instrument.ExpansionTypeCode != null && !instrument.currentExpansionTypeCode.Equals(instrument.ExpansionTypeCode))) { List <bool?> listCheck = hand.CheckExistParentChild(instrument.InstrumentCode); if (listCheck[0].Value) { res.AddErrorMessage(MessageUtil.MODULE_MASTER, MessageUtil.MessageList.MSG1022); return(Json(res)); } } #endregion //instrument.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; //instrument.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; MAS090_ScreenParameter MAS090Param = GetScreenObject <MAS090_ScreenParameter>(); instrument.UpdateDate = MAS090Param.updateDate; // add by Jirawat Jannet on 216-12-23 #region Set amount and currency type if (instrument.SaleUnitPriceCurrencyType == CurrencyUtil.C_CURRENCY_US) { instrument.SaleUnitPriceUsd = instrument.SaleUnitPrice; instrument.SaleUnitPrice = null; } else { instrument.SaleUnitPriceUsd = null; } if (instrument.RentalUnitPriceCurrencyType == CurrencyUtil.C_CURRENCY_US) { instrument.RentalUnitPriceUsd = instrument.RentalUnitPrice; instrument.RentalUnitPrice = null; } else { instrument.RentalUnitPriceUsd = null; } if (instrument.AddUnitPriceCurrencyType == CurrencyUtil.C_CURRENCY_US) { instrument.AddUnitPriceUsd = instrument.AddUnitPrice; instrument.AddUnitPrice = null; } else { instrument.AddUnitPriceUsd = null; } if (instrument.RemoveUnitPriceCurrencyType == CurrencyUtil.C_CURRENCY_US) { instrument.RemoveUnitPriceUsd = instrument.RemoveUnitPrice; instrument.RemoveUnitPrice = null; } else { instrument.RemoveUnitPriceUsd = null; } if (instrument.MoveUnitPriceCurrencyType == CurrencyUtil.C_CURRENCY_US) { instrument.MoveUnitPriceUsd = instrument.MoveUnitPrice; instrument.MoveUnitPrice = null; } else { instrument.MoveUnitPriceUsd = null; } #endregion List <tbm_Instrument> updatedList = hand.UpdateInstrument(instrument); if (updatedList.Count > 0) { res.ResultData = true; } } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Validate before add instrument.<br /> /// - Validate require field.<br /> /// - Check quantity.<br /> /// - Check instrument code.<br /> /// - Check is exist instrument.<br /> /// - Check cannot add more than 15 instruments. /// </summary> /// <param name="Cond"></param> /// <returns></returns> public ActionResult IVS250_ValidateAddInst(doInstrument250 Cond) { ObjectResultData res = new ObjectResultData(); try { IVS250_ScreenParameter prm = GetScreenObject <IVS250_ScreenParameter>(); if (prm.lstInstrument == null) { prm.lstInstrument = new List <doInstrument250>(); } ValidatorUtil.BuildErrorMessage(res, this, null); if (res.IsError) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } //add new 25/11/2015 adunyarich IInventoryHandler invH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; IInstrumentMasterHandler InsH = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; List <tbm_Instrument> lstInst = InsH.GetTbm_Instrument(Cond.InstrumentCode.Trim()); if (lstInst.FirstOrDefault().LineUpTypeCode == "3") { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4149, new string[] { Cond.InstrumentCode }); return(Json(res)); } if (res.IsError) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } if (Cond.OrderQty.Value <= 0) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4020); return(Json(res)); } if ((!CommonUtil.IsNullOrEmpty(Cond.InstrumentCode)) && CommonUtil.IsNullOrEmpty(Cond.dtNewInstrument)) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0082, new string[] { Cond.InstrumentCode }, new string[] { "InstrumentCode" }); return(Json(res)); } if (CommonUtil.IsNullOrEmpty(Cond.Unit)) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4145, null, new string[] { "Unit" }); return(Json(res)); } List <doInstrument250> exist = (from c in prm.lstInstrument where c.InstrumentCode == Cond.InstrumentCode select c).ToList <doInstrument250>(); if (exist.Count > 0) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4038); return(Json(res)); } //if (prm.lstInstrument.Count >= 15) //{ // res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4021); // return Json(res); //} Cond.Amount = (Cond.OrderQty ?? 0) * (Cond.UnitPrice ?? 0); prm.lstInstrument.Add(Cond); UpdateScreenObject(prm); res.ResultData = Cond; return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Register purchase order.<br /> /// - Check system suspending.<br /> /// - Check permission.<br /> /// - Insert new purchase order.<br /> /// - Generate report. /// </summary> /// <returns></returns> public ActionResult IVS250_cmdConfirm() { ObjectResultData res = new ObjectResultData(); try { IVS250_ScreenParameter prm = GetScreenObject <IVS250_ScreenParameter>(); if (prm.lstInstrument == null) { prm.lstInstrument = new List <doInstrument250>(); } if (prm.SpecifyPOrder250 == null) { prm.SpecifyPOrder250 = new doSpecifyPOrder250(); } //Check Suspend ICommonHandler ComH = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (ComH.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } if (!CheckUserPermission(ScreenID.C_INV_SCREEN_ID_REGISTER_PURCHASE_ORDER, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } foreach (var i in prm.lstInstrument) { IInstrumentMasterHandler InsH = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; List <tbm_Instrument> lstInst = InsH.GetTbm_Instrument(i.InstrumentCode); if (lstInst[0].LineUpTypeCode == LineUpType.C_LINE_UP_TYPE_LOGICAL_DELETE) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4140, new string[] { lstInst[0].InstrumentCode }); return(Json(res)); } } using (TransactionScope scope = new TransactionScope()) { try { IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; string strPurchaseOrderNo = InvH.GeneratePurchaseOrderNo(prm.Supplier.RegionCode); tbt_PurchaseOrder doPurchaseOrder = new tbt_PurchaseOrder(); doPurchaseOrder.PurchaseOrderNo = strPurchaseOrderNo; doPurchaseOrder.PurhcaseOrderType = prm.SpecifyPOrder250.PurchaseOrderType; doPurchaseOrder.PurchaseOrderStatus = PurchaseOrderStatus.C_PURCHASE_ORDER_STATUS_WAIT_TO_RECEIVE; doPurchaseOrder.SupplierCode = prm.SpecifyPOrder250.SupplierCode; doPurchaseOrder.TransportType = prm.SpecifyPOrder250.TransportType; doPurchaseOrder.Currency = prm.SpecifyPOrder250.Currency; doPurchaseOrder.BankName = prm.Supplier.BankName; doPurchaseOrder.AccountNo = prm.Supplier.AccountNo; doPurchaseOrder.AccountName = prm.Supplier.AccountName; doPurchaseOrder.ShippingDate = prm.SpecifyPOrder250.AdjustDueDate; doPurchaseOrder.Amount = prm.SpecifyPOrder250.TotalAmount; if (prm.SpecifyPOrder250.PurchaseOrderType == PurchaseOrderType.C_PURCHASE_ORDER_TYPE_DOMESTIC || (prm.SpecifyPOrder250.PurchaseOrderType == PurchaseOrderType.C_PURCHASE_ORDER_TYPE_SECOM && prm.SpecifyPOrder250.Currency == CurrencyType.C_CURRENCY_TYPE_THB)) { doPurchaseOrder.Vat = prm.SpecifyPOrder250.Vat; } doPurchaseOrder.Memo = prm.SpecifyPOrder250.Memo; doPurchaseOrder.CreateBy = CommonUtil.dsTransData.dtUserData.EmpNo; doPurchaseOrder.CreateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; doPurchaseOrder.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; doPurchaseOrder.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; doPurchaseOrder.WHT = prm.SpecifyPOrder250.WHT; doPurchaseOrder.Discount = prm.SpecifyPOrder250.Discount; List <tbt_PurchaseOrder> lst = new List <tbt_PurchaseOrder>(); lst.Add(doPurchaseOrder); List <tbt_PurchaseOrder> dolstPurchaseOrder = InvH.InsertTbt_PurchaseOrder(lst); if (dolstPurchaseOrder.Count <= 0) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0148, new string[] { TableName.C_TBL_NAME_INV_PURCHASE }); } List <tbt_PurchaseOrderDetail> lstDetail = new List <tbt_PurchaseOrderDetail>(); //foreach (doInstrument250 i in prm.lstInstrument) foreach (doInstrument250 i in prm.SpecifyPOrder250.InstrumentData) //Modify by Jutarat A. on 28102013 { tbt_PurchaseOrderDetail OrderDetail = new tbt_PurchaseOrderDetail(); OrderDetail.PurchaseOrderNo = strPurchaseOrderNo; OrderDetail.InstrumentCode = i.InstrumentCode; OrderDetail.InstrumentName = i.InstrumentName; //Add by Jutarat A. on 28102013 OrderDetail.Memo = i.Memo; //Add by Jutarat A. on 28102013 OrderDetail.UnitPrice = i.UnitPrice; OrderDetail.FirstOrderQty = i.OrderQty; OrderDetail.ModifyOrderQty = null; OrderDetail.ReceiveQty = 0; OrderDetail.CreateBy = CommonUtil.dsTransData.dtUserData.EmpNo; OrderDetail.CreateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; OrderDetail.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; OrderDetail.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; OrderDetail.Unit = i.Unit; OrderDetail.OriginalUnitPrice = i.OriginalUnitPrice; OrderDetail.Amount = i.Amount; lstDetail.Add(OrderDetail); } List <tbt_PurchaseOrderDetail> doPurchaseOrderDetail = InvH.InsertTbt_PurchaseOrderDetail(lstDetail); if (doPurchaseOrderDetail.Count <= 0) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0148, new string[] { TableName.C_TBL_NAME_INV_PURCHASE_DETAIL }); } //if (prm.SpecifyPOrder250.PurchaseOrderType == PurchaseOrderType.C_PURCHASE_ORDER_TYPE_SECOM) //{ // IInventoryDocumentHandler handlerInventoryDocument = ServiceContainer.GetService<IInventoryDocumentHandler>() as IInventoryDocumentHandler; // string reportPath = handlerInventoryDocument.GenerateIVR190FilePath(strPurchaseOrderNo, prm.office.OfficeCode, CommonUtil.dsTransData.dtUserData.EmpNo, CommonUtil.dsTransData.dtOperationData.ProcessDateTime); // prm.slipNo = strPurchaseOrderNo; // prm.reportFilePath = reportPath; //} //else if (prm.SpecifyPOrder250.PurchaseOrderType == PurchaseOrderType.C_PURCHASE_ORDER_TYPE_DOMESTIC) //{ // IInventoryDocumentHandler handlerInventoryDocument = ServiceContainer.GetService<IInventoryDocumentHandler>() as IInventoryDocumentHandler; // string reportPath = handlerInventoryDocument.GenerateIVR191FilePath(strPurchaseOrderNo, prm.office.OfficeCode, CommonUtil.dsTransData.dtUserData.EmpNo, CommonUtil.dsTransData.dtOperationData.ProcessDateTime); // prm.slipNo = strPurchaseOrderNo; // prm.reportFilePath = reportPath; //} IInventoryDocumentHandler handlerInventoryDocument = ServiceContainer.GetService <IInventoryDocumentHandler>() as IInventoryDocumentHandler; string reportPath = handlerInventoryDocument.GenerateIVR192FilePath(strPurchaseOrderNo, prm.office.OfficeCode, CommonUtil.dsTransData.dtUserData.EmpNo, CommonUtil.dsTransData.dtOperationData.ProcessDateTime); prm.slipNo = strPurchaseOrderNo; prm.reportFilePath = reportPath; scope.Complete(); res.ResultData = strPurchaseOrderNo; return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } } } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }