Esempio n. 1
0
        public JsonResult NotViewofferChaseShenHe(int id)
        {
            using (TransactionScope sc = new TransactionScope())
            {
                try
                {
                    T_offerApprove offerApprove = db.T_offerApprove.SingleOrDefault(a => a.PID == id && a.ApproveTime == null);
                    if (offerApprove == null)
                    {
                        return(Json(new { State = "Faile", Message = "该数据已审核" }));
                    }
                    offerApprove.ApproveTime = DateTime.Now;
                    offerApprove.Status      = 2;
                    db.SaveChanges();

                    T_offer model = db.T_offer.Find(id);
                    model.Status = 2;
                    model.Step   = 1;
                    db.SaveChanges();



                    sc.Complete();
                    return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { State = "Faile", Message = ex.Message }, JsonRequestBehavior.AllowGet));
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 报价保存
        /// </summary>
        /// <param name="model"></param>
        /// <param name="detailList"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public JsonResult ViewofferAddSave(T_offer model, string detailList, decimal costTotal, decimal offerTotal)
        {
            string name = Server.UrlDecode(Request.Cookies["Nickname"].Value);

            using (TransactionScope sc = new TransactionScope())
            {
                try
                {
                    List <T_offerDetails> details = Com.Deserialize <T_offerDetails>(detailList);
                    if (string.IsNullOrWhiteSpace(detailList))
                    {
                        return(Json(new { State = "Faile", Message = "详情不能为空" }));
                    }

                    model.offerName  = name;
                    model.offerDate  = DateTime.Now;
                    model.Step       = 0;
                    model.Status     = -1;
                    model.costTotal  = costTotal;
                    model.offerTotal = offerTotal;
                    db.T_offer.Add(model);
                    db.SaveChanges();

                    foreach (var item in details)
                    {
                        item.offerID = model.ID;
                        db.T_offerDetails.Add(item);
                    }
                    db.SaveChanges();

                    T_offerApprove approve = new T_offerApprove
                    {
                        ApproveName = "武装色",
                        Status      = -1,
                        PID         = model.ID
                    };
                    db.T_offerApprove.Add(approve);
                    db.SaveChanges();

                    sc.Complete();
                    return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { State = "Faile", Message = ex.Message }, JsonRequestBehavior.AllowGet));
                }
            }
        }