Ejemplo n.º 1
0
        /// <summary>
        /// 新增需求(订单)
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public static int OwnNeedDataIns(tb_Order order)
        {
            using (CareCenterEntities entity = new CareCenterEntities())
            {
                try
                {
                    int count     = 0;
                    var orderdata = entity.tb_Order.FirstOrDefault(item => item.OrderID == order.OrderID);
                    if (orderdata == null)
                    {
                        order.Status              = 0;
                        order.CreateDate          = Utility.GetSysDateTime();
                        entity.Entry(order).State = System.Data.Entity.EntityState.Added;
                        entity.SaveChanges();
                        count = 1;
                    }

                    return(count);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 编辑需求数据
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public static int EditOrderData(tb_Order order)
        {
            using (CareCenterEntities entity = new CareCenterEntities())
            {
                try
                {
                    int count     = 0;
                    var orderdata = entity.tb_Order.FirstOrDefault(item => item.OrderID == order.OrderID);
                    if (orderdata != null)
                    {
                        orderdata.Memo          = order.Memo;
                        orderdata.OrderClassify = order.OrderClassify;
                        orderdata.OrderIntor    = order.OrderIntor;
                        orderdata.OrderTitle    = order.OrderTitle;
                        orderdata.OrderType     = order.OrderType;

                        entity.Entry(orderdata).State = System.Data.Entity.EntityState.Modified;
                        entity.SaveChanges();
                        count = 1;
                    }

                    return(count);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Ejemplo n.º 3
0
        //添加订单
        public int AddOrder(tb_Order orders, List <tb_Menu> m)
        {
            string Number = "";

            Number           = "DH " + DateTime.Now.ToString("yyyyMMddHHmmss");
            orders.Order_Dan = DateTime.Now;
            string sql = $"insert into tb_order(Order_Num,User_Id,Desk_Id,Order_YingFu,Order_Price,Order_State,Order_YouHuiId,Order_YouHui,Order_fs,Order_Sate,Order_Dan) VALUES('{Number}','{orders.User_Id}','1','{orders.Order_YingFu}','{orders.Order_Price}','0','{orders.Order_YouHuiId}','{orders.Order_YouHui}','微信','{DateTime.Now}','{orders.Order_Dan}')";
            int    c   = db.ExcuteNonQuery(sql);
            int    oid = 0;
            int    s1  = 0;

            if (c > 0)
            {
                string          sql1 = "select * from tb_order";
                DataTable       tb   = db.ExcuteSql(sql1);
                List <tb_Order> list = JsonConvert.DeserializeObject <List <tb_Order> >(JsonConvert.SerializeObject(tb)).ToList();

                oid = (from s in list orderby s.Order_Dan descending select s).FirstOrDefault().Order_Id;

                foreach (var item in m)
                {
                    string sql2 = $"insert into tb_orderdetail(Order_Id,Menu_Id,MenuNum) values('{oid}','{item.M_Id}','{item.CarNum}')";
                    s1 += db.ExcuteNonQuery(sql2);
                }
            }
            if (s1 == m.Count)
            {
                return(oid);
            }
            else if (s1 == 0)
            {
                return(0);
            }
            else
            {
                return(-1);
            }
        }
Ejemplo n.º 4
0
        public ActionResult EditClassCareData()
        {
            //验证登录
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("SignIn", "Home"));
            }
            var OrderID = Request["OrderID"];
            var Title   = Request["Title"];
            var Memo    = Request["Memo"];
            //var VideoUrl = Request["VideoUrl"];
            //var ImgUrl = Request["ImgUrl"];
            var OrderClassify = Request["OrderClassify"];
            var OrderType     = Request["OrderType"];
            var OrderIntro    = Request["OrderIntro"];

            //需求数据
            tb_Order order = new tb_Order();

            order.OrderID       = OrderID;
            order.OrderTitle    = Title;
            order.OrderType     = OrderType;
            order.OrderClassify = Convert.ToInt32(OrderClassify);
            order.Memo          = Memo;
            order.OrderIntor    = OrderIntro;

            int count = DemandBLL.EditOrderData(order);

            if (count > 0)
            {
                return(OperContext.PackagingAjaxMsg(AjaxStatu.ok, "信息提交成功请查看详情!", null, "/MemberM/AdminClassCare/"));
            }
            else
            {
                return(OperContext.PackagingAjaxMsg(AjaxStatu.err, "信息提交失败!"));
            }
        }
Ejemplo n.º 5
0
        public ActionResult SetOwnNeedData()
        {
            var Title         = Request["Title"];
            var Memo          = Request["Memo"];
            var VideoUrl      = Request["VideoUrl"];
            var ImgUrl        = Request["ImgUrl"];
            var OrderClassify = Request["OrderClassify"];
            var OrderType     = Request["OrderType"];
            var OrderIntro    = Request["OrderIntro"];
            var OrderID       = Utility.GetNewGUID();
            var PersonInro    = Request["PersonInro"];//被照护人情况
            var Address       = Request["Address"];
            var CeraRange     = Request["CeraRange"];
            var DateType      = Request["DateType"];// 照护方式  如:4H(半天)、10h(白天)、24h(全天)
            var CarePerson    = Request["CarePerson"];
            var CareAddress   = Request["CareAddress"];
            int picCnt        = 0;                                      //图片
            int videoCnt      = 0;                                      //视频
            var userphone     = User.Identity.Name;
            var userInfo      = HomeBLL.GetUserInfoByPhone(userphone);; //获取用户信息

            //需求数据
            tb_Order order = new tb_Order();

            order.UserID        = userInfo.ID;
            order.OrderID       = OrderID;
            order.OrderTitle    = Title;
            order.OrderType     = OrderType;
            order.OrderClassify = Convert.ToInt32(OrderClassify);
            order.Memo          = Memo;
            order.OrderIntor    = OrderIntro;
            order.PersonInro    = PersonInro;
            order.Address       = Address;
            order.CeraRange     = CeraRange;
            order.DateType      = DateType;
            order.CarePerson    = CarePerson;
            order.CareAddress   = CareAddress;



            int count     = DemandBLL.OwnNeedDataIns(order);
            var ordertemp = UserBLL.GetOrderDataBYOrderID(OrderID);

            if (count > 0 && ordertemp != null)
            {
                //图片
                if (!string.IsNullOrEmpty(ImgUrl))
                {
                    tb_Pictuer pic = new tb_Pictuer();
                    pic.OrderID = OrderID;
                    pic.PicUrl  = ImgUrl;
                    picCnt      = DemandBLL.PictureIns(pic);
                }

                //视频
                if (!string.IsNullOrEmpty(VideoUrl))
                {
                    tb_Video video = new tb_Video();
                    video.OrderID  = OrderID;
                    video.VideoUrl = VideoUrl;
                    videoCnt       = DemandBLL.VideoIns(video);
                }
                if (!string.IsNullOrEmpty(ImgUrl) && picCnt <= 0)
                {
                    return(OperContext.PackagingAjaxMsg(AjaxStatu.err, "图片提交失败,请联系管理员!"));
                }
                if (!string.IsNullOrEmpty(VideoUrl) && videoCnt <= 0)
                {
                    return(OperContext.PackagingAjaxMsg(AjaxStatu.err, "视频提交失败,请联系管理员!"));
                }

                return(OperContext.PackagingAjaxMsg(AjaxStatu.ok, "需求提交成功请至个人中心查看!", null, "/User/OwnNeed/"));
            }
            else
            {
                return(OperContext.PackagingAjaxMsg(AjaxStatu.err, "需求提交失败,请联系管理员!"));
            }
        }
Ejemplo n.º 6
0
        public int AddOrder([FromForm] tb_Order orders, [FromForm] string lists)
        {
            List <tb_Menu> list = JsonConvert.DeserializeObject <List <tb_Menu> >(lists).ToList();

            return(bll.AddOrder(orders, list));
        }