Esempio n. 1
0
 public static void DeleteList(List <int> list)
 {
     BLL.Items bv = new BLL.Items();
     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.DirectoryServices.Items> list)
        {
            bool isNew = false;
            BLL.Items bv = new BLL.Items();
            foreach (HCMIS.Desktop.DirectoryServices.Items 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)
                {
                    isNew = true;
                    bv.AddNew();
                    bv.IsFree = true;
                }
                // populate the contents of v on the to the database list
                if (v.ID.HasValue)
                    bv.ID = v.ID.Value;
                if (v.StockCode != "" && v.StockCode != null)
                    bv.StockCode = v.StockCode;

                if (v.Strength != "" && v.Strength != null)
                    bv.Strength = v.Strength;
                else
                    bv.SetColumnNull("Strength");

                if (v.DosageFormID.HasValue)
                    bv.DosageFormID = v.DosageFormID.Value;
                else
                    bv.SetColumnNull("DosageFormID");

                if (v.UnitID.HasValue)
                    bv.UnitID = v.UnitID.Value;

                if (v.VEN.HasValue)
                    bv.VEN = v.VEN.Value;
                else
                    bv.VEN = 1;

                if (v.ABC.HasValue)
                    bv.ABC = v.ABC.Value;
                else
                    bv.ABC = 1;
                if (v.QtyPerPack.HasValue)
                    bv.Cost = v.QtyPerPack.Value;
                if (v.EDL.HasValue)
                    bv.EDL = v.EDL.Value;
                if (v.Pediatric.HasValue)
                    bv.Pediatric = v.Pediatric.Value;
                if (v.IINID.HasValue)
                    bv.IINID = v.IINID.Value;
                if (v.NeedExpiryBatch.HasValue)
                {
                    bv.NeedExpiryBatch = v.NeedExpiryBatch.Value;
                }
                else
                {
                    bv.NeedExpiryBatch = false;
                }

                if (v.Code != "" && v.Code != null)
                    bv.Code = v.Code;

                if (v.StockCodeDACA != "" && v.StockCodeDACA != null)
                    bv.StockCodeDACA = v.StockCodeDACA;

                if (v.NearExpiryTrigger.HasValue)
                    bv.NearExpiryTrigger = v.NearExpiryTrigger.Value;
                if (v.StorageTypeID.HasValue && isNew)
                    bv.StorageTypeID = v.StorageTypeID.Value;
                if (v.IsStackStored.HasValue && isNew)
                    bv.IsStackStored = v.IsStackStored.Value;

                bv.Save();
            }
        }
        public static void DeleteList(List<int> list)
        {
            BLL.Items bv = new BLL.Items();
            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

            }
        }
Esempio n. 4
0
        public static void SaveList(List <HCMIS.Desktop.DirectoryServices.Items> list)
        {
            bool isNew = false;

            BLL.Items bv = new BLL.Items();
            foreach (HCMIS.Desktop.DirectoryServices.Items 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)
                {
                    isNew = true;
                    bv.AddNew();
                    bv.IsFree = true;
                }
                // populate the contents of v on the to the database list
                if (v.ID.HasValue)
                {
                    bv.ID = v.ID.Value;
                }
                if (v.StockCode != "" && v.StockCode != null)
                {
                    bv.StockCode = v.StockCode;
                }

                if (v.Strength != "" && v.Strength != null)
                {
                    bv.Strength = v.Strength;
                }
                else
                {
                    bv.SetColumnNull("Strength");
                }

                if (v.DosageFormID.HasValue)
                {
                    bv.DosageFormID = v.DosageFormID.Value;
                }
                else
                {
                    bv.SetColumnNull("DosageFormID");
                }

                if (v.UnitID.HasValue)
                {
                    bv.UnitID = v.UnitID.Value;
                }

                if (v.VEN.HasValue)
                {
                    bv.VEN = v.VEN.Value;
                }
                else
                {
                    bv.VEN = 1;
                }

                if (v.ABC.HasValue)
                {
                    bv.ABC = v.ABC.Value;
                }
                else
                {
                    bv.ABC = 1;
                }
                if (v.QtyPerPack.HasValue)
                {
                    bv.Cost = v.QtyPerPack.Value;
                }
                if (v.EDL.HasValue)
                {
                    bv.EDL = v.EDL.Value;
                }
                if (v.Pediatric.HasValue)
                {
                    bv.Pediatric = v.Pediatric.Value;
                }
                if (v.IINID.HasValue)
                {
                    bv.IINID = v.IINID.Value;
                }
                if (v.NeedExpiryBatch.HasValue)
                {
                    bv.NeedExpiryBatch = v.NeedExpiryBatch.Value;
                }
                else
                {
                    bv.NeedExpiryBatch = false;
                }

                if (v.Code != "" && v.Code != null)
                {
                    bv.Code = v.Code;
                }

                if (v.StockCodeDACA != "" && v.StockCodeDACA != null)
                {
                    bv.StockCodeDACA = v.StockCodeDACA;
                }

                if (v.NearExpiryTrigger.HasValue)
                {
                    bv.NearExpiryTrigger = v.NearExpiryTrigger.Value;
                }
                if (v.StorageTypeID.HasValue && isNew)
                {
                    bv.StorageTypeID = v.StorageTypeID.Value;
                }
                if (v.IsStackStored.HasValue && isNew)
                {
                    bv.IsStackStored = v.IsStackStored.Value;
                }

                bv.Save();
            }
        }