Beispiel #1
0
        public string UpdateR(String dwphid, String dwdm, String selected, String unselected)
        {
            int dr = -1;
            int sr = 1;
            //第一步,获得该单位已保存的所有支出渠道
            Dictionary <string, object> dicWhere = DataConverterHelper.ConvertToDic(null);
            CreateCriteria createCriteria        = new CreateCriteria(dicWhere);

            createCriteria.Add(ORMRestrictions <string> .Eq("Dylx", "ZC"));
            if (dwdm != null)
            {
                createCriteria.Add(ORMRestrictions <string> .Eq("Dwdm", dwdm));
            }
            List <CorrespondenceSettings2Model> correspondenceSettings2s = CorrespondenceSettings2Service.LoadWithPage(0, Int32.MaxValue, dicWhere).Results as List <CorrespondenceSettings2Model>;
            ArrayList dbSave = new ArrayList();

            String[] selects    = selected.Split(',');
            String[] unseleteds = unselected.Split(',');
            foreach (CorrespondenceSettings2Model c2m in correspondenceSettings2s)
            {
                foreach (String us in unseleteds)
                {
                    if (c2m.Dydm.Equals(us))
                    {
                        CorrespondenceSettings2Service.Delete(c2m.PhId);
                        dr--;
                        break;
                    }
                    else
                    {
                        dbSave.Add(c2m.Dydm);
                    }
                }
            }
            foreach (String s in selects)
            {
                if (!dbSave.Contains(s) && s != null && !s.Equals("") && !s.Equals(" "))
                {
                    CorrespondenceSettings2Model c2m = new CorrespondenceSettings2Model();
                    c2m.Dylx            = "ZC";
                    c2m.Dydm            = s;
                    c2m.Dwdm            = dwdm;
                    c2m.DefStr2         = dwphid;
                    c2m.PersistentState = PersistentState.Added;
                    //List<CorrespondenceSettings2Model> tc2 = new List<CorrespondenceSettings2Model>();
                    //tc2.Add(c2m);
                    String resulet = DataConverterHelper.SerializeObject(CorrespondenceSettings2Service.Save <Int64>(c2m, ""));
                    //c2m.PhId = 55466;
                    //tc2.Clear();
                    //tc2.Add(c2m);
                    //resulet = DataConverterHelper.SerializeObject(CorrespondenceSettings2Service.Save<Int64>(tc2));
                    sr++;
                }
            }

            return((dr * sr).ToString());
        }
        /// <summary>
        /// 取列表数据
        /// </summary>
        /// <returns>返回Json串</returns>
        public string GetCorrespondenceSettings2List()
        {
            string clientJsonQuery = System.Web.HttpContext.Current.Request.Params["queryfilter"];    //查询条件
            Dictionary <string, object> dicWhere = DataConverterHelper.ConvertToDic(clientJsonQuery); //查询条件转Dictionary

            DataStoreParam storeparam = this.GetDataStoreParam();
            var            result     = CorrespondenceSettings2Service.LoadWithPage(storeparam.PageIndex, storeparam.PageSize, dicWhere);

            return(DataConverterHelper.EntityListToJson <CorrespondenceSettings2Model>(result.Results, (Int32)result.TotalItems));
        }
        /// <summary>
        /// 根据组织取绩效得分对应绩效结论设置列表数据
        /// </summary>
        /// <returns>返回Json串</returns>
        public string GetJXJLset()
        {
            string Dwdm = System.Web.HttpContext.Current.Request.Params["Dwdm"];
            Dictionary <string, object> dicWhere = new Dictionary <string, object>();//查询条件转Dictionary

            new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("Dwdm", Dwdm))
            .Add(ORMRestrictions <string> .Eq("Dylx", "JXJL"));
            DataStoreParam storeparam = this.GetDataStoreParam();
            var            result     = CorrespondenceSettings2Service.LoadWithPage(storeparam.PageIndex, storeparam.PageSize, dicWhere, new string[] { "DefStr1" });

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