/// <summary> /// Check suspend, authority and resume of CMS450 /// </summary> /// <param name="param">Screen parameter</param> /// <returns></returns> public ActionResult CMS450_Authority(CMS450_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { // Check permission if (CheckUserPermission(ScreenID.C_SCREEN_ID_VIEW_BILLING_DETAIL, FunctionID.C_FUNC_ID_OPERATE) == false) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } // is parameter OK ? if (CommonUtil.IsNullOrEmpty(param.BillingTargetCode) && CommonUtil.IsNullOrEmpty(param.ContractCode) && CommonUtil.IsNullOrEmpty(param.BillingOCC) && CommonUtil.IsNullOrEmpty(param.InvoiceNo)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0156); return(Json(res)); } // data is exist ? CommonUtil cm = new CommonUtil(); IBillingHandler handlerBilling = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; IViewBillingHandler handlerViewBilling = ServiceContainer.GetService <IViewBillingHandler>() as IViewBillingHandler; List <dtTbt_BillingTargetForView> listBillingTarget = new List <dtTbt_BillingTargetForView>(); if (!CommonUtil.IsNullOrEmpty(param.BillingTargetCode)) { listBillingTarget = handlerBilling.GetTbt_BillingTargetForView(cm.ConvertBillingTargetCode(param.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG), MiscType.C_CUST_TYPE); if (listBillingTarget.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); return(Json(res)); } } else if (!CommonUtil.IsNullOrEmpty(param.BillingOCC) && !CommonUtil.IsNullOrEmpty(param.ContractCode)) { //GetBillingDetailOfBillingCode string strContractCode = cm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); List <dtTbt_BillingBasicForView> listBillingBasicForView = handlerBilling.GetTbt_BillingBasicForView(strContractCode, param.BillingOCC); if (listBillingBasicForView.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); return(Json(res)); } } else if (!CommonUtil.IsNullOrEmpty(param.InvoiceNo)) { List <dtViewBillingDetailListOfLastInvoiceOCC> listBillingDetailListOfLastInvoiceOCC = handlerViewBilling.GetViewBillingDetailListOfLastInvoiceOCC(param.InvoiceNo, null, null, null, null); if (listBillingDetailListOfLastInvoiceOCC.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); return(Json(res)); } } else { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0156); return(Json(res)); } } catch (Exception ex) { res.AddErrorMessage(ex); } return(InitialScreenEnvironment <CMS450_ScreenParameter>("CMS450", param, res)); }
public ActionResult CMS450() { ObjectResultData res = new ObjectResultData(); CMS450_ScreenParameter param = GetScreenObject <CMS450_ScreenParameter>(); CommonUtil cm = new CommonUtil(); // Prepare for show section ViewBag._ContractCode = param.ContractCode; ViewBag._BillingOCC = param.BillingOCC; ViewBag._BillingTargetCode = param.BillingTargetCode; ViewBag._InvoiceNo = param.InvoiceNo; try { IBillingHandler handlerBilling = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; IViewBillingHandler handlerViewBilling = ServiceContainer.GetService <IViewBillingHandler>() as IViewBillingHandler; if (!CommonUtil.IsNullOrEmpty(param.BillingTargetCode)) { List <dtTbt_BillingTargetForView> listBillingTarget = handlerBilling.GetTbt_BillingTargetForView(cm.ConvertBillingTargetCode(param.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG), MiscType.C_CUST_TYPE); if (listBillingTarget.Count > 0) { ViewBag.txtBillingTargetCode = listBillingTarget[0].BillingTargetCode_Short; ViewBag.txtBillingClientNameEnglish = listBillingTarget[0].FullNameEN; ViewBag.txtBillingClientAddressEnglish = listBillingTarget[0].AddressEN; ViewBag.txtBillingClientNameLocal = listBillingTarget[0].FullNameLC; ViewBag.txtBillingClientAddressLocal = listBillingTarget[0].AddressLC; } } else if (!CommonUtil.IsNullOrEmpty(param.BillingOCC) && !CommonUtil.IsNullOrEmpty(param.ContractCode)) { //GetBillingDetailOfBillingCode string strContractCode = cm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); List <dtTbt_BillingBasicForView> listBillingBasicForView = handlerBilling.GetTbt_BillingBasicForView(strContractCode, param.BillingOCC); if (listBillingBasicForView.Count > 0) { ViewBag.txtBillingCode = cm.ConvertBillingCode(listBillingBasicForView[0].BillingCode, CommonUtil.CONVERT_TYPE.TO_SHORT); ViewBag.txtBillingOffice = listBillingBasicForView[0].OfficeName; ViewBag.txtBillingTargetCode = cm.ConvertBillingTargetCode(listBillingBasicForView[0].BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT); ViewBag.txtBillingClientNameEnglish = listBillingBasicForView[0].FullNameEN; ViewBag.txtBillingClientAddressEnglish = listBillingBasicForView[0].AddressEN; ViewBag.txtBillingClientNameLocal = listBillingBasicForView[0].FullNameLC; ViewBag.txtBillingClientAddressLocal = listBillingBasicForView[0].AddressLC; } } else if (!CommonUtil.IsNullOrEmpty(param.InvoiceNo)) { List <dtViewBillingDetailListOfLastInvoiceOCC> listBillingDetailListOfLastInvoiceOCC = handlerViewBilling.GetViewBillingDetailListOfLastInvoiceOCC(param.InvoiceNo, null, null, null, null); if (listBillingDetailListOfLastInvoiceOCC.Count > 0) { ViewBag.txtInvoiceNo = listBillingDetailListOfLastInvoiceOCC[0].InvoiceNo; ViewBag.txtBillingTargetCode = cm.ConvertBillingTargetCode(listBillingDetailListOfLastInvoiceOCC[0].BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT); ViewBag.txtBillingClientNameEnglish = listBillingDetailListOfLastInvoiceOCC[0].FullNameEN; ViewBag.txtBillingClientAddressEnglish = listBillingDetailListOfLastInvoiceOCC[0].AddressEN; ViewBag.txtBillingClientNameLocal = listBillingDetailListOfLastInvoiceOCC[0].FullNameLC; ViewBag.txtBillingClientAddressLocal = listBillingDetailListOfLastInvoiceOCC[0].AddressLC; } } else { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0040); return(Json(res)); } } catch (Exception ex) { res.AddErrorMessage(ex); } return(View()); }