Ejemplo n.º 1
0
        public List <StoreStaff> GetStoreStaff(int storeID)
        {
            List <StoreStaff> list = new List <StoreStaff>();

            try
            {
                var sql  = "SELECT [ID],[StoreID],[StaffName],[Phone],[IsReceiveDelivery] FROM StoreStaff WEHER [StoreID]=@StoreID";
                var pars = new List <SqlParameter>();
                pars.Add(new SqlParameter("@StoreID", storeID));
                var dt = SQLHelper.GetTable(sql, pars.ToArray());
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var obj = new StoreStaff
                    {
                        ID    = Convert.IsDBNull(dt.Rows[i]["ID"]) ? 0 : Convert.ToInt32(dt.Rows[i]["ID"]),
                        Store = new Store
                        {
                            StoreID = Convert.IsDBNull(dt.Rows[i]["StoreID"]) ? 0 : Convert.ToInt32(dt.Rows[i]["StoreID"]),
                        },
                        StaffName         = Convert.IsDBNull(dt.Rows[i]["StaffName"]) ? "" : Convert.ToString(dt.Rows[i]["StaffName"]),
                        Phone             = Convert.IsDBNull(dt.Rows[i]["Phone"]) ? "" : Convert.ToString(dt.Rows[i]["Phone"]),
                        IsReceiveDelivery = Convert.IsDBNull(dt.Rows[i]["IsReceiveDelivery"]) ? false : Convert.ToBoolean(dt.Rows[i]["IsReceiveDelivery"])
                    };
                    list.Add(obj);
                }
            }
            catch (Exception ex)
            {
            }
            return(list);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Team10ADModel context = new Team10ADModel();
                string        id      = (string)Session["AdjustVoucherId"];
                int           adjId   = Convert.ToInt32(id);

                int        storestaffid = (int)Session["clerkid"];
                StoreStaff staff        = RayBizLogic.GetStoreStaffById(storestaffid);

                dgvVoucherDetail.DataSource = RayBizLogic.AdjustmentVoucherDetailList(adjId);
                dgvVoucherDetail.DataBind();

                StockAdjustmentVoucher voucher = context.StockAdjustmentVouchers.Where(v => v.VoucherID == adjId).First();
                VouchderIdBox.Text = voucher.VoucherID.ToString();
                DateTextBox.Text   = voucher.DateIssue.ToString();
                GenByTextBox.Text  = voucher.StoreStaff.Name;

                if (staff.Title == "Supervisor" && voucher.Status == "Pending" && RayBizLogic.AdjustmentVoucherCost(adjId) <= 250)
                {
                    AcknowledgeButton.Visible = true;
                }
                else if (staff.Title == "Manager" && voucher.Status == "Pending" && RayBizLogic.AdjustmentVoucherCost(adjId) > 250)
                {
                    AcknowledgeButton.Visible = true;
                }
            }
        }
Ejemplo n.º 3
0
        public ActionResult FindPO(string startDate, string endDate, string status)
        {
            List <PurchaseOrder> purchaseOrders = new List <PurchaseOrder>();
            List <StoreStaff>    creators       = new List <StoreStaff>();

            //if (PONumber != null && PONumber != "")
            //{
            //    int number = Convert.ToInt32(PONumber);
            //    purchaseOrders = purchaseOrderDAO.GetPurchaseOrders(number);
            //}
            if (startDate != null && endDate != null)
            {
                DateTime start = DateTime.Parse(startDate);
                DateTime end   = DateTime.Parse(endDate);
                purchaseOrders = purchaseOrderDAO.GetPurchaseOrders(start, end);
            }
            else if (status != "")
            {
                purchaseOrders = purchaseOrderDAO.GetPurchaseOrders(status);
            }

            if (purchaseOrders.Count != 0)
            {
                foreach (PurchaseOrder po in purchaseOrders)
                {
                    StoreStaff storeStaff = storestaffDAO.GetStoreStaffbyPONumber(po.StaffId);
                    creators.Add(storeStaff);
                }
            }

            ViewData["creators"]       = creators;
            ViewData["purchaseOrders"] = purchaseOrders;

            return(View());
        }
Ejemplo n.º 4
0
        //Method1
        public void SendtoManager(AdjustmentVoucher adjv, string managerID)
        {
            StoreStaffDAO stsdao = new StoreStaffDAO();
            StoreStaff    sts    = stsdao.getstorestaffbyrole("manager");

            adjv.authorisedBy = sts.role;//manager only one person
            context.SaveChanges();
        }
Ejemplo n.º 5
0
        private StoreStaff getStoreStaffByUsername(string username)
        {
            List <StoreStaff> staffl = context.StoreStaffs.Where(x => x.email == username).ToList();
            StoreStaff        staff  = new StoreStaff();

            staff.storeStaffID = "";
            if (staffl.Count > 0)
            {
                staff = staffl.First();
            }
            return(staff);
        }
Ejemplo n.º 6
0
        public string getStoreStaffNameByID(string ID)
        {
            List <StoreStaff> list = new List <StoreStaff>();
            StoreStaff        s    = new StoreStaff();

            list = context.StoreStaffs.Where(x => x.storeStaffID == ID).ToList();
            if (list.Count() > 0)
            {
                s = list.First();
            }
            return(s.storeStaffName);
        }
Ejemplo n.º 7
0
        public ActionResult ApprovePO(string status, string remarks, int id)
        {
            purchaseOrderDAO.SetPOStatus(status, remarks, id);
            PurchaseOrder purchaseOrder = purchaseOrderDAO.GetPurchaseOrder(id);
            StoreStaff    storeStaff    = storestaffDAO.GetStaffbyId(purchaseOrder.StaffId);
            List <string> emails        = new List <string>();

            emails.Add(storeStaff.StaffEmail);
            string subj = "Status of PO: " + purchaseOrder.OrderId.ToString();
            string msg  = "Dear " + storeStaff.StaffName + ",\n Your PO: " + purchaseOrder.OrderId.ToString() + " has been " + purchaseOrder.Status + ".";

            EmailService.SendEmail(emails, subj, msg);
            return(RedirectToAction("FindPO"));
        }
Ejemplo n.º 8
0
        public ActionResult StoreLogin(string username, string password)
        {
            string session = (string)Session["StoreSession"];

            if (session != null)
            {
                //return RedirectToAction("Index", "Inventory");
            }
            if (username == null || password == null)
            {
                return(View());
            }
            StoreStaff user = db.StoreStaff.Where(x => x.Username == username && x.Password == password).SingleOrDefault();

            if (user == null)
            {
                return(View());
            }
            string sessionId = Guid.NewGuid().ToString();

            if (user != null)
            {
                user.SessionId = sessionId;
                db.SaveChanges();
            }
            Session["StoreSession"] = sessionId;
            Session["StoreStaff"]   = user;
            if (user.StaffType == "Clerk")
            {
                return(RedirectToAction("Index", "Inventory"));
            }
            else if (user.StaffType == "Supervisor")
            {
                return(RedirectToAction("Index", "Supervisor"));
            }
            else if (user.StaffType == "Manager")
            {
                return(RedirectToAction("Index", "Manager"));
            }
            else
            {
                return(View());
            }
        }
Ejemplo n.º 9
0
        public ActionResult addcart()
        {
            StoreStaff user = (StoreStaff)Session["user"];
            int        form_number;
            List <AdjustmentDetail> cart_list;
            List <ProductViewModel> items;

            using (LogicEntities db = new LogicEntities())
            {
                //items = db.Product.ToList();
                items       = getProducts(db);
                form_number = db.Adjustment.AsEnumerable().Max(p => p.AdjustmentId);
                cart_list   = db.AdjustmentDetail.Include(ad => ad.Product).Where(x => x.AdjustmentId == form_number).ToList();
            }

            ViewData["cart_list"]   = cart_list;
            ViewData["form_number"] = form_number;
            ViewData["items"]       = items;
            return(View("create_form"));
        }
Ejemplo n.º 10
0
 public string[] getUser(string username)
 {
     if (getDeptStaffByUsername(username).staffID != "")
     {//is a department staff
         DeptStaff staff = getDeptStaffByUsername(username);
         result[0] = staff.staffID;
         result[1] = staff.role;
         result[2] = staff.password;
         result[3] = staff.staffName;
     }
     else if (getStoreStaffByUsername(username).storeStaffID != "")
     {//is a store staff
         StoreStaff staff = getStoreStaffByUsername(username);
         result[0] = staff.storeStaffID;
         result[1] = staff.role;
         result[2] = staff.password;
         result[3] = staff.storeStaffName;
     }
     return(result);
 }
Ejemplo n.º 11
0
        public ActionResult DetailedDisbursementList(int id)
        {
            Disbursement disbursement = new Disbursement();
            Department   department   = new Department();
            List <DisbursementDetail> disbursementDetails = new List <DisbursementDetail>();
            List <Product>            disbursedProducts   = new List <Product>();
            StoreStaff      storeStaff = new StoreStaff(); //To create via the session object
            DepartmentStaff receiver   = new DepartmentStaff();
            CollectionPoint cp         = new CollectionPoint();

            using (db = new LogicEntities())
            {
                var result = from d in db.Disbursement
                             where d.DisId == id
                             select d;
                disbursement        = result.First();
                department          = disbursement.Department;
                disbursementDetails = disbursement.DisbursementDetails.ToList();
                foreach (DisbursementDetail dd in disbursementDetails)
                {
                    disbursedProducts.Add(dd.Product);
                }
            }
            if (disbursement.StoreStaffId != null)
            {
                storeStaff = storestaffDAO.GetStaffbyId(disbursement.StoreStaffId.Value);
            }
            else
            {
                storeStaff = (StoreStaff)Session["StoreStaff"];//StoreStaff from session
            }
            receiver                        = departmentStaffDAO.GetStaffById(disbursement.ReceiveStaffId);
            cp                              = collectionPointDAO.GetCollectionPoint(disbursement.CollectionPointId);
            ViewData["receiver"]            = receiver;
            ViewData["storestaff"]          = storeStaff;
            ViewData["disbursement"]        = disbursement;
            ViewData["disbursementdetails"] = disbursementDetails;
            ViewData["CollectionPoint"]     = cp;
            return(View());
        }
Ejemplo n.º 12
0
        public ActionResult SavePO(string supplierId)
        {
            StoreStaff storeStaff = (StoreStaff)Session["StoreStaff"];
            StoreStaff supervisor = storestaffDAO.GetStoreStaffbyRole("Supervisor");

            string[] productIds  = Request.Form.GetValues("itemCode");
            string[] requiredQty = Request.Form.GetValues("quantity");

            int id = storeStaff.StaffId;

            int           poNum  = purchaseOrderDAO.SaveNewPO(supplierId, productIds, requiredQty, id);
            List <string> emails = new List <string>();

            emails.Add(supervisor.StaffEmail);
            string subj = "PO for Approval";
            string msg  = "Dear " + supervisor.StaffName + ",\n" +
                          storeStaff.StaffName + " has created PO: " + poNum.ToString() + " for your approval.";

            EmailService.SendEmail(emails, subj, msg);

            return(RedirectToAction("FindPO"));
        }
Ejemplo n.º 13
0
        public ActionResult DetailedPO(int id)
        {
            PurchaseOrder po       = new PurchaseOrder();
            StoreStaff    creator  = new StoreStaff();
            Supplier      supplier = new Supplier();
            List <PurchaseOrderDetail> poDetails  = new List <PurchaseOrderDetail>();
            List <Product>             poProducts = new List <Product>();
            List <SupplierProduct>     priceList  = new List <SupplierProduct>();

            //method cannot be put in a seperate class (DAO), otherwise the other fields cannot be populated
            using (db)
            {
                var result = from o in db.PurchaseOrder
                             where o.OrderId == id
                             select o;
                po = result.First();
                var result2 = from ss in db.StoreStaff
                              where ss.StaffId == po.StaffId
                              select ss;
                creator   = result2.First();
                supplier  = po.Supplier;
                priceList = po.Supplier.SupplierProduct.ToList();
                poDetails = po.RequestDetails.ToList();

                //Not sure why, but this section of code prevents an exception from happening
                foreach (PurchaseOrderDetail pod in poDetails)
                {
                    poProducts.Add(pod.Product);
                }
            }

            ViewData["PO"]        = po;
            ViewData["creator"]   = creator;
            ViewData["supplier"]  = supplier;
            ViewData["poDetails"] = poDetails;
            ViewData["priceList"] = priceList;

            return(View());
        }
        protected void btn_SendToManager_Click(object sender, EventArgs e)
        {
            AdjustmentVoucher adjv = adjvdao.findAdjustmentVoucherByadjvId(adjvoucherID);

            adjvdao.SendtoManageranother(adjv);//Method2

            //send email and notification to rep
            SA45_Team09_LogicUEntities context = new SA45_Team09_LogicUEntities();
            string     supervisorName          = Session["loginName"].ToString();
            StoreStaff manager     = context.StoreStaffs.Where(x => x.role == "manager").ToList().First();
            string     managerID   = manager.storeStaffID;
            string     managerName = manager.storeStaffName;

            string          confirmDate = DateTime.Now.ToShortDateString();
            NotificationDAO nDAO        = new NotificationDAO();

            nDAO.addStoreNotification(managerID, supervisorName + " has send an adjustment voucher!" + confirmDate, DateTime.Now);

            Email email = new Email();

            email.sendAdjustmentEmailToManager(supervisorName, managerName);

            Response.Redirect("./SS_ViewAdjustment.aspx");
        }
Ejemplo n.º 15
0
 public ActionResult Logout(string type)
 {
     if (type == "d")
     {
         string          session = (string)Session["DeptSession"];
         DepartmentStaff ds      = db.DepartmentStaff.Where(x => x.SessionId == session).SingleOrDefault();
         ds.SessionId = null;
         Session.Remove("DeptSession");
         Session.Remove("DeptStaff");
         Session.Remove("TempHead");
         db.SaveChanges();
         return(RedirectToAction("DepartmentLogin"));
     }
     else
     {
         string     session = (string)Session["StoreSession"];
         StoreStaff ss      = db.StoreStaff.Where(x => x.SessionId == session).SingleOrDefault();
         ss.SessionId = null;
         Session.Remove("StoreSession");
         Session.Remove("StoreStaff");
         db.SaveChanges();
         return(RedirectToAction("StoreLogin"));
     }
 }
Ejemplo n.º 16
0
 public bool AddStoreStaff(StoreStaff storeStaff)
 {
     return(dal.AddStoreStaff(storeStaff));
 }
Ejemplo n.º 17
0
        public ActionResult ApproveForm(string approve, string reject, string remarks, int id)
        {
            using (LogicEntities db = new LogicEntities())
            {
                Adjustment    rd     = db.Adjustment.Find(id);
                StoreStaff    staff  = db.StoreStaff.Find(rd.StaffId);
                List <string> emails = new List <string>();
                emails.Add(staff.StaffEmail);
                string subj = "Status - Adjustment Form: " + rd.AdjustmentId;

                if (approve == "Approve")
                {
                    rd.Status = approve;
                    rd.Remark = remarks;

                    db.SaveChanges();

                    List <AdjustmentDetail> adjustmentDetails = db.AdjustmentDetail.Where(x => x.AdjustmentId == id).ToList();
                    foreach (var detail in adjustmentDetails)
                    {
                        var res = db.Product.SingleOrDefault(p => p.ProductId == detail.ProductId);
                        //var res2 = db.StockTransaction.SingleOrDefault(p => p.ProductId == detail.ProductId);

                        if (res != null)
                        {
                            res.Qty += detail.Qty;
                            db.SaveChanges();
                        }

                        StockTransaction st = new StockTransaction
                        {
                            TranDate     = DateTime.Now,
                            ProductId    = detail.ProductId,
                            Qty          = detail.Qty,
                            Remarks      = "Inventory Adjustment: " + detail.reason,
                            TotalBalance = res.Qty
                        };

                        db.StockTransaction.Add(st);
                        db.SaveChanges();

                        //if (res2 != null)
                        //{
                        //    res2.Qty += detail.Qty;
                        //    db.SaveChanges();
                        //}
                    }
                    //Send email to notify that adjustment voucher has been approved
                    string msg = "Dear " + staff.StaffName + ",\n Your Adjustment voucher has been approved.";
                    EmailService.SendEmail(emails, subj, msg);
                }
                else if (reject == "Reject")
                {
                    rd.Status = reject;
                    rd.Remark = remarks;
                    db.SaveChanges();
                    //Send email to notify that adjustment has been rejected
                    string msg = "Dear " + staff.StaffName + ",\n Your Adjustment voucher has been rejected.";
                    EmailService.SendEmail(emails, subj, msg);
                }
            }
            return(RedirectToAction("ViewVoucherList"));
        }
Ejemplo n.º 18
0
        public string getStoreStaffIDbyName(string name)
        {
            StoreStaff s = context.StoreStaffs.Where(x => x.storeStaffName == name).First();

            return(s.storeStaffID);
        }
        protected void Submit_Click(object sender, EventArgs e)
        {
            string name = this.staffID;
            SA45_Team09_LogicUEntities       m   = new DBEntities().getDBInstance();
            List <AdjustmentVoucherItemcart> lac = new List <AdjustmentVoucherItemcart>();

            lac = (List <AdjustmentVoucherItemcart>)Session["adjvcart"];
            if (lac.Count > 0)
            {
                int num   = 0;
                int judge = 0;
                foreach (Control i in cartRepeater.Items)                                     //get Quantity
                {
                    LinkButton deletebtn  = i.FindControl("cart_deleteButton") as LinkButton; //get itemID
                    TextBox    cartqty    = i.FindControl("cart_qtyTextBox") as TextBox;      //get quantity
                    TextBox    cartrecord = i.FindControl("cart_recordTextBox") as TextBox;   //get record
                    lac[num].ItemID = deletebtn.CommandArgument.ToString();
                    if (cartqty.Text.Trim() == "")
                    {
                        judge = 1;
                        break;
                    }
                    try
                    {
                        lac[num].Qty = Int32.Parse(cartqty.Text.ToString());
                    }
                    catch
                    {
                        judge = 1;
                        break;
                    }
                    if ((lac[num].Qty % 1 != 0) || (lac[num].Qty == 0))
                    {
                        judge = 1;
                        break;
                    }
                    if ((lac[num].Qty < 0) && (Math.Abs(lac[num].Qty) > itemDAO.getItemByitemID(lac[num].ItemID).First().qtyOnHand))
                    {
                        judge = 2;
                        break;
                    }
                    lac[num].Record = cartrecord.Text;
                    num++;
                }
                if (judge == 0)
                {
                    AdjustmentVoucherDAO adjvdao = new AdjustmentVoucherDAO();
                    adjvdao.addAdjustmentVoucher(name, lac);
                    lac = new List <AdjustmentVoucherItemcart>();//clear the cart session
                    Session["adjvcart"] = lac;

                    //send email and notification to rep
                    SA45_Team09_LogicUEntities context = new SA45_Team09_LogicUEntities();
                    string     clerkName      = Session["loginName"].ToString();
                    StoreStaff supervisor     = context.StoreStaffs.Where(x => x.role == "supervisor").ToList().First();
                    string     supervisorID   = supervisor.storeStaffID;
                    string     supervisorName = supervisor.storeStaffName;

                    string          confirmDate = DateTime.Now.ToShortDateString();
                    NotificationDAO nDAO        = new NotificationDAO();
                    nDAO.addStoreNotification(supervisorID, clerkName + " has send an adjustment voucher!" + confirmDate, DateTime.Now);

                    Email email = new Email();
                    email.sendAdjustmentEmailToSupervisor(clerkName, supervisorName);

                    HttpContext.Current.Response.Redirect("SC_ViewAdjustmentVoucher.aspx");
                }
                else
                {
                    if (judge == 1)
                    {
                        ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>win.alert('Notice', 'Input must be integer!');</script>");
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>win.alert('Notice', 'Input must be lower than qty on hand!');</script>");
                    }
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage2", "alert('Nothing in cart')", true);
                return;
            }
        }
Ejemplo n.º 20
0
        public WCFStoreStaff GetStoreStaffById(string storeStaffID)
        {
            StoreStaff s = sDAO.getStoreStaffInfoById(storeStaffID);

            return(new WCFStoreStaff(s.storeStaffID, s.storeStaffName, s.role, s.email, s.phone, s.password));
        }
Ejemplo n.º 21
0
        public static int GenerateAdjustmentVoucherDetails(List <RetrievalDetail> suggested, List <RetrievalDetail> userinput, int clerkid)
        {
            using (Team10ADModel context = new Team10ADModel())
            {
                //To be returned for redirecting to the correct adjustment detail
                int adjustmentVoucherId = 0;
                //Counter to check whether there is any item that need adjustment
                int needAdjustment = 0;

                //StockAdjustmentVoucher adjNew = new StockAdjustmentVoucher();
                List <StockAdjustmentVoucherDetail> adjDetailList = new List <StockAdjustmentVoucherDetail>();

                foreach (RetrievalDetail sDetail in suggested)
                {
                    foreach (RetrievalDetail uDetail in userinput)
                    {
                        if (sDetail.ItemCode == uDetail.ItemCode)
                        {
                            //Check that there is a change in suggested quantity and that the balance is below the requested quantity
                            //This is to give clerk the flexibility to still reduce the quantity and not trigger an adjustment
                            if (sDetail.RetrievedQuantity < sDetail.RequestedQuantity && sDetail.RetrievedQuantity != uDetail.RetrievedQuantity)
                            {
                                needAdjustment++;
                                if (needAdjustment == 1)
                                {
                                    StockAdjustmentVoucher adj = new StockAdjustmentVoucher();
                                    adj.StoreStaffID = clerkid;
                                    adj.DateIssue    = DateTime.Now;
                                    adj.Status       = "Pending";
                                    context.StockAdjustmentVouchers.Add(adj);
                                    context.SaveChanges();

                                    //adjNew = context.StockAdjustmentVouchers.OrderByDescending(x => x.VoucherID).First();
                                    //adjustmentVoucherId = adjNew.VoucherID;

                                    adjustmentVoucherId = adj.VoucherID;
                                }

                                StockAdjustmentVoucherDetail adjDetail = new StockAdjustmentVoucherDetail();
                                adjDetail.VoucherID        = adjustmentVoucherId;
                                adjDetail.ItemCode         = uDetail.ItemCode;
                                adjDetail.QuantityAdjusted = -(uDetail.Catalogue.BalanceQuantity - uDetail.RetrievedQuantity);

                                Catalogue item = context.Catalogues.Where(x => x.ItemCode == adjDetail.ItemCode).First();
                                item.BalanceQuantity -= (uDetail.Catalogue.BalanceQuantity - uDetail.RetrievedQuantity);

                                adjDetail.QuantityAfter = item.BalanceQuantity;
                                adjDetailList.Add(adjDetail);
                                context.SaveChanges();
                            }
                        }
                    }
                }

                if (needAdjustment > 0)
                {
                    foreach (StockAdjustmentVoucherDetail detail in adjDetailList)
                    {
                        context.StockAdjustmentVoucherDetails.Add(detail);
                        context.SaveChanges();
                    }
                }

                StoreStaff supervisor = context.StoreStaffs.Where(x => x.Title == "Supervisor").First();
                StoreStaff manager    = context.StoreStaffs.Where(x => x.Title == "Manager").First();
                if (adjustmentVoucherId > 0 && AdjustmentVoucherCost(adjustmentVoucherId) <= 250)
                {
                    LogicUtility.Instance.SendAdjustmentEmail(adjustmentVoucherId, supervisor.StoreStaffID);
                }
                else if (adjustmentVoucherId > 0 && AdjustmentVoucherCost(adjustmentVoucherId) > 250)
                {
                    LogicUtility.Instance.SendAdjustmentEmail(adjustmentVoucherId, manager.StoreStaffID);
                }

                return(adjustmentVoucherId);
            }
        }
Ejemplo n.º 22
0
        public ActionResult create_form()
        {
            StoreStaff user = new StoreStaff();

            user = (StoreStaff)Session["StoreStaff"];
            using (LogicEntities db = new LogicEntities())
            {
                db.Adjustment.RemoveRange(db.Adjustment.Where(x => x.Status == "temp").ToList());
                db.SaveChanges();
            }
            int form_number = 1;

            using (LogicEntities db = new LogicEntities())
            {
                if (db.Adjustment.AsEnumerable().ToList().Count != 0)
                {
                    form_number = db.Adjustment.AsEnumerable().Max(p => p.AdjustmentId);
                    //Debug.WriteLine("***************** before" + form_number);
                    form_number = form_number + 1;
                    //Debug.WriteLine("***************** after" + form_number);
                }
                else
                {
                    form_number = 1;
                }
            }



            //Debug.WriteLine("*****************" + form_number);
            using (LogicEntities db = new LogicEntities())
            {
                db.Adjustment.Add(new Adjustment {
                    AdjustmentId = form_number, Remark = "--", AdjustedDate = DateTime.Now.Date, StaffId = user.StaffId, Status = "temp"
                });
                db.SaveChanges();
            }

            List <ProductViewModel> items;

            int num_new;

            using (LogicEntities db = new LogicEntities())
            {
                //items = db.Product.Select(p => new Product
                //{
                //    ProductId = p.ProductId,
                //    Category = p.Category,
                //    Description = p.Description,
                //    Qty = p.Qty
                //}).ToList();

                //items = db.Product.ToList();
                items   = getProducts(db);
                num_new = db.Adjustment.AsEnumerable().Max(p => p.AdjustmentId);
            }

            ViewData["form_number"] = num_new;
            ViewData["items"]       = items;
            ViewData["msg"]         = num_new.ToString();

            return(View());
        }
Ejemplo n.º 23
0
 public bool AddStoreStaff(StoreStaff storeStaff)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 24
0
 public bool UpdateStoreStaff(StoreStaff storeStaff)
 {
     return(dal.UpdateStoreStaff(storeStaff));
 }