示例#1
0
        public static List <Region> ToList(BLL.Region v)
        {
            List <Region> list = new List <Region>();

            while (!v.EOF)
            {
                Region t = new Region();
                if (!v.IsColumnNull("ID"))
                {
                    t.ID = v.ID;
                }
                if (!v.IsColumnNull("RegionName"))
                {
                    t.RegionName = v.RegionName;
                }
                if (!v.IsColumnNull("RegionCode"))
                {
                    t.RegionCode = v.RegionCode;
                }


                list.Add(t);
                v.MoveNext();
            }
            return(list);
        }
示例#2
0
        public static void SaveList(List <HCMIS.Desktop.GeneralLookups.Region> list)
        {
            BLL.Region bv = new BLL.Region();
            foreach (HCMIS.Desktop.GeneralLookups.Region v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v.ID.Value);

                // if the entry doesn't exist, create it
                if (bv.RowCount == 0)
                {
                    bv.AddNew();
                }
                // populate the contents of v on the to the database list
                if (v.ID.HasValue)
                {
                    bv.ID = v.ID.Value;
                }
                if (v.RegionName != "" && v.RegionName != null)
                {
                    bv.RegionName = v.RegionName;
                }
                if (v.RegionCode != "" && v.RegionCode != null)
                {
                    bv.RegionCode = v.RegionCode;
                }
                //if( v.IsDeleted.HasValue )
                //     bv.IsDeleted = v.IsDeleted.Value;
                //if( v.UpdateTime.HasValue )
                //     bv.UpdateTime = v.UpdateTime.Value;

                bv.Save();
            }
        }
示例#3
0
        public static List <int> GetDeletedIDsAfter(long LastVersion)
        {
            BLL.Region v = new BLL.Region();
            //v.LoadDeletedIDs(LastVersion);
            List <int> list = new List <int>();

            while (!v.EOF)
            {
                list.Add((int)v.GetColumn("ID"));
                v.MoveNext();
            }
            return(list);
        }
示例#4
0
 public static void DeleteList(List <int> list)
 {
     BLL.Region bv = new BLL.Region();
     foreach (int v in list)
     {
         // try to load by primary key
         bv.LoadByPrimaryKey(v);
         // if the entry doesn't exist, create it
         if (bv.RowCount > 0)
         {
             bv.MarkAsDeleted();
             bv.Save();
         }
         // populate the contents of v on the to the database list
     }
 }
示例#5
0
 public static List <Region> GetUpdatesAfter(long?lastVersion, DateTime?lastUpdateTime)
 {
     BLL.Region v = new BLL.Region();
     if (lastVersion.HasValue && lastVersion.Value != 0)
     {
         v.LoadUpdatesAfter(Convert.ToInt32(lastVersion.Value));
     }
     else if (lastUpdateTime.HasValue)
     {
         // v.LoadUpdatesAfterByTime(lastUpdateTime.Value);
     }
     else
     {
         v.LoadAll();
     }
     return(ToList(v));
 }
示例#6
0
 public static List <Region> GetAll()
 {
     BLL.Region v = new BLL.Region();
     v.LoadAll();
     return(ToList(v));
 }
        public static void DeleteList(List<int> list)
        {
            BLL.Region bv = new BLL.Region();
            foreach (int v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v);
                // if the entry doesn't exist, create it
                if (bv.RowCount > 0)
                {
                    bv.MarkAsDeleted();
                    bv.Save();
                }
                // populate the contents of v on the to the database list

            }
        }
        public static void SaveList(List<HCMIS.Desktop.GeneralLookups.Region> list)
        {
            BLL.Region bv = new BLL.Region();
            foreach (HCMIS.Desktop.GeneralLookups.Region v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v.ID.Value);

                // if the entry doesn't exist, create it
                if (bv.RowCount == 0)
                {
                    bv.AddNew();
                }
                // populate the contents of v on the to the database list
                if (v.ID.HasValue)
                    bv.ID = v.ID.Value;
                if (v.RegionName != "" && v.RegionName != null)
                    bv.RegionName = v.RegionName;
                if (v.RegionCode != "" && v.RegionCode != null)
                    bv.RegionCode = v.RegionCode;
                //if( v.IsDeleted.HasValue )
                //     bv.IsDeleted = v.IsDeleted.Value;
                //if( v.UpdateTime.HasValue )
                //     bv.UpdateTime = v.UpdateTime.Value;

                bv.Save();
            }
        }
 public static List<Region> GetUpdatesAfter(long? lastVersion, DateTime? lastUpdateTime)
 {
     BLL.Region v = new BLL.Region();
     if (lastVersion.HasValue && lastVersion.Value != 0)
     {
         v.LoadUpdatesAfter(Convert.ToInt32(lastVersion.Value));
     }
     else if (lastUpdateTime.HasValue)
     {
         // v.LoadUpdatesAfterByTime(lastUpdateTime.Value);
     }
     else
     {
         v.LoadAll();
     }
     return ToList(v);
 }
 public static List<int> GetDeletedIDsAfter(long LastVersion)
 {
     BLL.Region v = new BLL.Region();
     //v.LoadDeletedIDs(LastVersion);
     List<int> list = new List<int>();
     while (!v.EOF)
     {
         list.Add((int)v.GetColumn("ID"));
         v.MoveNext();
     }
     return list;
 }
 public static List<Region> GetAll()
 {
     BLL.Region v = new BLL.Region();
     v.LoadAll();
     return ToList(v);
 }
示例#12
0
        void IServiceBase.Request(string t, string pars, out string res)
        {
            try
            {
                ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars);
                var          kv  = r.ToDictionary();
                IBLL.IRegion bll = new BLL.Region();
                if (t == "get_list")
                {
                    var tb = bll.GetList();
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("data", tb);
                    res = w.ToString();
                }
                else if (t == "get_item")
                {
                    string region_no = r.Read("region_no");
                    var    tb        = bll.GetItem(region_no);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("data", tb);
                    res = w.ToString();
                }
                else if (t == "max_code")
                {
                    string code = bll.MaxCode();
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("code", code);
                    res = w.ToString();
                }
                else if (t == "add")
                {
                    Model.bi_t_region_info item = new Model.bi_t_region_info();
                    item.region_no     = r.Read("region_no");
                    item.region_name   = r.Read("region_name");
                    item.display_flag  = r.Read("display_flag");
                    item.region_parent = r.Read("region_parent");
                    item.update_time   = DateTime.Now;
                    bll.Add(item);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "change")
                {
                    Model.bi_t_region_info item = new Model.bi_t_region_info();
                    item.region_no     = r.Read("region_no");
                    item.region_name   = r.Read("region_name");
                    item.display_flag  = r.Read("display_flag");
                    item.region_parent = r.Read("region_parent");
                    item.update_time   = DateTime.Now;
                    bll.Change(item);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "delete")
                {
                    string region_no = r.Read("region_no");
                    bll.Delete(region_no);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else
                {
                    throw new Exception("未找到方法" + t);
                }
            }
            catch (Exception ex)
            {
                ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                w.Append("errId", "-1");
                w.Append("errMsg", ex.Message);
                res = w.ToString();
            }
        }