예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            BuyerCashAdjustment buyerCashAdjustment = db.BuyerCashAdjustment.Find(id);

            db.BuyerCashAdjustment.Remove(buyerCashAdjustment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
        // GET: BuyerCashAdjustments/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BuyerCashAdjustment buyerCashAdjustment = db.BuyerCashAdjustment.Find(id);

            if (buyerCashAdjustment == null)
            {
                return(HttpNotFound());
            }
            return(View(buyerCashAdjustment));
        }
예제 #3
0
        // GET: BuyerCashAdjustments/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BuyerCashAdjustment buyerCashAdjustment = db.BuyerCashAdjustment.Find(id);

            if (buyerCashAdjustment == null)
            {
                return(HttpNotFound());
            }
            ViewBag.BuyerInfoId = new SelectList(db.BuyerInfo, "Id", "Name", buyerCashAdjustment.BuyerInfoId);
            return(View(buyerCashAdjustment));
        }
예제 #4
0
        //public ActionResult Edit([Bind(Include = "Id,BuyerInfoId,BuyerAdjustDate,BuyerReciptNo,BuyerAdjustAmount,BuyerAdjustRemarks,IsAuth,OpBy,OpOn,AuthBy,AuthOn")] BuyerCashAdjustment buyerCashAdjustment)
        public ActionResult Edit([Bind(Include = "Id,BuyerInfoId,BuyerAdjustDate,BuyerReciptNo,BuyerAdjustAmount,BuyerAdjustRemarks,EntryDate")] BuyerCashAdjustment buyerCashAdjustment)
        {
            if (ModelState.IsValid)
            {
                //db.Entry(buyerCashAdjustment).State = EntityState.Modified;
                //db.SaveChanges();
                //return RedirectToAction("Index");

                buyerCashAdjustment.OpBy            = 1;
                buyerCashAdjustment.OpOn            = DateTime.Now;
                buyerCashAdjustment.IsAuth          = false;
                db.Entry(buyerCashAdjustment).State = EntityState.Modified;
                db.SaveChanges();
                //Success("Saved successfully !!", true);
                return(RedirectToAction("Index"));
            }
            ViewBag.BuyerInfoId = new SelectList(db.BuyerInfo, "Id", "Name", buyerCashAdjustment.BuyerInfoId);
            return(View(buyerCashAdjustment));
        }
예제 #5
0
        //------------------------------------------------------SAVE-----------------------------------------------
        public JsonResult SaveBuyerCashAdjustment(IEnumerable <BuyerCashAdjustment> buyerCashAdjustment, DateTime EntryDate)
        {
            var result = new
            {
                flag    = false,
                message = "Error occured. !",
                Id      = 0
            };

            try
            {
                var OpDate = DateTime.Now;
                using (var dbContextTransaction = db.Database.BeginTransaction())
                {
                    try
                    {
                        foreach (var item in buyerCashAdjustment)
                        {
                            var OrderD = new BuyerCashAdjustment()
                            {
                                Id                 = 0,
                                EntryDate          = EntryDate,
                                BuyerInfoId        = item.BuyerInfoId,
                                BuyerAdjustDate    = item.BuyerAdjustDate,
                                BuyerReciptNo      = item.BuyerReciptNo,
                                BuyerAdjustAmount  = item.BuyerAdjustAmount,
                                BuyerAdjustRemarks = item.BuyerAdjustRemarks,
                                IsAuth             = false,
                                OpBy               = 1,
                                OpOn               = DateTime.Now
                                                     // AuthBy = ,
                                                     // AuthOn = ,
                            };

                            db.BuyerCashAdjustment.Add(OrderD);
                            db.SaveChanges();
                        }

                        //---- shipment data


                        dbContextTransaction.Commit();

                        result = new
                        {
                            flag    = true,
                            message = "Saving successful!!",
                            Id      = 0
                        };

                        Success("Record saved successfully.", true);
                    }
                    catch (Exception ex)
                    {
                        dbContextTransaction.Rollback();

                        result = new
                        {
                            flag    = false,
                            message = ex.Message,
                            Id      = 0
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                result = new
                {
                    flag    = false,
                    message = ex.Message,
                    Id      = 0
                };
            }


            return(Json(result, JsonRequestBehavior.AllowGet));
        }