Beispiel #1
0
        public Form1()
        {
            InitializeComponent();
            password = "******";
            SignInForm signInForm = new SignInForm();

            signInForm.OnResultCallback = (resultArgs) => {
                if (resultArgs["password"] as string == password)
                {
                    signInForm.Close();
                }
                else
                {
                    MessageBox.Show("Wrong password!");
                    return;
                }
                this.passwordLabel.Text = resultArgs["password"] as string;
            };
            signInForm.ShowDialog();
            goodsListBox.DataSource            = GoodsModel;
            goodsListBox.SelectedValueChanged += (s, a) => {
                SelectedGood = (s as ListBox).SelectedItem as Good;
            };
            GoodsModel.ListChanged += (s, a) => { goodsListBox.SelectedItem = GoodsModel.ElementAtOrDefault(0); };
        }
Beispiel #2
0
        /// <summary>
        /// 详情
        /// </summary>
        /// <param name="goodsId"></param>
        /// <param name="productId"></param>
        /// <param name="mark"></param>
        /// <returns></returns>
        public virtual ActionResult Index(long?goodsId, long?productId, string mark)
        {
            if (!goodsId.HasValue && productId.HasValue)
            {
                var product = this.GetEntity <ProductEntity>(productId.Value);
                if (product == null)
                {
                    return(View("~/Views/Home/Unsale.cshtml"));
                }
                goodsId = product.Goods.Id;
            }
            var model = new GoodsModel
            {
                ProductId  = productId,
                Goods      = GetGoods(goodsId.HasValue?goodsId.Value:0, mark),
                IdentityId = Identity == null ? 0 : Identity.Id,
                Agent      = GetAgent()
            };

            if (model.Goods == null || model.Goods.Products == null || model.Goods.Products.Count == 0)
            {
                return(View("~/Views/Home/Unsale.cshtml", model));
            }
            if (model.Product == null)
            {
                return(View("~/Views/Home/Unsale.cshtml", model));
            }
            model.SetSkuProperties();
            model.SetPrice();
            return(View("~/Views/Home/index.cshtml", model));
        }
Beispiel #3
0
        public async Task <IActionResult> Save([FromBody] GoodsModel goods)
        {
            if (goods == null)
            {
                return(BadRequest());
            }

            //处理商品主图
            if (!string.IsNullOrEmpty(goods.picture))
            {
                goods.picture = ParseUploadFile(goods.picture);
            }
            //处理附件
            if (goods.downloads != null && goods.downloads.Any())
            {
                foreach (var item in goods.downloads)
                {
                    item.url = ParseUploadFile(item.url);
                }
            }

            //如果有id,则为修改,否则就是新增。
            if (goods.id > 0)
            {
                await goodsService.Update(goods.ToEntity(), goods.attrs.ToEntity(), goods.downloads.ToEntity());
            }
            else
            {
                await goodsService.Insert(goods.ToEntity(), goods.attrs.ToEntity(), goods.downloads.ToEntity());
            }
            return(Ok());
        }
Beispiel #4
0
    public void GetAreaInfo()
    {
        GoodsModel model1 = new GoodsModel();
        GoodsBll   bll1   = new GoodsBll();

        model = bll.GetModel1(_Pid);

        model1            = bll1.GetModel(_Pid);
        this.txtname.Text = model1.serviceName;
        if (model != null)
        {
            //this.txtID.Text = model.sysnumber;
            this.txtPrice.Text = model.Price.ToString();
            this.txtValue.Text = model.value;
            //this.txtsysnumber.Visible =false ;
            //this.txtID.Visible = true;
            if (model.IsDefault == 1)
            {
                this.CheckDefault.SelectedValue = "1";
            }
            else
            {
                this.CheckDefault.SelectedValue = "0";
            }
        }
    }
Beispiel #5
0
 public ActionResult Add(GoodsModel m)
 {
     try
     {
         string sql = "select price,amount from TbGoods where gid=@p0";
         IDictionary <string, object> goods = DBHelper.QueryOneDicRow(sql, m.Gid);
         decimal price   = (decimal)goods["price"];
         decimal vamount = price * m.Amount;
         int     gamount = ((int)goods["amount"]) - m.Amount;
         sql = @"insert into TbVipCardRecord(vcid,rtype,amount,info) values(@p0,-1,@p1,'商品购买')";
         DBHelper.Update(sql, m.Vcid, vamount);
         sql = @"select top 1 vcrid from TbVipCardRecord order by vcrid desc";
         object vcrid = DBHelper.QueryOne(sql);
         sql = @"insert into TbBuyGoods(gid,amount,vcrid) values(@p0,@p1,@p2)";
         DBHelper.Update(sql, m.Gid, m.Amount, vcrid);
         sql = @"update TbGoods set amount=@p0 where gid=@p1";
         DBHelper.Update(sql, gamount, m.Gid);
         m.Ok("添加完成");
     }
     catch (Exception ex)
     {
         m.Fail(ex);
     }
     return(Json(m));
 }
Beispiel #6
0
        public async Task <IActionResult> GoodsDetail(string id = null)
        {
            ViewBag.Operation = string.IsNullOrEmpty(id?.Trim()) ? "add" : "update";
            var applicationUser = await _userManager.GetUserAsync(new System.Security.Claims.ClaimsPrincipal(User.Identity));

            if (applicationUser == null || string.IsNullOrEmpty(applicationUser.OrganizationId))
            {
                return(RedirectToAction("Login", "Account"));
            }

            var categories = await HttpRequestHelper.GetAsync <List <GoodsCategoryModel> >("http://goodsservice.gooios.com/api/goodscategory/v1", "", "63e960bff18111e79916012cc8e9f005", applicationUser.Id);

            var goodsCategories = categories.Where(o => string.IsNullOrEmpty(o.ParentId)).Select(item =>
            {
                return(new GoodsCategoryModel
                {
                    Id = item.Id,
                    Name = item.Name,
                    ParentId = item.ParentId,
                    Children = categories.Where(g => g.ParentId == item.Id).ToList()
                });
            }).ToList();

            ViewBag.Categories     = goodsCategories;
            ViewBag.CategoriesJson = JsonConvert.SerializeObject(goodsCategories);

            GoodsModel model = string.IsNullOrEmpty(id) ? null : await HttpRequestHelper.GetAsync <GoodsModel>($"http://goodsservice.gooios.com/api/goods/v1/getgoods", $"id={id}", "63e960bff18111e79916012cc8e9f005", applicationUser.Id);

            return(View(model));
        }
        public async Task SaveGoodsAsync(GoodsModel goods, int[] sizes)
        {
            Goods editGoods = await this._context.Goods.FindAsync(goods.GoodsId);

            if (editGoods != null)
            {
                editGoods.Name          = goods.Name;
                editGoods.Description   = goods.Description;
                editGoods.CategoryId    = goods.CategoryId;
                editGoods.ClothesTypeId = goods.ClothesTypeId;
                editGoods.Price         = goods.Price;
                if (goods.ImageData != null)
                {
                    editGoods.ImageData     = goods.ImageData;
                    editGoods.ImageMimeType = goods.ImageMimeType;
                }
                if (sizes != null)
                {
                    editGoods.Sizes.Clear();
                    foreach (var size in await this._context.Sizes.Where(s => sizes.Contains(s.SizeId)).ToListAsync())
                    {
                        editGoods.Sizes.Add(size);
                    }
                }
                this._context.Entry(editGoods).State = EntityState.Modified;
                await this._context.SaveChangesAsync();
            }
        }
 /// <summary>
 /// 将商品发送到相应的群
 /// </summary>
 /// <param name="shareData">The share data.</param>
 /// <param name="goods">The goods.</param>
 /// <param name="lst">The LST.</param>
 private void SendWeChatGroupShareText(List <weChatShareTextModel> shareData, GoodsModel goods, List <WindowInfo> wins)
 {
     try
     {
         Image image       = null;
         bool  isSendImage = isImageText();
         try
         {
             using (Stream stream = new FileStream(goods.goodslocatImgPath, FileMode.Open))
             {
                 image = Image.FromStream(stream);
             }
         }
         catch (Exception ex)
         {
             image       = null;
             isSendImage = true;
             log.Error(ex);
         }
         if (isSendImage)
         {
             SendImage(image, shareData, wins, true);
             SendText(shareData, wins, true);
         }
         else
         {
             SendText(shareData, wins, false);
             SendImage(image, shareData, wins, false);
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
     }
 }
Beispiel #9
0
 void Show()
 {
     info.gameObject.SetActive(true);
     Debug.Log(info.gameObject.name);
     OkBtn     = info.Find("UseBtn").GetComponent <Button>();
     CancelBtn = info.Find("Cancel").GetComponent <Button>();
     CancelBtn.onClick.AddListener(() => { info.gameObject.SetActive(false); });
     OkBtn.onClick.AddListener(() => {
         if (gameObject.name != "Image(Clone)")
         {
             ID            = int.Parse(gameObject.name);
             GoodsModel gm = Save.Equiplist.Find(x => x.Id == ID);
             Save.BuyItem(Read.GedInstance().GetItemId(ID), false);
             if (gm != null)
             {
                 Save.UseItem(Read.GedInstance().GetItemId(ID), true);
             }
             //GetComponent<Image>().sprite = Resources.Load<Sprite>("Icon/Slotlayout");
             //if (gameObject.name==ID.ToString())
             //{
             //    gameObject.name = "Image";
             //}
         }
         info.gameObject.SetActive(false);
         TTUIPage.ShowPage <EquiPanel>();
     });
 }
Beispiel #10
0
    protected void GetFormInfo(ref GoodsModel mod)
    {
        mod.GoodsName       = this.txtName.Value.Trim();
        mod.Orderby         = Convert.ToInt32(this.txtOrder.Value.Trim() == "" ? "0" : this.txtOrder.Value.Trim());
        mod.Remarks         = this.txtRemarks.Text;
        mod.GoodsSampleDesc = this.txtSampleDesc.Text;
        mod.GoodsDesc       = this.hzst_ckeditor.Text;


        string[] codeList = this.cselect.hfCode.Split('|');
        if (codeList.Length < 1 || cselect.hfCode == "")
        {
            mod.CategoryId = "1";
        }
        else
        {
            mod.CategoryId = codeList[codeList.Length - 1];
        }

        mod.GoodsCode = this.txtGoodsCode.Value.Trim();
        mod.IsHot     = this.cbIsHot.Checked == true ? 1 : 0;
        mod.IsNew     = this.cbIsNew.Checked == true ? 1 : 0;
        mod.IsSpe     = 0;
        mod.IsRec     = this.cbIsRec.Checked == true ? 1 : 0;
        //mod.IsSpe = this.cbIsSpe.Checked == true ? 1 : 0;
        mod.SalePrice     = Convert.ToDecimal(this.txtSalePrice.Value.Trim());
        mod.IsSale        = Int32.Parse(this.rdIsSale.SelectedValue);
        mod.MorePropertys = this.ddlMorePropertys.SelectedValue;
        //20160605
        mod.MarketPrice    = Convert.ToDecimal(this.txtMarketPrice.Value.Trim());
        mod.JobStartTime   = DateTime.Now;
        mod.JobEndTime     = DateTime.Now;
        mod.JobType        = this.ddlJobType.Value;
        mod.TotalSaleCount = Int32.Parse(this.txtTotalSaleCount.Value);
    }
Beispiel #11
0
        public void AddToCart(CartPostModel input)
        {
            // var user = httpContext.HttpContext.User;
            //var claims = user.Claims;
            var data = new GoodsModel
            {
                _id    = 1,
                Name   = "鲜享黑米",
                Price  = 10,
                Remark = "鲜享黑米,不好吃不要钱!",
                Images = new List <ImageBase> {
                    new ImageBase {
                        Path = "http://a0.att.hudong.com/78/52/01200000123847134434529793168.jpg"
                    }
                },
                Types = new List <ClassifyModel> {
                    new ClassifyModel {
                        Remark = "谷物类", Name = "谷物类", _id = 1
                    }
                }
            };

            StaticData.CartUserGoods.TryAdd(1, new List <GoodsModel> {
                data
            });
        }
        public async Task <ActionResult> GetGoodsDescription(int?goodsId, int page = 1)
        {
            if (goodsId != null)
            {
                GoodsModel goods = await _repository.GetGoodsByIdAsync((int)goodsId);

                if (goods != null)
                {
                    ICollection <ReviewModel> reviews = await this._reviewRepository.GetReviewsByGoodsIdForOnePageAsync((int)goodsId, pageSizeForReviews, page);

                    PagingInfo pageInfo = new PagingInfo
                    {
                        CurrentPage  = page,
                        ItemsPerPage = pageSizeForReviews,
                        TotalItems   = await this._reviewRepository.GetCountReviewsByGoodsIdAsync((int)goodsId)
                    };

                    ReviewsListViewModel model = new ReviewsListViewModel
                    {
                        Reviews    = reviews,
                        PagingInfo = pageInfo,
                        Goods      = goods,
                    };
                    return(View(model));
                }
                else
                {
                    return(new HttpNotFoundResult());
                }
            }
            else
            {
                return(RedirectToAction("GoodsCards"));
            }
        }
Beispiel #13
0
    /// <summary>
    /// 锻造的时候添加材料
    /// </summary>
    /// <param name="_item"></param>
    public static void CurrCaiLiao(Item _item)
    {
        if (currformulas == null)
        {
            currformulas = new List <GoodsModel>();
        }
        if (currformulas.Count <= 2)
        {
            GoodsModel gm = currformulas.Find(x => x.Id == _item.item_ID);
            if (gm != null)
            {
                gm.Num += 1;
            }
            else
            {
                currformulas.Add(new GoodsModel()
                {
                    Id = _item.item_ID, Num = 1
                });
            }
        }
        else
        {
            //GoodsModel gm = currformulas.Find(x => x.Id == _item.item_ID);
            //if (gm != null)
            //{
            currformulas.RemoveAt(0);
            ////currformulas.Add(gm);
            //}
        }

        SaveCaiLiao();
        //TTUIPage.ShowPage<Success>();
    }
Beispiel #14
0
        public string EditGoods(GoodsModel u)
        {
            int    k;
            string msg = "商品编辑失败。";

            if (HasGoodsNo(u.GOODS_NAME, u.FID))
            {
                k   = -2;
                msg = "商品已存在。";
            }
            else
            {
                var oldGoods = GoodsDal.Instance.Get(u.FID);
                k = GoodsDal.Instance.Update(u);
                if (k > 0)
                {
                    msg = "编辑商品成功。";
                    LogBll <GoodsModel> log = new LogBll <GoodsModel>();
                    log.AddLog(u);
                }
            }
            return(new JsonMessage {
                Data = k.ToString(), Message = msg, Success = k > 0
            }.ToString());
        }
Beispiel #15
0
        public ActionResult Query(GoodsModel m)
        {
            try
            {
                string gsql = "select * from TbGoods where amount>0";
                string vsql = "select * from TbVipCard";
                string sql  = @"select bg.bgid,bg.gid,bg.amount,bg.vcrid,
 CONVERT(varchar,bg.btime,120) 'btime',
 g.gname,g.price,vcr.amount 'vamount',vc.cardno,vc.username
 from TbBuyGoods bg
 inner join TbGoods g on bg.gid=g.gid
 inner join TbVipCardRecord vcr on bg.vcrid=vcr.vcrid
 inner join TbVipCard vc on vcr.vcid=vc.vcid";
                IList <IDictionary <string, object> > gdata = DBHelper.QueryDicRows(gsql);
                IList <IDictionary <string, object> > vdata = DBHelper.QueryDicRows(vsql);
                IList <IDictionary <string, object> > data  = DBHelper.QueryDicRows(sql);
                m.Datas.Add("glist", gdata);
                m.Datas.Add("vlist", vdata);
                m.Datas.Add("list", data);
                m.Ok("查询完成");
            }
            catch (Exception ex)
            {
                m.Fail(ex);
            }

            return(Json(m));
        }
Beispiel #16
0
 /// <summary>
 /// 编辑门店信息
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="apiCode">The API code.</param>
 /// <returns>true if XXXX, false otherwise.</returns>
 public bool EditGoodsInfo(GoodsModel model, out ApiStatusCode apiCode)
 {
     apiCode = ApiStatusCode.OK;
     if (model.GoodsId > 0)
     {
         if (dal.UpdateGoodsInfo(model))
         {
             apiCode = ApiStatusCode.OK;
             return(true);
         }
         else
         {
             apiCode = ApiStatusCode.更新失败;
         }
     }
     else
     {
         int flag = dal.AddGoodsInfo(model);
         if (flag > 0)
         {
             return(true);
         }
         else
         {
             apiCode = ApiStatusCode.添加失败;
         }
     }
     return(false);
 }
Beispiel #17
0
        public string AddGoods(GoodsModel u)
        {
            string uid = "0";
            string msg = "商品添加失败!";

            if (HasGoodsNo(u.GOODS_NAME, u.FID))
            {
                uid = "-2";
                msg = "商品已存在。";
            }
            else
            {
                uid = GoodsDal.Instance.Insert(u);
                if (uid != "")
                {
                    msg = "添加商品成功!";
                    LogBll <GoodsModel> log = new LogBll <GoodsModel>();
                    u.FID = uid;
                    log.AddLog(u);
                }
            }
            return(new JsonMessage {
                Data = uid.ToString(), Message = msg, Success = uid != ""
            }.ToString());
        }
Beispiel #18
0
        public ActionResult Index()
        {
            // 先获得推荐商品的索引 即商品的guid list
            IEnumerable <ReCommend> recommendList = _recommendBLL.GetAllReCommendListwithSortByTime();

            List <GoodsModel> goodsModelList = new List <GoodsModel>();

            foreach (var item in recommendList)
            {
                Goods goods = _goodsBLL.GetGoodsById(item.GoodsId);
                if (goods == null)
                {
                    LogHelper.Log.Write("goods is null");
                }

                GoodsImage gi = _goodsImageBLL.GetPictureByGoodsId(goods.Id);

                if (gi == null)
                {
                    LogHelper.Log.Write("gi is null");
                }

                GoodsModel gm = new GoodsModel(goods);
                gm.PicturePath = gi.ImagePath;

                goodsModelList.Add(gm);
            }

            // 要显示的推荐商品
            ViewData["GoodsModelList"] = goodsModelList;
            return(View());
        }
Beispiel #19
0
    public static void BuyItem(DataMgr.Item _item)
    {
        Debug.Log("买买买");
        Debug.Log(_item.item_ID);
        if (Goodlist == null)
        {
            Goodlist = new List <GoodsModel>();
        }

        GoodsModel gm = Goodlist.Find(x => x.Id == _item.item_ID);

        if (gm != null)
        {
            gm.Num += 1;
        }
        else
        {
            Goodlist.Add(new GoodsModel()
            {
                Id = _item.item_ID, Num = 1
            });
        }
        // SaveGoods();
        TTUIPage.ShowPage <TipePanel>(_item.item_ID);
    }
Beispiel #20
0
        /**
         * pay接口:       星云地址之间的转账
         * @param goods   商品详情
         * @param to      转账目标地址
         * @param value   转账value,单位为wei (1NAS =10^18 wei)
         */
        public static void Pay(GoodsModel goods, String to, String value, String serialNumber)
        {
            OpenAppMode openAppMode = new OpenAppMode();

            openAppMode.category = Constants.CATEGORY;
            openAppMode.des      = Constants.DESCRIPTION;

            PageParamsModel pageParamsModel = new PageParamsModel();

            pageParamsModel.serialNumber = serialNumber;
            pageParamsModel.callback     = isMainnet ? mainnetUrl : testnetUrl;
            pageParamsModel.goods        = goods;

            PayloadModel payloadModel = new PayloadModel();

            payloadModel.type = Constants.PAY_PAYLOAD_TYPE;

            PayModel payModel = new PayModel();

            payModel.currency = Constants.PAY_CURRENCY;
            payModel.payload  = payloadModel;
            payModel.value    = value;
            payModel.to       = to;

            pageParamsModel.pay = payModel;

            openAppMode.pageParams = pageParamsModel;

            String _params = OpenAppMode.getOpenAppModel(openAppMode);

            String url = OpenAppSchema.getSchemaUrl(_params);

            ContractAction.start(url);
        }
Beispiel #21
0
        /// <summary>
        /// </summary>
        /// <param name="GoodsCode"></param>
        /// <returns></returns>
        public ActionResult Update(string GoodsCode)
        {
            // 根据 传递过来的goodsCode 获取对应的goods
            Goods goods = _goodsBLL.GetGoodsByCode(GoodsCode);

            // 再生成 goodsModel 这个将作为model传递到前台
            GoodsModel gm = new GoodsModel(goods);

            // 构造 categoryList
            List <Category> categoryList = new List <Category>();

            // 先根据 goodsId 获取 该 goods对应的分类Id列表

            // 再 找到对应的分类列表
            foreach (var item in _goodsCategoryBLL.GetGoodsCategoryListByGoodsId(gm.Id))
            {
                Category category = _categoryBLL.GetCategoryById(item.CategoryId);
                categoryList.Add(category);
            }

            // 当前已选分类
            ViewData["CurrentCategoryList"] = categoryList;

            // 所有的分类
            ViewData["CategoryList"] = _categoryBLL.GetAllCategory();

            GoodsImage gi = new GoodsImage();

            gi = _goodsImagesBLL.GetPictureByGoodsId(gm.Id);

            gm.PicturePath = gi.ImagePath;

            return(View(gm));
        }
Beispiel #22
0
        public async Task <WrapResult <object> > Get(int id)
        {
            var data = new GoodsModel
            {
                _id    = 1,
                Name   = "鲜享黑米",
                Price  = 10,
                Remark = "鲜享黑米,不好吃不要钱!",
                Images = new List <ImageBase> {
                    new ImageBase {
                        Path = "http://a0.att.hudong.com/78/52/01200000123847134434529793168.jpg"
                    }
                },
                Types = new List <ClassifyModel> {
                    new ClassifyModel {
                        Remark = "谷物类", Name = "谷物类", _id = 1
                    }
                }
            };
            var result = new WrapResult <object>
            {
                Data = data
            };

            return(await Task.FromResult(result));
        }
Beispiel #23
0
        public virtual IActionResult AddGoods(GoodsModel model)
        {
            if (!permissionService.Authorize(StandardPermissionProvider.ManageConsignmentOrders))
            {
                return(AccessDeniedView());
            }

            if (ModelState.IsValid)
            {
                var entity = consignmentOrderService.Get(model.OrderId);
                if (null == entity)
                {
                    return(Json(new { Result = false }));
                }

                var entityItem = model.ToEntity <Goods>();
                entityItem.CTime = DateTime.UtcNow;
                entity.Goods.Add(entityItem);
                consignmentOrderService.Update(entity);

                return(Json(new { Result = true }));
            }
            else
            {
                var errors = ModelState.Where(x => x.Value.Errors.Any())
                             .ToDictionary(
                    x => x.Key,
                    y => string.Join(Environment.NewLine,
                                     y.Value.Errors.Select(e =>
                                                           string.IsNullOrWhiteSpace(e.ErrorMessage) ? e.Exception.Message : e.ErrorMessage))
                    );

                return(Json(new { Result = false, Error = string.Join(Environment.NewLine, errors.Values) }));
            }
        }
Beispiel #24
0
        public string Edit(FormCollection context)
        {
            try
            {
                UserBll.Instance.CheckUserOnlingState();

                var        rpm   = GetRpm(context);
                GoodsModel model = GoodsDal.Instance.Get(rpm.FID);
                GoodsModel d     = new GoodsModel();
                d.InjectFrom(rpm.Entity);
                d.FID            = model.FID;
                d.GOODS_NUMBER   = model.GOODS_NUMBER;
                d.CREATE_USER_ID = model.CREATE_USER_ID;
                d.STATUS         = model.STATUS;
                d.AUDIT_TIME     = model.AUDIT_TIME;
                d.AUDIT_USER     = model.AUDIT_USER;
                d.AUDIT_USER_ID  = model.AUDIT_USER_ID;
                d.CREATE_TIME    = model.CREATE_TIME;

                return(GoodsBll.Instance.EditGoods(d));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex);
                return(ex.Message);
            }
        }
Beispiel #25
0
    /// <summary>
    ///使用物品是存入装备数组,脱装备的时候从装备数组移除
    /// </summary>
    /// <param name="_item"></param>
    /// <param name="istakeoff"></param>
    public static void UseItem(Item _item, bool istakeoff)
    {
        if (istakeoff == false)
        {
            if (equiplist == null)
            {
                equiplist = new List <GoodsModel>();
            }
            GoodsModel gm = equiplist.Find(x => x.Id == _item.item_ID);
            if (gm != null)
            {
                BuyItem(_item, false);
            }
            else
            {
                equiplist.Add(new GoodsModel()
                {
                    Id = _item.item_ID, Num = 1
                });
            }
        }

        else
        {
            GoodsModel gm = equiplist.Find(x => x.Id == _item.item_ID);
            equiplist.Remove(gm);
        }

        SaveUse();
        //TTUIPage.ShowPage<Success>();
    }
Beispiel #26
0
 // GET: Cart
 public ActionResult Index()
 {
     //string username = (string )Session["Username"];
     //var user = from n in db.UserInfo.Where(n => n.user_name == username) select n;
     //int id = (int)Session["userid"];
     if (Session["UserID"] != null)
     {
         int id   = (int)Session["userid"];
         var list = from n in db.Goods
                    //from m in db.Cart
                    join m in db.Cart on n.good_id equals m.good_id
                    from q in db.UserInfo
                    where m.user_id == id && q.user_id == id
                    select new CartModel
         {
             GOOD_IMG       = n.good_img,
             GOOD_INTRODUCE = n.good_introduce,
             GOOD_PRICE     = (int)n.good_price,
             NUM            = (int)m.num,
             cart_id        = m.cart_id
         };
         //var list1 = from n in db.Cart.Where(n => n.user_id == id) select n;
         var index = new GoodsModel
         {
             CART = list
         };
         return(View(index));
     }
     else
     {
         return(Content("<script>;alert('您还未登陆!');history.go(-1)</script>"));
     }
 }
Beispiel #27
0
    /// <summary>
    /// 锻造成功减少材料
    /// </summary>
    /// <param name="formula"></param>
    public static void SuccessDZ(Formula formula)
    {
        if (currformulas == null)
        {
            currformulas = new List <GoodsModel>();
        }
        GoodsModel gm  = currformulas.Find(x => x.Id == formula.Item1ID);
        GoodsModel gm1 = currformulas.Find(x => x.Id == formula.Item2ID);
        GoodsModel gm2 = goodList.Find(x => x.Id == formula.Item1ID);//修改背包数据
        GoodsModel gm3 = goodList.Find(x => x.Id == formula.Item2ID);

        if (gm != null && gm1 != null && gm.Num > 0 && gm1.Num > 0)
        {
            gm.Num  -= formula.Item2Amount;
            gm1.Num -= formula.Item2Amount;
            gm2.Num -= formula.Item1Amount;
            gm3.Num -= formula.Item2Amount;
            //Save.BuyItem();
            foreach (var item in currformulas)
            {
                if (item.Num <= 0)
                {
                    currformulas.Remove(item);
                }
            }
        }
        Save.SaveCaiLiao();
        Save.SaveGoodss();
    }
Beispiel #28
0
        public async Task <ActionResult> EditGoods(GoodsModel goods, int[] selectedSizes, HttpPostedFileBase image = null)
        {
            if (ModelState.IsValid)
            {
                if (image != null)
                {
                    goods.ImageData     = new byte[image.ContentLength];
                    goods.ImageMimeType = image.ContentType;
                    image.InputStream.Read(goods.ImageData, 0, image.ContentLength);
                }
                if (goods.GoodsId == 0)
                {
                    await _repository.AddGoodsAsync(goods, selectedSizes);
                }
                else
                {
                    await _repository.SaveGoodsAsync(goods, selectedSizes);
                }
                TempData["message"] = string.Format("Изменения в товаре \"{0}\" были сохранены", goods.Name);
                return(RedirectToAction("ListGoods"));
            }
            else
            {
                ViewBag.Categories   = new SelectList(await this._categoryRepository.GetCategoriesAsync(), "CategoryId", "Name");
                ViewBag.ClothesTypes = new SelectList(await this._typeRepository.GetClothesTypesAsync(), "ClothesTypeId", "Name");
                ViewBag.Sizes        = await this._sizeRepository.GetSizesAsync();

                return(View(goods));
            }
        }
Beispiel #29
0
    public void CallTransfer()
    {
        var gmol         = new GoodsModel();
        var serialNumber = Util.getRandomCode(32);

        SmartContracts.Call(gmol, "vote", inputQueryTransfer.text, (Util.OnNAS * 0.000001).ToString("F0"), new string[] { "霸王别姬" }, serialNumber);
        StartCoroutine(TransferStatusCoroutine(serialNumber));
    }
        /// <summary>
        /// 按钮—选择商品
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSelectGoods_Click(object sender, RoutedEventArgs e)
        {
            if (!PubHelper.CheckIsManager1Purview("12"))
            {
                return;
            }
            PubHelper.p_BusinOper.GoodsOper.CurrentGoods = null;
            FrmGoodsChoice frmGoodsChoice = new FrmGoodsChoice();

            frmGoodsChoice.ShowDialog();

            if ((PubHelper.p_BusinOper.GoodsOper.CurrentGoods != null) && (currentGoodsWay.CurrentGoodsWayProduct != null))
            {
                GoodsModel mcdInfo = new GoodsModel();
                mcdInfo.McdCode    = PubHelper.p_BusinOper.GoodsOper.CurrentGoods.McdCode;
                mcdInfo.McdName    = PubHelper.p_BusinOper.GoodsOper.CurrentGoods.McdName;
                mcdInfo.McdContent = PubHelper.p_BusinOper.GoodsOper.CurrentGoods.McdContent;
                mcdInfo.PicName    = PubHelper.p_BusinOper.GoodsOper.CurrentGoods.PicName;

                bool result = PubHelper.p_BusinOper.UpdateAsileGoods(currentGoodsWay.CurrentGoodsWayProduct.PaCode, mcdInfo);
                if (result)
                {
                    PubHelper.p_IsRefreshAsile = true;
                    if (PubHelper.p_BusinOper.ConfigInfo.GoodsShowModel == BusinessEnum.GoodsShowModelType.GoodsType)
                    {
                        PubHelper.p_IsRefreshGoodsType = true;
                    }

                    // 更改货道商品显示
                    tbMcdCode_Value.Text    = mcdInfo.McdCode;
                    tbMcdName_Value.Text    = mcdInfo.McdName;
                    tbMcdContent_Value.Text = mcdInfo.McdContent;
                    currentGoodsWay.CurrentGoodsWayProduct.McdCode    = tbMcdCode_Value.Text;
                    currentGoodsWay.CurrentGoodsWayProduct.McdName    = tbMcdName_Value.Text;
                    currentGoodsWay.CurrentGoodsWayProduct.McdPicName = mcdInfo.PicName;
                    currentGoodsWay.CurrentGoodsWayProduct.McdContent = mcdInfo.McdContent;
                    SetAsileInfo(currentGoodsWay);
                    currentGoodsWay.SetAsilePic();

                    if (!string.IsNullOrEmpty(mcdInfo.McdCode))
                    {
                        if (PubHelper.p_BusinOper.ConfigInfo.GoodsShowModel != BusinessEnum.GoodsShowModelType.GoodsToOnlyAsile)
                        {
                            // 如果商品展示模式不是商品对应货道模式,则不能做移除商品处理
                            btnRemoveGoods.IsEnabled = false;
                        }
                        else
                        {
                            btnRemoveGoods.IsEnabled = true;
                        }
                    }
                }
                else
                {
                    PubHelper.ShowMsgInfo(PubHelper.p_LangOper.GetStringBundle("Pub_OperFail"), PubHelper.MsgType.Ok);
                }
            }
        }