示例#1
0
        public ActionResult PostCNInfo(CNInfo cn)
        {
            if (ModelState.IsValid == false)
            {
                var    errors = ModelState.Select(x => x.Value.Errors).Where(y => y.Count > 0).ToList();
                string msg    = "";
                foreach (var item in errors)
                {
                    foreach (var ermsg in item)
                    {
                        msg = msg + ermsg.ErrorMessage;
                    }
                }
                return(Json(msg, JsonRequestBehavior.AllowGet));
            }
            HttpCookie myCookie = Request.Cookies["UserCookie"];

            cn.AddBy          = myCookie.Values["UserInfoId"].ToString();
            cn.AddDate        = DateTime.Now.ToString();
            cn.Status         = "A";
            cn.Ex1            = "";
            cn.DeliveryStatus = "0";
            //cn.ServiceCharge = "0";//need to add on the form
            db.CNInfoset.Add(cn);
            var result = db.SaveChanges();

            return(Json(cn.CNInfoId, JsonRequestBehavior.AllowGet));
        }
        //
        // GET: /LE/ConsignmentNote/_Generate
        public int _Generate(List <string> deliverySet, int carrier, bool replace)
        {
            CNInfo node = models.ConsignmentNote.Generate(deliverySet, carrier, replace);

            Session["ConsignmentNote"] = node;
            return(node.ID);
        }
示例#3
0
        public ActionResult GetCNInfoById(int id)
        {
            CNInfo cNInfo = db.CNInfoset.Find(id);

            if (cNInfo == null)
            {
                return(Json("0", JsonRequestBehavior.AllowGet));
            }

            return(Json(cNInfo, JsonRequestBehavior.AllowGet));
        }
示例#4
0
        public ActionResult DeleteCNInfo(int id)
        {
            CNInfo cNInfo = db.CNInfoset.Find(id);

            if (cNInfo == null)
            {
                return(Json("Model not found", JsonRequestBehavior.AllowGet));
            }

            db.CNInfoset.Remove(cNInfo);
            db.SaveChanges();

            return(Json(cNInfo, JsonRequestBehavior.AllowGet));
        }
        public ActionResult _Modify(CNInfo node, string quickPrint)
        {
            int ID = 0;

            if (node.ID > 0)
            {
                node.Creator = ((AccountInfo)Session["Account"]).Name;
                models.ConsignmentNote.Update(node);
                ID = node.ID;
            }
            else
            {
                node.Creator = ((AccountInfo)Session["Account"]).Name;
                ID           = models.ConsignmentNote.Create(node);
            }
            return(RedirectToAction("Edit", new { ID = ID, quickPrint = quickPrint }));
        }
        //
        // GET: /LE/ConsignmentNote/Print
        public ActionResult Print(int ID, int carrierID, string quickPrint)
        {
            CNInfo consignmentnote = models.ConsignmentNote.Read(ID);

            //检查是否已经存在托运单
            CNInfo keywords = new CNInfo();

            keywords.Carrier     = consignmentnote.Carrier;
            keywords.Destination = consignmentnote.Destination;
            keywords.Date        = consignmentnote.Date;
            keywords.DateEnd     = consignmentnote.Date;
            keywords.Receiver    = consignmentnote.Receiver;
            keywords.Status      = 0;

            IList <CNInfo> nodes = models.ConsignmentNote.Read(keywords);
            string         chk   = "";

            for (int i = 0; i < nodes.Count; i++)
            {
                if (nodes[i].ID != ID)
                {
                    if (chk != "")
                    {
                        chk = chk + "、";
                    }
                    chk = chk + nodes[i].SerialNumber;
                }
            }
            if (chk != "")
            {
                chk = "存在物流公司、收货地址、日期相同的托运单(SN:" + chk + ")!";
            }
            Session["ConsignmentNote_CHK"] = chk;

            Session["Print.ConsignmentNote.JSON"] = JsonConvert.SerializeObject(consignmentnote);
            return(RedirectToAction("Print", "Layout", new { area = "Print", doc = "ConsignmentNote-" + carrierID, mac = "ee:ee:ee:ee:ee:ee", quickPrint = quickPrint }));
        }
示例#7
0
        public ActionResult UpdateCNInfo(int id, CNInfo cNInfo)
        {
            if (!ModelState.IsValid)
            {
                return(Json("Model is not valid", JsonRequestBehavior.AllowGet));
            }

            if (id != cNInfo.CNInfoId)
            {
                return(Json("Model is not valid", JsonRequestBehavior.AllowGet));
            }

            HttpCookie myCookie = Request.Cookies["UserCookie"];

            cNInfo.AddBy = myCookie.Values["UserInfoId"].ToString();

            db.Entry(cNInfo).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CNInfoExists(id))
                {
                    return(Json("Model not found", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    throw;
                }
            }

            return(Json(cNInfo, JsonRequestBehavior.AllowGet));
        }
 public ActionResult _Create(CNInfo node)
 {
     return(RedirectToAction("Edit", new { ID = models.ConsignmentNote.Create(node) }));
 }
 public ActionResult _List(CNInfo keywords)
 {
     return(PartialView(models.ConsignmentNote.Read(keywords)));
 }
示例#10
0
 public bool Update(CNInfo node)
 {
     return(client.Update(node));
 }
示例#11
0
 public IList <CNInfo> Report(CNInfo keyowrds)
 {
     return(client.Report(keyowrds));
 }
示例#12
0
 public IList <CNInfo> Read(CNInfo keyowrds)
 {
     return(client.Select(keyowrds));
 }
示例#13
0
 public int Create(CNInfo node)
 {
     return(client.Create(node));
 }