public ActionResult SaveOrUpdate(String data)
        {
            DataStoreParam dataStoreParam = this.GetDataStoreParam();
            var            result         = CorrespondenceSettingsService.LoadWithPageOrg(dataStoreParam);
            //Dictionary<string, object> dicWhere = DataConverterHelper.ConvertToDic("");
            IList <OrganizeModel> organizes = result.Results as List <OrganizeModel>;

            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).Add(ORMRestrictions <Int64> .NotEq("PhId", 0));
            IList <CorrespondenceSettings2Model> correspondenceSettings2s = CorrespondenceSettings2Service.Find(dicWhere).Data as List <CorrespondenceSettings2Model>;

            //IList<CorrespondenceSettings2Model> correspondenceSettings2s = CorrespondenceSettings2Service.LoadWithPage(dataStoreParam.PageIndex, dataStoreParam.PageSize, dicWhere).Results as List<CorrespondenceSettings2Model>;
            organizes = ProjectThresholdService.GetSBOrganizes(organizes, correspondenceSettings2s);
            //IList<ProjectThresholdModel> projectThresholds = (ProjectThresholdService.LoadWithPage(dataStoreParam.PageIndex, dataStoreParam.PageSize, dicWhere)).Results as List<ProjectThresholdModel>;
            IList <ProjectThresholdModel> projectThresholds = ProjectThresholdService.Find(dicWhere).Data as List <ProjectThresholdModel>;

            if (this.ProjectThresholdService.SaveOrUpdate(data, organizes, projectThresholds, dataStoreParam))
            {
                return(Content("{\"result\":\"success\"}"));
            }
            else
            {
                return(Content("{\"result\":\"fail\"}"));
            }
        }
        /// <summary>
        /// 取对应关系列表数据  取所有org(不包括部门)
        /// </summary>
        /// <returns>返回Json串</returns>
        public string GetOrg()
        {
            DataStoreParam dataStoreParam = this.GetDataStoreParam();
            var            result         = CorrespondenceSettingsService.LoadWithPageOrg(dataStoreParam);

            return(DataConverterHelper.EntityListToJson <OrganizeModel>(result.Results, (Int32)result.TotalItems));
        }
        /// <summary>
        /// 根据申报单位组装数据发送给前台
        /// </summary>
        /// <returns>返回Json串</returns>

        /**
         * 需要借用orange组件
         *
         *
         * */
        public string GetProjectThresholdListByUserPower()
        {
            DataStoreParam        dataStoreParam = this.GetDataStoreParam();
            var                   result         = CorrespondenceSettingsService.LoadWithPageOrg(dataStoreParam);
            IList <OrganizeModel> organizes      = result.Results as List <OrganizeModel>;
            //Dictionary<string, object> dicWhere = DataConverterHelper.ConvertToDic("");//查询条件转Dictionary
            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).Add(ORMRestrictions <Int64> .NotEq("PhId", 0));
            IList <CorrespondenceSettings2Model> correspondenceSettings2s = CorrespondenceSettings2Service.Find(dicWhere).Data as List <CorrespondenceSettings2Model>;

            organizes = ProjectThresholdService.GetSBOrganizes(organizes, correspondenceSettings2s);
            IList <ProjectThresholdModel> projectThresholds = ProjectThresholdService.Find(dicWhere).Data as List <ProjectThresholdModel>;

            IList <VProjectThresholdModel> vprojectThresholds = new List <VProjectThresholdModel>();

            foreach (OrganizeModel organize in organizes)
            {
                var q1 = from dt1 in projectThresholds
                         where dt1.Orgid == organize.PhId
                         select dt1;
                VProjectThresholdModel pt1 = new VProjectThresholdModel();
                if (q1.Count() == 0)
                {
                    pt1.Orgcode    = organize.OCode;
                    pt1.Orgid      = organize.PhId;
                    pt1.FThreshold = "未设置";
                }
                if (q1.Count() == 1)
                {
                    var pm = q1.ToList()[0];
                    pt1.PhId         = pm.PhId;
                    pt1.Orgid        = pm.Orgid;
                    pt1.Orgcode      = pm.Orgcode;
                    pt1.FThreshold   = pm.FThreshold;
                    pt1.ProjTypeId   = pm.ProjTypeId;
                    pt1.ProjTypeName = pm.ProjTypeName;
                }


                pt1.Orgname = organize.OName;
                vprojectThresholds.Add(pt1);
            }

            return(DataConverterHelper.EntityListToJson <VProjectThresholdModel>(vprojectThresholds, (Int32)vprojectThresholds.Count()));


            //return DataConverterHelper.EntityListToJson<ProjectThresholdModel>(result.Results, (Int32)result.TotalItems);
        }