public static List <Stores> ToList(BLL.Activity v)
        {
            List <Stores> list = new List <Stores>();

            while (!v.EOF)
            {
                Stores t = new Stores();
                if (!v.IsColumnNull("ID"))
                {
                    t.ID = v.ID;
                }
                if (!v.IsColumnNull("HospitalID"))
                {
                    t.HospitalID = v.HospitalID;
                }
                if (!v.IsColumnNull("StoreName"))
                {
                    t.StoreName = v.StoreName;
                }
                if (!v.IsColumnNull("UsesMovingAverage"))
                {
                    t.UsesMovingAverage = v.UsesMovingAverage;
                }

                list.Add(t);
                v.MoveNext();
            }
            return(list);
        }
        public static void SaveList(List <HCMIS.Desktop.DirectoryServices.SubSubAccount> list)
        {
            BLL.Activity bv = new BLL.Activity();
            foreach (HCMIS.Desktop.DirectoryServices.SubSubAccount 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.Name != "" && v.Name != null)
                {
                    bv.StoreName = v.Name;
                }
                if (v.SubAccountID.HasValue)
                {
                    bv.StoreGroupDivisionID = v.SubAccountID.Value;
                }

                bv.Save();
            }
        }
 private void CostAnalysis_Load(object sender, EventArgs e)
 {
     gridJournal.DataSource = dvJournal;
     var store = new BLL.Activity();
     store.LoadByPrimaryKey(storeID);
     textEdit1.EditValue = store.Name;
     var supplier = new BLL.Supplier();
     supplier.LoadByPrimaryKey(supplierID);
     textEdit2.EditValue = supplier.CompanyName;
 }
Esempio n. 4
0
        private void CostAnalysis_Load(object sender, EventArgs e)
        {
            gridJournal.DataSource = dvJournal;
            var store = new BLL.Activity();

            store.LoadByPrimaryKey(storeID);
            textEdit1.EditValue = store.Name;
            var supplier = new BLL.Supplier();

            supplier.LoadByPrimaryKey(supplierID);
            textEdit2.EditValue = supplier.CompanyName;
        }
 public static void DeleteList(List <int> list)
 {
     BLL.Activity bv = new BLL.Activity();
     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
     }
 }
        protected override ICollection <ActivityGroup> GetData()
        {
            ICollection <Domain.ActivityGroup> activities = new Collection <Domain.ActivityGroup>();
            var dbActivities = new BLL.Activity();

            dbActivities.LoadAll();
            while (!dbActivities.EOF)
            {
                activities.Add(new ActivityGroup {
                    Activity = new Activity {
                        ActivityID = dbActivities.ID, Name = dbActivities.FullActivityName
                    }, IsDeliveryNote = true
                });
                activities.Add(new ActivityGroup {
                    Activity = new Activity {
                        ActivityID = dbActivities.ID, Name = dbActivities.FullActivityName
                    }, IsDeliveryNote = false
                });
                dbActivities.MoveNext();
            }
            return(activities);
        }
        public static void DeleteList(List<int> list)
        {
            BLL.Activity bv = new BLL.Activity();
            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.SubSubAccount> list)
        {
            BLL.Activity bv = new BLL.Activity();
            foreach (HCMIS.Desktop.DirectoryServices.SubSubAccount 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.Name != "" && v.Name != null)
                    bv.StoreName = v.Name;
                if (v.SubAccountID.HasValue)
                    bv.StoreGroupDivisionID = v.SubAccountID.Value;

                bv.Save();
            }
        }
        public static BLL.Models.StockAvailabilityStatistics GetStockAvailabilityStats(int month, int year)
        {
            var commodityType= new CommodityType();
            commodityType.LoadAll();
            var activity = new BLL.Activity();
            activity.LoadByMode(Mode.Constants.HEALTH_PROGRAM);

            var overstocked = 0;
            var nearEOP = 0;
            var belowEOP = 0;
            var stockedOut = 0;
            var normal = 0;

            while(!commodityType.EOF)
            {
                activity.Rewind();
                while(!activity.EOF)
                {
                    DataTable tbl = GetSohForAllItems(activity.ID,
                                                      commodityType.ID, year, month);
                    overstocked += (from y in tbl.AsEnumerable() where y["Status"].ToString() == "Over Stocked" select y).Count();
                    nearEOP += (from y in tbl.AsEnumerable() where y["Status"].ToString() == "Near EOP" select y).Count();
                    belowEOP += (from y in tbl.AsEnumerable() where y["Status"].ToString() == "Below EOP" select y).Count();
                    stockedOut += (from y in tbl.AsEnumerable() where y["Status"].ToString() == "Stock Out" select y).Count();
                    normal += (from y in tbl.AsEnumerable() where y["Status"].ToString() == "Normal" select y).Count();

                    activity.MoveNext();
                }
                commodityType.MoveNext();
            }

            var statistics = new StockAvailabilityStatistics(overstocked, normal, nearEOP, belowEOP, stockedOut);
            return statistics;
        }