Exemplo n.º 1
0
        public lgk.Model.tb_TicketBack GetModel(string where)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 * from tb_TicketBack ");
            strSql.Append(" where " + where);

            lgk.Model.tb_TicketBack model = new lgk.Model.tb_TicketBack();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), null);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Type"] != null && ds.Tables[0].Rows[0]["Type"].ToString() != "")
                {
                    model.Type = ds.Tables[0].Rows[0]["Type"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderNo"] != null && ds.Tables[0].Rows[0]["OrderNo"].ToString() != "")
                {
                    model.OrderNo = ds.Tables[0].Rows[0]["OrderNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderStatus"] != null && ds.Tables[0].Rows[0]["OrderStatus"].ToString() != "")
                {
                    model.OrderStatus = ds.Tables[0].Rows[0]["OrderStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Reason"] != null && ds.Tables[0].Rows[0]["Reason"].ToString() != "")
                {
                    model.Reason = ds.Tables[0].Rows[0]["Reason"].ToString();
                }
                if (ds.Tables[0].Rows[0]["TicketNos"] != null && ds.Tables[0].Rows[0]["TicketNos"].ToString() != "")
                {
                    model.TicketNos = ds.Tables[0].Rows[0]["TicketNos"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Sign"] != null && ds.Tables[0].Rows[0]["Sign"].ToString() != "")
                {
                    model.Sign = ds.Tables[0].Rows[0]["Sign"].ToString();
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(lgk.Model.tb_TicketBack model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_TicketBack(");
            strSql.Append("Type,OrderNo,OrderStatus,Reason,TicketNos,FefundMoney,PoundageFee,Sign)");
            strSql.Append(" values (");
            strSql.Append("@Type,@OrderNo,@OrderStatus,@Reason,@TicketNos,@FefundMoney,@PoundageFee,@Sign)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Type",        SqlDbType.Int),
                new SqlParameter("@OrderNo",     SqlDbType.VarChar,  100),
                new SqlParameter("@OrderStatus", SqlDbType.VarChar),
                new SqlParameter("@Reason",      SqlDbType.VarChar,  100),
                new SqlParameter("@TicketNos",   SqlDbType.VarChar,  100),
                new SqlParameter("@FefundMoney", SqlDbType.VarChar,  100),
                new SqlParameter("@PoundageFee", SqlDbType.VarChar,  100),
                new SqlParameter("@Sign",        SqlDbType.VarChar, 100)
            };
            parameters[0].Value = model.Type;
            parameters[1].Value = model.OrderNo;
            parameters[2].Value = model.OrderStatus;
            parameters[3].Value = model.Reason;
            parameters[4].Value = model.TicketNos;
            parameters[5].Value = model.FefundMoney;
            parameters[6].Value = model.PoundageFee;
            parameters[7].Value = model.Sign;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(lgk.Model.tb_TicketBack model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_TicketBack set ");
            strSql.Append("Type=@Type,");
            strSql.Append("OrderStatus=@OrderStatus,");
            strSql.Append("Reason=@Reason,");
            strSql.Append("TicketNos=@TicketNos,");
            strSql.Append("Sign=@Sign");
            strSql.Append(" where OrderNo=@OrderNo");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Type",        SqlDbType.Int),

                new SqlParameter("@OrderStatus", SqlDbType.VarChar),
                new SqlParameter("@Reason",      SqlDbType.VarChar,  100),
                new SqlParameter("@TicketNos",   SqlDbType.VarChar,  100),
                new SqlParameter("@Sign",        SqlDbType.VarChar,  100),
                new SqlParameter("@OrderNo",     SqlDbType.VarChar, 100)
            };
            parameters[0].Value = model.Type;
            parameters[1].Value = model.OrderStatus;
            parameters[2].Value = model.Reason;
            parameters[3].Value = model.TicketNos;
            parameters[4].Value = model.Sign;
            parameters[5].Value = model.OrderNo;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(lgk.Model.tb_TicketBack model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(lgk.Model.tb_TicketBack model)
 {
     return(dal.Add(model));
 }
        public void ProcessRequest(HttpContext context)
        {
            string s = "\r\n" + "\r\n" + "\r\n" + "\r\n" + "记录时间" + DateTime.Now.ToString() + "\r\n";

            try
            {
                context.Response.ContentType = "text/plain";
                lgk.Model.tb_TicketBack Model = new lgk.Model.tb_TicketBack();
                if (context.Request["type"] == null)
                {
                    s = s + "没有回调\r\n";
                    context.Response.Write("没有回调数据");
                }
                else
                {
                    Model.Type = context.Request["type"];
                    if (Model.Type == "0")
                    {
                        Model.OrderNo     = context.Request["orderno"];
                        Model.OrderStatus = context.Request["orderstatus"];
                        Model.Reason      = context.Request["reason"];
                    }
                    else if (Model.Type == "1")
                    {
                        Model.OrderNo     = context.Request["orderno"];
                        Model.OrderStatus = context.Request["orderstatus"];
                        Model.TicketNos   = context.Request["ticketnos"];
                    }
                    else if (Model.Type == "3")
                    {
                        Model.FefundMoney = context.Request["fefundmoney"];
                        Model.PoundageFee = context.Request["poundagefee"];
                        Model.Reason      = context.Request["fefunstatemsg"];
                        Model.OrderStatus = context.Request["fefundstate"];
                        Model.OrderNo     = context.Request["fefundno"];
                    }
                    Model.Sign = context.Request["sign"];
                    s          = s + "接受内容信息:通知类型:" + Model.Type + ",订单号:" + Model.OrderNo + ",订单状态:" + Model.OrderStatus + ",返回结果集:" + Model.Reason + "\r\n";
                    if (Model != null)
                    {
                        lgk.Model.tb_TicketBack Modelreback = orderCallbll.GetModel(" OrderNo='" + Model.OrderNo + "'");
                        if (Modelreback == null)
                        {
                            if (orderCallbll.Add(Model) > 0)
                            {
                                lgk.Model.tb_TicketOrder order = orderBLL.GetModel("OrdeID='" + Model.OrderNo + "'");
                                if (order != null)
                                {
                                    if (orderBLL.UpdateStatus(Convert.ToInt32(Model.OrderStatus), 1, Model.OrderNo))
                                    {
                                        s = s + "更新订单状态成功,订单状态为:" + StateCode(Model.OrderStatus.ToString()) + "\r\n";
                                        //退票退款通知 返还金额到账户
                                        if (Model.Type == "3" || Model.Type == "0" || Model.OrderStatus != "3")
                                        {
                                            lgk.Model.tb_user model = userBLL.GetModel(order.UserID);
                                            model.Emoney += Convert.ToDecimal(order.PayPrice);
                                            userBLL.Update(model);
                                            string bramk = "退票退款:" + order.PayPrice;
                                            ac.AddJournal(Convert.ToInt32(order.UserID), bramk, Convert.ToDecimal(order.PayPrice), 0, model.Emoney, 1);
                                            bllaccount.UpdateBanlcen("TicketAccount", Convert.ToDecimal(order.PayPrice), 2);
                                        }
                                        context.Response.Write("SUCCESS");
                                    }
                                }
                                else
                                {
                                    s = s + "订单不存在\r\n";
                                    context.Response.Write("订单不存在");
                                }
                            }
                        }
                        else
                        {
                            if (orderCallbll.Update(Model))
                            {
                                lgk.Model.tb_TicketOrder order = orderBLL.GetModel("OrdeID='" + Model.OrderNo + "'");
                                if (order != null)
                                {
                                    if (orderBLL.UpdateStatus(Convert.ToInt32(Model.OrderStatus), 1, Model.OrderNo))
                                    {
                                        s = s + "更新订单状态成功,订单状态为:" + StateCode(Model.OrderStatus.ToString()) + "\r\n";
                                        //退票退款通知 返还金额到账户
                                        if (Model.Type == "3" || Model.Type == "0" || Model.OrderStatus != "3")
                                        {
                                            lgk.Model.tb_user model = userBLL.GetModel(order.UserID);
                                            model.Emoney += Convert.ToDecimal(Model.FefundMoney);
                                            userBLL.Update(model);
                                            string bramk = "退票退款";
                                            ac.AddJournal(Convert.ToInt32(order.UserID), bramk, Convert.ToDecimal(Model.FefundMoney), 0, model.Emoney, 1);
                                            bllaccount.UpdateBanlcen("TicketAccount", Convert.ToDecimal(Model.FefundMoney), 2);
                                        }
                                    }
                                }
                                else
                                {
                                    s = s + "订单不存在\r\n";
                                    context.Response.Write("订单不存在");
                                }
                            }
                            s = s + "重复推送\r\n";
                            context.Response.Write("SUCCESS");
                        }
                    }
                    else
                    {
                        s = s + "回调数据为空\r\n";
                        context.Response.Write("没有回调数据");
                    }
                }
            }
            catch (Exception ex)
            {
                s = s + "回调异常,错误信息" + ex.Message + "\r\n";
                context.Response.Write("回调异常,错误信息" + ex.Message);
            }
            System.IO.File.AppendAllText(context.Server.MapPath("~/log/RequesTicketBacklog/RequestBacklog" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + ".txt"), s);
        }