Example #1
0
        /// <summary>
        /// Get customer group summary data
        /// </summary>
        /// <returns></returns>
        public ActionResult CMS100_LoadGroupSummary()
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                CMS100_ScreenParameter CMS100Param   = GetScreenObject <CMS100_ScreenParameter>();
                IViewContractHandler   hand          = ServiceContainer.GetService <IViewContractHandler>() as IViewContractHandler;
                ICommonHandler         comHand       = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                List <doMiscTypeCode>  tmpCurrencies = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>()
                {
                    new doMiscTypeCode()
                    {
                        FieldName = MiscType.C_CURRENCT,
                        ValueCode = "%"
                    }
                }).ToList();

                List <dtGroupSummaryForShow> lst = hand.GetGroupSummaryForViewCustGrpData(CMS100Param.GroupCode);

                res.ResultData = CommonUtil.ConvertToXml <dtGroupSummaryForShow>(lst, "Common\\CMS100_Gsum", CommonUtil.GRID_EMPTY_TYPE.VIEW);
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }
            return(Json(res));
        }
Example #2
0
        /// <summary>
        /// Get contract data for view
        /// </summary>
        /// <param name="type"></param>
        /// <param name="contractPrefix"></param>
        /// <returns></returns>
        public ActionResult CMS100_LoadContract(string type, string contractPrefix)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                CMS100_ScreenParameter CMS100Param   = GetScreenObject <CMS100_ScreenParameter>();
                IViewContractHandler   hand          = ServiceContainer.GetService <IViewContractHandler>() as IViewContractHandler;
                ICommonHandler         comHand       = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                List <doMiscTypeCode>  tmpCurrencies = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>()
                {
                    new doMiscTypeCode()
                    {
                        FieldName = MiscType.C_CURRENCT,
                        ValueCode = "%"
                    }
                }).ToList();

                List <dtContractListGrp> lst = new List <dtContractListGrp>();
                if (type.Contains("CT"))
                {
                    if (type.Contains("Rental"))
                    {
                        lst = hand.GetContractListForViewCustGrp_CT_Rental(CMS100Param.GroupCode, contractPrefix);
                    }
                    else
                    {
                        lst = hand.GetContractListForViewCustGrp_CT_Sale(CMS100Param.GroupCode, contractPrefix);
                    }
                }
                else
                {
                    if (type.Contains("Rental"))
                    {
                        lst = hand.GetContractListForViewCustGrp_R_Rental(CMS100Param.GroupCode, contractPrefix);
                    }
                    else
                    {
                        lst = hand.GetContractListForViewCustGrp_R_Sale(CMS100Param.GroupCode, contractPrefix);
                    }
                }
                //Add Currency
                for (int i = 0; i < lst.Count(); i++)
                {
                    lst[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies);
                }

                res.ResultData = CommonUtil.ConvertToXml <dtContractListGrp>(lst, "Common\\CMS100_ContractList", CommonUtil.GRID_EMPTY_TYPE.VIEW);
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }
            return(Json(res));
        }
Example #3
0
        /// <summary>
        /// Check permission for access screen CMS100
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public ActionResult CMS100_Authority(CMS100_ScreenParameter param) // old: string GroupCode
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                //Mock Data
                //GroupCode = "G0000024";

                if (!CheckUserPermission(ScreenID.C_SCREEN_ID_VIEW_CUSTOMER_GROUP, FunctionID.C_FUNC_ID_OPERATE))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053);
                    return(Json(res));
                }

                if (CommonUtil.IsNullOrEmpty(param.GroupCode))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0040);
                    return(Json(res));
                }

                IGroupMasterHandler hand  = ServiceContainer.GetService <IGroupMasterHandler>() as IGroupMasterHandler;
                doGroup             doGrp = new doGroup();
                doGrp.GroupCode = param.GroupCode;
                List <doGroup> lst = hand.GetGroup(doGrp);
                if (lst.Count <= 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001);
                    return(Json(res));
                }

                param.GroupData        = lst[0];
                param.GroupSummaryList = new List <dtGroupSummaryForShow>();
                param.CustomerList     = new List <dtCustomerListGrp>();
                param.SiteList         = new List <dtsiteListGrp>();
                param.ContractList     = new List <dtContractListGrp>();

                return(InitialScreenEnvironment <CMS100_ScreenParameter>(CMS100_Screen, param, res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
                return(Json(res));
            }
        }
Example #4
0
        public ActionResult CMS100()
        {
            CMS100_ScreenParameter CMS100Param = new CMS100_ScreenParameter();

            try
            {
                CMS100Param         = GetScreenObject <CMS100_ScreenParameter>();
                ViewBag.GroupCode   = CMS100Param.GroupData.GroupCode;
                ViewBag.GroupNameEN = CMS100Param.GroupData.GroupNameEN;
                ViewBag.GroupNameLC = CMS100Param.GroupData.GroupNameLC;
                ViewBag.Memo        = CMS100Param.GroupData.Memo;
            }
            catch
            {
            }

            ViewBag.OfficeInCharge = CommonUtil.TextCodeName(CMS100Param.GroupData.GroupOfficeCode, CMS100Param.GroupData.OfficeNameEN);
            ViewBag.PersonInCharge = CommonUtil.TextCodeName(CMS100Param.GroupData.GroupEmpNo, CMS100Param.GroupData.GroupEmpName);
            ViewBag.PageRow        = CommonValue.ROWS_PER_PAGE_FOR_VIEWPAGE;
            ViewBag.AlarmPrefix    = ContractPrefix.C_CONTRACT_PREFIX_ALARM;
            ViewBag.MaintPrefix    = ContractPrefix.C_CONTRACT_PREFIX_MAINTAINENCE;
            ViewBag.GuardPrefix    = ContractPrefix.C_CONTRACT_PREFIX_GUARD;
            ViewBag.SalePrefix     = ContractPrefix.C_CONTRACT_PREFIX_SALE;

            ViewBag.CustomerListHeader = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, ScreenID.C_SCREEN_ID_VIEW_CUSTOMER_GROUP, "lblHeaderCustomerList");
            ViewBag.SiteListHeader     = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, ScreenID.C_SCREEN_ID_VIEW_CUSTOMER_GROUP, "lblHeaderSiteList");
            ViewBag.ContractListHeader = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, ScreenID.C_SCREEN_ID_VIEW_CUSTOMER_GROUP, "lblHeaderContractList");

            ViewBag.ContractTargetDisplay = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, ScreenID.C_SCREEN_ID_VIEW_CUSTOMER_GROUP, "headerContractTaget");
            ViewBag.RealCustomerDisplay   = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, ScreenID.C_SCREEN_ID_VIEW_CUSTOMER_GROUP, "headerRealCustomer");
            ViewBag.AlarmDisplay          = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, ScreenID.C_SCREEN_ID_VIEW_CUSTOMER_GROUP, "headerAlarm");
            ViewBag.MaintenanceDisplay    = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, ScreenID.C_SCREEN_ID_VIEW_CUSTOMER_GROUP, "headerMaintenance");
            ViewBag.GuardDisplay          = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, ScreenID.C_SCREEN_ID_VIEW_CUSTOMER_GROUP, "headerGuard");
            ViewBag.SaleDisplay           = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, ScreenID.C_SCREEN_ID_VIEW_CUSTOMER_GROUP, "headerSale");

            ViewBag.RoleTypeContractTarget = CustRoleType.C_CUST_ROLE_TYPE_CONTRACT_TARGET;
            ViewBag.RoleTypePurchaser      = CustRoleType.C_CUST_ROLE_TYPE_PURCHASER;
            ViewBag.RoleTypeRealCust       = CustRoleType.C_CUST_ROLE_TYPE_REAL_CUST;

            return(View(CMS100_Screen));
        }
Example #5
0
        /// <summary>
        /// Get site data for view
        /// </summary>
        /// <param name="type"></param>
        /// <param name="contractPrefix"></param>
        /// <returns></returns>
        public ActionResult CMS100_LoadSite(string type, string contractPrefix)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                CMS100_ScreenParameter CMS100Param = GetScreenObject <CMS100_ScreenParameter>();
                IViewContractHandler   hand        = ServiceContainer.GetService <IViewContractHandler>() as IViewContractHandler;
                List <dtsiteListGrp>   lst         = new List <dtsiteListGrp>();
                if (type.Contains("CT"))
                {
                    if (type.Contains("Rental"))
                    {
                        lst = hand.GetSiteListForViewCustGrp_CT_Rental(CMS100Param.GroupCode, contractPrefix);
                    }
                    else
                    {
                        lst = hand.GetSiteListForViewCustGrp_CT_Sale(CMS100Param.GroupCode, contractPrefix);
                    }
                }
                else
                {
                    if (type.Contains("Rental"))
                    {
                        lst = hand.GetSiteListForViewCustGrp_R_Rental(CMS100Param.GroupCode, contractPrefix);
                    }
                    else
                    {
                        lst = hand.GetSiteListForViewCustGrp_R_Sale(CMS100Param.GroupCode, contractPrefix);
                    }
                }
                res.ResultData = CommonUtil.ConvertToXml <dtsiteListGrp>(lst, "Common\\CMS100_SiteList", CommonUtil.GRID_EMPTY_TYPE.VIEW);
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }
            return(Json(res));
        }