Пример #1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            if (context.Session["id"] != null)
            {
                int id = context.Request.QueryString["goods_id"] == null ? 0 : Int32.Parse(context.Request.QueryString["goods_id"]);
                //context.Response.Write("Hello World"+id);

                if (id > 0)
                {
                    int i = GoodsBLL.DeleteGoodsById(id);
                    if (i > 0)
                    {
                        context.Response.Write("删除成功!");
                    }
                    else
                    {
                        context.Response.Write("删除失败");
                    }
                    context.Response.Write("<a href='ProcessAdminProduct.ashx'>回到商品首页</a>");
                }
            }
            else
            {
                context.Response.Redirect("~/admin_login.html");
            }
        }
Пример #2
0
    protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int    id      = e.CommandArgument.ToArrowInt();
        string command = e.CommandName;

        if (command == "UpdateData")
        {
            GridViewRow drv     = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent));
            string      catName = (gvData.Rows[drv.RowIndex].FindControl("tbName") as TextBox).Text;
            string      order   = (gvData.Rows[drv.RowIndex].FindControl("tbOrder") as TextBox).Text;
            if (!catName.IsNullOrEmpty())
            {
                var model = GoodsBLL.SelectGoodsCat(id);
                if (model != null)
                {
                    model.Name      = catName;
                    model.SortOrder = order.ToArrowInt();
                    GoodsBLL.UpdateGoodsCat(model);
                }
            }
        }
        else if (command == "DelData")
        {
            var model = GoodsBLL.SelectGoodsCat(id);
            if (model != null)
            {
                model.IsDel = 1;
                GoodsBLL.UpdateGoodsCat(model);
            }
        }

        BindData();
        MessageBox.Show("操作成功!");
    }
Пример #3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            int    id   = context.Request.QueryString["goods_id"] == null ? 0 : Int32.Parse(context.Request.QueryString["goods_id"]);
            string temp = File.ReadAllText(context.Server.MapPath("drugstore_details.html"));

            GoodModel good = GoodsBLL.GetAGoodDetail(id);

            temp = temp.Replace("@goods_id", good.GoodsId.ToString());
            temp = temp.Replace("@a1", good.GoodsName);
            temp = temp.Replace("@a2", good.GoodsEffect);
            temp = temp.Replace("@a3", good.GoodsPrice.ToString());
            temp = temp.Replace("@a4", "商品规格:" + good.GoodsNorms);
            temp = temp.Replace("@a5", "生产厂家:" + good.GoodsFactory);
            temp = temp.Replace("@a6", "库存状态: " + good.GoodsStock);
            temp = temp.Replace("@a7", "../Images/product_img/" + good.GoodsPicture);
            if (context.Session["users_id"] != null)
            {
                temp = temp.Replace("@user_name", context.Session["user_name"].ToString());
            }
            else
            {
                temp = temp.Replace("@user_name", "游客");
            }
            context.Response.Write(temp);
        }
Пример #4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            if (context.Session["id"] != null)
            {
                List <GoodModel> goodsList = new List <GoodModel>();
                if (context.Request.Form["name"] != null)
                {
                    goodsList = GoodsBLL.GetGoodsListBySearch(context.Request.Form["name"].ToString());
                }
                else
                {
                    goodsList = GoodsBLL.GetGoodsList2();
                }

                //读取模板
                string temp = File.ReadAllText(context.Server.MapPath("admin_product.html"));
                //删除文本
                //string deleteText = "'确认要删除{1}的商品?'";
                StringBuilder sb = new StringBuilder();
                foreach (GoodModel item in goodsList)
                {
                    sb.AppendFormat(@"<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td><a href='DeleteGoods.ashx?goods_id={0}' class='btn btn-danger'>删除</a><a href='SaveGoods.ashx?goods_id={0}' class='btn btn-primary'>修改</a></td></tr>", item.GoodsId, item.GoodsName, item.GoodsPrice + "元", item.GoodsStock + "件");
                }
                temp = temp.Replace("@content", sb.ToString());
                temp = temp.Replace("@admin", context.Session["admin_name"].ToString());
                context.Response.Write(temp);
            }
            else
            {
                context.Response.Redirect("~/admin_login.html");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string action = context.Request.Params["action"];

            try
            {
                DriveMgr.Model.User userFromCookie = DriveMgr.Common.UserHelper.GetUser(context);   //获取cookie里的用户对象
                userOperateLog          = new Model.UserOperateLog();
                userOperateLog.UserIp   = context.Request.UserHostAddress;
                userOperateLog.UserName = userFromCookie.UserId;
                switch (action)
                {
                case "search":
                    SearchEnterStoreHouseDetails(context);
                    break;

                case "searchEnterStoreHouseDetails":
                    SearchEnterDetailsByID(context);
                    break;

                case "delete":
                    DelEnterStoreHouseDetails(userFromCookie, context);
                    break;

                case "getEnterStoreHouseDT":
                    EnterStoreHouseBLL enterStoreHouseBLL = new EnterStoreHouseBLL();
                    context.Response.Write(enterStoreHouseBLL.GetEnterStoreHouseDT());
                    break;

                case "getGoodsCategoryDT":
                    GoodsCategoryBLL goodsCategoryBLL = new GoodsCategoryBLL();
                    context.Response.Write(goodsCategoryBLL.GetGoodsCategoryDT());
                    break;

                case "getGoodsDT":
                    GoodsBLL goodsBLL = new GoodsBLL();
                    context.Response.Write(goodsBLL.GetGoodsDT());
                    break;

                case "add":
                    AddEnterStoreHouseDetails(userFromCookie, context);
                    break;

                default:
                    context.Response.Write("{\"msg\":\"参数错误!\",\"success\":false}");
                    break;
                }
            }
            catch (Exception ex)
            {
                context.Response.Write("{\"msg\":\"" + DriveMgr.Common.JsonHelper.StringFilter(ex.Message) + "\",\"success\":false}");
                userOperateLog.OperateInfo = "用户功能异常";
                userOperateLog.IfSuccess   = false;
                userOperateLog.Description = DriveMgr.Common.JsonHelper.StringFilter(ex.Message);
                DriveMgr.BLL.UserOperateLog.InsertOperateInfo(userOperateLog);
            }
        }
Пример #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SetNav("商品管理");
     if (!Page.IsPostBack)
     {
         GoodsBLL.BindGoodsCat(ddlCat);
         BindData();
     }
 }
Пример #7
0
        public async Task <IActionResult> Index([FromServices] GoodsBLL service, [FromServices] TengoDbContext db, PageInfo pageInfo, List <int> categoryID = null, string keyword = null, string sortBy = null)
        {
            ViewBag.Category = await db.Category.ToListAsync();

            if (pageInfo.PageSize <= 0)
            {
                pageInfo.PageSize = 60;
            }
            ViewBag.Goods = await service.PageList(pageInfo, categoryID, keyword, sortBy);

            return(View());
        }
Пример #8
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        int goodsID = GetUrlInt("GoodsID");

        if (goodsID > 0)
        {
            MyGoods = GoodsBLL.SelectGoods(goodsID);
        }

        BindBuyNum();
    }
Пример #9
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string effectId = context.Request.QueryString["effect"];

            int pageSize = 8;
            int pageIndex;

            if (!int.TryParse(context.Request.QueryString["pageIndex"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageCount = GoodsBLL.GetGoodsPageCount(pageSize);

            pageIndex = pageIndex < 1 ? 1 : pageIndex;
            pageIndex = pageIndex > pageCount ? pageCount : pageIndex;
            List <GoodModel> GoodsList = GoodsBLL.GetGoodsList(pageIndex, pageSize);

            //string sqlText = GoodsBLL.getPaginationSql(0, pageSize, "goods", "*", "Goods_is_delete = 0", "goods_id");



            string        temp = File.ReadAllText(context.Server.MapPath("drugstore_all.html"));
            StringBuilder sb   = new StringBuilder();


            if (GoodsList == null)
            {
                temp = temp.Replace("@content", "该类型的商品还未上架,敬请期待.");
            }
            else
            {
                foreach (GoodModel item in GoodsList)
                {
                    sb.AppendFormat(@"<div class='col-lg-3' ><div class='thumbnail'><img src='{4}' style='height: 300px' alt='...'><div class='caption'><h3>{0}</h3><p>{1}元</p><p>总销量:{2}</p><p><a href='ProcessDrugDetails.ashx?goods_id={3}' class='btn btn-primary' role='button'>查看详情</a> <a href='../ShopCartInfo/ProcessAddCart.ashx?goods_id={3}' class='btn btn-default' role='button'>加入购物车</a></p></div></div></div>", item.GoodsName, item.GoodsPrice, item.GoodsSalesVolume, item.GoodsId, "../Images/product_img/" + item.GoodsPicture);
                }
            }

            temp = temp.Replace("@page", PageBarHelper.GetPageBar(pageIndex, pageCount));
            temp = temp.Replace("@content", sb.ToString());
            if (context.Session["users_id"] != null)
            {
                temp = temp.Replace("@user_name", context.Session["user_name"].ToString());
            }
            else
            {
                temp = temp.Replace("@user_name", "游客");
            }

            context.Response.Write(temp);
        }
Пример #10
0
    protected void BindModel()
    {
        var model = GoodsBLL.SelectGoods(GetGoodsID());

        if (model != null)
        {
            tbName.Text          = model.Name;
            ddlCat.SelectedValue = model.CatID.ToString();
            tbNum.Text           = model.Num.ToString();
            tbPoints.Text        = model.Points.ToString();
            tbRemarks.Text       = model.Remarks.ToString();
            tbCoverPath.Text     = model.CoverPath;
        }
    }
Пример #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentGoods = GoodsBLL.SelectGoods(GetUrlInt("id"));
        if (CurrentGoods == null || CurrentGoods.IsOut == 1)
        {
            MessageBox.Show("该商品不存在或已下架!", true);
        }

        ddlNum.Items.Clear();
        for (int i = 1; i <= CurrentGoods.Num; i++)
        {
            ddlNum.Items.Add(i.ToString());
        }
    }
Пример #12
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            if (context.Session["id"] != null)
            {
                string temp = File.ReadAllText(context.Server.MapPath("drugstore_admin_order.html"));
                if (context.Request.Form["goods_number"] != null)
                {
                    int i = OrderBLL.SendOrder(context.Request.Form["goods_number"].ToString());
                }

                List <OrdersModel> orderList = new List <OrdersModel>();
                if (context.Request.Form["name"] == null)
                {
                    orderList = OrderBLL.GetOrderByIsend();
                }
                else
                {
                    orderList = OrderBLL.GetOrderByName(context.Request.Form["name"].ToString());
                }

                StringBuilder sb = new StringBuilder();
                if (orderList != null)
                {
                    foreach (OrdersModel item in orderList)
                    {
                        sb.AppendFormat("<div class='panel panel-default'><div class='panel-heading'><b>{0}</b>订单号: <span>{1}</span> <span class='pull-right'>是否发货:{5}</span><span class='pull-right'>买家ID:{2}</span><span class='pull-right'>&nbsp;</span><span class='pull-right'>手机:{3}</span><span class='pull-right'>&nbsp;</span><span class='pull-right'>{4}</span> </div><table class='table table-bordered'><thead><tr><td>#</td><td>药品名</td><td>治疗症状</td><td>数量</td></tr></thead><tbody>", item.Ordertime, item.Ordernumber, item.Orderusersid.ToString(), item.Orderphone, item.Orderadress, item.OrderIssend);
                        List <GoodsorderModel> dt1 = GoodsOrderBLL.GetGoodsOrderListById(item.Orderid);
                        foreach (GoodsorderModel item1 in dt1)
                        {
                            GoodModel goods = GoodsBLL.GetAGoodDetail(item1.Gdod_goods_id);
                            //dt2.Rows[0].item[""]
                            sb.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td></tr>", goods.GoodsId, goods.GoodsName, goods.GoodsEffect, item1.Gdod_order_count);
                        }
                        sb.AppendFormat("</tbody></table></div> ");
                    }
                }



                temp = temp.Replace("@admin", context.Session["admin_name"].ToString());
                temp = temp.Replace("@content", sb.ToString());
                context.Response.Write(temp);
            }
            else
            {
                context.Response.Redirect("~/admin_login.html");
            }
        }
Пример #13
0
        public MResult <ItemGoodsDetails> GetGoodsInfo(string sid, string token, string guid, string user_id, string uid, string gid)
        {
            var result = new MResult <ItemGoodsDetails>(true);

            try
            {
                var iGid = MCvHelper.To <int>(gid);
                result = GoodsBLL.GetGoodsInfo(base.SystemType.ToString(), base.Uid, (int)base.SystemType, iGid);
            }
            catch (Exception ex)
            {
                result.status = MResultStatus.ExceptionError;
                result.msg    = "处理数据出错!";
            }
            return(result);
        }
Пример #14
0
        public MResult <List <ItemGoodsCategory> > GetGoodsCategoryList(string sid, string token, string guid, string user_id,
                                                                        string uid)
        {
            var result = new MResult <List <ItemGoodsCategory> >();

            try
            {
                result = GoodsBLL.GetGoodsCategoryList(SystemType);
            }
            catch (Exception ex)
            {
                result.status = MResultStatus.ExceptionError;
                result.msg    = "处理数据出错!";
            }

            return(result);
        }
Пример #15
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string effectId = context.Request.QueryString["effect"];

            List <GoodModel> goodsList = new List <GoodModel>();

            if (effectId != null)
            {
                goodsList = GoodsBLL.GetGoodsListByEffectId(effectId);
            }
            else if (context.Request.Form["goods_name"] != null)
            {
                goodsList = GoodsBLL.GetGoodsListBySearch(context.Request.Form["goods_name"].ToString());
            }


            string        temp = File.ReadAllText(context.Server.MapPath("drugstore_search.html"));
            StringBuilder sb   = new StringBuilder();

            if (goodsList == null)
            {
                temp = temp.Replace("@content", "该类型的商品还未上架,敬请期待.");
            }
            else
            {
                foreach (GoodModel item in goodsList)
                {
                    sb.AppendFormat(@"<div class='col-lg-3' ><div class='thumbnail'><img src='{4}' style='height: 300px' alt='...'><div class='caption'><h3>{0}</h3><p>{1}元</p><p>总销量:{2}</p><p><a href='ProcessDrugDetails.ashx?goods_id={3}' class='btn btn-primary' role='button'>查看详情</a> <a href='../ShopCartInfo/ProcessAddCart.ashx?goods_id={3}' class='btn btn-default' role='button'>加入购物车</a></p></div></div></div>", item.GoodsName, item.GoodsPrice, item.GoodsSalesVolume, item.GoodsId, "../Images/product_img/" + item.GoodsPicture);
                }
            }



            temp = temp.Replace("@content", sb.ToString());
            if (context.Session["users_id"] != null)
            {
                temp = temp.Replace("@user_name", context.Session["user_name"].ToString());
            }
            else
            {
                temp = temp.Replace("@user_name", "游客");
            }

            context.Response.Write(temp);
        }
Пример #16
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string temp = File.ReadAllText(context.Server.MapPath("drugstore_index.html"));



            List <GoodModel> list1 = GoodsBLL.GetTop5SaleGoods();
            List <GoodModel> list2 = GoodsBLL.GetTop5NewGoods();

            StringBuilder         sb1           = new StringBuilder();
            StringBuilder         sb2           = new StringBuilder();
            StringBuilder         sb3           = new StringBuilder();
            List <GoodsTypeModel> goodsTypeList = GoodsTypeBLL.GetGoodsTypeList();
            int count = 1;

            foreach (GoodModel item in list1)
            {
                sb1.AppendFormat(@"<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>", count, item.GoodsName, item.GoodsEffect);
                count++;
            }
            count = 1;
            foreach (GoodModel item in list2)
            {
                sb2.AppendFormat(@"<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>", count, item.GoodsName, item.GoodsEffect);
                count++;
            }
            foreach (GoodsTypeModel item in goodsTypeList)
            {
                sb3.AppendFormat("<a href='drugstore_search.ashx?effect={0}' class='list-group-item'>{1}</a>", item.GoodsTypeid, item.GoodsTypename);
            }
            temp = temp.Replace("@content1", sb1.ToString());
            temp = temp.Replace("@content2", sb2.ToString());
            temp = temp.Replace("@goods_type", sb3.ToString());
            if (context.Session["users_id"] != null)
            {
                temp = temp.Replace("@user_name", context.Session["user_name"].ToString());
            }
            else
            {
                temp = temp.Replace("@user_name", "游客");
            }

            context.Response.Write(temp);
        }
Пример #17
0
        /// <summary>
        /// 获取购物车商品列表 筛选 没有删除的商品,和 图片路径已经被格式化
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="guid">用户全局变量</param>
        /// <param name="channelId">渠道ID</param>
        /// <returns></returns>
        public static MResult <ShoppingCartResult> GetShoppingCartGoodsList(int userId, string guid, int channelId)
        {
            var result       = new MResult <ShoppingCartResult>(true);
            var shoppingCart = Factory.DALFactory.ShoppingCartDal();
            var goodsList    = shoppingCart.GetShoppingCartProductInfosByUserIDGuidChannelID(userId, guid, channelId);

            if (goodsList.Any())
            {
                result.info.shoppingcart_list = goodsList.FindAll(item => item.intIsDelete == 0);
                result.info.shoppingcart_list.ForEach(item =>
                {
                    item.vchPicURL = GoodsBLL.FormatProductPicUrl(item.vchPicURL);
                });
                result.info.shoppingcart_total = result.info.shoppingcart_list.Sum(item => item.intBuyCount * item.numSalePrice);
            }
            result.status = Core.Enums.MResultStatus.Success;
            return(result);
        }
Пример #18
0
        public async Task <IActionResult> Detail([FromServices] GoodsBLL service, int id = 0)
        {
            if (id <= 0)
            {
                return(new NotFoundResult());
            }
            var model = await service.Get(id);

            if (model == null || model.Status != 1)
            {
                return(new NotFoundResult());
            }

            ViewData.Model   = model;
            ViewBag.RecGoods = await service.GetRecList(5);

            return(View());
        }
Пример #19
0
        public MResultList <ProductImg> GetGoodsPicList(string sid, string token, string guid, string user_id, string uid, string gid)
        {
            var result = new MResultList <ProductImg>(true);

            try
            {
                var iGid = MCvHelper.To <int>(gid);
                result = MCacheManager.UseCached <MResultList <ProductImg> >(
                    string.Format("GetGoodsPicList{0}_{1}", sid, gid),
                    MCaching.CacheGroup.Goods,
                    () => GoodsBLL.GetGoodsPicList(sid, uid, iGid));
            }
            catch (Exception ex)
            {
                result.status = MResultStatus.ExceptionError;
                result.msg    = "处理图片列表数据出错!";
            }

            return(result);
        }
Пример #20
0
    protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string commandName = e.CommandName;
        int    id          = e.CommandArgument.ToArrowInt();

        if (e.CommandName == "UpdateData")
        {
            Response.Redirect("GoodsEdit.aspx?id=" + id + CreateReturnUrl("&"));
        }
        else if (e.CommandName == "SetOut")
        {
            //下架
            GoodsBLL.ChangeGoodsStatus(id, 1);
        }
        else if (e.CommandName == "Restore")
        {
            //上架
            GoodsBLL.ChangeGoodsStatus(id, 0);
        }
        BindData();
        MessageBox.Show("操作成功!");
    }
Пример #21
0
        public ActionResult GetProductTypeList(int id = 0, string KeyWord = "")
        {
            int    count    = 0;
            string sql      = "SELECT [id] ,[code] ,[name],[ParentId],[AddTime] FROM [" + DBName + "].[dbo].[tb_ProductType] ";
            string strWhere = " Where 1=1";

            if (KeyWord != "")
            {
                strWhere += " and ( id in ( select id from  [" + DBName + "].[dbo].[tb_ProductType] where code like '%" + KeyWord + "%' or name like '%" + KeyWord + "%' ) ";
                strWhere += "  or id in ( select ParentId from  [" + DBName + "].[dbo].[tb_ProductType] where code like '%" + KeyWord + "%' or name like '%" + KeyWord + "%' ) ) ";
            }
            //sql = sql + strWhere;
            //DataSet ds = DataPageHelper.GetDataPage(DataPageHelper.GetPageSql(sql, 1, 10000, "id desc"), out count);

            //List<MenuPage> list = TBToList<MenuPage>.ConvertToList(ds.Tables[0]).ToList();
            ////List<tb_ProductType> list = ef.tb_ProductType.Where(p => p.MenuID > 0).ToList();
            //List<MenuPage> listJson = new List<MenuPage>();
            //foreach (tb_ProductType model in list.Where(p => p.ParentId == 0).OrderBy(p => p.id))
            //{
            //    MakeMenuJson(list, model, id);
            //    listJson.Add(model);
            //}


            //return Json(listJson, JsonRequestBehavior.AllowGet);

            GoodsBLL bn = new GoodsBLL();
            //string sql = @"select p.Uname,p.Sex,p.roleId,p.truename,p.UId from Users p order by UId desc";
            //string sql = @"select * ,(select top 1 truename from [dbo].Users where UId=m.UId) as truename, (select roleName from Role where roleId in(select top 1  roleId from Users where UId=m.UId)) as roelName  from .[dbo].Users m  where  " + strWhere;
            DataSet ds = bn.GetMenu();
            // DataSet ds = DataPageHelper.GetDataPage(DataPageHelper.GetPageSql(sql, 7, rows, "UId desc"), out count);
            List <MenuPage> list = TBToList <MenuPage> .ConvertToList(ds.Tables[0]).ToList();

            var grid = new EasyuiDataGrid <List <MenuPage> >();

            grid.total = count;
            grid.rows  = list;
            return(Json(grid, JsonRequestBehavior.AllowGet));
        }
Пример #22
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            if (context.Session["id"] != null)
            {
                int    id   = context.Request.QueryString["goods_id"] == null ? 0 : Int32.Parse(context.Request.QueryString["goods_id"]);
                string temp = File.ReadAllText(context.Server.MapPath("admin_product_save.html"));

                GoodModel good = GoodsBLL.GetAGoodDetail(id);
                temp = temp.Replace("@Goods_name", good.GoodsName);
                temp = temp.Replace("@Goods_effect", good.GoodsEffect);
                temp = temp.Replace("@Goods_price", good.GoodsPrice.ToString());
                temp = temp.Replace("@Goods_norms", good.GoodsNorms.ToString());
                temp = temp.Replace("@Goods_factory", good.GoodsFactory.ToString());
                temp = temp.Replace("@Goods_stock", good.GoodsStock.ToString());
                temp = temp.Replace("@Goods_id", id.ToString());

                List <GoodsTypeModel> goodsType = GoodsTypeBLL.GetGoodsTypeList();
                StringBuilder         sb        = new StringBuilder();
                string selectedHtml             = "";
                foreach (GoodsTypeModel item in goodsType)
                {
                    if (good.GoodsGoodsType == item.GoodsTypeid)
                    {
                        selectedHtml = "selected = 'true'";
                    }
                    sb.AppendFormat(@"<option value='{0}' {2}>{1}</option>", item.GoodsTypeid, item.GoodsTypename, selectedHtml);
                    selectedHtml = "";
                }

                temp = temp.Replace("@admin", context.Session["admin_name"].ToString());
                temp = temp.Replace("@product_type", sb.ToString());
                context.Response.Write(temp);
            }
            else
            {
                context.Response.Redirect("~/admin_login.html");
            }
        }
        private void AddOutStoreHouseDetails(DriveMgr.Model.User userFromCookie, HttpContext context)
        {
            GoodsBLL         goodsBll         = new GoodsBLL();
            OutStoreHouseBLL outStoreHouseBLL = new OutStoreHouseBLL();

            string outDetailStr = "[" + context.Request.Params["outDetailStr"].Trim(',') + "]";
            JavaScriptSerializer             serializer = new JavaScriptSerializer();
            List <OutStoreHouseDetailsModel> outStoreHouseDetailsModelList = serializer.Deserialize <List <OutStoreHouseDetailsModel> >(outDetailStr);

            OutStoreHouseModel outStoreHouseAdd = new OutStoreHouseModel();

            outStoreHouseAdd.OutDate      = DateTime.Now;
            outStoreHouseAdd.HandlePerson = userFromCookie.UserId;
            outStoreHouseAdd.CreateDate   = DateTime.Now;
            outStoreHouseAdd.CreatePerson = userFromCookie.UserId;
            outStoreHouseAdd.UpdatePerson = userFromCookie.UserId;
            outStoreHouseAdd.UpdateDate   = DateTime.Now;
            outStoreHouseAdd.DeleteMark   = false;

            int outStoreHouseID = outStoreHouseBLL.AddOutStoreHouse(outStoreHouseAdd);

            foreach (OutStoreHouseDetailsModel model in outStoreHouseDetailsModelList)
            {
                OutStoreHouseDetailsModel newOutStoreHouseDetailsModel = new OutStoreHouseDetailsModel();
                newOutStoreHouseDetailsModel.GoodsID         = model.GoodsID;
                newOutStoreHouseDetailsModel.OutQuantity     = model.OutQuantity;
                newOutStoreHouseDetailsModel.OutStoreHouseID = outStoreHouseID;
                newOutStoreHouseDetailsModel.DeleteMark      = false;
                if (outStoreHouseDetailsBll.AddOutStoreHouseDetails(newOutStoreHouseDetailsModel))    //添加入库明细
                {
                    GoodsModel goodsModel = goodsBll.GetGoodsModel(newOutStoreHouseDetailsModel.GoodsID.Value);
                    goodsModel.RealQuantity -= newOutStoreHouseDetailsModel.OutQuantity;
                    goodsBll.UpdateGoods(goodsModel);    //更新物品数量
                }
            }

            context.Response.Write("{\"msg\":\"出库成功!\",\"success\":true}");
        }
        private void AddEnterStoreHouseDetails(DriveMgr.Model.User userFromCookie, HttpContext context)
        {
            GoodsBLL           goodsBll           = new GoodsBLL();
            EnterStoreHouseBLL enterStoreHouseBLL = new EnterStoreHouseBLL();

            string enterDetail = "[" + context.Request.Params["enterDetailStr"].Trim(',') + "]";
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            List <EnterStoreHouseDetailsModel> enterStoreHouseDetailsModelList = serializer.Deserialize <List <EnterStoreHouseDetailsModel> >(enterDetail);

            EnterStoreHouseModel enterStoreHouseAdd = new EnterStoreHouseModel();

            enterStoreHouseAdd.EnterDate    = DateTime.Now;
            enterStoreHouseAdd.HandlePerson = userFromCookie.UserId;
            enterStoreHouseAdd.CreateDate   = DateTime.Now;
            enterStoreHouseAdd.CreatePerson = userFromCookie.UserId;
            enterStoreHouseAdd.UpdatePerson = userFromCookie.UserId;
            enterStoreHouseAdd.UpdateDate   = DateTime.Now;
            enterStoreHouseAdd.DeleteMark   = false;

            int enterStoreHouseID = enterStoreHouseBLL.AddEnterStoreHouse(enterStoreHouseAdd);

            foreach (EnterStoreHouseDetailsModel model in enterStoreHouseDetailsModelList)
            {
                EnterStoreHouseDetailsModel newEnterStoreHouseDetailsModel = new EnterStoreHouseDetailsModel();
                newEnterStoreHouseDetailsModel.GoodsID           = model.GoodsID;
                newEnterStoreHouseDetailsModel.EnterQuantity     = model.EnterQuantity;
                newEnterStoreHouseDetailsModel.EnterStoreHouseID = enterStoreHouseID;
                newEnterStoreHouseDetailsModel.DeleteMark        = false;
                if (enterStoreHouseDetailsBll.AddEnterStoreHouseDetails(newEnterStoreHouseDetailsModel))    //添加入库明细
                {
                    GoodsModel goodsModel = goodsBll.GetGoodsModel(newEnterStoreHouseDetailsModel.GoodsID.Value);
                    goodsModel.RealQuantity += newEnterStoreHouseDetailsModel.EnterQuantity;
                    goodsBll.UpdateGoods(goodsModel);    //更新物品数量
                }
            }

            context.Response.Write("{\"msg\":\"入库成功!\",\"success\":true}");
        }
Пример #25
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            if (context.Session["id"] != null)
            {
                string         id      = context.Request.QueryString["Goods_id"];
                string         name    = context.Request.Form["name"];
                string         effect  = context.Request.Form["effect"];
                string         price   = context.Request.Form["price"];
                string         factory = context.Request.Form["factory"];
                string         stock   = context.Request.Form["stock"];
                string         norms   = context.Request.Form["norms"];
                string         type    = context.Request.Form["type"];
                HttpPostedFile imgFile = context.Request.Files[0];
                //Image img = new Bitmap(imgFile.InputStream);
                string newFileName = DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss") + System.IO.Path.GetExtension(imgFile.FileName).ToLower();
                imgFile.SaveAs(context.Server.MapPath("~/Images/product_img/" + newFileName));

                GoodModel good = new GoodModel(name, effect, Convert.ToDouble(price), norms, factory, Convert.ToInt32(stock), DateTime.Now, newFileName, Convert.ToInt32(type));
                good.GoodsId = Convert.ToInt32(id);
                int i = GoodsBLL.UpdateGood(good);

                if (i > 0)
                {
                    context.Response.Write("修改成功!");
                }
                else
                {
                    context.Response.Write("修改失败!");
                }
                context.Response.Write("<a href='ProcessAdminProduct.ashx'>回到商品首页</a>");
                //context.Response.Write(name + "/" + effect + "/" + price + "/" + factory + "/" + stock + "/"+newFileName);
            }
            else
            {
                context.Response.Redirect("~/admin_login.html");
            }
        }
Пример #26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (CurrentMember == null)
     {
         Response.Redirect("Login.aspx");
     }
     ShowTitle("兑换");
     if (!Page.IsPostBack)
     {
         var model = MemberBLL.Select(CurrentMember.UserName);
         if (model != null)
         {
             ltPoints.Text = (model.TotalPoints - model.UsedPoints).ToString();
         }
         var goods = GoodsBLL.SelectGoods(GetUrlInt("GoodsID"));
         if (goods != null)
         {
             ltGoodsName.Text  = goods.Name;
             ltPointsCost.Text = goods.Points.ToString();
             ltGoodsNum.Text   = goods.Num.ToString();
         }
     }
 }
Пример #27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (GetGoodsID() == 0)
        {
            SetNav("添加商品");
            ltTips.Text    = "在这里,您可以添加商品";
            btnSubmit.Text = "确定添加";
        }
        else
        {
            SetNav("修改商品");
            ltTips.Text    = "在这里,您可以修改商品";
            btnSubmit.Text = "确定修改";
            if (!Page.IsPostBack)
            {
                BindModel();
            }
        }

        if (!Page.IsPostBack)
        {
            GoodsBLL.BindGoodsCat(ddlCat, false);
        }
    }
Пример #28
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        string catName   = tbName.Text.Trim();
        int    sortOrder = tbSortOrder.Text.Trim().ToArrowInt();

        if (catName.ValidateIsNullOrEmpty("请输入分类名称!"))
        {
            return;
        }

        var model = new TMS.GoodsCatInfo();

        model.IsDel     = 0;
        model.Name      = catName;
        model.Remarks   = "";
        model.SortOrder = sortOrder;

        GoodsBLL.AddGoodsCat(model);

        tbName.Text      = "";
        tbSortOrder.Text = "";
        MessageBox.Show("添加成功!");
        BindData();
    }
Пример #29
0
        public MResultList <ItemGoods> GetGoodsList(string sid, string token, string guid, string user_id, string uid, string bid, string cid, string age, string price, string sort, string page, string size)
        {
            var result = new MResultList <ItemGoods>(true);

            try
            {
                var brandId    = MCvHelper.To <int>(bid);
                var categoryId = MCvHelper.To <int>(cid);
                var pIndex     = MCvHelper.To <int>(page);
                var pSize      = MCvHelper.To <int>(size);
                var channelId  = MCvHelper.To <SystemType>(sid);

                result = MCacheManager.UseCached <MResultList <ItemGoods> >(
                    string.Format("GetGoodsList_{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}_{8}", sid, user_id, bid, cid, age, price, sort, page, size),
                    MCaching.CacheGroup.Goods, () => GoodsBLL.GetGoodsList(sid, uid, (int)channelId, categoryId, brandId, age, price, sort, pSize, pIndex));
            }
            catch (Exception ex)
            {
                result.status = MResultStatus.ExceptionError;
                result.msg    = "处理数据出错!";
            }

            return(result);
        }
Пример #30
0
 public async Task <IActionResult> RecList([FromServices] GoodsBLL service, int take = 5)
 {
     return(Json(await service.GetRecList(take)));
 }