/// <summary> /// Check permission for access screen BLS030 /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult BLS030_Authority(BLS030_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; CommonUtil cm = new CommonUtil(); if (chandler.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } if (!CheckUserPermission(ScreenID.C_SCREEN_ID_REGIST_BILL_BASIC, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } if (param.CallerScreenID != ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET) { param.ContractProjectCodeShort = ""; param.BillingClientCode = ""; param.BillingTargetRunningNo = ""; } return(InitialScreenEnvironment <BLS030_ScreenParameter>("BLS030", param, res)); }
/// <summary> /// Check suspend, authority and resume of MAS130 /// </summary> /// <param name="screenParam"></param> /// <returns></returns> public ActionResult MAS130_Authority(MAS130_ScreenParameter screenParam) { ObjectResultData res = new ObjectResultData(); try { ICommonHandler commonHandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (commonHandler.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } if (!(CheckUserPermission(ScreenID.C_SCREEN_ID_MAINTAIN_SAFETY_STOCK_INFO, FunctionID.C_FUNC_ID_VIEW) == true || CheckUserPermission(ScreenID.C_SCREEN_ID_MAINTAIN_SAFETY_STOCK_INFO, FunctionID.C_FUNC_ID_ADD) == true || CheckUserPermission(ScreenID.C_SCREEN_ID_MAINTAIN_SAFETY_STOCK_INFO, FunctionID.C_FUNC_ID_EDIT) == true )) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } return(InitialScreenEnvironment <MAS130_ScreenParameter>("MAS130", screenParam, res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Stop checking.<br /> /// - Check enable start button.<br /> /// - Check system suspending.<br /> /// - Check status of last checking schedule must be implementing.<br /> /// - Update inventory checking schedule. /// </summary> /// <returns></returns> public ActionResult IVS150_StopChecking() { ObjectResultData res = new ObjectResultData(); string result = "0"; try { var enableButton = IVS150_GetPermission(); if (enableButton.EnableBtnStopChecking) { IInventoryHandler handlerInventory = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; // Is suspend ? ICommonHandler handler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (handler.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } var list = handlerInventory.GetLastCheckingSchedule(); if (list.Count > 0) { if (list[0].CheckingStatus != CheckingStatus.C_INV_CHECKING_STATUS_IMPLEMENTING) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4075); return(Json(res)); } // update field for update Tbt_InventoryCheckingSchedule list[0].CheckingFinishDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; list[0].CheckingStatus = CheckingStatus.C_INV_CHECKING_STATUS_STOPPING; list[0].FinishCheckingBy = CommonUtil.dsTransData.dtUserData.EmpNo; list[0].UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; list[0].UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; using (TransactionScope scope = new TransactionScope()) { string xml = CommonUtil.ConvertToXml_Store(list); handlerInventory.UpdateTbt_InventoryCheckingSchedule(xml); scope.Complete(); result = "1"; } } } res.ResultData = result; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Valid before register new project data /// </summary> /// <returns></returns> public ActionResult CTS230_ConfirmRegisterProject() { ObjectResultData res = new ObjectResultData(); try { CTS230_ScreenParameter param = GetScreenObject <CTS230_ScreenParameter>(); //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_SCREEN_ID_PROJ_NEW, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0063); return(Json(res)); } string ProjectCode = RegisterData(param.InitialData.doRegisterData); res.ResultData = ProjectCode; return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Check screen authority and permission /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult ICS140_Authority(ICS140_ScreenParameter param) { ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; IIncomeHandler iincomeHandler = ServiceContainer.GetService <IIncomeHandler>() as IIncomeHandler; ObjectResultData res = new ObjectResultData(); if (handlerCommon.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } // Check User Permission if (CheckUserPermission(ScreenID.C_SCREEN_ID_DEBT_TRACING, FunctionID.C_FUNC_ID_OPERATE) == false) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } param.IsHQUser = false; if (CommonUtil.dsTransData != null && CommonUtil.dsTransData.dtUserData != null) { var permission = iincomeHandler.GetTbm_DebtTracingPermission(CommonUtil.dsTransData.dtUserData.EmpNo); if (permission != null && permission.Count > 0) { param.IsHQUser = true; } } return(InitialScreenEnvironment <ICS140_ScreenParameter>("ICS140", param, res)); }
/// <summary> /// Authority screen CTS230 /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult CTS230_Authority(CTS230_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { ICommonHandler comhand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (comhand.IsSystemSuspending()) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } if (!CheckUserPermission(ScreenID.C_SCREEN_ID_PROJ_NEW, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } } catch (Exception ex) { res.AddErrorMessage(ex); } return(InitialScreenEnvironment <CTS230_ScreenParameter>("CTS230", param, res)); }
/// <summary> /// Check suspend, authority and resume /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult BLS010_Authority(BLS010_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { ///////// Check Suspending ////////// ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (chandler.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } /////// Check permission ////////// if (!CheckUserPermission(ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } } catch (Exception ex) { res.AddErrorMessage(ex); } return(InitialScreenEnvironment <BLS010_ScreenParameter>("BLS010", param, res)); }
/// <summary> /// Checking user's permission. /// </summary> /// <param name="param">Screen's parameter.</param> /// <returns>Return ActionResult of the screen.</returns> public ActionResult IVS288_Authority(IVS288_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { ICommonHandler srvCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (srvCommon.IsSystemSuspending()) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); //res.ResultData = MessageUtil.MessageList.MSG0049.ToString(); return(Json(res)); } if (!CheckUserPermission(ScreenID.C_INV_SCREEN_ID_IN_STOCK_REPORT, FunctionID.C_FUNC_ID_OPERATE)) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); //res.ResultData = MessageUtil.MessageList.MSG0053.ToString(); return(Json(res)); } } catch (Exception ex) { res.AddErrorMessage(ex); } return(InitialScreenEnvironment <IVS288_ScreenParameter>("IVS288", param, res)); }
/// <summary> /// Event when click register button /// </summary> /// <param name="data">screen input information</param> /// <returns></returns> public ActionResult ICS100_Register(ICS100_RegisterData data) { ICS100_ScreenParameter param = GetScreenObject <ICS100_ScreenParameter>(); ICS100_RegisterData RegisterData = new ICS100_RegisterData(); CommonUtil comUtil = new CommonUtil(); ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; ObjectResultData resByIssue = new ObjectResultData(); ObjectResultData resByInvoice = new ObjectResultData(); try { // Common Check Sequence // System Suspend ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (handlerCommon.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } // Check User Permission // revise ScreenID. search value by "<SECOM_AJIS.Common.Util.ConstantValue.ScreenID>" //if (!CheckUserPermission(ScreenID.C_SCREEN_ID_MANAGE_MONEY_COLLECTION, FunctionID.C_FUNC_ID_OPERATE) ) //{ // res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); // return Json(res); //} // Save RegisterData in session if (param != null) { param.RegisterData = data; } // return "1" to js is every thing OK if (res.MessageList == null || res.MessageList.Count == 0) { res.ResultData = "1"; } else { res.ResultData = "0"; } return(Json(res)); } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Validate input data before save to database (BLS090) /// </summary> /// <param name="RegisterData"></param> /// <returns></returns> public ActionResult BLS090_Register(List <BLS090_DetailData> RegisterData) { CommonUtil cm = new CommonUtil(); ObjectResultData res = new ObjectResultData(); List <dtBillingContract> list = new List <dtBillingContract>(); try { BLS090_ScreenParameter param = GetScreenObject <BLS090_ScreenParameter>(); // Check permission if (CheckUserPermission(ScreenID.C_INV_SCREEN_ID_TRANSFER_BUFFER, FunctionID.C_FUNC_ID_OPERATE) == false) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } // Is suspend ? ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (handlerCommon.IsSystemSuspending()) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; var newFee = RegisterData.Sum(m => m.NewBillingFee); // Akat K. : compare to OrderContractFee //if (newFee != param.TotalFee) if (newFee != param.OrderContractFee) { res.AddErrorMessage(MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6058); return(Json(res)); } param.RegisterData = RegisterData; for (int i = 0; i < param.DetailData.Count; i++) { param.DetailData[i].NewMonthlyBillingAmountCurrency = RegisterData[i].NewMonthlyBillingAmountCurrency; } res.ResultData = "1"; } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// - Check system suspending.<br /> /// - Check user permission for screen IVS060.<br /> /// - Check freezed data.<br /> /// - Check started stock checking.<br /> /// - Get inventory head office. /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult IVS060_Authority(IVS060_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { 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_TRANSFER_OFFICE, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } IInventoryHandler handInven = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; if (handInven.CheckFreezedData() == 0) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4002); return(Json(res)); } if (handInven.CheckStartedStockChecking() == 0) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4003); return(Json(res)); } List <doOffice> IvHeadOffice = handInven.GetInventoryHeadOffice(); if (IvHeadOffice.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4016); return(Json(res)); } param.office = IvHeadOffice[0]; List <doOffice> SrinakarinOffice = handInven.GetInventorySrinakarinOffice(); if (SrinakarinOffice.Count > 0) { param.SrinakarinOfficeCode = SrinakarinOffice[0]; } } catch (Exception ex) { res.AddErrorMessage(ex); } return(InitialScreenEnvironment <IVS060_ScreenParameter>("IVS060", param, res)); }
//Change to Screen param //public CTS090_RegisterCancelTargetData CTS090_Session //{ // get // { // return CommonUtil.GetSession<CTS090_RegisterCancelTargetData>(ScreenID.C_SCREEN_ID_REGISTER_CANCEL_SALE_CONTRACT); // } // set // { // CommonUtil.SetSession(ScreenID.C_SCREEN_ID_REGISTER_CANCEL_SALE_CONTRACT, value); // } //} /// <summary> /// Check system is suspending /// </summary> /// <param name="res"></param> /// <returns></returns> private bool CheckIsSuspending(ObjectResultData res) { ICommonHandler handler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (handler.IsSystemSuspending()) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(true); } return(false); }
/// <summary> /// Validate before show confirm screen.<br /> /// </summary> /// <param name="cond"></param> /// <param name="SlipNo"></param> /// <returns></returns> public ActionResult RegisterIvs012(List <doIvs012Inventory> cond, string SlipNo, string VoucherNo, DateTime?VoucherDate) { ObjectResultData res = new ObjectResultData(); IVS012_ScreenParameter prm = GetScreenObject <IVS012_ScreenParameter>(); try { ICommonHandler comh = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; //3.1 if (comh.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } // Requested by user @ 2015/08/04, allowed 0 price. //var qErrorCtrls = cond.Where(i => // ( // i.InstrumentArea == InstrumentArea.C_INV_AREA_NEW_SALE // || i.InstrumentArea == InstrumentArea.C_INV_AREA_NEW_RENTAL // || i.InstrumentArea == InstrumentArea.C_INV_AREA_NEW_DEMO // ) // && i.InstrumentTotalPrice <= 0 // && i.InstrumentTotalPriceEnable == true //).Select(i => i.txtInstrumentTotalPrice); //if (qErrorCtrls.Count() > 0) //{ // res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; // res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4052, null, qErrorCtrls.ToArray()); // return Json(res); //} IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; List <tbt_InventorySlip> lstInventorySlip = InvH.GetTbt_InventorySlip(SlipNo); // Monthly Price @ 2015 : Allow to register asset anytime until LockFlag = true if (lstInventorySlip.Count > 0 && lstInventorySlip[0].LockFlag == true) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4148); return(Json(res)); } prm.SlipNo = SlipNo; prm.lstIVS012Inventory = cond; prm.VoucherNo = VoucherNo; prm.VoucherDate = VoucherDate; return(Json(true)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
private ObjectResultData checkSystemSuspending() { ObjectResultData res = new ObjectResultData(); ICommonHandler commonHandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; bool bSuspendingStatus = commonHandler.IsSystemSuspending(); if (bSuspendingStatus) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); } return(res); }
/// <summary> /// Event when click register button /// </summary> /// <param name="data">screen input information</param> /// <returns></returns> public ActionResult ICS031_Register(ICS031_RegisterData data) { ICS031_ScreenParameter param = GetScreenObject <ICS031_ScreenParameter>(); ICS031_RegisterData RegisterData = new ICS031_RegisterData(); CommonUtil comUtil = new CommonUtil(); ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; ObjectResultData resByIssue = new ObjectResultData(); ObjectResultData resByInvoice = new ObjectResultData(); try { // System Suspend ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; IIncomeHandler iincomeHandler = ServiceContainer.GetService <IIncomeHandler>() as IIncomeHandler; if (handlerCommon.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } // Save RegisterData in session if (param != null) { param.RegisterData = data; } // return "1" to js is every thing OK if (res.MessageList == null || res.MessageList.Count == 0) { res.ResultData = "1"; } else { res.ResultData = "0"; } return(Json(res)); } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// - Check system suspending.<br /> /// - Check user permission for screen IVS160.<br /> /// - Check freezed data.<br /> /// - Check implement stock checking. /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult IVS160_Authority(IVS160_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { // Is suspend ? ICommonHandler handler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (handler.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } // Check permission if (CheckUserPermission(ScreenID.C_INV_SCREEN_ID_CHECKING_INSTRUMENT, FunctionID.C_FUNC_ID_OPERATE) == false) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } // Check freezed data IInventoryHandler handlerInventory = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; if (handlerInventory.CheckFreezedData() == 0) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4002); return(Json(res)); } //// Check for the stock is started //if (handlerInventory.CheckStartedStockChecking() == 0) //{ // res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4003); // return Json(res); //} // Check for the implement stock checkint if (handlerInventory.CheckImplementStockChecking() == 0) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4003); return(Json(res)); } } catch (Exception ex) { res.AddErrorMessage(ex); } return(InitialScreenEnvironment <IVS160_ScreenParameter>("IVS160", param, res)); }
/// <summary> /// Checking user's permission. /// </summary> /// <param name="param">Screen's parameter.</param> /// <returns>Return ActionResult of the screen.</returns> public ActionResult IVS240_Authority(IVS240_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { ICommonHandler srvCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (srvCommon.IsSystemSuspending()) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); //res.ResultData = MessageUtil.MessageList.MSG0049.ToString(); return(Json(res)); } if (!CheckUserPermission(ScreenID.C_INV_SCREEN_ID_PICKING_LIST, FunctionID.C_FUNC_ID_OPERATE)) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); //res.ResultData = MessageUtil.MessageList.MSG0053.ToString(); return(Json(res)); } IInventoryHandler srvInv = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; if (srvInv.CheckFreezedData() == 0) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4002); //res.ResultData = MessageUtil.MessageList.MSG4002.ToString(); return(Json(res)); } if (srvInv.CheckStartedStockChecking() == 0) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4003); //res.ResultData = MessageUtil.MessageList.MSG4003.ToString(); return(Json(res)); } } catch (Exception ex) { res.AddErrorMessage(ex); } return(InitialScreenEnvironment <IVS240_ScreenParameter>("IVS240", param, res)); }
/// <summary> /// Check screen authority and permission /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult CTS030_Authority(CTS030_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { #region Check Permission IApprovalPermissionHandler handler = ServiceContainer.GetService <IApprovalPermissionHandler>() as IApprovalPermissionHandler; //bool bIsPermitted = handler.isPermittedIPAddress(); bool bIsPermitted = isPermittedIPAddress(); if (!bIsPermitted || !CheckUserPermission(ScreenID.C_SCREEN_ID_SEARCH_APPROVE, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } #endregion #region Check is Suspending ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (chandler.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } #endregion #region Get approval status misc IMasterHandler mHand = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler; List <tbs_MiscellaneousTypeCode> appvList = mHand.GetTbs_MiscellaneousTypeCode(MiscType.C_APPROVE_STATUS); CommonUtil.MappingObjectLanguage <tbs_MiscellaneousTypeCode>(appvList); param.approvalStatus = appvList; #endregion } catch (Exception ex) { res.AddErrorMessage(ex); } return(InitialScreenEnvironment <CTS030_ScreenParameter>("CTS030", param, res)); }
/// <summary> /// - Check system suspending.<br /> /// - Check user permission for screen IVS250.<br /> /// - Get inventory head office. /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult IVS250_Authority(IVS250_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { GetScreenObject <IVS250_ScreenParameter>(); 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)); } IInventoryHandler handInven = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; List <doOffice> IvHeadOffice = handInven.GetInventoryHeadOffice(); if (IvHeadOffice.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4016); return(Json(res)); } ICommonHandler ComH = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doSystemConfig> config = ComH.GetSystemConfig(ConfigName.C_VAT_THB); param.m_VatTHB = Convert.ToDecimal(config[0].ConfigValue); param.office = IvHeadOffice[0]; List <doSystemConfig> configWht = ComH.GetSystemConfig(ConfigName.C_WHT); param.m_WHT = Convert.ToDecimal(configWht[0].ConfigValue); } catch (Exception ex) { res.AddErrorMessage(ex); } return(InitialScreenEnvironment <IVS250_ScreenParameter>("IVS250", param, res)); }
/// <summary> /// Check screen authority and permission /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult ICS031_Authority(ICS031_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); // System Suspend ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (handlerCommon.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } // Permission if (!CheckUserPermission(ScreenID.C_SCREEN_ID_SET_UNPAID_TARGET, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } return(InitialScreenEnvironment <ICS031_ScreenParameter>("ICS031", param, res)); }
/// <summary> /// Check screen authority and permission /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult ICS110_Authority(ICS110_ScreenParameter param) { ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; IIncomeHandler iincomeHandler = ServiceContainer.GetService <IIncomeHandler>() as IIncomeHandler; ObjectResultData res = new ObjectResultData(); if (handlerCommon.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } // Check User Permission if (CheckUserPermission(ScreenID.C_SCREEN_ID_MATCH_WHT, FunctionID.C_FUNC_ID_OPERATE) == false) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } return(InitialScreenEnvironment <ICS110_ScreenParameter>("ICS110", param, res)); }
/// <summary> /// Check permission for access screen BLS090 /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult BLS090_Authority(BLS090_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); // Is suspend ? ICommonHandler handler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (handler.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } // Check permission if (CheckUserPermission(ScreenID.C_SCREEN_ID_EDIT_MONTHLY, FunctionID.C_FUNC_ID_OPERATE) == false) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } return(InitialScreenEnvironment <object>("BLS090", param, res)); }
/// <summary> /// Check ics032 popup screen authority and permission /// </summary> /// <param name=""></param> /// <returns></returns> public ActionResult ICS030_CheckForICS032() { // 1 = ok // 2 = Suspending // 3 = no permission string ResultDataFlag = "1"; ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; try { // System Suspend ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (handlerCommon.IsSystemSuspending()) { ResultDataFlag = "2"; res.ResultData = ResultDataFlag; return(Json(res)); } if (!CheckUserPermission(ScreenID.C_SCREEN_ID_DEBT_TRACING_INFO, FunctionID.C_FUNC_ID_OPERATE)) { ResultDataFlag = "3"; res.ResultData = ResultDataFlag; return(Json(res)); } res.ResultData = ResultDataFlag; return(Json(res)); } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Check screen authority and permission /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult CTS190_Authority(CTS190_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); //doContractInfoCondition param = new doContractInfoCondition(); // Check permission if (!CheckUserPermission(ScreenID.C_SCREEN_ID_CP32, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } // Check system is syspend ? try { ICommonHandler handler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; bool isSuspend = handler.IsSystemSuspending(); if (isSuspend) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } } catch { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } return(InitialScreenEnvironment <CTS190_ScreenParameter>("CTS190", param, res)); }
/// <summary> /// Register stock in asset.<br /> /// - Update inventory current.<br /> /// - Update inventory slip.<br /> /// - Update account transfer sample/new instrument. /// </summary> /// <returns></returns> public ActionResult cmdConfirmIVS012() { IVS012_ScreenParameter prm = GetScreenObject <IVS012_ScreenParameter>(); List <doIvs012Inventory> Cond = prm.lstIVS012Inventory; ObjectResultData res = new ObjectResultData(); using (TransactionScope scope = new TransactionScope()) { decimal decMovingAveragePrice = 0; try { ICommonHandler comh = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; if (comh.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } #region Monthly Price @ 2015 : C_INV_SHELF_NO_NOT_PRICE has no longer been used. ////5.3 //List<tbt_InventoryCurrent> SourceCurrent = InvH.GetTbt_InventoryCurrent(prm.office.OfficeCode, InstrumentLocation.C_INV_LOC_INSTOCK, null, ShelfNo.C_INV_SHELF_NO_NOT_PRICE, null); // //foreach (doIvs012Inventory i in Cond) //{ // List<tbt_InventoryCurrent> OriginCurrent = (from c in SourceCurrent where i.InstrumentCode == c.InstrumentCode && i.InstrumentArea == c.AreaCode select c).ToList<tbt_InventoryCurrent>(); // // if (OriginCurrent.Count > 0) // { // OriginCurrent[0].InstrumentQty = OriginCurrent[0].InstrumentQty - i.StockInQty; // OriginCurrent[0].UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; // OriginCurrent[0].UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; // InvH.UpdateTbt_InventoryCurrent(OriginCurrent); // } //} // //List<tbt_InventoryCurrent> exCurrent = InvH.GetTbt_InventoryCurrent(prm.office.OfficeCode, InstrumentLocation.C_INV_LOC_INSTOCK, null, ShelfNo.C_INV_SHELF_NO_NOT_MOVE_SHELF, null); // //foreach (doIvs012Inventory i in Cond) //{ // var current = exCurrent.Where(c => i.InstrumentCode == c.InstrumentCode && i.InstrumentArea == c.AreaCode); // if (current.Count() > 0) // { // tbt_InventoryCurrent InvCurrent = current.First(); // InvCurrent.InstrumentQty = (InvCurrent.InstrumentQty.HasValue ? InvCurrent.InstrumentQty : 0) + i.StockInQty; // InvCurrent.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; // InvCurrent.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; // // InvH.UpdateTbt_InventoryCurrent(new List<tbt_InventoryCurrent>(new tbt_InventoryCurrent[] { InvCurrent })); // } // else // { // tbt_InventoryCurrent InvCurrent = new tbt_InventoryCurrent(); // InvCurrent.OfficeCode = prm.office.OfficeCode; // InvCurrent.LocationCode = InstrumentLocation.C_INV_LOC_INSTOCK; // InvCurrent.AreaCode = i.InstrumentArea; // InvCurrent.ShelfNo = ShelfNo.C_INV_SHELF_NO_NOT_MOVE_SHELF; // InvCurrent.InstrumentCode = i.InstrumentCode; // InvCurrent.InstrumentQty = i.StockInQty; // InvCurrent.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; // InvCurrent.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; // InvCurrent.CreateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; // InvCurrent.CreateBy = CommonUtil.dsTransData.dtUserData.EmpNo; // // InvH.InsertTbt_InventoryCurrent(new List<tbt_InventoryCurrent>(new tbt_InventoryCurrent[] { InvCurrent })); // } //} #endregion //Modify by Jutarat A. on 30052013 //List<tbt_InventorySlip> lstSlip = InvH.GetTbt_InventorySlip(prm.SlipNo); //List<tbt_InventorySlip> lstSlip = prm.lstInventorySlip; List <tbt_InventorySlip> lstSlip = CommonUtil.ClonsObjectList <tbt_InventorySlip, tbt_InventorySlip>(prm.lstInventorySlip); //Modify by Jutarat A. on 31102013 if (lstSlip == null || lstSlip.Count == 0) { lstSlip = InvH.GetTbt_InventorySlip(prm.SlipNo); } //End Modify foreach (tbt_InventorySlip slip in lstSlip) { slip.RegisterAssetFlag = RegisterAssetFlag.C_INV_REGISTER_ASSET_REGISTERED; slip.VoucherID = prm.VoucherNo; slip.VoucherDate = prm.VoucherDate; //Comment by Jutarat A. on 30052013 (Set at UpdateTbt_InventorySlip()) //slip.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; //slip.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; //End Comment } InvH.UpdateTbt_InventorySlip(lstSlip); DateTime Stock_InDate = lstSlip[0].StockInDate.GetValueOrDefault(DateTime.Now); //5.6 foreach (doIvs012Inventory i in Cond) { ICommonHandler commonHandler = CSI.WindsorHelper.ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <tbt_InventorySlipDetail> lstSlipDetail = InvH.GetTbt_InventorySlipDetail(prm.SlipNo, i.RunningNo); if (lstSlipDetail.Count > 0) { lstSlipDetail[0].InstrumentCode = i.InstrumentCode; //lstSlipDetail[0].InstrumentAmount = Convert.ToDecimal(i.StockInUnitPrice * i.StockInQty); double errorCode = 0; if (i.InstrumentAmountCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { lstSlipDetail[0].InstrumentAmount = null; lstSlipDetail[0].InstrumentAmountUsd = Convert.ToDecimal(i.InstrumentAmountUsd); //Modify by Jutarat A. on 09042013 lstSlipDetail[0].InstrumentAmountCurrencyType = i.InstrumentAmountCurrencyType; } else { lstSlipDetail[0].InstrumentAmount = Convert.ToDecimal(i.InstrumentTotalPrice); //Modify by Jutarat A. on 09042013 lstSlipDetail[0].InstrumentAmountUsd = commonHandler.ConvertCurrencyPrice(Convert.ToDecimal(i.InstrumentTotalPrice), CurrencyUtil.C_CURRENCY_LOCAL, CurrencyUtil.C_CURRENCY_US, Stock_InDate, ref errorCode); lstSlipDetail[0].InstrumentAmountCurrencyType = i.InstrumentAmountCurrencyType; if (errorCode == RateCalcCode.C_ERROR_NO_RATE) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0334); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING_DIALOG; } } } List <tbt_InventorySlipDetail> doInventorySlipDetail = InvH.UpdateTbt_InventorySlipDetail(lstSlipDetail); if (doInventorySlipDetail.Count <= 0) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0148, new string[] { TableName.C_TBL_NAME_INV_SLIP_DETAIL }); } #region Monthly Price @ 2015 : moved to stock-in process (IVS010) //if (i.InstrumentArea == InstrumentArea.C_INV_AREA_NEW_SAMPLE) //{ // doGroupSampleInstrument GroupSample = new doGroupSampleInstrument(); // GroupSample.SourceOfficeCode = prm.office.OfficeCode; // GroupSample.DestinationOfficeCode = prm.office.OfficeCode; // GroupSample.SourceLocationCode = InstrumentLocation.C_INV_LOC_INSTOCK; // GroupSample.DestinationLocationCode = InstrumentLocation.C_INV_LOC_INSTOCK; // GroupSample.ContractCode = null; // GroupSample.ProjectCode = null; // GroupSample.Instrumentcode = i.InstrumentCode; // GroupSample.TransferQty = i.StockInQty; // GroupSample.ObjectID = ScreenID.C_INV_SCREEN_ID_STOCKIN_ASSET; // InvH.UpdateAccountTransferSampleInstrument(GroupSample, null); //} //else //{ // doGroupNewInstrument GroupNew = new doGroupNewInstrument(); // GroupNew.SourceOfficeCode = prm.office.OfficeCode; // GroupNew.DestinationOfficeCode = prm.office.OfficeCode; // GroupNew.SourceLocationCode = InstrumentLocation.C_INV_LOC_INSTOCK; // GroupNew.DestinationLocationCode = InstrumentLocation.C_INV_LOC_INSTOCK; // GroupNew.ProjectCode = null; // GroupNew.ContractCode = null; // GroupNew.Instrumentcode = i.InstrumentCode; // GroupNew.TransferQty = i.StockInQty; // //GroupNew.UnitPrice = Convert.ToDecimal(i.StockInUnitPrice); // GroupNew.UnitPrice = Convert.ToDecimal(i.InstrumentTotalPrice / i.StockInQty); //Modify by Jutarat A. on 09042013 // GroupNew.ObjectID = ScreenID.C_INV_SCREEN_ID_STOCKIN_ASSET; // decMovingAveragePrice = InvH.CalculateMovingAveragePrice(GroupNew); // bool blnUpdate = InvH.UpdateAccountTransferNewInstrument(GroupNew, Convert.ToDecimal(decMovingAveragePrice)); //} #endregion } scope.Complete(); res.ResultData = true; return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } } }
/// <summary> /// Confirming picking list registration. /// </summary> /// <param name="lstInstallationSlipNo">List of installation slip no. for registering.</param> /// <returns>Return ActionResult of confirmation process result.</returns> public ActionResult IVS240_ConfirmPickingList(List <string> lstInstallationSlipNo) { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; //All message during confirmation process must be information dialog box. try { IVS240_ScreenParameter sParam = GetScreenObject <IVS240_ScreenParameter>(); //Add by Jutarat A. on 04122012 ICommonHandler srvCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (srvCommon.IsSystemSuspending()) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); res.ResultData = this.IVS240_ConfirmPickingList_CreateResult(false, null, null); return(Json(res)); } if (!CheckUserPermission(ScreenID.C_INV_SCREEN_ID_PICKING_LIST, FunctionID.C_FUNC_ID_OPERATE)) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); res.ResultData = this.IVS240_ConfirmPickingList_CreateResult(false, null, null); return(Json(res)); } if (lstInstallationSlipNo == null || lstInstallationSlipNo.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4063); res.ResultData = this.IVS240_ConfirmPickingList_CreateResult(false, null, null); return(Json(res)); } IInventoryHandler srvInv = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; List <string> lstError = new List <string>(); List <tbt_InventorySlip> lstInvSlip = new List <tbt_InventorySlip>(); foreach (var strInstallationSlipNo in lstInstallationSlipNo) { var lstTempInvSlip = srvInv.GetTbt_InventorySlip(null, strInstallationSlipNo); //if (lstInvSlip.Count > 0 && lstInvSlip[0].PickingListNo != null) //{ // res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4064 // , new string[] { strInstallationSlipNo }); // lstError.Add(strInstallationSlipNo); //} if (lstTempInvSlip.Any(p => p.PickingListNo != null)) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4064 , new string[] { strInstallationSlipNo }); lstError.Add(strInstallationSlipNo); res.ResultData = this.IVS240_ConfirmPickingList_CreateResult(false, lstError, null); return(Json(res)); } lstInvSlip.AddRange(lstTempInvSlip); } //if (lstError.Count > 0) //{ // res.ResultData = this.IVS240_ConfirmPickingList_CreateResult(false, lstError, null); // return Json(res); //} string strPickingListNo = srvInv.GeneratePickingListNo(); #region //R2 foreach (var slip in lstInvSlip) { slip.PickingListNo = strPickingListNo; //Comment by Jutarat A. on 30052013 (Set at UpdateTbt_InventorySlip()) //slip.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; //slip.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; //End Comment } #endregion srvInv.UpdateTbt_InventorySlip(lstInvSlip); IInventoryDocumentHandler srvInvDoc = ServiceContainer.GetService <IInventoryDocumentHandler>() as IInventoryDocumentHandler; //srvInvDoc.GenerateIVR170FilePath(strPickingListNo, CommonUtil.dsTransData.dtUserData.EmpNo, CommonUtil.dsTransData.dtOperationData.ProcessDateTime); sParam.ResultStream = srvInvDoc.GenerateIVR170(strPickingListNo, CommonUtil.dsTransData.dtUserData.EmpNo, CommonUtil.dsTransData.dtOperationData.ProcessDateTime); //Modify by Jutarat A. on 04122012 res.ResultData = this.IVS240_ConfirmPickingList_CreateResult(true, null, strPickingListNo); return(Json(res)); } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); res.ResultData = this.IVS240_ConfirmPickingList_CreateResult(false, null, null);; return(Json(res)); } }
/// <summary> /// Registering picking list. /// </summary> /// <param name="lstInstallationSlipNo">List of installation slip no. for registering.</param> /// <returns>Return ActionResult of registration process result.</returns> public ActionResult IVS240_RegisterPickingList(List <string> lstInstallationSlipNo) { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; try { ICommonHandler srvCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (srvCommon.IsSystemSuspending()) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); res.ResultData = this.IVS240_RegisterPickingList_CreateResult(false, null); return(Json(res)); } if (!CheckUserPermission(ScreenID.C_INV_SCREEN_ID_PICKING_LIST, FunctionID.C_FUNC_ID_OPERATE)) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); res.ResultData = this.IVS240_RegisterPickingList_CreateResult(false, null); return(Json(res)); } if (lstInstallationSlipNo == null || lstInstallationSlipNo.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4063); res.ResultData = this.IVS240_RegisterPickingList_CreateResult(false, null); return(Json(res)); } IInventoryHandler service = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; List <string> lstError = new List <string>(); foreach (var strInstallationSlipNo in lstInstallationSlipNo) { var lstTempInvSlip = service.GetTbt_InventorySlip(null, strInstallationSlipNo); //if (lstInvSlip.Count > 0 && lstInvSlip[0].PickingListNo != null) //{ // res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4064 // , new string[] { strInstallationSlipNo }); // lstError.Add(strInstallationSlipNo); //} if (lstTempInvSlip.Any(p => p.PickingListNo != null)) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4064 , new string[] { strInstallationSlipNo }); lstError.Add(strInstallationSlipNo); } } if (lstError.Count > 0) { res.ResultData = this.IVS240_RegisterPickingList_CreateResult(false, lstError);; } else { res.ResultData = this.IVS240_RegisterPickingList_CreateResult(true, null);; } } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); res.ResultData = this.IVS240_RegisterPickingList_CreateResult(false, null); } return(Json(res)); }
/// <summary> /// Register input data to database (BLS090) /// </summary> /// <returns></returns> public ActionResult BLS090_Confirm() { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; List <dtBillingContract> list = new List <dtBillingContract>(); try { // Is suspend ? ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (handlerCommon.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } BLS090_ScreenParameter param = GetScreenObject <BLS090_ScreenParameter>(); IBillingHandler handlerBilling = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; if (param.RegisterData == null) { param.RegisterData = new List <BLS090_DetailData>(); } var updateList = (from p in param.RegisterData where p.MonthlyBillingAmount != p.NewBillingFee || p.MonthlyBillingAmountCurrencyType != p.NewMonthlyBillingAmountCurrency select p).ToList <BLS090_DetailData>(); // Prepare List <tbt_BillingBasic> billiingBasicList = new List <tbt_BillingBasic>(); tbt_BillingBasic billiingBasic; List <tbt_MonthlyBillingHistory> billingHistoryList_ForInsert = new List <tbt_MonthlyBillingHistory>(); List <tbt_MonthlyBillingHistory> billingHistoryList_ForUpdate = new List <tbt_MonthlyBillingHistory>(); tbt_MonthlyBillingHistory billingHistory; foreach (var item in updateList) { decimal?amount = null; decimal?amountUS = null; if (item.NewMonthlyBillingAmountCurrency == CurrencyUtil.C_CURRENCY_LOCAL) { amount = item.NewBillingFee; } else { amountUS = item.NewBillingFee; } // Billig basic billiingBasic = new tbt_BillingBasic() { ContractCode = item.ContractCode, BillingOCC = item.BillingOCC, StopBillingFlag = (Convert.ToDecimal(item.NewBillingFee) <= 0), // *** //MonthlyBillingAmount = item.NewBillingFee, // *** MonthlyBillingAmount = amount, // add by jirawat jannet @ 2016-08-29 MonthlyBillingAmountUsd = amountUS, // add by jirawat jannet @ 2016-08-29 UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo, UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime, MonthlyBillingAmountCurrencyType = item.NewMonthlyBillingAmountCurrency }; billiingBasicList.Add(billiingBasic); // Billing history var lastBillingHistory = handlerBilling.GetLastBillingHistory(item.ContractCode, item.BillingOCC, CurrencyUtil.C_CURRENCY_LOCAL, CurrencyUtil.C_CURRENCY_US); if (lastBillingHistory.Count > 0) { // Case UPDATE. var billingHistory_update = lastBillingHistory[0]; billingHistory_update.MonthlyBillingAmount = amount;// item.NewBillingFee; // *** billingHistory_update.MonthlyBillingAmountUsd = amountUS; billingHistory_update.MonthlyBillingAmountCurrencyType = item.NewMonthlyBillingAmountCurrency; billingHistory_update.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; billingHistory_update.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; billingHistoryList_ForUpdate.Add(billingHistory_update); } else { // Case CREATE. billingHistory = new tbt_MonthlyBillingHistory() { ContractCode = item.ContractCode, BillingOCC = item.BillingOCC, MonthlyBillingAmount = item.NewBillingFee, // *** BillingStartDate = DateTime.Now, CreateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime, CreateBy = CommonUtil.dsTransData.dtUserData.EmpNo, UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime, UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo }; billingHistoryList_ForInsert.Add(billingHistory); } } // TODO : (Narupon W.) , Uncomment as finally using (TransactionScope scope = new TransactionScope()) { try { // Save to DB !! handlerBilling.UpdateMonthlyBillingAmount(billiingBasicList); // Case Create. handlerBilling.InsertTbt_MonthlyBillingHistory(CommonUtil.ConvertToXml_Store(billingHistoryList_ForInsert)); // Case Update. handlerBilling.UpdateTbt_MonthlyBillingHistoryData(CommonUtil.ConvertToXml_Store(billingHistoryList_ForUpdate)); scope.Complete(); } catch (Exception ex) { scope.Dispose(); throw ex; } } res.ResultData = "1"; res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION_OK; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0046, null, null); } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Confirm billing target data /// </summary> /// <param name="doTbmBillingClient"></param> /// <param name="doTbtBillingTarget"></param> /// <returns></returns> public ActionResult BLS010_ConfirmBillingTargetData(SECOM_AJIS.DataEntity.Master.tbm_BillingClient doTbmBillingClient, tbt_BillingTarget doTbtBillingTarget) //public ActionResult BLS010_ConfirmBillingTargetData(BLS010_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); CommonUtil comUtil = new CommonUtil(); IBillingHandler handler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; SECOM_AJIS.DataEntity.Master.IBillingMasterHandler handlerMaster = ServiceContainer.GetService <SECOM_AJIS.DataEntity.Master.IBillingMasterHandler>() as SECOM_AJIS.DataEntity.Master.IBillingMasterHandler; string strBillingClientCode = null; string strBillingTargetCode = null; BLS010_ScreenParameter sParam = GetScreenObject <BLS010_ScreenParameter>(); // tbm_BillingClient doTbmBillingClient = param.doTbmBillingClientParam; // tbt_BillingTarget doTbtBillingTarget = param.doTbt_BillingTarget; try { ///////// Check Suspending ////////// ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (chandler.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } /////// Check permission ////////// if (!CheckUserPermission(ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } //clone tbtBillingClientData to tbm_billingcliebtData doTbmBillingClient = CommonUtil.CloneObject <SECOM_AJIS.DataEntity.Master.dtBillingClientData, SECOM_AJIS.DataEntity.Master.tbm_BillingClient>(sParam.doBillingClient); doTbmBillingClient.BillingClientCode = comUtil.ConvertBillingClientCode(doTbmBillingClient.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_LONG); doTbtBillingTarget.BillingClientCode = comUtil.ConvertBillingClientCode(doTbtBillingTarget.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_LONG); //validatebusiness tbt_BillingTarget tmpTbtBillingTarget = new tbt_BillingTarget(); if (!CommonUtil.IsNullOrEmpty(doTbmBillingClient.BillingClientCode)) { List <tbt_BillingTarget> lst = new List <tbt_BillingTarget>(); lst = handler.GetTbt_BillingTarget(null, doTbmBillingClient.BillingClientCode, doTbtBillingTarget.BillingOfficeCode); if (lst.Count > 0) { tmpTbtBillingTarget = lst[0]; } else { tmpTbtBillingTarget = null; } if (tmpTbtBillingTarget != null) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_BILLING, ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6002, new string[] { comUtil.ConvertBillingTargetCode(tmpTbtBillingTarget.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT) }, null); return(Json(res)); } } var tmpdoTbmBillingClient = CommonUtil.CloneObject <tbm_BillingClient, tbm_BillingClient>(doTbmBillingClient); var tmpdoTbtBillingTarget = CommonUtil.CloneObject <tbt_BillingTarget, tbt_BillingTarget>(doTbtBillingTarget); //register new billing target using (TransactionScope scope = new TransactionScope()) { //7.3.4 if (CommonUtil.IsNullOrEmpty(tmpdoTbtBillingTarget.BillingClientCode)) { strBillingClientCode = handlerMaster.ManageBillingClient(tmpdoTbmBillingClient); tmpdoTbtBillingTarget.BillingClientCode = strBillingClientCode; } //7.3.5 create billing target strBillingTargetCode = handler.CreateBillingTarget(tmpdoTbtBillingTarget); tmpdoTbtBillingTarget.BillingTargetCode = comUtil.ConvertBillingClientCode(strBillingTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT); tmpdoTbmBillingClient.BillingClientCode = comUtil.ConvertBillingClientCode(tmpdoTbmBillingClient.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_SHORT); scope.Complete(); doTbmBillingClient = CommonUtil.CloneObject <tbm_BillingClient, tbm_BillingClient>(tmpdoTbmBillingClient); doTbtBillingTarget = CommonUtil.CloneObject <tbt_BillingTarget, tbt_BillingTarget>(tmpdoTbtBillingTarget); } doTbtBillingTarget.BillingClientCode = comUtil.ConvertBillingClientCode(doTbtBillingTarget.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_SHORT); sParam.doTbt_BillingTarget = doTbtBillingTarget; res.ResultData = doTbtBillingTarget; res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION_OK; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0046, null, null); return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Register billing target /// </summary> /// <param name="doTbtBillingTarget"></param> /// <param name="doBillingClientDdata"></param> /// <returns></returns> public ActionResult BLS010_RegisterData(tbt_BillingTarget doTbtBillingTarget, dtBillingClientData doBillingClientDdata) { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; ValidatorUtil validator = new ValidatorUtil(); CommonUtil comUtil = new CommonUtil(); try { BLS010_ScreenParameter sParam = GetScreenObject <BLS010_ScreenParameter>(); BLS010_ScreenInputValidate obj = new BLS010_ScreenInputValidate(); IBillingHandler handler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; List <string> lstParam = new List <string>(); List <string> lstControl = new List <string>(); ///////// Check Suspending ////////// ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (chandler.IsSystemSuspending()) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } /////// Check permission ////////// if (!CheckUserPermission(ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, FunctionID.C_FUNC_ID_OPERATE)) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } //if (sParam.doBillingClientList == null) //{ // res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; // //res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, new string[] { "lblBillingClientCode" }, new string[] { "lblBillingClientCode" }); // res.AddErrorMessage(MessageUtil.MODULE_BILLING, // ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, // MessageUtil.MODULE_COMMON, // MessageUtil.MessageList.MSG0007, // new string[] { "lblBillingClientCode" }, // new string[] { "lblBillingClientCode" }); // return Json(res); //} ////////////////5.2 Check mandatory //if (CommonUtil.IsNullOrEmpty(sParam.doBillingClientList[0].BillingClientCode)) //{ // if (CommonUtil.IsNullOrEmpty(sParam.doBillingClientList[0].NameEN)) // { // lstParam.Add("lblNameEnglish"); // lstControl.Add("FullNameEN"); // } // if (CommonUtil.IsNullOrEmpty(sParam.doBillingClientList[0].NameLC)) // { // lstParam.Add("lblNameLocal"); // lstControl.Add("FullNameEN"); // } // if (CommonUtil.IsNullOrEmpty(sParam.doBillingClientList[0].CustTypeCode)) // { // lstParam.Add("lblCustTypeCode"); // lstControl.Add("CustTypeName"); // } //} // Modify by siripoj 06-06-12 if (CommonUtil.IsNullOrEmpty(doBillingClientDdata.BillingClientCode)) { if (CommonUtil.IsNullOrEmpty(doBillingClientDdata.NameEN)) { lstParam.Add("lblNameEnglish"); lstControl.Add("FullNameEN"); } // 2017.02.15 delete matsuda start //if (CommonUtil.IsNullOrEmpty(doBillingClientDdata.NameLC)) //{ // lstParam.Add("lblNameLocal"); // lstControl.Add("FullNameLC"); //} // 2017.02.15 delete matsuda end if (CommonUtil.IsNullOrEmpty(doBillingClientDdata.CustTypeCode)) { lstParam.Add("lblCustTypeCode"); lstControl.Add("CustTypeName"); } } if (CommonUtil.IsNullOrEmpty(doTbtBillingTarget.BillingOfficeCode)) { lstParam.Add("lblBillingOffice"); lstControl.Add("BillingOfficeCode"); } if (lstParam.Count > 0 && lstControl.Count > 0) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; // res.AddErrorMessage(MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG0007, lstParam.ToArray(), lstControl.ToArray()); res.AddErrorMessage(MessageUtil.MODULE_BILLING, ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, lstParam.ToArray(), lstControl.ToArray()); return(Json(res)); } //Clone Data //obj = CommonUtil.CloneObject<dtBillingClientData, BLS010_ScreenInputValidate>(sParam.doBillingClientList[0]); //obj.BillingOfficeCode = doTbtBillingTarget.BillingOfficeCode; ////////////////5.2 Check mandatory //ValidatorUtil.BuildErrorMessage(res, this, new object[] { obj }); //if (res.IsError) //{ // return Json(res); //} ///////////////5.3 Validate Business //doTbtBillingTarget = CommonUtil.CloneObject<dtBillingClientData, tbt_BillingTarget>(sParam.doBillingClientList[0]); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; // Modify by Siripoj 06-06-12 //doTbtBillingTarget.BillingClientCode = sParam.doBillingClientList[0].BillingClientCode; doTbtBillingTarget.BillingClientCode = doBillingClientDdata.BillingClientCode; if (CommonUtil.IsNullOrEmpty(doTbtBillingTarget.IssueInvMonth)) { doTbtBillingTarget.IssueInvMonth = 0; } if (doTbtBillingTarget.IssueInvMonth > 60) { //res.AddErrorMessage(MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6001, new string[] { "IssueInvTime" }, new string[] { "IssueInvTime" }); res.AddErrorMessage(MessageUtil.MODULE_BILLING, ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6001, new string[] { "lblIssueInvoiceTiming" }, new string[] { "IssueInvMonth" }); return(Json(res)); } if (!CommonUtil.IsNullOrEmpty(doTbtBillingTarget.BillingClientCode)) { List <tbt_BillingTarget> lst = new List <tbt_BillingTarget>(); lst = handler.GetTbt_BillingTarget(null, comUtil.ConvertBillingClientCode(doTbtBillingTarget.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_LONG), doTbtBillingTarget.BillingOfficeCode); if (lst.Count > 0) { doTbtBillingTarget = lst[0]; } else { doTbtBillingTarget = null; } //doTbtBillingTarget = handler.GetTbt_BillingTarget(null, comUtil.ConvertBillingClientCode(doTbtBillingTarget.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_LONG), doTbtBillingTarget.BillingOfficeCode); if (doTbtBillingTarget != null) { res.AddErrorMessage(MessageUtil.MODULE_BILLING, ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6002, new string[] { comUtil.ConvertBillingTargetCode(doTbtBillingTarget.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT) }, new string[] { "BillingClientCodeView" }); return(Json(res)); } } res.ResultData = true; sParam.doBillingClient = doBillingClientDdata; sParam.doTbt_BillingTarget = doTbtBillingTarget; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }