Example #1
0
        /// <summary>
        /// 删除未审核订单
        /// </summary>
        /// <param name="orderFormId"></param>
        /// <returns></returns>
        public ActionResult DeleteOrderForm(int orderFormId)
        {
            //定义返回
            string strMsg = "fail";

            try
            {
                B_OrderFormList dbGoods = (from tbOrderForm in MyModels.B_OrderFormList
                                           where tbOrderForm.OrderFormID == orderFormId
                                           where tbOrderForm.ConsigneeNot == false
                                           select tbOrderForm).Single();

                MyModels.B_OrderFormList.Remove(dbGoods);

                if (MyModels.SaveChanges() > 0)
                {
                    B_OrderFormDetailList dbGoodsDetail = (from tbOrderFormDetail in MyModels.B_OrderFormDetailList
                                                           where tbOrderFormDetail.OrderFormID == orderFormId
                                                           select tbOrderFormDetail).Single();

                    MyModels.B_OrderFormDetailList.Remove(dbGoodsDetail);

                    if (MyModels.SaveChanges() > 0)
                    {
                        strMsg = "success";
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(Json(strMsg, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        /// <summary>
        /// 修改保存
        /// </summary>
        /// <returns></returns>
        public ActionResult DingDanXiuGaiBaoCun()
        {
            string styMy = "fail";

            try
            {
                B_OrderFormList KK = new B_OrderFormList();
                KK.OrderFormID        = Convert.ToInt32(Request.Form["OrderFormID"]);
                KK.OrderNumber        = Request.Form["OrderNumber"];
                KK.OrderFormPactID    = Convert.ToInt32(Request.Form["OrderFormPactID"]);
                KK.SpouseBRanchID     = Convert.ToInt32(Request.Form["SpouseBRanchID"]);
                KK.OrderGoodsData     = Convert.ToDateTime(Request.Form["OrderGoodsData"]);
                KK.Place              = Request.Form["Place"];
                KK.DeliveryFashion    = Request.Form["DeliveryFashion"];
                KK.Value              = Convert.ToDecimal(Request.Form["Value"]);
                KK.ExpensesOTtaxation = Convert.ToDecimal(Request.Form["ExpensesOTtaxation"]);
                KK.ValueTotal         = Convert.ToDecimal(Request.Form["ValueTotal"]);
                KK.OrderFormTypeID    = Convert.ToInt32(Request.Form["OrderFormTypeID"]);
                KK.Register           = Request.Form["Register"];
                KK.RegisterTime       = Convert.ToDateTime(Request.Form["RegisterTime"]);
                KK.CheckRen           = Request.Form["CheckRen"];
                KK.Checktime          = Convert.ToDateTime(Request.Form["Checktime"]);
                KK.ConsigneeNot       = Convert.ToBoolean(Request.Form["ConsigneeNot"]);

                MyModels.Entry(KK).State = System.Data.Entity.EntityState.Modified;
                MyModels.SaveChanges();

                B_OrderFormDetailList JJ = new B_OrderFormDetailList();
                JJ.OrderFormID       = KK.OrderFormID;
                JJ.OrderFormDetailID = Convert.ToInt32(Request.Form["OrderFormDetailID"]);
                JJ.GoodsID           = Convert.ToInt32(Request.Form["GoodsID"]);
                JJ.MumberOfPackages  = Convert.ToDecimal(Request.Form["MumberOfPackages"]);
                JJ.Subdivision       = Convert.ToDecimal(Request.Form["Subdivision"]);
                JJ.Quantity          = Request.Form["Quantity"];
                JJ.Remarks           = Request.Form["Remarks"];

                MyModels.Entry(JJ).State = System.Data.Entity.EntityState.Modified;
                MyModels.SaveChanges();

                styMy = "success";
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(Json(styMy, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        /// <summary>
        /// 新增保存
        /// </summary>
        /// <param name="pwOrderForm"></param>
        /// <returns></returns>
        public ActionResult XinZengDingDanXinXi(B_OrderFormList pwOrderForm)
        {
            string strMsg = "fali";

            try
            {
                //判断数据是否已经存在
                int oldOrderFormRows = (from tbGoodsMoneyRule in MyModels.B_OrderFormList
                                        where tbGoodsMoneyRule.OrderNumber == pwOrderForm.OrderNumber
                                        select tbGoodsMoneyRule).Count();
                if (oldOrderFormRows == 0)
                {
                    try
                    {
                        B_OrderFormList Dep = new B_OrderFormList();
                        Dep.OrderNumber        = Request.Form["OrderNumber"];
                        Dep.OrderFormPactID    = Convert.ToInt32(Request.Form["OrderFormPactID"]);
                        Dep.SpouseBRanchID     = Convert.ToInt32(Request.Form["SpouseBRanchID"]);
                        Dep.OrderGoodsData     = Convert.ToDateTime(Request.Form["OrderGoodsData"]);
                        Dep.Place              = Request.Form["Place"];
                        Dep.DeliveryFashion    = Request.Form["DeliveryFashion"];
                        Dep.Value              = Convert.ToDecimal(Request.Form["Value"]);
                        Dep.ExpensesOTtaxation = Convert.ToDecimal(Request.Form["ExpensesOTtaxation"]);
                        Dep.ValueTotal         = Convert.ToDecimal(Request.Form["ValueTotal"]);
                        Dep.OrderFormTypeID    = Convert.ToInt32(Request.Form["OrderFormTypeID"]);
                        Dep.Register           = Request.Form["Register"];
                        Dep.RegisterTime       = Convert.ToDateTime(Request.Form["RegisterTime"]);
                        Dep.CheckRen           = Request.Form["CheckRen"];
                        Dep.Checktime          = Convert.ToDateTime(Request.Form["Checktime"]);
                        Dep.ConsigneeNot       = Convert.ToBoolean(Request.Form["ConsigneeNot"]);
                        if (Dep.OrderNumber != null && Dep.SpouseBRanchID != null && Dep.OrderGoodsData != null && Dep.OrderFormPactID != null &&
                            Dep.Place != null && Dep.DeliveryFashion != null && Dep.Value != null && Dep.ExpensesOTtaxation != null &&
                            Dep.ValueTotal != null && Dep.OrderFormTypeID != null && Dep.Register != null && Dep.RegisterTime != null &&
                            Dep.CheckRen != null && Dep.Checktime != null)
                        {
                            MyModels.B_OrderFormList.Add(Dep);
                            MyModels.SaveChanges();

                            B_OrderFormDetailList KK = new B_OrderFormDetailList();
                            KK.OrderFormID      = Dep.OrderFormID;
                            KK.GoodsID          = Convert.ToInt32(Request.Form["GoodsID"]);
                            KK.MumberOfPackages = Convert.ToDecimal(Request.Form["MumberOfPackages"]);
                            KK.Subdivision      = Convert.ToDecimal(Request.Form["Subdivision"]);
                            KK.Quantity         = Request.Form["Quantity"];
                            KK.Remarks          = Request.Form["Remarks"];
                            if (KK.OrderFormID != null && KK.GoodsID != null && KK.MumberOfPackages != null && KK.Subdivision != null &&
                                KK.Quantity != null && KK.Remarks != null)
                            {
                                MyModels.B_OrderFormDetailList.Add(KK);
                                MyModels.SaveChanges();

                                strMsg = "success";
                            }
                        }
                    }
                    catch (Exception)
                    {
                        return(Json(strMsg, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    strMsg = "exsit";
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(Json(strMsg, JsonRequestBehavior.AllowGet));
        }