Beispiel #1
0
        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":
                    SearchOutStoreHouse(context);
                    break;

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

                case "getPriceConfigDT":
                    PriceConfigBLL priceConfigBll = new PriceConfigBLL();
                    context.Response.Write(priceConfigBll.GetPriceConfigDT(1));
                    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);
            }
        }
        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":
                    SearchSiteRental(context);
                    break;

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

                case "edit":
                    EditSiteRental(userFromCookie, context);
                    break;

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

                case "getPriceConfigDT":
                    PriceConfigBLL priceConfigBll = new PriceConfigBLL();
                    context.Response.Write(priceConfigBll.GetPriceConfigDT(1));
                    break;

                case "setTotalPrice":
                    string priceConfigID = context.Request.Params["priceConfigID"] ?? "";
                    string longer        = context.Request.Params["longer"] ?? "";
                    if (priceConfigID != string.Empty)
                    {
                        PriceConfigBLL         configBll = new PriceConfigBLL();
                        Model.PriceConfigModel model     = configBll.GetPriceConfigModel(Int32.Parse(priceConfigID));
                        try
                        {
                            decimal aaa = model.Price.Value * decimal.Parse(longer);
                            context.Response.Write("{\"totalPrice\":" + model.Price.Value * decimal.Parse(longer) + "}");
                        }
                        catch (System.Exception ex)
                        {
                            context.Response.Write("{\"totalPrice\":\"0\"}");
                        }
                    }
                    else
                    {
                        context.Response.Write("{\"totalPrice\":\"0\"}");
                    }
                    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);
            }
        }