public static void SaveList(List<Proxy.DrugSubCategory> list)
        {
            BLL.SubCategory bv = new BLL.SubCategory();
            foreach (Proxy.DrugSubCategory 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.CategoryId.HasValue )
                   bv.CategoryId = v.CategoryId.Value;
              if( v.SubCategoryName != "" && v.SubCategoryName != null )
                   bv.SubCategoryName = v.SubCategoryName;
              if( v.SubCategoryCode != "" && v.SubCategoryCode != null )
                   bv.SubCategoryCode = v.SubCategoryCode;
              if( v.Description != "" && v.Description != null )
                   bv.Description = v.Description;
              if( v.ParentID.HasValue )
                   bv.ParentID = v.ParentID.Value;

                bv.Save();
            }
        }
Exemple #2
0
 public static void DeleteList(List <int> list)
 {
     BLL.SubCategory bv = new BLL.SubCategory();
     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
     }
 }
Exemple #3
0
        //#region Web Service Getters

        //    public static List<DrugSubCategory> GetAll()
        //    {
        //        BLL.DrugSubCategory v = new BLL.DrugSubCategory();
        //        v.LoadAll();
        //        return ToList(v);
        //    }

        //    public static List<DrugSubCategory> GetUpdatesAfter(long? lastVersion,DateTime? lastUpdateTime)
        //    {
        //        BLL.DrugSubCategory v = new BLL.DrugSubCategory();
        //        if(lastVersion.HasValue && lastVersion.Value != 0)
        //        {
        //            v.LoadUpdatesAfter( lastVersion.Value );
        //        }else if(lastUpdateTime.HasValue)
        //        {
        //            v.LoadUpdatesAfterByTime(lastUpdateTime.Value);
        //        }else
        //        {
        //            v.LoadAll();
        //        }
        //        return ToList(v);
        //    }

        //    public static List<int> GetDeletedIDsAfter(long LastVersion)
        //    {
        //         BLL.DrugSubCategory v = new BLL.DrugSubCategory();
        //        v.LoadDeletedIDs(LastVersion);
        //        List<int> list = new List<int>();
        //        while (!v.EOF)
        //        {
        //            list.Add((int)v.GetColumn("ID"));
        //            v.MoveNext();
        //        }
        //        return list;
        //    }

        //#endregion



        #region Utilities


        #endregion


        #region Web service Saving

        public static void SaveList(List <HCMIS.Desktop.DirectoryServices.DrugSubCategory> list)
        {
            BLL.SubCategory bv = new BLL.SubCategory();
            foreach (HCMIS.Desktop.DirectoryServices.DrugSubCategory 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.CategoryId.HasValue)
                {
                    bv.CategoryId = v.CategoryId.Value;
                }
                if (v.SubCategoryName != "" && v.SubCategoryName != null)
                {
                    bv.SubCategoryName = v.SubCategoryName;
                }
                if (v.SubCategoryCode != "" && v.SubCategoryCode != null)
                {
                    bv.SubCategoryCode = v.SubCategoryCode;
                }
                if (v.Description != "" && v.Description != null)
                {
                    bv.Description = v.Description;
                }
                if (v.ParentID.HasValue)
                {
                    bv.ParentID = v.ParentID.Value;
                }
                //if( v.IsDeleted.HasValue )
                //     bv.IsDeleted = v.IsDeleted.Value;
                //if( v.UpdateTime.HasValue )
                //     bv.UpdateTime = v.UpdateTime.Value;

                bv.Save();
            }
        }
        //#region Web Service Getters

        //    public static List<Proxy.SubCategory> GetAll()
        //    {
        //        BLL.SubCategory v = new BLL.SubCategory();
        //        v.LoadAll();
        //        return ToList(v);
        //    }

        //    public static List<Proxy.SubCategory> GetUpdatesAfter(int LastVersion)
        //    {
        //        BLL.SubCategory v = new BLL.SubCategory();
        //        v.LoadUpdatesAfter( LastVersion );
        //        return ToList(v);
        //    }

        //#endregion



        #region Utilities

        public static List <Proxy.DrugSubCategory> ToList(BLL.SubCategory v)
        {
            List <Proxy.DrugSubCategory> list = new List <Proxy.DrugSubCategory>();

            while (!v.EOF)
            {
                Proxy.DrugSubCategory t = new Proxy.DrugSubCategory();
                if (!v.IsColumnNull("ID"))
                {
                    t.ID = v.ID;
                }
                if (!v.IsColumnNull("CategoryId"))
                {
                    t.CategoryId = v.CategoryId;
                }
                if (!v.IsColumnNull("SubCategoryName"))
                {
                    t.SubCategoryName = v.SubCategoryName;
                }
                if (!v.IsColumnNull("SubCategoryCode"))
                {
                    t.SubCategoryCode = v.SubCategoryCode;
                }
                if (!v.IsColumnNull("Description"))
                {
                    t.Description = v.Description;
                }
                if (!v.IsColumnNull("ParentID"))
                {
                    t.ParentID = v.ParentID;
                }

                list.Add(t);
                v.MoveNext();
            }
            return(list);
        }
        public static void DeleteList(List<int> list)
        {
            BLL.SubCategory bv = new BLL.SubCategory();
            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

            }
        }