コード例 #1
0
        private void DeleteNode(int Dictionary_PKID, Wicresoft.Session.Session session)
        {
            // Delete the entry in Dictionary
            BusinessMapping.Dictionary owner = new BusinessMapping.Dictionary();
            owner.SessionInstance = session;
            owner.PKID.Value      = Dictionary_PKID;
            owner.IsValid.Value   = false;
            owner.Update();

            // Delete the entry in Dictionary_RegionDetail
            BusinessObjectCollection region = new BusinessObjectCollection("Dictionary_RegionDetail");

            region.SessionInstance = session;

            BusinessFilter regiondeletefilter = new BusinessFilter("Dictionary_RegionDetail");

            regiondeletefilter.AddFilterItem("FK_Dictionary", Dictionary_PKID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            region.AddFilter(regiondeletefilter);

            ((BusinessMapping.Dictionary_RegionDetail)region.Businessobject).IsValid.Value = false;
            region.UpdateFilter();


            // Delete any child entries
            BusinessObjectCollection child = new BusinessObjectCollection("Dictionary");

            child.SessionInstance = session;

            BusinessFilter filter = new BusinessFilter("Dictionary");

            filter.AddFilterItem("Parent", Dictionary_PKID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("Type", ((int)SystemManage.DictionaryType.Region).ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            child.AddFilter(filter);

            DataTable childtable = child.GetDataTable();

            for (int i = 0; i < childtable.Rows.Count; i++)
            {
                DeleteNode(int.Parse(childtable.Rows[i]["PKID"].ToString()), session);
            }
        }
コード例 #2
0
        /* Jian.li Modify 2010-01-22 */
        public string GetCenterString()
        {
            //获取没有中心的城市
            string sql = "select pkid from dictionaryAd where isvalid = 1 and ([level]=1 or [level]=0)";

            Wicresoft.Session.Session session = new Wicresoft.Session.Session();
            DataTable dt      = session.SqlHelper.ExcuteDataTable(null, sql, CommandType.Text);
            string    NOPKIDs = "";

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                NOPKIDs += "," + dt.Rows[i][0];
            }
            if (NOPKIDs != string.Empty)
            {
                NOPKIDs = NOPKIDs.Substring(1, NOPKIDs.Length - 1);
            }

            return(NOPKIDs);
        }
コード例 #3
0
        public DataTable GetRegionList(out int totalCount, int pageSize, int pageIndex, Common.OrderByType obType, BusinessFilter subfilter, string Parent)
        {
            Wicresoft.Session.Session session = new Wicresoft.Session.Session();
            BusinessObjectCollection  boc     = new BusinessObjectCollection("Dictionary");
            BusinessFilter            filter  = new BusinessFilter("Dictionary");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("Type", ((int)SystemManage.DictionaryType.Region).ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);

            if (Parent == SystemManage.Level.Top)
            {
                BusinessMapping.Dictionary TopParent = new BusinessMapping.Dictionary();
                TopParent.SessionInstance = session;
                BusinessFilter searchparent = new BusinessFilter("Dictionary");
                searchparent.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
                searchparent.AddFilterItem("Type", ((int)SystemManage.DictionaryType.Region).ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
                searchparent.AddFilterItem("Parent", SystemManage.Level.Top, Operation.Equal, FilterType.NumberType, AndOr.AND);
                TopParent.AddFilter(searchparent);
                TopParent.Load();
                if (TopParent.HaveRecord)
                {
                    Parent = TopParent.PKID.Value.ToString();
                }
            }

            if (!(Parent == null || Parent.Equals(string.Empty)))
            {
                filter.AddFilterItem("Parent", Parent.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            }

            if (subfilter != null)
            {
                filter.AddFilter(subfilter, AndOr.AND);
            }
            boc.SessionInstance = session;
            boc.AddFilter(filter);
            DataSet ds = boc.GetPagedRecords(pageIndex, pageSize, "PKID", (obType == Common.OrderByType.ASC) ? true : false);

            totalCount = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
            return(ds.Tables[1]);
        }
コード例 #4
0
 public void SetSession(Session _session)
 {
     session = _session;
 }
コード例 #5
0
        //Qick新加方法
        public DataTable GetCityListAD(out int totalCount, int pageSize, int pageIndex, Common.OrderByType obType, BusinessFilter filter)
        {
            //获取没有中心的城市
            string sql = "select pkid from dictionaryAd where pkid in (select pkid from dictionaryAd where [name] not in (select [name] from dictionary where isvalid =1 and ([level]=1 or [level]=0)) and isvalid = 1 and ([level]=1 or [level]=0)) and ([level]=1 or [level]=0)";

            Wicresoft.Session.Session session = new Wicresoft.Session.Session();
            DataTable dt      = session.SqlHelper.ExcuteDataTable(null, sql, CommandType.Text);
            string    NOPKIDs = "";

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                NOPKIDs += "," + dt.Rows[i][0];
            }
            //获取登陆用户拥有权限的城市
            /* Andy Modify 2009-12-17 用DictionaryAD表的PKID和FK_Dictionary过滤不同值 */
            BusinessRule.BaseData.Region regionRule = new BusinessRule.BaseData.Region();
            string cityPKIDs = regionRule.GetAuthorizedCitiesPKID(GlobalFacade.SystemContext.GetContext().UserID).ToString();

            if (cityPKIDs.IndexOf("2,") != -1)
            {
                cityPKIDs += ",1";
            }
            if (NOPKIDs != string.Empty)
            {
                NOPKIDs = NOPKIDs.Substring(1, NOPKIDs.Length - 1);
            }
            //			string cityPKIDs = ","+regionRule.GetAuthorizedCitiesPKID(GlobalFacade.SystemContext.GetContext().UserID).ToString()+",";
            //			if(cityPKIDs.IndexOf(",2,")!=-1)
            //			{
            //				cityPKIDs=cityPKIDs.Substring(1,cityPKIDs.Length-2);
            //				cityPKIDs+=",1";
            //				if(NOPKIDs!=null&&NOPKIDs!=""&&NOPKIDs!=string.Empty)
            //				{
            //					cityPKIDs+=NOPKIDs;
            //				}
            //			}
            //			else
            //			{
            //				cityPKIDs=cityPKIDs.Substring(1,cityPKIDs.Length-2);
            //			}

            Common commonRule = new Common();

            BusinessFilter flt = new BusinessFilter("DictionaryAD");

            flt.AddCustomerFilter("(DictionaryAD.PKID IN(" + NOPKIDs + ") OR DictionaryAD.FK_Dictionary IN (" + cityPKIDs + "))", AndOr.AND);
            //			flt.AddCustomerFilter("(DictionaryAD.PKID IN(" + cityPKIDs + ") OR DictionaryAD.PKID IN (" + cityPKIDs + "))", AndOr.AND);
            flt.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            flt.AddFilter(filter, AndOr.AND);

            // Add Data Permission
            //			flt.AddFilter(GetAuthorizedCityFilter(GlobalFacade.SystemContext.GetContext().UserID), AndOr.AND);

            BusinessObjectCollection boc = new BusinessObjectCollection("DictionaryAD");

            boc.SessionInstance = new Session();
            boc.AddFilter(flt);

            DataSet ds = boc.GetPagedRecords(pageIndex, pageSize, "PKID", (obType == Common.OrderByType.ASC) ? true : false);

            totalCount = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
            return(ds.Tables[1]);
        }
コード例 #6
0
        public DataTable GetDictionaryList(out int totalCount, int pageSize, int pageIndex,
                                           Common.OrderByType obType, BusinessFilter subfilter)
        {
//			//找出没有中心的城市PKID
//			string sql="select pkid from dictionaryAd where pkid in (select pkid from dictionaryAd where [name] not in (select [name] from dictionary where isvalid =1 and ([level]=1 or [level]=0)) and isvalid = 1 and ([level]=1 or [level]=0)) and ([level]=1 or [level]=0)";
//			Wicresoft.Session.Session session = new Wicresoft.Session.Session();
//			DataTable dt = session.SqlHelper.ExcuteDataTable(null,sql,CommandType.Text);
//			string NOPKIDs="";
//			for(int i=0;i<dt.Rows.Count;i++)
//			{
//				NOPKIDs+=","+dt.Rows[i][0];
//			}
//
//			//找出当前用户所拥有权限的城市PKID
//			BusinessRule.BaseData.Region regionRule = new BusinessRule.BaseData.Region();
//
//			string cityPKIDs = ","+regionRule.GetAuthorizedCitiesPKID(GlobalFacade.SystemContext.GetContext().UserID).ToString()+",";
//
//			BusinessObjectCollection boc = new BusinessObjectCollection("ADClient");
//			boc.SessionInstance = session;
//			BusinessFilter filter = new BusinessFilter("ADClient");
//
//			//找出是总部发布的PKID
//			string sqlADInfomation="select PKID from ADInfomation where FK_Center =1 and isvalid=1";
//			Wicresoft.Session.Session sessionADInfomation = new Wicresoft.Session.Session();
//			DataTable dtADInfomation=sessionADInfomation.SqlHelper.ExcuteDataTable(null,sqlADInfomation,CommandType.Text);
//			string ADInfomationPKID =  string.Empty;
//			if(dtADInfomation.Rows.Count>0)
//			{
//				for(int j=0;j<dtADInfomation.Rows.Count;j++)
//				{
//					ADInfomationPKID+=dtADInfomation.Rows[j][0]+",";
//				}
//				ADInfomationPKID=ADInfomationPKID.Substring(0,ADInfomationPKID.Length-1);
//			}
//			//防止ADInfomationPKID为空
//			if(ADInfomationPKID ==  string.Empty)
//			{
//				ADInfomationPKID = "0";
//			}
//			//有总部权限的
//			if(cityPKIDs.IndexOf(",2,")!=-1)
//			{
//				cityPKIDs=cityPKIDs.Substring(1,cityPKIDs.Length-2);
//				cityPKIDs+=",1";
//				if(NOPKIDs!=null&&NOPKIDs!=""&&NOPKIDs!=string.Empty)
//				{
//					cityPKIDs+=NOPKIDs;
//				}
//				//如果该用户是总部的 就能看到
//							/* Andy Modify 2009-03-08 */
//				filter.AddCustomerFilter("(ADClient.FK_City IN(" + cityPKIDs + ") OR ADClient.FK_ADInfomation IN (" + ADInfomationPKID + ")) AND ADClient.FK_ADInfomation IN (" + regionRule.GetAuthorizedADInfomationPKID(GlobalFacade.SystemContext.GetContext().UserID) + ")", AndOr.AND);
//			}
//			else
//			{
//				cityPKIDs=cityPKIDs.Substring(1,cityPKIDs.Length-2);
//				//如果该用户不是总部的 无法看到
//				/* Andy Modify 2009-03-08 */
//				filter.AddCustomerFilter("(ADClient.FK_City IN(" + cityPKIDs + ") AND ADClient.FK_ADInfomation not IN (" + ADInfomationPKID + ")) AND ADClient.FK_ADInfomation IN (" + regionRule.GetAuthorizedADInfomationPKID(GlobalFacade.SystemContext.GetContext().UserID) + ")", AndOr.AND);
//			}
//						//过滤城市
//			//filter.AddCustomerFilter("(ADClient.FK_City IN(" + cityPKIDs + ") OR ADClient.FK_City IN (" + cityPKIDs + "))", AndOr.AND);
//			filter.AddFilterItem("IsValid","1",Operation.Equal,FilterType.NumberType,AndOr.AND);
//
//			if (subfilter != null)
//				filter.AddFilter(subfilter,AndOr.AND);
//			boc.AddFilter(filter);
//			DataSet ds = boc.GetPagedRecords(pageIndex, pageSize, "PKID", (obType == Common.OrderByType.ASC)?true:false);
//
//			totalCount = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
//			return ds.Tables[1];
            Wicresoft.Session.Session session = new Wicresoft.Session.Session();
            BusinessObjectCollection  boc     = new BusinessObjectCollection("Dictionary");

            boc.SessionInstance = session;
            BusinessFilter filter = new BusinessFilter("Dictionary");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("Level", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            if (subfilter != null)
            {
                filter.AddFilter(subfilter, AndOr.AND);
            }
            boc.AddFilter(filter);
            DataSet ds = boc.GetPagedRecords(pageIndex, pageSize, "PKID", (obType == Common.OrderByType.ASC)?true:false);

            totalCount = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
            return(ds.Tables[1]);
        }
コード例 #7
0
 public Dictionary()
 {
     session = new Wicresoft.Session.Session();
 }