示例#1
0
        public ActionResult DoOrder(Shop_Goods goods, Shop_Store store, Shop_People people, Shop_Order order, int stock)
        {
            BuyGoods buyGoods= BuildFactory.GoodsFactory().GetBuyTotl(goods.GoodsId);

            if (buyGoods != null && (buyGoods.buyNum + order.buyNum) > stock)
            {

                return Content("<script>alert('订单数已超库存,库存尚余" + (stock - buyGoods.buyNum) + "个,请调整订单数或联系商家!');;</script>");
            }

            if (BuildFactory.GoodsFactory().GenOrder(people,store,order))
            {
                return Content("<script>alert('已发送购买信息,卖家收到信息后会进行联系确认');location.href = 'https://www.alipay.com/'</script>");
            }
            ;

            return Content("<script>alert('购买信息填写出错,请重新填写');;</script>");
        }
示例#2
0
文件: Shop.cs 项目: 503945930/baoxin
        public bool GenOrder(Shop_People people,Shop_Store store,Shop_Order order)
        {
            using (TransactionScope transaction=new TransactionScope())
            {
                try
                {
                    DbEntityEntry<Shop_People> entity = db.Entry(people);
                    entity.State = EntityState.Added;
                    db.SaveChanges();
                    order.PeopleId_buy = people.PeopleId;
                    order.StoreId = store.StoreId;
                    order.BoolYX = false;
                    order.butTime = DateTime.Now;
                    order.BoolSeng = false;
                    DbEntityEntry<Shop_Order> entity1 = db.Entry(order);
                    entity1.State = EntityState.Added;
                    db.SaveChanges();
                    transaction.Complete();
                    return true;

                }
                catch (Exception)
                {
                    transaction.Dispose();
                    return false;
                    throw;
                }
            }
        }
示例#3
0
        public ContentResult DoApply(Shop_Photo photo, Shop_People people, Shop_Store shop)
        {
            #region 上传图片
            //上传和返回(保存到数据库中)的路径
            string uppath = string.Empty;
            string savepath = string.Empty;
            if (Request.Files.Count > 0)
            {
                //  HttpPostedFileBase imgFile = Request.Files["imgName"];
                //if (imgFile != null)
                //{
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    //创建图片新的名称
                    string nameImg = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                    //获得上传图片的路径
                    // string strPath = imgFile.FileName[i].ToString();
                    var httpPostedFileBase = Request.Files[i];
                    if (httpPostedFileBase != null)
                    {
                        string strPath = httpPostedFileBase.FileName.ToString();
                        //获得上传图片的类型(后缀名)
                        string type = strPath.Substring(strPath.LastIndexOf(".") + 1).ToLower();
                        if (ValidateImg(type))
                        {
                            //拼写数据库保存的相对路径字符串
                            savepath = "../../Uploads/Files/";
                            savepath += nameImg + "." + type;
                            //拼写上传图片的路径
                            uppath = Server.MapPath("~/Uploads/Files/");
                            uppath += nameImg + "." + type;
                            //上传图片
                            httpPostedFileBase.SaveAs(uppath);
                        }
                        else
                        {
                            return Content("<script>alert('请上传正确的格式图片');location.href = '/shop/shop/apply';</script>");
                        }

                    }
                    photo.PhotoURL = savepath;
                    photo.PhontName = nameImg;
                    photo.BoolYX = true;

                    //}

                }

            }
            #endregion

            shop.StoreUser =((UsersEntity)Session["User"]).NickName;
            shop.AddTime = DateTime.Now;
            people.BoolLX = true;
            shop.BoolYX = true;
            shop.StoreOrde = 0;
            if (BuildFactory.AppylyStroeFactory().Apply(photo, people, shop))
            {
                return Content("<script>alert('请等待管理员审核通知审核结果将发至您的邮箱,请注意查收.');location.href = '/index';</script>");
            }
            ;

            return Content("<script>alert('申请失败,请重新申请');location.href = '/shop/shop/apply';</script>");

            // return null();
        }