Exemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(lgk.Model.tb_OrderCallBack model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_OrderCallBack(");
            strSql.Append("OrderID,CheCi,FromStationName,FromStationCode,ToStationName,ToStationCode,TrainDate,UserOrderid,Orderamount,Ordernumber,Status,Msg,RefundMoney,Passengers)");
            strSql.Append(" values (");
            strSql.Append("@OrderID,@CheCi,@FromStationName,@FromStationCode,@ToStationName,@ToStationCode,@TrainDate,@UserOrderid,@Orderamount,@Ordernumber,@Status,@Msg,@RefundMoney,@Passengers)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderID",         SqlDbType.VarChar,   100),
                new SqlParameter("@CheCi",           SqlDbType.VarChar,   100),
                new SqlParameter("@FromStationName", SqlDbType.VarChar,   100),
                new SqlParameter("@FromStationCode", SqlDbType.VarChar,   100),
                new SqlParameter("@ToStationName",   SqlDbType.VarChar,   100),
                new SqlParameter("@ToStationCode",   SqlDbType.VarChar),
                new SqlParameter("@TrainDate",       SqlDbType.DateTime),
                new SqlParameter("@UserOrderid",     SqlDbType.VarChar),
                new SqlParameter("@Orderamount",     SqlDbType.Decimal),
                new SqlParameter("@Ordernumber",     SqlDbType.VarChar),
                new SqlParameter("@Status",          SqlDbType.Int),
                new SqlParameter("@Msg",             SqlDbType.VarChar),
                new SqlParameter("@RefundMoney",     SqlDbType.VarChar),
                new SqlParameter("@Passengers",      SqlDbType.VarChar)
            };
            parameters[0].Value  = model.OrderID;
            parameters[1].Value  = model.CheCi;
            parameters[2].Value  = model.FromStationName;
            parameters[3].Value  = model.FromStationCode;
            parameters[4].Value  = model.ToStationName;
            parameters[5].Value  = model.ToStationCode;
            parameters[6].Value  = model.TrainDate;
            parameters[7].Value  = model.UserOrderid;
            parameters[8].Value  = model.Orderamount;
            parameters[9].Value  = model.Ordernumber;
            parameters[10].Value = model.Status;
            parameters[11].Value = model.Msg;
            parameters[12].Value = model.RefundMoney;
            parameters[13].Value = model.Passengers;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 2
0
        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";
                string data = context.Request["data"];
                s = s + "接受内容信息:" + data + "\r\n";
                var emResult = JsonConvert.DeserializeObject <data>(data);
                if (emResult != null)
                {
                    lgk.Model.tb_OrderCallBack Modelreback = orderCallbll.GetModel(" OrderID='" + emResult.orderid + "'");
                    if (Modelreback == null)
                    {
                        lgk.Model.tb_OrderCallBack Model = new lgk.Model.tb_OrderCallBack();
                        Model.OrderID         = emResult.orderid.Trim();
                        Model.FromStationCode = emResult.from_station_code.Trim();
                        Model.FromStationName = emResult.from_station_name.Trim();
                        Model.CheCi           = emResult.checi.Trim();
                        Model.Msg             = emResult.msg.Trim();
                        if (string.IsNullOrEmpty(emResult.orderamount))
                        {
                            Model.Orderamount = 0;
                        }
                        else
                        {
                            Model.Orderamount = Convert.ToDecimal(emResult.orderamount.Trim());
                        }
                        if (string.IsNullOrEmpty(emResult.ordernumber))
                        {
                            Model.Ordernumber = "";
                        }
                        else
                        {
                            Model.Ordernumber = emResult.ordernumber.Trim();
                        }

                        Model.Passengers = "[";
                        for (int i = 0; i < emResult.passengers.Count; i++)
                        {
                            Model.Passengers += "{passengerid:" + emResult.passengers[i].passengerid + ",passengersename:" + emResult.passengers[i].passengersename + ",passportseno:" + emResult.passengers[i].passportseno + ",passporttypeseid:" + emResult.passengers[i].passporttypeseid + ",passporttypeseidname" + emResult.passengers[i].passporttypeseidname + ",piaotype:" + emResult.passengers[i].piaotype + ",piaotypename:" + emResult.passengers[i].piaotypename + ",price:" + emResult.passengers[i].price + ",zwcode:" + emResult.passengers[i].zwcode + ",zwname:" + emResult.passengers[i].zwname + "}";
                            if (i != emResult.passengers.Count - 1)
                            {
                                Model.Passengers += ",";
                            }
                        }
                        Model.Passengers += "]";
                        //emResult.passengers = emResult.passengers;
                        Model.RefundMoney   = emResult.refund_money;
                        Model.Status        = Convert.ToInt32(emResult.status.Trim());
                        Model.ToStationCode = emResult.to_station_code.Trim();
                        Model.ToStationName = emResult.to_station_name.Trim();
                        Model.TrainDate     = Convert.ToDateTime(emResult.train_date.Trim());
                        Model.UserOrderid   = emResult.user_orderid;
                        if (orderCallbll.Add(Model) > 0)
                        {
                            lgk.Model.tb_TrainTicketsOrder order = orderBLL.GetModel("OrderID='" + Model.OrderID + "'");

                            if (order != null)
                            {
                                List <lgk.Model.tb_TrainTicketsOrderDetail> list = bllorderdeil.GetModelList("OrderID=" + order.ID);
                                order.State = Model.Status;
                                if (orderBLL.Update(order))
                                {
                                    for (int i = 0; i < emResult.passengers.Count; i++)
                                    {
                                        bllorderdeil.UpdateStatus(emResult.passengers[i].cxin, Convert.ToInt32(Model.Status), order.ID, Convert.ToInt32(emResult.passengers[i].passengerid));
                                    }
                                    //出票失败处理
                                    if (Model.Status == 5)
                                    {
                                        lgk.Model.tb_user model = userBLL.GetModel(order.UserID);
                                        model.BonusAccount += order.OrderPrice;
                                        userBLL.Update(model);
                                        string bramk = "出票失败" + order.OrderCode + ",返回云图:" + order.OrderPrice;
                                        JournalAdd(order.UserID, bramk, 1, order.OrderPrice);
                                        bllaccount.UpdateBanlcen("TrainAccount", order.OrderPrice + 3 * list.Count, 2);
                                    }
                                    s = s + "更新订单状态成功,订单状态为:" + StateCode(Model.Status) + "\r\n";
                                    context.Response.Write("success");
                                }
                            }
                            else
                            {
                                s = s + "订单不存在\r\n";
                                context.Response.Write("订单不存在");
                            }
                        }
                    }
                    else
                    {
                        Modelreback.Status = Convert.ToInt32(emResult.status);
                        if (orderCallbll.Update(Modelreback))
                        {
                            lgk.Model.tb_TrainTicketsOrder order             = orderBLL.GetModel("OrderID='" + Modelreback.OrderID + "'");
                            List <lgk.Model.tb_TrainTicketsOrderDetail> list = bllorderdeil.GetModelList("OrderID=" + order.ID);
                            if (order != null)
                            {
                                order.State = Convert.ToInt32(emResult.status);
                                if (orderBLL.Update(order))
                                {
                                    for (int i = 0; i < emResult.passengers.Count; i++)
                                    {
                                        bllorderdeil.UpdateStatus(emResult.passengers[i].cxin, Convert.ToInt32(Modelreback.Status), order.ID, Convert.ToInt32(emResult.passengers[i].passengerid));
                                    }
                                    //出票失败处理
                                    if (Modelreback.Status == 5)
                                    {
                                        lgk.Model.tb_user model = userBLL.GetModel(order.UserID);
                                        model.BonusAccount += order.OrderPrice;
                                        userBLL.Update(model);
                                        string bramk = "出票失败" + order.OrderCode + ",返回云图:" + order.OrderPrice;
                                        JournalAdd(order.UserID, bramk, 1, order.OrderPrice);
                                        bllaccount.UpdateBanlcen("TrainAccount", order.OrderPrice + 3 * list.Count, 2);
                                    }
                                    s = s + "更新订单状态成功,订单状态为:" + StateCode(Modelreback.Status) + "\r\n";
                                    //context.Response.Write("success");
                                }
                            }
                        }
                        // 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/RequesTrainBacklog/RequestBacklog" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + ".txt"), s);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(lgk.Model.tb_OrderCallBack model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(lgk.Model.tb_OrderCallBack model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(lgk.Model.tb_OrderCallBack model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_OrderCallBack set ");
            strSql.Append("OrderID=@OrderID,");
            strSql.Append("CheCi=@CheCi,");
            strSql.Append("FromStationName=@FromStationName,");
            strSql.Append("FromStationCode=@FromStationCode,");
            strSql.Append("ToStationName=@ToStationName,");
            strSql.Append("ToStationCode=@ToStationCode,");
            strSql.Append("TrainDate=@TrainDate,");
            strSql.Append("UserOrderid=@UserOrderid,");
            strSql.Append("Orderamount=@Orderamount,");
            strSql.Append("Ordernumber=@Ordernumber,");
            strSql.Append("Status=@Status,");
            strSql.Append("Msg=@Msg,");
            strSql.Append("RefundMoney=@RefundMoney,");
            strSql.Append("Passengers=@Passengers");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderID",         SqlDbType.VarChar,   100),
                new SqlParameter("@CheCi",           SqlDbType.VarChar,   100),
                new SqlParameter("@FromStationName", SqlDbType.VarChar,   100),
                new SqlParameter("@FromStationCode", SqlDbType.VarChar,   100),
                new SqlParameter("@ToStationName",   SqlDbType.VarChar,   100),
                new SqlParameter("@ToStationCode",   SqlDbType.VarChar),
                new SqlParameter("@TrainDate",       SqlDbType.DateTime),
                new SqlParameter("@UserOrderid",     SqlDbType.VarChar),
                new SqlParameter("@Orderamount",     SqlDbType.Decimal),
                new SqlParameter("@Ordernumber",     SqlDbType.VarChar),
                new SqlParameter("@Status",          SqlDbType.Int),
                new SqlParameter("@Msg",             SqlDbType.VarChar),
                new SqlParameter("@RefundMoney",     SqlDbType.Decimal),
                new SqlParameter("@Passengers",      SqlDbType.VarChar),
                new SqlParameter("@ID",              SqlDbType.Int)
            };
            parameters[0].Value  = model.OrderID;
            parameters[1].Value  = model.CheCi;
            parameters[2].Value  = model.FromStationName;
            parameters[3].Value  = model.FromStationCode;
            parameters[4].Value  = model.ToStationName;
            parameters[5].Value  = model.ToStationCode;
            parameters[6].Value  = model.TrainDate;
            parameters[7].Value  = model.UserOrderid;
            parameters[8].Value  = model.Orderamount;
            parameters[9].Value  = model.Ordernumber;
            parameters[10].Value = model.Status;
            parameters[11].Value = model.Msg;
            parameters[12].Value = model.RefundMoney;
            parameters[13].Value = model.Passengers;
            parameters[14].Value = model.ID;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 6
0
        public lgk.Model.tb_OrderCallBack GetModel(string where)
        {
            StringBuilder strSql = new StringBuilder();

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

            lgk.Model.tb_OrderCallBack model = new lgk.Model.tb_OrderCallBack();
            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]["OrderID"] != null && ds.Tables[0].Rows[0]["OrderID"].ToString() != "")
                {
                    model.OrderID = ds.Tables[0].Rows[0]["OrderID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["CheCi"] != null && ds.Tables[0].Rows[0]["CheCi"].ToString() != "")
                {
                    model.CheCi = ds.Tables[0].Rows[0]["CheCi"].ToString();
                }
                if (ds.Tables[0].Rows[0]["FromStationName"] != null && ds.Tables[0].Rows[0]["FromStationName"].ToString() != "")
                {
                    model.FromStationName = ds.Tables[0].Rows[0]["FromStationName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["FromStationCode"] != null && ds.Tables[0].Rows[0]["FromStationCode"].ToString() != "")
                {
                    model.FromStationCode = ds.Tables[0].Rows[0]["FromStationCode"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ToStationName"] != null && ds.Tables[0].Rows[0]["ToStationName"].ToString() != "")
                {
                    model.ToStationName = ds.Tables[0].Rows[0]["ToStationName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ToStationCode"] != null && ds.Tables[0].Rows[0]["ToStationCode"].ToString() != "")
                {
                    model.ToStationCode = ds.Tables[0].Rows[0]["ToStationCode"].ToString();
                }
                if (ds.Tables[0].Rows[0]["TrainDate"] != null && ds.Tables[0].Rows[0]["TrainDate"].ToString() != "")
                {
                    model.TrainDate = Convert.ToDateTime(ds.Tables[0].Rows[0]["TrainDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UserOrderid"] != null && ds.Tables[0].Rows[0]["UserOrderid"].ToString() != "")
                {
                    model.UserOrderid = ds.Tables[0].Rows[0]["UserOrderid"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Orderamount"] != null && ds.Tables[0].Rows[0]["Orderamount"].ToString() != "")
                {
                    model.Orderamount = Convert.ToDecimal(ds.Tables[0].Rows[0]["Orderamount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Ordernumber"] != null && ds.Tables[0].Rows[0]["Ordernumber"].ToString() != "")
                {
                    model.Ordernumber = ds.Tables[0].Rows[0]["Ordernumber"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Status"] != null && ds.Tables[0].Rows[0]["Status"].ToString() != "")
                {
                    model.Status = Convert.ToInt32(ds.Tables[0].Rows[0]["Status"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Msg"] != null && ds.Tables[0].Rows[0]["Msg"].ToString() != "")
                {
                    model.Msg = ds.Tables[0].Rows[0]["Msg"].ToString();
                }
                if (ds.Tables[0].Rows[0]["RefundMoney"] != null && ds.Tables[0].Rows[0]["RefundMoney"].ToString() != "")
                {
                    model.RefundMoney = ds.Tables[0].Rows[0]["RefundMoney"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Passengers"] != null && ds.Tables[0].Rows[0]["Passengers"].ToString() != "")
                {
                    model.Passengers = ds.Tables[0].Rows[0]["Passengers"].ToString();
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }