Beispiel #1
0
        // GET: TxQohs1/Edit/5
        public ActionResult Edit(int?id)
        {
            ViewBag.ReturnUrl = Request.UrlReferrer;
            var txqohs = db.TxQohs.SingleOrDefault(c => c.Txqohid == id);

            var customers         = db.Customers.ToList();
            var customerdivisions = db.CustomerDivisions.ToList();
            var mlsdivisions      = db.MlsDivisions.ToList();
            var parttypes         = db.PartTypes.ToList();
            var activeparts       = db.ActiveParts.ToList();

            var viewModel = new SaveTxQohViewModel()
            {
                TxQoh             = txqohs,
                Customers         = customers,
                CustomerDivisions = customerdivisions,
                MlsDivisions      = mlsdivisions,
                PartTypes         = parttypes,
                ActiveParts       = activeparts
            };

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TxQoh txQoh = db.TxQohs.Find(id);

            if (txQoh == null)
            {
                return(HttpNotFound());
            }
            return(View("Edit", viewModel));
            //return View(txQoh);
        }
Beispiel #2
0
        public ActionResult LogDeleteTxQohActivity(TxQoh txQoh)
        {
            var currentUser = User.Identity.GetUserName();
            var logDateTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"));
            var eventType   = "Delete";

            TxQohLog txQohLog = new TxQohLog();

            txQohLog.User               = currentUser;
            txQohLog.EventDateTime      = logDateTime;
            txQohLog.EventType          = eventType;
            txQohLog.CustomerId         = txQoh.CustomerId;
            txQohLog.CustomerDivisionId = txQoh.CustomerDivisionId;
            txQohLog.MlsDivisionId      = txQoh.MlsDivisionId;
            txQohLog.ActivePartId       = txQoh.ActivePartId;
            txQohLog.PartTypeId         = txQoh.PartTypeId;
            txQohLog.Pn              = txQoh.Pn;
            txQohLog.UhPn            = txQoh.UhPn;
            txQohLog.PartDescription = txQoh.PartDescription;
            txQohLog.Qoh             = txQoh.Qoh;
            txQohLog.Location        = txQoh.Location;
            txQohLog.Notes           = txQoh.Notes;

            db.TxQohLogs.Add(txQohLog);
            db.SaveChanges();
            return(null);
        }
Beispiel #3
0
        public ActionResult DeleteConfirmed(int id, string returnUrl)
        {
            TxQoh txQoh = db.TxQohs.Find(id);

            db.TxQohs.Remove(txQoh);
            db.SaveChanges();
            LogDeleteTxQohActivity(txQoh);
            return(Redirect(returnUrl));
        }
Beispiel #4
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            TxQoh txQoh = await db.TxQohs.FindAsync(id);

            db.TxQohs.Remove(txQoh);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Beispiel #5
0
        public async Task <ActionResult> Edit([Bind(Include = "Txqohid,Pn,UhPn,Qoh")] TxQoh txQoh)
        {
            if (ModelState.IsValid)
            {
                db.Entry(txQoh).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(txQoh));
        }
Beispiel #6
0
        public async Task <ActionResult> Create([Bind(Include = "Txqohid,Pn,UhPn,Qoh")] TxQoh txQoh)
        {
            if (ModelState.IsValid)
            {
                db.TxQohs.Add(txQoh);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(txQoh));
        }
Beispiel #7
0
 //public ActionResult Edit([Bind(Include = "Txqohid,Pn,UhPn,Qoh,NcrQty,Notes")] TxQoh txQoh)
 public ActionResult Edit(TxQoh txQoh, string returnUrl)
 {
     if (ModelState.IsValid)
     {
         db.Entry(txQoh).State = EntityState.Modified;
         db.SaveChanges();
         LogEditTxQohActivity(txQoh);
         return(Redirect(returnUrl));
         //return RedirectToAction("Index", "WorkOrders");
     }
     return(View());
     //return View(txQoh);
 }
Beispiel #8
0
        //public ActionResult Create([Bind(Include = "Txqohid,Pn,UhPn,Qoh,NcrQty,Notes")] TxQoh txQoh)
        public ActionResult Create(TxQoh txQoh, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                db.TxQohs.Add(txQoh);
                db.SaveChanges();
                LogCreateTxQohActivity(txQoh);
                return(Redirect(returnUrl));
                //return RedirectToAction("Index", "WorkOrders");
            }

            //return View(txQoh);
            return(View());
        }
Beispiel #9
0
        // GET: TxQohs1/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TxQoh txQoh = db.TxQohs.Find(id);

            if (txQoh == null)
            {
                return(HttpNotFound());
            }
            return(View(txQoh));
        }
Beispiel #10
0
        // GET: TxQohs/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TxQoh txQoh = await db.TxQohs.FindAsync(id);

            if (txQoh == null)
            {
                return(HttpNotFound());
            }
            return(View(txQoh));
        }
Beispiel #11
0
        // GET: TxQohs1/Delete/5
        public ActionResult Delete(int?id)
        {
            ViewBag.ReturnUrl = Request.UrlReferrer;
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TxQoh txQoh = db.TxQohs.Find(id);

            if (txQoh == null)
            {
                return(HttpNotFound());
            }
            return(View(txQoh));
        }