コード例 #1
0
        public string GetEntryLevelById(string entryId)
        {
            BusinessFilter flt = new BusinessFilter("Dictionary");

            flt.AddFilterItem("PKID", entryId, Operation.Equal, FilterType.NumberType, AndOr.AND);

            BusinessMapping.Dictionary bo = new BusinessMapping.Dictionary();
            bo.SessionInstance = session;
            bo.AddFilter(flt);
            bo.Load();

            return((bo.HaveRecord)?bo.Level.Value.ToString():string.Empty);
        }
コード例 #2
0
        public string GetRoot()
        {
            BusinessFilter filter = new BusinessFilter("Dictionary");

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

            BusinessMapping.Dictionary rootregion = new BusinessMapping.Dictionary();
            rootregion.AddFilter(filter);
            rootregion.SessionInstance = new Session();
            rootregion.Load();

            return((rootregion.HaveRecord) ? rootregion.PKID.Value.ToString() : SystemManage.Level.Top);
        }
コード例 #3
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);
            }
        }
コード例 #4
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]);
        }
コード例 #5
0
        /// <summary>
        /// 获取城市名称
        /// </summary>
        /// <param name="pkid">城市PKID</param>
        /// <returns></returns>
        public string GetDictionaryName(string pkid)
        {
            string name = string.Empty;

            BusinessMapping.Dictionary bo = new BusinessMapping.Dictionary();
            bo.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("Dictionary");

            filter.AddFilterItem("PKID", pkid, Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            bo.AddFilter(filter);

            bo.Load();
            if (bo.HaveRecord)
            {
                name = bo.Name.Value;
            }

            return(name);
        }