Exemplo n.º 1
0
        //#region Web Service Getters

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

        //    public static List<DrugItemSubCategory> GetUpdatesAfter(long? lastVersion,DateTime? lastUpdateTime)
        //    {
        //        BLL.DrugItemSubCategory v = new BLL.DrugItemSubCategory();
        //        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.DrugItemSubCategory v = new BLL.DrugItemSubCategory();
        //        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.DrugItemSubCategory> list)
        {
            BLL.ProductsCategory bv = new BLL.ProductsCategory();
            foreach (HCMIS.Desktop.DirectoryServices.DrugItemSubCategory 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.SubCategoryID.HasValue)
                {
                    bv.SubCategoryID = v.SubCategoryID.Value;
                }
                if (v.ItemId.HasValue)
                {
                    bv.ItemId = v.ItemId.Value;
                }
                //if( v.IsDeleted.HasValue )
                //     bv.IsDeleted = v.IsDeleted.Value;
                //if( v.UpdateTime.HasValue )
                //     bv.UpdateTime = v.UpdateTime.Value;

                bv.Save();
            }
        }
        public static void SaveList(List<HCMIS.Desktop.DirectoryServices.DrugItemSubCategory> list)
        {
            BLL.ProductsCategory bv = new BLL.ProductsCategory();
            foreach (HCMIS.Desktop.DirectoryServices.DrugItemSubCategory 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.SubCategoryID.HasValue )
                   bv.SubCategoryID = v.SubCategoryID.Value;
              if( v.ItemId.HasValue )
                   bv.ItemId = v.ItemId.Value;
              //if( v.IsDeleted.HasValue )
              //     bv.IsDeleted = v.IsDeleted.Value;
              //if( v.UpdateTime.HasValue )
              //     bv.UpdateTime = v.UpdateTime.Value;

                bv.Save();
            }
        }