/// <summary>
        /// Check user permission for screen CMS080.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public ActionResult CMS080_Authority(CMS080_ScreenParameter obj)
        {
            ObjectResultData res = new ObjectResultData();

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

                obj.strCustomerCode_short = obj.strCustomerCode;

                CommonUtil c = new CommonUtil();
                obj.strCustomerCode = c.ConvertCustCode(obj.strCustomerCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                ICustomerMasterHandler handler  = ServiceContainer.GetService <ICustomerMasterHandler>() as ICustomerMasterHandler;
                List <doCustomer>      custList = handler.GetCustomerAll(obj.strCustomerCode);

                if (custList.Count == 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001);
                    return(Json(res));
                }

                if (res.IsError)
                {
                    return(Json(res));
                }

                obj.hasPermission_CMS100 = CheckUserPermission(ScreenID.C_SCREEN_ID_VIEW_CUSTOMER_GROUP, FunctionID.C_FUNC_ID_OPERATE);
                obj.hasPermission_CMS280 = CheckUserPermission(ScreenID.C_SCREEN_ID_VIEW_SITE_INFO, FunctionID.C_FUNC_ID_OPERATE);

                return(InitialScreenEnvironment <CMS080_ScreenParameter>(CMS080_Screen, obj, res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
                return(Json(res));
            }
        }
        public ActionResult CMS080()
        {
            CMS080_ScreenParameter param = new CMS080_ScreenParameter();

            ViewBag.HasPermissionCMS100 = "";
            ViewBag.HasPermissionCMS280 = "";

            try
            {
                param = GetScreenObject <CMS080_ScreenParameter>();
                ViewBag.HasPermissionCMS100 = param.hasPermission_CMS100;
                ViewBag.HasPermissionCMS280 = param.hasPermission_CMS280;
                ViewBag.CustCode_short      = param.strCustomerCode_short;
            }
            catch
            {
            }

            CommonUtil c = new CommonUtil();

            try
            {
                ICustomerMasterHandler handler  = ServiceContainer.GetService <ICustomerMasterHandler>() as ICustomerMasterHandler;
                List <doCustomer>      custList = handler.GetCustomerAll(param.strCustomerCode);

                if (custList.Count != 0)
                {
                    ViewBag.CustCode          = c.ConvertCustCode(custList[0].CustCode, CommonUtil.CONVERT_TYPE.TO_SHORT);
                    ViewBag.CustNameEN        = custList[0].CustFullNameEN;
                    ViewBag.AddressFullEN     = custList[0].AddressFullEN;
                    ViewBag.CustNameLC        = custList[0].CustFullNameLC;
                    ViewBag.AddressFullLC     = custList[0].AddressFullLC;
                    ViewBag.RepPersonName     = custList[0].RepPersonName;
                    ViewBag.ContactPersonName = custList[0].ContactPersonName;
                    ViewBag.URL                = custList[0].URL;
                    ViewBag.IDNo               = custList[0].IDNo;
                    ViewBag.PhoneNo            = custList[0].PhoneNo;
                    ViewBag.SECOMContactPerson = custList[0].SECOMContactPerson;
                    ViewBag.FaxNo              = custList[0].FaxNo;
                    if (CommonUtil.GetCurrentLanguage() == CommonValue.DEFAULT_LANGUAGE_EN)
                    {
                        ViewBag.CustType = CommonUtil.TextCodeName(custList[0].CustTypeCode, custList[0].CustTypeNameEN);
                        ViewBag.FinancialMarketTypeName = CommonUtil.TextCodeName(custList[0].FinancialMarketTypeCode, custList[0].FinancialMaketTypeNameEN);
                        ViewBag.Nationality             = custList[0].NationalityEN;
                        ViewBag.BusinessTypeName        = CommonUtil.TextCodeName(custList[0].BusinessTypeCode, custList[0].BusinessTypeNameEN);
                    }
                    else if (CommonUtil.GetCurrentLanguage() == CommonValue.DEFAULT_LANGUAGE_JP)
                    {
                        ViewBag.CustType = CommonUtil.TextCodeName(custList[0].CustTypeCode, custList[0].CustTypeNameJP);
                        ViewBag.FinancialMarketTypeName = CommonUtil.TextCodeName(custList[0].FinancialMarketTypeCode, custList[0].FinancialMaketTypeNameJP);
                        ViewBag.Nationality             = custList[0].NationalityJP;
                        ViewBag.BusinessTypeName        = CommonUtil.TextCodeName(custList[0].BusinessTypeCode, custList[0].BusinessTypeNameJP);
                    }
                    else
                    {
                        ViewBag.CustType = CommonUtil.TextCodeName(custList[0].CustTypeCode, custList[0].CustTypeNameLC);
                        ViewBag.FinancialMarketTypeName = CommonUtil.TextCodeName(custList[0].FinancialMarketTypeCode, custList[0].FinancialMaketTypeNameLC);
                        ViewBag.Nationality             = custList[0].NationalityLC;
                        ViewBag.BusinessTypeName        = CommonUtil.TextCodeName(custList[0].BusinessTypeCode, custList[0].BusinessTypeNameLC);
                    }
                    if (custList[0].DeleteFlag.Value)
                    {
                        ViewBag.Deleted = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, ScreenID.C_SCREEN_ID_VIEW_CUSTOMER_INFO, "lblDeleted");
                    }

                    string rolelabel = CommonUtil.GetLabelFromResource("Common", "CMS080", "txtRole");
                    if (CommonUtil.IsNullOrEmpty(param.strCustomerRole))
                    {
                        ViewBag.CustomerRoleLabel = "(" + rolelabel + ": " + CommonUtil.GetLabelFromResource("Common", "CMS080", "txtRoleAll") + ")";
                    }
                    else if (param.strCustomerRole == "1")
                    {
                        ViewBag.CustomerRoleLabel = "(" + rolelabel + ": Contract)";
                    }
                    else
                    {
                        ICommonHandler        commonHand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                        List <doMiscTypeCode> misc       = new List <doMiscTypeCode>();
                        misc.Add(new doMiscTypeCode()
                        {
                            FieldName = MiscType.C_CUST_ROLE_TYPE,
                            ValueCode = param.strCustomerRole
                        });

                        List <doMiscTypeCode> roleType = commonHand.GetMiscTypeCodeList(misc);
                        if (roleType.Count != 0)
                        {
                            ViewBag.CustomerRoleLabel = "(" + rolelabel + ": " + roleType[0].ValueDisplay + ")";
                        }
                    }
                }

                ViewBag.CustomerCode = param.strCustomerCode;
                ViewBag.CustomerRole = CommonUtil.IsNullOrEmpty(param.strCustomerRole) ? "" : param.strCustomerRole;

                return(View());
            }
            catch (Exception ex)
            {
                ObjectResultData res = new ObjectResultData();
                res.AddErrorMessage(ex);
                return(null);
            }
        }