예제 #1
0
        public ActionResult Index(NhaKho hh)
        {
            string message = string.Empty;

            if (hh.ID_NhaKho == 0)
            {
                var nhhs = new NhaKho()
                {
                    SoTang = hh.SoTang,
                    SoHang = hh.SoHang,
                    SoCot  = hh.SoCot,
                    Status = "Sẵn sàng",
                };
                khoDao.Insert(nhhs);
                message = "Thêm xong";
            }
            else
            {
                var nhh = khoDao.NhaKho(hh.ID_NhaKho);
                nhh.SoTang = hh.SoTang;
                nhh.SoHang = hh.SoHang;
                nhh.SoCot  = hh.SoCot;
                nhh.Status = hh.Status;
                khoDao.Update();
                message = "Cập nhật xong";
            }
            return(Json(data: new { message = "Thành công " + message, success = true }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
 public frmEdit_NhaKho(NhaKho obj)
 {
     InitializeComponent();
     ucBaseEdit1.iFormBase = this;
     mObj          = obj;
     StartPosition = FormStartPosition.CenterScreen;
 }
예제 #3
0
        public ActionResult Edit(NhaKho ob)
        {
            var db = new dbQLKhoEntities();

            db.Entry(ob).State = ob.ID_NhaKho > 0 ? System.Data.Entity.EntityState.Modified : System.Data.Entity.EntityState.Added;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #4
0
        public override bool Add()
        {
            var ob = new NhaKho()
            {
                Status = "SanSang"
            };

            if (new frmEdit_NhaKho(ob).ShowDialog() == System.Windows.Forms.DialogResult.Yes)
            {
                var db = new dbQLKhoEntities();
                db.NhaKhoes.Add(ob);
                return(db.SaveChanges() > 0);
            }
            return(false);
        }
예제 #5
0
        public ActionResult Send(int id)
        {
            List <NhaKho> items = khoDao.GetNhaKhos();
            var           nhh   = new NhaKho();

            foreach (var item in items)
            {
                if (item.ID_NhaKho == id)
                {
                    nhh.ID_NhaKho = item.ID_NhaKho;
                    nhh.SoTang    = item.SoTang;
                    nhh.SoHang    = item.SoHang;
                    nhh.SoCot     = item.SoCot;
                    nhh.Status    = item.Status;
                }
            }
            return(Json(nhh, JsonRequestBehavior.AllowGet));
        }
예제 #6
0
        public ActionResult Edit(int?id = null)
        {
            NhaKho ob = new NhaKho()
            {
                Status = "SanSang"
            };

            ViewBag.Title = "THÊM MỚI NHÀ KHO";
            if (id.HasValue)
            {
                ob = new dbQLKhoEntities().NhaKhoes.ToList().FirstOrDefault(q => q.ID_NhaKho == id);
                if (ob == null)
                {
                    RedirectToAction("Index");
                }
                ViewBag.Title = "SỬA NHÀ KHO";
            }
            return(View(ob));
        }
예제 #7
0
 public void Insert(NhaKho nk)
 {
     db.NhaKhoes.Add(nk);
     db.SaveChanges();
 }