/// <summary> /// Getting installaiton for CSV /// </summary> /// <returns></returns> public ActionResult CMS180_GetInstallationForCSV() { CMS180_ScreenParameter sParam = GetScreenObject <CMS180_ScreenParameter>(); CommonUtil cm = new CommonUtil(); ObjectResultData res = new ObjectResultData(); List <dtInstallation> lst = new List <dtInstallation>(); try { IInstallationHandler handler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; doSearchInstallationCondition cond = new doSearchInstallationCondition(); cond.slipNoNullFlag = true; lst = handler.GetInstallationDataListForCsvFile(cond); List <CMS180_SearchResultGridData> resultGridData = CommonUtil.ClonsObjectList <dtInstallation, CMS180_SearchResultGridData>(lst); if (resultGridData.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); return(Json(res)); } else { res.ResultData = resultGridData; sParam.doResultCSVData = resultGridData; //Add by Jutarat A. on 25062013 } } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Download installation list data by CSV /// </summary> /// <param name="result"></param> public void CMS180_DownloadAsCSV() //(List<CMS180_SearchResultGridData> result) //Modify by Jutarat A. on 25062013 { ObjectResultData res = new ObjectResultData(); try { //Modify by Jutarat A. on 25062013 //IInstallationHandler handler = ServiceContainer.GetService<IInstallationHandler>() as IInstallationHandler; //doSearchInstallationCondition cond = new doSearchInstallationCondition(); //cond.slipNoNullFlag = true; //List<dtInstallation> lst = new List<dtInstallation>(); //lst = handler.GetInstallationDataListForCsvFile(cond); //List<CMS180_SearchResultGridData> resultGridData = CommonUtil.ClonsObjectList<dtInstallation, CMS180_SearchResultGridData>(lst); //if (resultGridData.Count > 0) CMS180_ScreenParameter sParam = GetScreenObject <CMS180_ScreenParameter>(); if (sParam.doResultCSVData != null && sParam.doResultCSVData.Count > 0) { string strCSVResultData = CSVReportUtil.GenerateCSVData <CMS180_SearchResultGridData>(sParam.doResultCSVData, true); //resultGridData this.DownloadCSVFile("InstallationBasic.csv", strCSVResultData); } //End Modify } catch (Exception ex) { res.AddErrorMessage(ex); } }
/// <summary> /// Check suspend, authority and resume of CMS180 /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult CMS180_Authority(CMS180_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { //Check permission if (CheckUserPermission(ScreenID.C_SCREEN_ID_VIEW_INSTALLATION, FunctionID.C_FUNC_ID_OPERATE) == false) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } // If param.ContractCode is null then set to CommonUtil.dsTransData.dtCommonSearch.ContractCode; //if (CommonUtil.IsNullOrEmpty(param.ContractCode) == true) //{ // param.ContractCode = CommonUtil.dsTransData.dtCommonSearch.ContractCode; //} param.CommonSearch = new ScreenParameter.CommonSearchDo() { ContractCode = param.ContractCode }; } catch (Exception ex) { res.AddErrorMessage(ex); } return(InitialScreenEnvironment <CMS180_ScreenParameter>("CMS180", param, res)); }
/// <summary> /// Search and get installation data list for view with initial /// </summary> /// <returns></returns> public ActionResult CMS180_SearchResultWithInitial() { CMS180_ScreenParameter param = GetScreenObject <CMS180_ScreenParameter>(); CommonUtil cm = new CommonUtil(); ObjectResultData res = new ObjectResultData(); List <dtInstallation> lst = new List <dtInstallation>(); try { IInstallationHandler handler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; doSearchInstallationCondition cond = new doSearchInstallationCondition(); if (!CommonUtil.IsNullOrEmpty(param.ContractCode) || !CommonUtil.IsNullOrEmpty(param.InstallationSlipNo)) { cond.ContractCode = cm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); cond.slipNo = param.InstallationSlipNo; cond.ViewFlag = true; cond.InstallationBy = null; } else { cond.InstallationBy = InstallationBy.C_INSTALLATION_BY_SECOM; } lst = handler.GetInstallationDataListForView(cond); res.ResultData = CommonUtil.ConvertToXml <dtInstallation>(lst, "Common\\CMS180_ViewInstallationInfo", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
public ActionResult CMS180() { ObjectResultData res = new ObjectResultData(); try { CMS180_ScreenParameter param = GetScreenObject <CMS180_ScreenParameter>(); //for test //param.ContractCode = "N2700112"; //param.InstallationSlipNo = "70000120120101"; //Prepare for show section if (!CommonUtil.IsNullOrEmpty(param)) { ViewBag.ContractCode = param.ContractCode; ViewBag.InstallationSlipNo = param.InstallationSlipNo; } if (string.IsNullOrEmpty(param.ContractCode) == false) { //Finding service type code CommonUtil c = new CommonUtil(); string longContractCode = c.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); //Rental IRentralContractHandler handlerR = ServiceContainer.GetService <IRentralContractHandler>() as IRentralContractHandler; List <tbt_RentalContractBasic> dtRentalContract = handlerR.GetTbt_RentalContractBasic(longContractCode, null); if (dtRentalContract.Count > 0) { param.ServiceTypeCode = ServiceType.C_SERVICE_TYPE_RENTAL; } else { // Sale ISaleContractHandler handlerS = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler; List <tbt_SaleBasic> dtSaleContract = handlerS.GetTbt_SaleBasic(longContractCode, null, true); if (dtSaleContract.Count > 0) { param.ServiceTypeCode = ServiceType.C_SERVICE_TYPE_SALE; } } } ViewBag.ServiceTypeCode = param.ServiceTypeCode; } catch (Exception ex) { res.AddErrorMessage(ex); } //ViewBag.AttachKey = GetCurrentKey(); return(View()); }
/// <summary> /// Search and get installation data list for view /// </summary> /// <param name="cond"></param> /// <returns></returns> public ActionResult CMS180_SearchResult(doSearchInstallationCondition cond) { CMS180_ScreenParameter param = GetScreenObject <CMS180_ScreenParameter>(); CommonUtil cm = new CommonUtil(); ObjectResultData res = new ObjectResultData(); List <dtInstallation> lst = new List <dtInstallation>(); try { IInstallationHandler handler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; // Concate string CustomerTypeCode with commar separate. like ,xx,yy,zz, List <string> lstManagementStatus = new List <string>(); lstManagementStatus.Add(cond.chkInstallationNotRegistered); lstManagementStatus.Add(cond.chkInstallationRequestedAndPoRegistered); lstManagementStatus.Add(cond.chkInstallationNotRequest); lstManagementStatus.Add(cond.chkInstallationUnderInstall); //Add by Jutarat A. on 27032014 lstManagementStatus.Add(cond.chkInstallationCompleted); lstManagementStatus.Add(cond.chkInstallationRequestButPoNotRegistered); lstManagementStatus.Add(cond.chkInstallationCancelled); cond.installationStatus = CommonUtil.CreateCSVString(lstManagementStatus); List <string> lstSlipStatus = new List <string>(); lstSlipStatus.Add(cond.chkNotStockOut); lstSlipStatus.Add(cond.chkNoNeedToStockOut); lstSlipStatus.Add(cond.chkReturned); lstSlipStatus.Add(cond.chkPartialStockOut); lstSlipStatus.Add(cond.chkInstallationSlipCanceled); lstSlipStatus.Add(cond.chkNoNeedToReturn); lstSlipStatus.Add(cond.chkStockOut); lstSlipStatus.Add(cond.chkWaitForReturn); lstSlipStatus.Add(cond.chkReplaced); cond.slipStatus = CommonUtil.CreateCSVString(lstSlipStatus); List <string> lstInstallationManagementStatus = new List <string>(); lstInstallationManagementStatus.Add(cond.chkProcessing); lstInstallationManagementStatus.Add(cond.chkApproved); lstInstallationManagementStatus.Add(cond.chkCompleted); lstInstallationManagementStatus.Add(cond.chkRequestApprove); lstInstallationManagementStatus.Add(cond.chkRejected); lstInstallationManagementStatus.Add(cond.chkCanceled); cond.managementStatus = CommonUtil.CreateCSVString(lstInstallationManagementStatus); cond.siteCode = cm.ConvertSiteCode(cond.siteCode, CommonUtil.CONVERT_TYPE.TO_LONG); cond.ViewFlag = false; cond.ContractCode = cm.ConvertContractCode(cond.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); List <string> ignoreList = new List <string>(); ignoreList.Add("chkInstallationNotRegistered"); ignoreList.Add("chkInstallationRequestedAndPoRegistered"); ignoreList.Add("chkInstallationNotRequest"); ignoreList.Add("chkInstallationUnderInstall"); //Add by Jutarat A. on 27032014 ignoreList.Add("chkInstallationCompleted"); ignoreList.Add("chkInstallationRequestButPoNotRegistered"); ignoreList.Add("chkInstallationCancelled"); ignoreList.Add("chkNotStockOut"); ignoreList.Add("chkNoNeedToStockOut"); ignoreList.Add("chkReturned"); ignoreList.Add("chkPartialStockOut"); ignoreList.Add("chkInstallationSlipCanceled"); ignoreList.Add("chkNoNeedToReturn"); ignoreList.Add("chkStockOut"); ignoreList.Add("chkWaitForReturn"); ignoreList.Add("chkReplaced"); ignoreList.Add("chkProcessing"); ignoreList.Add("chkApproved"); ignoreList.Add("chkCompleted"); ignoreList.Add("chkRequestApprove"); ignoreList.Add("chkRejected"); ignoreList.Add("chkCanceled"); ignoreList.Add("ViewFlag"); ignoreList.Add("slipNoNullFlag"); //================ Teerapong S. 24/09/2011 ================ ignoreList.Add("NotRegisteredYetSlipFlag"); ignoreList.Add("NotRegisteredYetManagementFlag"); //========================================================= res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; //=============== Teerapong S. 24/09/2011 ================== if ( (CommonUtil.IsNullOrEmpty(cond.chkInstallationNotRegistered) && CommonUtil.IsNullOrEmpty(cond.chkInstallationRequestedAndPoRegistered) && CommonUtil.IsNullOrEmpty(cond.chkInstallationNotRequest) && CommonUtil.IsNullOrEmpty(cond.chkInstallationCompleted) && CommonUtil.IsNullOrEmpty(cond.chkInstallationRequestButPoNotRegistered) && CommonUtil.IsNullOrEmpty(cond.chkInstallationCancelled)) && CommonUtil.IsNullOrEmpty(cond.chkInstallationUnderInstall) || //Add (chkInstallationUnderInstall) by Jutarat A. on 27032014) (CommonUtil.IsNullOrEmpty(cond.chkNotStockOut) && CommonUtil.IsNullOrEmpty(cond.chkNoNeedToStockOut) && CommonUtil.IsNullOrEmpty(cond.chkReturned) && CommonUtil.IsNullOrEmpty(cond.chkPartialStockOut) && CommonUtil.IsNullOrEmpty(cond.chkInstallationSlipCanceled) && CommonUtil.IsNullOrEmpty(cond.chkNoNeedToReturn) && CommonUtil.IsNullOrEmpty(cond.chkStockOut) && CommonUtil.IsNullOrEmpty(cond.chkWaitForReturn) && CommonUtil.IsNullOrEmpty(cond.chkReplaced) && CommonUtil.IsNullOrEmpty(cond.NotRegisteredYetSlipFlag)) || (CommonUtil.IsNullOrEmpty(cond.chkProcessing) && CommonUtil.IsNullOrEmpty(cond.chkApproved) && CommonUtil.IsNullOrEmpty(cond.chkCompleted) && CommonUtil.IsNullOrEmpty(cond.chkRequestApprove) && CommonUtil.IsNullOrEmpty(cond.chkRejected) && CommonUtil.IsNullOrEmpty(cond.chkCanceled) && CommonUtil.IsNullOrEmpty(cond.NotRegisteredYetManagementFlag))) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0158); return(Json(res)); } //========================================================= if (CommonUtil.IsNullAllField(cond, ignoreList.ToArray())) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006); return(Json(res)); } if (cond.slipIssueDateFrom > cond.slipIssueDateTo) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0090); return(Json(res)); } cond.InstallationBy = InstallationBy.C_INSTALLATION_BY_SECOM; lst = handler.GetInstallationDataListForView(cond); res.ResultData = CommonUtil.ConvertToXml <dtInstallation>(lst, "Common\\CMS180_ViewInstallationInfo", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }