コード例 #1
0
        public ActionResult AddProperty()
        {
            int sid = Request.Form["JobOrderId"] != null ? Request.Form["JobOrderId"].Split(',')[0].ParseInt() : 0;
            var id  = Request.Form["selProductP"].Split(':'); //  ProductId:PriceNet
            int qty = Request.Form["QuantityP"].ParseInt();


            if (id.Count() > 0)
            {
                var detail = uow.Modules.JobOrder.GetProperties(sid);
                int pid    = int.Parse(id[0]);

                TblJobOrderProperties ob = uow.Modules.JobOrder.GetPropertie(0);

                ob.No         = detail != null ? detail.Count + 1 : 1;
                ob.JobOrderId = sid;
                ob.ProductId  = pid;
                ob.Quantity   = qty;


                uow.Modules.JobOrder.SetProperty(ob);
                uow.SaveChanges();
            }
            return(RedirectToAction("Detail", MVCController, new { id = sid, tab = "Product", msg = "บันทึกข้อมูลอุปกรณ์เรียบร้อยแล้ว", msgType = AlertMsgType.Success }));
        }
コード例 #2
0
ファイル: JobOrderModule.cs プロジェクト: tonchilling/KemRex
 public void DeletePropertie(TblJobOrderProperties ob)
 {
     if (IsExist(ob.JobOrderId))
     {
         db.TblJobOrderProperties.Remove(ob);
     }
 }
コード例 #3
0
ファイル: JobOrderModule.cs プロジェクト: tonchilling/KemRex
        public void SetProperty(TblJobOrderProperties ob)
        {
            db.TblJobOrderProperties.Add(ob);

            /* if (ob.TransferId == 0)
             * { db.TransferDetail.Add(ob); }
             * else { db.Entry(ob).State = EntityState.Modified; }*/
        }
コード例 #4
0
        //[Authorized]
        public ActionResult PropertiesDelete()
        {
            int qid = Request.Form["JobOrderId"].ParseInt();

            try
            {
                int Seq = Request.Form["No"].ParseInt();
                TblJobOrderProperties ob = uow.Modules.JobOrder.GetPropertie(qid, Seq);
                if (ob == null)
                {
                    return(RedirectToAction("Detail", MVCController, new { id = qid, tab = "Product", msg = "ไม่พบข้อมูลที่ต้องการ", msgType = AlertMsgType.Warning }));
                }

                uow.Modules.JobOrder.DeletePropertie(ob);
                uow.SaveChanges();
                return(RedirectToAction("Detail", MVCController, new { id = qid, tab = "Product", msg = "ลบข้อมูลเรียบร้อยแล้ว", msgType = AlertMsgType.Success }));
            }
            catch (Exception ex)
            { return(RedirectToAction("Detail", MVCController, new { id = qid, tab = "Product", msg = ex.GetMessage(), msgType = AlertMsgType.Danger })); }
        }