示例#1
0
 public static List<Object> getChartData()
 {
     CollectionHelper cph = new CollectionHelper();
     stationeryEntities db = new stationeryEntities();
     List<Object> chartdata = new List<object>();
     DataTable charttable = new DataTable();
     List<ChartData> finalchart = new List<ChartData>();
     var q = from dep in db.departments
             from disb in db.disbursements
             from dd in db.disbursementdetails
             from i in db.items
             where
               i.ItemID == dd.DisbItemID &&
               disb.DisbID == dd.DisbID &&
               dep.DepID == disb.DisbDepID
             group new { i, dd } by new
             {
                 i.ItemDescription,
                 dd.DisbItemQuantDelivered
             } into g
             orderby
               g.Sum(p => p.dd.DisbItemQuantReq)
             select new
             {
                 g.Key.ItemDescription,
                 Qunatity_Delivered = (System.Int32?)g.Sum(p => p.dd.DisbItemQuantReq)
             };
     chartdata = q.ToList<Object>();
     return chartdata;
 }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            avList_Head.Visible = false;
            av_EMP.Visible = false;
            avList_Emp.Visible = false;
            stationeryEntities se=new stationeryEntities();
            storeemp semp = new storeemp();

            int userid = Convert.ToInt32(Session["userid"]);

            var q = from ste in se.storeemps
                    where ste.StoreEmpID == userid
                    select ste;
            semp = q.FirstOrDefault();
            if ((semp.role.RoleName == "Store Manager") || (semp.role.RoleName == "Store Supervisor"))
            {
                avList_Head.Visible = true;
            }
            else if (semp.role.RoleName == "Store Clerk")
            {
                av_EMP.Visible = true;
                avList_Emp.Visible = true;

            }

            HttpCookie user = new HttpCookie("usercookie");
            user = Request.Cookies["usercookie"];
            if (user != null)
            {
                lbl_username.InnerText = user.Value;
            }
        }
        public static List<Object> getChart(int itemName, int catName, int depName, string fromdate, string todate)
        {
            stationeryEntities se = new stationeryEntities();
            int itemID = itemName;
            int catID = catName;
            int depID = depName;

            DateTime fromdates = new DateTime();

            List<Object> chart = new List<object>();
            DateTime todates = new DateTime();
            fromdates = Convert.ToDateTime(fromdate);
            todates = Convert.ToDateTime(todate);

            //get Chart by Category
            if ((itemID == 0) && (catID != 0) && (depID == 0))
            {
                chart = se.getChartbyCategoryandItem(fromdates, todates, catID).ToList<Object>();

            }

                //get chart by Department
            else if ((itemID == 0) && ((catID != 0) || (catID == 0)) && (depID != 0))
            {
                chart = se.getChartForDepByCategoryOnly(fromdates, todates, depID).ToList<object>();

            }
            return chart;

            //chart = se.getChartbyCategory(fromdate, todate).ToList<Object>();
            //return chart;
        }
        public List<item> findLowQuantItems()
        {
            stationeryEntities se = new stationeryEntities();
            List<item> lowitems = new List<item>();
            var q = from i in se.items
                    where i.ItemQuant < i.ItemReOrderLvl
                    select i;
            lowitems = q.ToList();

            return lowitems;
        }
        public static List<string> GetCompletionList(string prefixText, int count)
        {
            using (var context = new stationeryEntities())
            {

                var subjects = from s in context.items
                               where s.ItemDescription.StartsWith(prefixText)
                               select s;
                List<String> cList = new List<String>();
                foreach (var subject in subjects)
                {
                    cList.Add(subject.ItemDescription);
                }
                return cList;
            }
        }
        public List<DepartmentDisbDetails> getDisbyStatus(string status, DateTime date)
        {
            DateTime checkdate = new DateTime();
            checkdate = date;
            List<DepartmentDisbDetails> finaldisbist = new List<DepartmentDisbDetails>();
            List<object> dlist = new List<object>();
            List<object> ditems = new List<object>();
            stationeryEntities db = new stationeryEntities();
            List<CustomDepartmentDisb> custdepdiblidt = new List<CustomDepartmentDisb>();
            custdepdiblidt = db.getDepForDisb1(checkdate, status).ToList<CustomDepartmentDisb>();
            foreach (CustomDepartmentDisb dep in custdepdiblidt)
            {
                DepartmentDisbDetails depitem = new DepartmentDisbDetails();
                depitem.DepID = dep.DepID;
                depitem.DepName = dep.DepName;
                depitem.DepCPName = dep.CollectionPointName;
                depitem.DepDisID = dep.DisbID;
                depitem.DepDisbItems = db.getDisbItemsByDep(dep.DepID, status, checkdate).ToList<object>();
                finaldisbist.Add(depitem);
            }

            return finaldisbist;
        }
示例#7
0
 public TransactionRepository()
 {
     se = new stationeryEntities();
 }
        public static List<CustomChart> getCustomChart(List<string> date)
        {
            stationeryEntities se = new stationeryEntities();
            List<string> Datesn = new List<string>();

            int index = Datesn.Count;
            int length = 0;
            List<CustomDepOrder> DepOrder = new List<CustomDepOrder>();
            List<CustomChart> finalChart = new List<CustomChart>();

            Datesn = date;
            foreach (string d in Datesn)
            {
                DateTime fromDate = new DateTime();
                DateTime toDate = new DateTime();
                List<Object> chart = new List<object>();
                fromDate = Convert.ToDateTime(d);
                toDate = fromDate.AddDays(30);
                DepOrder = se.getDepOrderByMonth1(fromDate,toDate).ToList<CustomDepOrder>();
                foreach (CustomDepOrder deporder in DepOrder)
                {
                    if (finalChart.Count == 0)
                    {
                        CustomChart newcc = new CustomChart();
                        newcc.depName = deporder.DepName;
                        newcc.Month1 = deporder.QuantDelivered ?? default(int);
                        finalChart.Add(newcc);

                    }
                    else
                    {
                        int notfound = 0;
                        length = finalChart.Count;
                        for (int i = 0; i < length; i++)
                        {
                            if (finalChart[i].depName == deporder.DepName)
                            {

                                if (finalChart[i].Month1 == 0)
                                {
                                    finalChart[i].Month1 = deporder.QuantDelivered ?? default(int);
                                }
                                else if (finalChart[i].Month2 == 0)
                                {
                                    finalChart[i].Month2 = deporder.QuantDelivered ?? default(int);
                                }
                                else if (finalChart[i].Month3 == 0)
                                {
                                    finalChart[i].Month3 = deporder.QuantDelivered ?? default(int);
                                }
                                notfound = 0;
                                break;

                            }
                            else
                            {
                                notfound = 1;

                            }

                        }

                        if (notfound != 0)
                        {
                            CustomChart newchart = new CustomChart();
                            newchart.depName = deporder.DepName;
                            newchart.Month1 = deporder.QuantDelivered ?? default(int);
                            finalChart.Add(newchart);
                        }

                        //foreach (CustomChart cusdep in finalChart)
                        //{
                        //    if (cusdep.depName == deporder.DepName)
                        //    {
                        //        if (cusdep.Month1 == 0)
                        //        {
                        //            cusdep.Month1 = deporder.QuantDelivered ?? default(int);
                        //        }
                        //        else if (cusdep.Month2 == 0)
                        //        {
                        //            cusdep.Month2 = deporder.QuantDelivered ?? default(int);
                        //        }
                        //        else if (cusdep.Month3 == 0)
                        //        {
                        //            cusdep.Month3 = deporder.QuantDelivered ?? default(int);
                        //        }

                        //    }
                        //    else
                        //    {
                        //        CustomChart newchart = new CustomChart();
                        //        newchart.depName = deporder.DepName;
                        //        newchart.Month1 = deporder.QuantDelivered ?? default(int);
                        //        finalChart.Add(newchart);

                        //    }

                        //}
                    }

                }

            }
            return finalChart;
        }
 public List<Object> getallCat()
 {
     stationeryEntities se = new stationeryEntities();
     List<Object> categories = new List<Object>();
     return categories;
 }
示例#10
0
 public DisbursementRepository()
 {
     se = new stationeryEntities();
 }
示例#11
0
 public RequisitionRepository()
 {
     entities = new stationeryEntities();
 }
示例#12
0
 public PurchaseOrderRepository()
 {
     se = new stationeryEntities();
 }
示例#13
0
 public AdjustmentRepository()
 {
     entity = new stationeryEntities();
 }