public void updateReqStatus(string reqId) //Update req status
        {
            Requisition r = context.Requisitions.Where(x => x.RequisitionID == reqId).First();

            r.Status = "Received";
            context.SaveChanges();
        }
Exemplo n.º 2
0
        public void updateOutstnading(string itemNumber, string depId, int quantity)  //To udate outstanding
        {
            OutstandingInfo o = context.OutstandingInfoes.Where(x => x.ItemNumber == itemNumber && x.DepartmentID == depId).FirstOrDefault();

            o.Quantity = quantity;
            o.Status   = "Pending";
            context.SaveChanges();
        }
Exemplo n.º 3
0
        public int activateDelegate(string empTitle, DateTime delegateStart, DateTime delegateEnd)
        {
            Employee e = getEmployeeByTitle(empTitle);

            e.Delegate          = 1;
            e.DelegateStartDate = delegateStart;
            e.DelegateEndDate   = delegateEnd;
            context.SaveChanges();
            return(0);
        }
        public void updateRequisitionStatus(string requisitionId, string status)
        {
            Requisition r = context.Requisitions.Where(x => x.RequisitionID == requisitionId).FirstOrDefault();

            r.Status = status;
            if (status == "Approved")
            {
                r.ApprovalDate = DateTime.Today;
            }
            context.SaveChanges();
        }
Exemplo n.º 5
0
        public int activateDelegate(string deptId, string empId, DateTime delegateStart, DateTime delegateEnd)
        {
            Employee h = getHeadByDepId(deptId);
            Employee e = getEmployeeById(empId);

            h.Delegate          = 1;
            h.DelegateStartDate = delegateStart;
            h.DelegateEndDate   = delegateEnd;
            e.Delegate          = 1;
            context.SaveChanges();
            return(0);
        }
        public Boolean createAdjustmentVoucher(string vID, string empID, double totalPrice)
        {
            bool status = false;
            SA43Team2StoreDBEntities ctx = new SA43Team2StoreDBEntities();
            Adjustment abo = new Adjustment();

            abo.VoucherID              = vID;
            abo.EmpID                  = empID;
            abo.AdjustmentStatus       = "Pending";
            abo.VoucherDate            = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));
            abo.AuthorisedBySupervisor = "No";
            abo.AuthorisedByManager    = "No";
            abo.TotalPrice             = Convert.ToDecimal(totalPrice);
            ctx.Adjustments.Add(abo);

            if (ctx.SaveChanges() > 0)
            {
                status = true;
            }
            else
            {
                status = false;
            }
            return(status);
        }
Exemplo n.º 7
0
        public Boolean updateStatusMan(string voId)
        {
            bool       status = false;
            Adjustment vo     = context.Adjustments.Where(x => x.VoucherID == voId).FirstOrDefault();

            vo.AdjustmentStatus    = "Approved";
            vo.AuthorisedByManager = "Yes";

            if (context.SaveChanges() > 0)
            {
                status = true;
            }
            else
            {
                status = false;
            }
            return(status);
        }
Exemplo n.º 8
0
    /*get delegated employee*/
    public static void delegateEmp(string DeptId, string EmpName, string startDate, string endDate)
    {
        string   EmpActName = EmpName.Replace("_", " ");
        Employee e          = (from x in m.Employees
                               where x.EmpName.Equals(EmpActName) && x.DepartmentID.Equals(DeptId)
                               select x).First();

        e.Delegate = 1;

        Employee e1 = (from x in m.Employees
                       where x.DepartmentID.Equals(DeptId) && x.EmpTitle.Equals("Head")
                       select x).First();

        e1.Delegate          = 1;
        e1.DelegateStartDate = Convert.ToDateTime(startDate);
        e1.DelegateEndDate   = Convert.ToDateTime(endDate);

        m.SaveChanges();
    }
        public int assignDepRep(string empId)
        {
            Employee e = new Employee();

            e = context.Employees.Where(x => x.EmpID.Equals(empId)).FirstOrDefault();
            Department d = new Department();

            d       = context.Departments.Where(x => x.DepartmentID.Equals(e.DepartmentID)).FirstOrDefault();
            d.RepID = empId;
            context.SaveChanges();
            return(0);
        }
    public static string ApproveRequisition(string comment, string reqId)
    {
        string update = "false";

        Requisition r = (from x in m.Requisitions
                         where x.RequisitionID.Equals(reqId)
                         select x).First();

        r.Status         = "Approved";
        r.CommentsByHead = comment;
        r.ApprovalDate   = DateTime.Now;

        if (m.SaveChanges() > 0)
        {
            update = "true";
        }
        else
        {
            update = "false";
        }

        return(update);
    }
        /*get update supplier*/
        public int updateSupplier(InventoryStock item)
        {
            InventoryStock stock = getInventoryById(item.ItemNumber);

            stock.Supplier1 = item.Supplier1;
            stock.Supplier2 = item.Supplier2;
            stock.Supplier3 = item.Supplier3;
            stock.Price1    = item.Price1;
            stock.Price2    = item.Price2;
            stock.Price3    = item.Price3;

            context.SaveChanges();

            return(1);
        }
        public void createAdjustmentVoucherDetails(string adNum, string vID, string itemNum, string qty, string supp, string reason)
        {
            SA43Team2StoreDBEntities ctx = new SA43Team2StoreDBEntities();
            AdjustmentDetail         ad  = new AdjustmentDetail();

            ad.AdjustmentDetailsID = adNum;
            ad.VoucherID           = vID;
            ad.ItemNumber          = itemNum;
            ad.QuantityAdjustment  = Convert.ToInt32(qty);
            ad.SupplierID          = supp;
            ad.Reason = reason;
            ctx.AdjustmentDetails.Add(ad);

            ctx.SaveChanges();
        }
    public static string updatePO(PurchaseOrder po)
    {
        var           q = m.PurchaseOrders.Where(x => x.POID == po.POID).FirstOrDefault();
        PurchaseOrder p = (PurchaseOrder)q;

        q.ApprovalDate         = DateTime.Today;
        q.Status               = po.Status;
        q.CommentsBySupervisor = po.CommentsBySupervisor;
        int updateStatus = m.SaveChanges();

        if (updateStatus > 0)
        {
            return("Success");
        }
        return("Fail");
    }
        public bool updateCollectionTime(string cp, string ct)
        {
            bool r = false;

            CollectionPointDetail d = new CollectionPointDetail();

            d = (from x in context.CollectionPointDetails
                 where x.CollectionPoint.Equals(cp)
                 select x).First();

            if (d != null)
            {
                d.CollectionTime = ct;
                context.SaveChanges();
                r = true;
            }
            return(r);
        }
        public bool updateCollectionPoint(string depId, string cp)
        {
            bool       r = false;
            string     id;
            Department d = new Department();

            d = (from x in context.Departments
                 where x.DepartmentID.Equals(depId)
                 select x).First();

            if (d != null)
            {
                id = getCollectionId(cp);
                d.CollectionPointID = id;
                context.SaveChanges();
                r = true;
            }
            return(r);
        }
Exemplo n.º 16
0
 public void submitRequisition(Requisition requisition)
 {
     context.Requisitions.Add(requisition);
     context.SaveChanges();
 }
Exemplo n.º 17
0
    public void updateDisList(List <ReadyForCollectionBO> rcboLst)
    {
        foreach (ReadyForCollectionBO rbo in rcboLst)
        {
            Disbursement d = (from x in context.Disbursements
                              where x.DepartmentID == rbo.DepId && x.RequisitionID.Equals(rbo.ReqisitionId) && x.ItemNumber == rbo.ItemNumber
                              select x).FirstOrDefault();
            if (d != null)
            {
                d.Status = "Close";
                d.DisbursementQuantity = rbo.DisbursedQuantity;
                context.SaveChanges();
                OutstandingInfo q2 = (from x in context.OutstandingInfoes
                                      where x.DepartmentID.Equals(rbo.DepId) && x.ItemNumber.Equals(rbo.ItemNumber)
                                      select x).FirstOrDefault();

                if (q2 != null)
                {
                    int requestedQty = Convert.ToInt32(d.OrderQuantity);
                    int dispQty      = (int)rbo.DisbursedQuantity; //To read from text box
                                                                   //Check for outstanding status
                    if (q2.Status != "Partial Received")
                    {
                        if ((requestedQty - dispQty) > 0)
                        {
                            q2.Quantity += (requestedQty - dispQty);
                        }
                        else if ((requestedQty - dispQty) < 0)
                        {
                            q2.Quantity -= (dispQty - requestedQty);
                        }
                        else
                        {
                            q2.Quantity = 0;
                        }
                    }

                    else
                    {
                        if ((requestedQty - dispQty) > 0)
                        {
                            q2.Quantity = q2.PartialPendingQty + (requestedQty - dispQty);
                        }
                        else if ((requestedQty - dispQty) < 0)
                        {
                            q2.Quantity = q2.PartialPendingQty + (dispQty - requestedQty);
                        }
                        else
                        {
                            q2.Quantity = 0;
                        }
                    }

                    if (q2.Quantity > 0)
                    {
                        q2.Status = "Pending";
                    }
                    else
                    {
                        q2.Status = "Received";
                    }
                    context.SaveChanges();
                }
            }
        }
    }