コード例 #1
0
        public IActionResult EditDeleteStationery(string?cmd, int Id)  //stationery id
        {
            if (!(HttpContext.Session.GetString("role") == EmployeeRole.STORECLERK ||
                  HttpContext.Session.GetString("role") == EmployeeRole.STOREMANAGER ||
                  HttpContext.Session.GetString("role") == EmployeeRole.STORESUPERVISOR))
            {
                return(RedirectToAction(HttpContext.Session.GetString("role"), "Home"));
            }

            ViewData["alertMsg"] = TempData["alertMsg"];
            SupplierStationery s = supService.GetSupplierStationeryById(Id);

            if (cmd == "delete")
            {
                supService.DeleteSupplierStationeryById(Id);
                TempData["alertMsg"] = "Deleted successfully!";
                return(RedirectToAction("Details", new { Id = s.SupplierId }));
            }
            if (cmd == "edit")
            {
                ViewData["item"] = s;
                return(View("UpdateStationery"));
            }
            return(RedirectToAction("Details", new { Id = s.SupplierId }));
        }
        public int DeleteSupplierStationery(string itemCode, string supplierCode)
        {
            SupplierStationery supplierstationery = context.SupplierStationeries.Where(x => x.ItemCode == itemCode && x.SupplierCode == supplierCode).First();

            context.SupplierStationeries.Remove(supplierstationery);
            return(context.SaveChanges());
        }
        public void DeleteSupplierStationeryById(int id)
        {
            SupplierStationery supplierstationery = GetSupplierStationeryById(id);

            supplierstationery.InventoryItem = null;
            supplierstationery.Supplier      = null;
            adProjContext.Remove(supplierstationery);
            adProjContext.SaveChanges();
        }
        public void UpdateSupplierStationeryById(int StationeryId, string SupplierId, string InventoryItemId, string UOM, float TenderPrice)
        {
            SupplierStationery item = GetSupplierStationeryById(StationeryId);

            item.SupplierId  = SupplierId;
            item.UOM         = UOM;
            item.TenderPrice = TenderPrice;
            adProjContext.SaveChanges();
        }
        public int UpdateSupplierStationery(int id, string supplierCode, string itemCode, double unitPrice, int rank)
        {
            SupplierStationery ss = context.SupplierStationeries.Where(x => x.SupplierStationeryId == id).First();

            ss.SupplierCode = supplierCode;
            ss.ItemCode     = itemCode;
            ss.UnitPrice    = unitPrice;
            ss.SupplierRank = rank;
            return(context.SaveChanges());
        }
        public void CreateSupplierStationery(string SupplierId, string InventoryItemId, string UOM, float TenderPrice)
        {
            SupplierStationery item = new SupplierStationery();

            item.SupplierId      = SupplierId;
            item.InventoryItemId = InventoryItemId;
            item.UOM             = UOM;
            item.TenderPrice     = TenderPrice;

            adProjContext.Add(item);
            adProjContext.SaveChanges();
        }
コード例 #7
0
        void PopulateData(Stationery stationery)
        {
            lblItemCode.Text        = stationery.ItemCode;
            lblItemDescription.Text = stationery.Description;
            lblBin.Text             = stationery.Bin.ToString();
            lblUOM.Text             = stationery.UnitOfMeasure;

            Label[] txbSuppliers = { lblSupplier1, lblSupplier2, lblSupplier3 };
            for (int i = 1; i <= 3; i++)
            {
                SupplierStationery ss = stationery.SupplierStationeries.Where(x => x.SupplierRank == i).FirstOrDefault();
                txbSuppliers[i - 1].Text = ss == null ? "NIL" : ss.Supplier.SupplierName;
            }

            int storeClerkId = (int)Session["employeeId"];

            gvMaintainStockCard.DataSource = StockManagementBizLogic.getStockManagements(stationery.ItemCode, storeClerkId);
            gvMaintainStockCard.DataBind();
        }
コード例 #8
0
        //create a adjustment Voucher;
        public void createAdjustmentVoucher(string itemname, int AdjustQty, double AdjustAmt, string reason, int employeeId)
        {
            string        name          = itemname;
            InventoryItem inventoryItem = GetInventoryItem(name);

            inventoryItem.QtyInStock += AdjustQty;
            SupplierStationery supplierStationery = GetSupplierStationery(name);
            Employee           emp = GetEmployeeById(employeeId);

            AdjustmentVoucher adjustmentVoucher = new AdjustmentVoucher();

            adjustmentVoucher.date               = DateTime.Now;
            adjustmentVoucher.AdjustQty          = AdjustQty;
            adjustmentVoucher.InventoryItemId    = inventoryItem.Id;
            adjustmentVoucher.AdjustAmt          = AdjustAmt;
            adjustmentVoucher.InventoryItem      = inventoryItem;
            adjustmentVoucher.SupplierStationery = supplierStationery;
            adjustmentVoucher.Reason             = reason;
            adjustmentVoucher.EmployeeId         = employeeId;

            dbcontext.Add(adjustmentVoucher);
            dbcontext.SaveChanges();
        }
コード例 #9
0
        public SupplierStationery GetSupplierStationery(string name)
        {
            SupplierStationery item = dbcontext.SupplierStationeries.Where(x => x.InventoryItem.Id == name).FirstOrDefault();

            return(item);
        }
 public int AddSupplierStationery(SupplierStationery supplierstationery)
 {
     context.SupplierStationeries.Add(supplierstationery);
     return(context.SaveChanges());
 }
        public SupplierStationery FindSupplierStationery(string itemCode, string supplierCode)
        {
            SupplierStationery supplierstationery = context.SupplierStationeries.Where(x => x.ItemCode == itemCode && x.SupplierCode == supplierCode).First();

            return(supplierstationery);
        }
        public SupplierStationery FindSupplierStationery(int id)
        {
            SupplierStationery supplierstationery = context.SupplierStationeries.Where(x => x.SupplierStationeryId == id).First();

            return(supplierstationery);
        }
        public SupplierStationery GetSupplierStationeryBySupplierId(string supplierid)
        {
            SupplierStationery supplierstationery = adProjContext.SupplierStationeries.Where(x => x.SupplierId == supplierid).FirstOrDefault();

            return(supplierstationery);
        }
        public SupplierStationery GetSupplierStationeryById(int id)
        {
            SupplierStationery supplierstationery = adProjContext.SupplierStationeries.Where(x => x.Id == id).FirstOrDefault();

            return(supplierstationery);
        }