public static ConsolidatedRequisitionList getOpenListForDept(string deptCode)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var query = from x in context.ConsolidatedRequisitionLists
                        where x.DepartmentCode == deptCode && x.Status == STATUS_OPEN
                        select x;

            List <ConsolidatedRequisitionList> list = query.ToList <ConsolidatedRequisitionList>();
            ConsolidatedRequisitionList        cl   = query.First <ConsolidatedRequisitionList>();

            return(cl);
        }
Exemplo n.º 2
0
        public static void deleteAdjustmentVoucher(int voucher)
        {
            UniversityStoreEntities CONTEXT = new UniversityStoreEntities();
            var b = from x in CONTEXT.AdjustmentVouchers
                    where x.VoucherNumber == voucher
                    select x;

            AdjustmentVoucher q = b.First <AdjustmentVoucher>();

            CONTEXT.DeleteObject(q);
            CONTEXT.SaveChanges();
        }
Exemplo n.º 3
0
        public static List <RequisitionDetail> getDetialsOfListW(string reqListNumber) //// for web
        {
            UniversityStoreEntities context = new UniversityStoreEntities();

            System.Int32 rNum  = Convert.ToInt32(reqListNumber);
            var          query = from x in context.RequisitionDetails
                                 from y in context.Products
                                 where x.RequisitionListNumber == rNum && y.ItemNumber == x.ItemNmber
                                 select x;

            return(query.ToList <RequisitionDetail>());
        }
        public static void addRequestedQtyForItem(int consolidatedListId, string itemCode, int qty)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var query = from x in context.ConsolidatedRequisitionListDetails
                        where x.ConsolidatedListID == consolidatedListId && x.ItemNumber == itemCode
                        select x;
            ConsolidatedRequisitionListDetail detailItem = query.First();
            int k = Convert.ToInt32(detailItem.QuantityRequested);

            detailItem.QuantityRequested = qty + k;
            context.SaveChanges();
        }
Exemplo n.º 5
0
        public static void changeToAcknowledge(int pn)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var q = from x in context.PurchaseOrderDetails
                    where x.PONumber == pn && x.PurchaseOrder.Status == STATUS_PENDING
                    select x;

            PurchaseOrderDetail a = q.First <PurchaseOrderDetail>();

            a.PurchaseOrder.Status = STATUS_ACKNOWLEGED;
            context.SaveChanges();
        }
Exemplo n.º 6
0
        public static List <Object> selectAllByGroupByCategory()
        {
            UniversityStoreEntities us = new UniversityStoreEntities();
            var q = from x in us.Products
                    group x by x.Category into g
                    select new
            {
                Category = g.Key
            };

            return(q.ToList <Object>());
        }
Exemplo n.º 7
0
        //public static DateTime getDate(int VoucherNo)
        //{
        //    var q2 = from x in CONTEXT.AdjustmentVouchers
        //             where x.VoucherNumber == VoucherNo
        //             select x;



        //    DateTime av =(DateTime) q2.First<AdjustmentVoucher>().DateCreated;
        //    return av;

        public static void deleteAdjustmentVoucherDetail(int voucherNo)
        {
            UniversityStoreEntities CONTEXT = new UniversityStoreEntities();
            var a = from x in CONTEXT.AdjustmentVoucherDetails
                    where x.VoucherNumber == voucherNo
                    select x;

            AdjustmentVoucherDetail d = a.First <AdjustmentVoucherDetail>();

            CONTEXT.DeleteObject(d);
            CONTEXT.SaveChanges();
        }
Exemplo n.º 8
0
        public static List <Product> getProductFromListOfID(String[] id)
        {
            UniversityStoreEntities us = new UniversityStoreEntities();
            List <Product>          pa = new List <Product>();

            foreach (String g in id)
            {
                Product c = us.Products.First <Product>(x => x.ItemNumber == g);
                pa.Add(c);
            }

            return(pa);
        }
Exemplo n.º 9
0
        public static List <Object> getAllDepInvolved()
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var q = from x in context.RequisitionLists
                    where x.Status == STATUS_APPROVED
                    group x by x.DepartmentCode into g
                    select new
            {
                depCode = g.Key
            };

            return(q.ToList <Object>());
        }
Exemplo n.º 10
0
        public static void changeReqListStatusClosed(string rlistNumber)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();

            System.Int32 rln   = Convert.ToInt32(rlistNumber);
            var          query = from x in context.RequisitionLists
                                 where x.RequisitionListNumber == rln
                                 select x;
            RequisitionList rl = query.First <RequisitionList>();

            rl.Status = STATUS_CLOSED;
            context.SaveChanges();
        }
        public static Department getListForConsolidatedItem(ConsolidatedRequisitionListDetail item)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var query = from x in context.ConsolidatedRequisitionLists
                        from y in context.ConsolidatedRequisitionListDetails
                        where x.ConsolidatedListID == y.ConsolidatedListID
                        select x;

            ConsolidatedRequisitionList list = query.First();
            Department dept = list.Department;

            return(dept);
        }
Exemplo n.º 12
0
        /////*********Wu************/////
        public static List <Object> getPendingAdjustmentVoucher()
        {
            UniversityStoreEntities CONTEXT = new UniversityStoreEntities();
            var query = from x in CONTEXT.AdjustmentVoucherDetails
                        where x.Status == APPROVAL_STATUS_PENDING
                        select new
            {
                x.VoucherNumber,
                x.AdjustmentVoucher.DateCreated
            };

            return(query.ToList <Object>());
        }
Exemplo n.º 13
0
        public static void addToCart(string itemNumber, int qty, string empNumber)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            RequestStationaryCart   c       = new RequestStationaryCart();

            c.EmployeeNumber = empNumber;
            c.ItemCode       = itemNumber;
            c.Quantity       = Convert.ToInt32(qty);

            context.AddToRequestStationaryCarts(c);

            context.SaveChanges();
        }
Exemplo n.º 14
0
        public static void RemoveDelegate(String empno)
        {
            UniversityStoreEntities EN = new UniversityStoreEntities();
            var q1 = from x in EN.Employees
                     where x.EmployeeNumber == empno
                     select x;


            Employee e = q1.First <Employee>();

            e.Role = ROLE_EMPLOYEE;
            EN.SaveChanges();
        }
Exemplo n.º 15
0
        public static Employee getDepartmentRepDetails(string deptCode)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var query = from x in context.Departments
                        where x.DepartmentCode == deptCode
                        select x;

            Department dept = query.First();
            //need to double check employee1 refers to deptrep again
            Employee deptRep = dept.Employee1;

            return(deptRep);
        }
Exemplo n.º 16
0
        public static List <PurchaseOrderDetail> AcceptSupply(int PONumber)
        {
            UniversityStoreEntities    context             = new UniversityStoreEntities();
            List <PurchaseOrderDetail> purchaseorderdetail = new List <PurchaseOrderDetail>();
            var z = from x in context.PurchaseOrderDetails
                    where x.PONumber == PONumber
                    select x;

            List <PurchaseOrderDetail> pli = new List <PurchaseOrderDetail>();

            pli = z.ToList <PurchaseOrderDetail>();
            return(pli);
        }
Exemplo n.º 17
0
        /** end by wu
         * */
        public static int generatePO(string sCode)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            PurchaseOrder           po      = new PurchaseOrder();

            po.SupplierCode = sCode;
            po.Status       = "Pending";
            po.DateCreated  = DateTime.Now;
            context.AddToPurchaseOrders(po);
            context.SaveChanges();

            return(po.PONumber);
        }
Exemplo n.º 18
0
        public static void createDelegate(String empno)
        {
            UniversityStoreEntities EN = new UniversityStoreEntities();
            var q = from x in EN.Employees
                    where x.EmployeeNumber == empno
                    select x;


            Employee e = q.First <Employee>();

            e.Role = ROLE_DELEGATE_HEAD;
            EN.SaveChanges();
        }
        /**********
         * added New method by Nitin
         * *********/

        public static void finisheCollection()
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var q = from x in context.ConsolidatedRequisitionLists
                    where x.Status == STATUS_OPEN
                    select x;
            List <ConsolidatedRequisitionList> conlist = q.ToList <ConsolidatedRequisitionList>();

            foreach (ConsolidatedRequisitionList c in conlist)
            {
                c.Status = STATUS_WAITING;
                context.SaveChanges();
            }
        }
Exemplo n.º 20
0
        public static List <Object> populateAllProduct()
        {
            UniversityStoreEntities us = new UniversityStoreEntities();
            var data = from x in us.Products
                       select new
            {
                x.ItemNumber,
                x.Description,
                x.UnitOfMeasure,
                x.Category
            };

            return(data.ToList <Object>());
        }
        public static void addDetailToList(int listID, string itemCode, int qtyReq, DateTime dateCreated, int actualQty)
        {
            UniversityStoreEntities           context = new UniversityStoreEntities();
            ConsolidatedRequisitionListDetail c2      = new ConsolidatedRequisitionListDetail();

            c2.ConsolidatedListID = listID;
            c2.ItemNumber         = itemCode;
            c2.QuantityRequested  = qtyReq;
            c2.DateRequest        = dateCreated;
            c2.ActualQuantity     = 0;

            context.AddToConsolidatedRequisitionListDetails(c2);
            context.SaveChanges();
        }
Exemplo n.º 22
0
        //added a function -ashwin
        public static void approvestatusadjustmentvoucher(int voucherno)
        {
            UniversityStoreEntities CONTEXT = new UniversityStoreEntities();
            var q = from x in CONTEXT.AdjustmentVoucherDetails
                    where x.ApprovalStatus == APPROVAL_STATUS_PENDING && x.VoucherNumber == voucherno
                    select x;
            List <AdjustmentVoucherDetail> list = q.ToList <AdjustmentVoucherDetail>();

            foreach (AdjustmentVoucherDetail ad in list)
            {
                ad.ApprovalStatus = APPROVAL_STATUS_APPROVED;
                CONTEXT.SaveChanges();
            }
        }
Exemplo n.º 23
0
        public static List <Object> getAdjustmentVoucherDetail(int vocherNo)
        {
            UniversityStoreEntities CONTEXT = new UniversityStoreEntities();
            var q = from x in CONTEXT.AdjustmentVoucherDetails
                    where x.VoucherNumber == vocherNo
                    select new
            {
                x.ItemNumber,
                x.Quantity,
                x.Comment
            };

            return(q.ToList <Object>());
        }
Exemplo n.º 24
0
        public static List <Object> getAllEmployeesOfThisHead(String depH)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var query = from x in context.Employees
                        where x.EmployeeNumber == depH
                        select x;
            string e = query.First <Employee>().DepartmentCode;

            var query2 = from x in context.Employees
                         where x.DepartmentCode == e
                         select new { x.EmployeeNumber, x.Name };

            return(query2.ToList <Object>());
        }
Exemplo n.º 25
0
        public static List <Object> getAllOrder(int pn)
        {
            //if (pn != null)
            // {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var q = from x in context.PurchaseOrderDetails
                    where x.PurchaseOrder.PONumber == pn
                    select
                    new { x.ItemNumber, x.Description, x.Price, x.Quantity };

            return(q.ToList <Object>());

            //}
        }
Exemplo n.º 26
0
        public static void CreatePurchaseOrder(PurchaseOrder purchaseorder, List <PurchaseOrderDetail> purchaselist)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            EntityCollection <PurchaseOrderDetail> purchaseorderdetailcoll = new EntityCollection <PurchaseOrderDetail>();

            foreach (PurchaseOrderDetail p in purchaselist)
            {
                purchaseorderdetailcoll.Add(p);
            }

            purchaseorder.PurchaseOrderDetails = purchaseorderdetailcoll;

            context.AddToPurchaseOrders(purchaseorder);
            context.SaveChanges();
        }
Exemplo n.º 27
0
        public static void generateDetails(int poNumber, string price, string itemNum, int qty, string desc)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            PurchaseOrderDetail     pdetail = new PurchaseOrderDetail();

            pdetail.PONumber    = poNumber;
            pdetail.Price       = Convert.ToDouble(price);
            pdetail.ItemNumber  = itemNum;
            pdetail.Description = desc;
            pdetail.Quantity    = Convert.ToInt32(qty);

            context.AddToPurchaseOrderDetails(pdetail);

            context.SaveChanges();
        }
Exemplo n.º 28
0
        public static Department getdepartmentfromempid(string empid)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var q = from x in context.Employees
                    where x.EmployeeNumber == empid
                    select x;
            Employee emp = q.First <Employee>();

            var z = from y in context.Departments
                    where y.DepartmentCode == emp.DepartmentCode
                    select y;
            Department dep = z.First <Department>();

            return(dep);
        }
Exemplo n.º 29
0
        //////////////*************Ashwin***************//////////////

        public static void UpdateStockfromadjustment(String PID, String stat, int qnt)
        {
            UniversityStoreEntities us = new UniversityStoreEntities();
            Stock s = us.Stocks.First <Stock>(x => x.ItemNumber == PID);

            if (stat == PRODUCT_ADJUSTMENT_STATUS_REDUCE)
            {
                s.TotalInventoryBalance -= qnt;
            }
            else if (stat == PRODUCT_ADJUSTMENT_STATUS_INCREASE)
            {
                s.TotalInventoryBalance += qnt;
            }
            us.SaveChanges();
        }
Exemplo n.º 30
0
        public static List <Object> pupulateInvoice(string supName)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var b = from x in context.PurchaseOrders
                    where x.Supplier.Name == supName && x.Status == "Pending"
                    select new {
                x.SupplierCode,
                x.DateCreated,
                x.Supplier.Name,
                x.Status,
                x.PONumber
            };

            return(b.ToList <Object>());
        }