Example #1
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();

            try
            {
                switch (AjaxType)
                {
                case "GETPAYMENT":
                    string startDate = "", endDate = "";
                    if (context.Request.Form["Date1"] != null && context.Request.Form["Date1"].ToString().Trim() != string.Empty)
                    {
                        startDate = context.Request.Form["Date1"].ToString().Trim();
                    }
                    if (context.Request.Form["Date2"] != null && context.Request.Form["Date2"].ToString().Trim() != string.Empty)
                    {
                        endDate  = context.Request.Form["Date2"].ToString().Trim();
                        endDate += " 23:59";
                    }

                    DateTime startTime = Convert.ToDateTime(startDate);
                    DateTime endTime   = Convert.ToDateTime(endDate);

                    List <Olb_PaymentRecord> list = PaymentManageService.GetInstance().GetPaymentRecord(startTime, endTime, base.loginOperator.Account);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <Olb_PaymentRecord>(list, list.Count)
                    };
                    break;

                case "GETGASBILL":
                    string companyId = "", userId = "", month = "";
                    if (context.Request.Form["month"] != null && context.Request.Form["month"].ToString().Trim() != string.Empty)
                    {
                        month = context.Request.Form["month"].ToString().Trim();
                    }
                    if (context.Request.Form["companyId"] != null && context.Request.Form["companyId"].ToString().Trim() != string.Empty)
                    {
                        companyId = context.Request.Form["companyId"].ToString().Trim();
                    }
                    if (context.Request.Form["userId"] != null && context.Request.Form["userId"].ToString().Trim() != string.Empty)
                    {
                        userId = context.Request.Form["userId"].ToString().Trim();
                    }

                    List <GasFeeBill> listBill = new List <GasFeeBill>();
                    GasFeeBill        bill     = IotMService.GetInstance().GetGasUserBill(userId, companyId, month);
                    if (bill == null)
                    {
                        jsonMessage = new Message()
                        {
                            Result     = false,
                            TxtMessage = "本月还未产生账单"
                        };
                    }
                    else
                    {
                        listBill.Add(bill);
                        jsonMessage = new Message()
                        {
                            Result     = true,
                            TxtMessage = JSon.ListToJson <GasFeeBill>(listBill, listBill.Count)
                        };
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Example #2
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();

            try
            {
                switch (AjaxType)
                {
                case "GETGASUSERLIST":
                    List <GasUser> userlist = GasUserManageService.GetInstance().GetGasUserList(base.loginOperator.Account);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <GasUser>(userlist, userlist.Count)
                    };
                    break;

                case "GETCOMPANY":
                    List <Company> list = IotMService.GetInstance().GetCompanyList();
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <Company>(list, list.Count)
                    };
                    break;

                case "GETGASUSER":
                    string companyId = "", userId = "";
                    if (context.Request.Form["companyId"] != null && context.Request.Form["companyId"].ToString().Trim() != string.Empty)
                    {
                        companyId = context.Request.Form["companyId"].ToString().Trim();
                    }
                    if (context.Request.Form["userId"] != null && context.Request.Form["userId"].ToString().Trim() != string.Empty)
                    {
                        userId = context.Request.Form["userId"].ToString().Trim();
                    }
                    if (companyId != "" && userId != "")
                    {
                        GasUser gasUser = IotMService.GetInstance().GetGasUserByUserId(userId, companyId);
                        jsonMessage = new Message()
                        {
                            Result     = true,
                            TxtMessage = JSon.TToJson <GasUser>(gasUser)
                        };
                    }
                    break;

                case "ADDGASUSER":
                    companyId = ""; userId = "";
                    if (context.Request.Form["companyId"] != null && context.Request.Form["companyId"].ToString().Trim() != string.Empty)
                    {
                        companyId = context.Request.Form["companyId"].ToString().Trim();
                    }
                    if (context.Request.Form["userId"] != null && context.Request.Form["userId"].ToString().Trim() != string.Empty)
                    {
                        userId = context.Request.Form["userId"].ToString().Trim();
                    }
                    if (companyId != "" && userId != "")
                    {
                        jsonMessage = GasUserManageService.GetInstance().AddGasUser(base.loginOperator.Account, userId, companyId);
                    }
                    break;

                case "DELETEGASUSER":
                    companyId = ""; userId = "";
                    if (context.Request.Form["Company"] != null && context.Request.Form["Company"].ToString().Trim() != string.Empty)
                    {
                        companyId = context.Request.Form["Company"].ToString().Trim();
                    }
                    if (context.Request.Form["UserID"] != null && context.Request.Form["UserID"].ToString().Trim() != string.Empty)
                    {
                        userId = context.Request.Form["UserID"].ToString().Trim();
                    }
                    if (companyId != "" && userId != "")
                    {
                        jsonMessage = GasUserManageService.GetInstance().RemoveGasUser(base.loginOperator.Account, userId, companyId);
                    }
                    break;

                case "CHARGE":
                    companyId = ""; userId = ""; decimal money = 0;
                    if (context.Request.Form["companyId"] != null && context.Request.Form["companyId"].ToString().Trim() != string.Empty)
                    {
                        companyId = context.Request.Form["companyId"].ToString().Trim();
                    }
                    if (context.Request.Form["userId"] != null && context.Request.Form["userId"].ToString().Trim() != string.Empty)
                    {
                        userId = context.Request.Form["userId"].ToString().Trim();
                    }
                    if (context.Request.Form["money"] != null && context.Request.Form["money"].ToString().Trim() != string.Empty)
                    {
                        money = decimal.Parse(context.Request.Form["money"].ToString().Trim());
                    }
                    if (companyId == "" || userId == "" || money == 0)
                    {
                        break;
                    }
                    string result = IotMService.GetInstance().Charge(userId, companyId, money);
                    if (result == "")
                    {
                        GasUser           gasUser = IotMService.GetInstance().GetGasUserByUserId(userId, companyId);
                        Olb_PaymentRecord payMent = new Olb_PaymentRecord()
                        {
                            Account        = base.loginOperator.Account,
                            GasUserID      = userId,
                            PayMoney       = money,
                            PayTime        = DateTime.Now,
                            Balance        = gasUser.Balance,
                            GasUserAddress = gasUser.Address,
                            GasUserName    = gasUser.UserName
                        };
                        PaymentManageService.GetInstance().AddPaymentRecord(payMent);
                        jsonMessage = new Message()
                        {
                            Result = true, TxtMessage = "充值成功。"
                        };
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary <string, string> sPara = GetRequestGet();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify    = new Notify();
                bool   verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]);

                if (verifyResult)//验证成功
                {
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码


                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表

                    //商户订单号

                    string out_trade_no = Request.QueryString["out_trade_no"];

                    //支付宝交易号

                    string trade_no = Request.QueryString["trade_no"];

                    //交易状态
                    string trade_status = Request.QueryString["trade_status"];


                    if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS")
                    {
                        //判断该笔订单是否在商户网站中已经做过处理
                        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                        //如果有做过处理,不执行商户的业务程序


                        Olb_ChargeOrder order = ChargeOrderService.GetInstance().GetChargeOrderById(out_trade_no);


                        if (order != null)
                        {
                            string result = IotMService.GetInstance().Charge(order.GasUserID, order.CompanyID, (decimal)order.OrderMoney);

                            if (result == "")
                            {
                                GasUser           gasUser = IotMService.GetInstance().GetGasUserByUserId(order.GasUserID, order.CompanyID);
                                Olb_PaymentRecord payMent = new Olb_PaymentRecord()
                                {
                                    Account        = order.Account,
                                    GasUserID      = order.GasUserID,
                                    PayMoney       = order.OrderMoney,
                                    PayTime        = DateTime.Now,
                                    Balance        = gasUser.Balance,
                                    GasUserAddress = gasUser.Address,
                                    GasUserName    = gasUser.UserName
                                };
                                PaymentManageService.GetInstance().AddPaymentRecord(payMent);
                                //jsonMessage = new Message() { Result = true, TxtMessage = "充值成功。" };

                                Response.Redirect("../PayMentDetail.aspx");
                            }
                        }
                    }
                    else
                    {
                        Response.Write("trade_status=" + Request.QueryString["trade_status"]);
                    }

                    //打印页面
                    Response.Write("验证成功<br />");

                    //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                }
                else//验证失败
                {
                    Response.Write("验证失败");
                }
            }
            else
            {
                Response.Write("无返回参数");
            }
        }