public ActionResult CustomerEditor(string ID)
        {
            //if (Request.QueryString["ID"] != null)
            //{
            //    rf = CustomerProfileManager.GetDetail(Request.QueryString["ID"])[0];
            //}

            int dataId = ParseHelper.Parse<int>(ID);
            List<FieldCategory> lfc = FieldCategory.GetMasterCategorys(FieldCategory.Category_TYPE_CUSTOMERPROFILE);
            if (dataId > 0)
            {
                CustomerProfileDetail detail = new CustomerProfileDetail();
                detail.FillCategoryData(lfc, dataId);
            }
            ViewBag.Categories = lfc;
            ViewBag.DataId = dataId;

            //权限
            ViewBag.Roles = 1;
            if (!AccessControl.CurrentLogonUser.IsCustomerAdmin())
            {
                PowerManager.LoadPower("22");
                if (!PowerManager.HasDel)//删除权限
                {
                    if (!PowerManager.HasEdit)//如没有编辑权限时
                    {
                        ViewBag.Roles = 0;
                    }
                }
            }

            return View();
        }
        private int Save(string postData, SystemMessages sysMsg)
        {
            int id = 0;
            if (!String.IsNullOrWhiteSpace(postData))
            {
                System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();
                Dictionary<string, object> jsonData = jss.Deserialize<Dictionary<string, object>>(postData) as Dictionary<string, object>;

                string dataId = Convert.ToString(jsonData["dataId"]);
                string operation = Convert.ToString(jsonData["operation"]);
                Int32.TryParse(dataId, out id);
                Dictionary<string, object> data = jsonData["data"] as Dictionary<string, object>;

                List<FieldCategory> lfc = FieldCategory.GetCategorys(FieldCategory.Category_TYPE_CUSTOMERPROFILE);

                foreach (FieldCategory fc in lfc)
                {
                    if (data.ContainsKey(fc.ID))
                    {
                        fc.CheckDataType(data[fc.ID] as Dictionary<string, object>, sysMsg);
                        //检查Customer Name 唯一
                        CheckCustomerName(dataId, data[fc.ID] as Dictionary<string, object>, sysMsg);
                    }
                }

                if (sysMsg.isPass)
                {
                    using (TScope ts = new TScope())
                    {
                        try
                        {
                            CustomerProfileDetail dm = new CustomerProfileDetail(lfc, data);
                            if (id > 0)
                            {
                                dm.Update(id);
                            }
                            else
                            {
                                id = dm.Add();
                            }
                        }
                        catch (Exception ex)
                        {
                            ts.Rollback();
                            sysMsg.isPass = false;
                            sysMsg.Messages.Add("Error", ex.Message);
                        }
                    }
                }
            }
            return id;
        }
        public ActionResult CustomerPrint(string ID)
        {
            //if (Request.QueryString["ID"] != null)
            //{
            //    rf = CustomerProfileManager.GetDetail(Request.QueryString["ID"])[0];
            //}

            int dataId = ParseHelper.Parse<int>(ID);
            List<FieldCategory> lfc = FieldCategory.GetMasterCategorys(FieldCategory.Category_TYPE_CUSTOMERPROFILE);
            if (dataId > 0)
            {
                CustomerProfileDetail detail = new CustomerProfileDetail();
                detail.FillCategoryData(lfc, dataId);
            }
            ViewBag.Categories = lfc;
            ViewBag.DataId = dataId;
            return View();
        }