Пример #1
0
        public static HotelOrder GetOrderInfo(string orderID, string weixinid, string userweixinID)
        {
            string sql = @"select top 1 a.id as did,a.OrderNO,a.RatePlanID,a.Ordertime,a.state,a.RatePlanName,a.UserID,a.RoomID,a.RoomName,a.yRoomNum,a.yinDate,a.youtDate,a.lastTime,a.UserName,a.LinkTel,a.yPriceStr,a.ySumPrice,a.sSumPrice,isnull(a.jifen,0) as jf,a.HotelID,a.NetPrice,a.realprice,a.UserWeiXinID,s.statename,Hotel.Tel,a.PayType,isMeeting from HotelOrder a left join hotelorderstate s on a.state=s.id left join Hotel on Hotel.id=a.HotelID where   a.weixinID=@weixinID and a.userweixinID=@userweixinID and a.id=@orderid";

            System.Data.DataTable dt = HotelCloud.SqlServer.SQLHelper.Get_DataTable(sql, HotelCloud.SqlServer.SQLHelper.GetCon(), new Dictionary <string, HotelCloud.SqlServer.DBParam> {
                { "orderid", new HotelCloud.SqlServer.DBParam {
                      ParamValue = orderID
                  } },
                { "weixinID", new HotelCloud.SqlServer.DBParam {
                      ParamValue = weixinid
                  } },
                { "userweixinID", new HotelCloud.SqlServer.DBParam {
                      ParamValue = userweixinID
                  } }
            });
            System.Data.DataRow dr    = dt.Rows[0];
            HotelOrder          order = new HotelOrder();

            order.ID           = Convert.ToInt32(dr["did"].ToString());
            order.OrderNO      = dr["OrderNO"].ToString();
            order.OrderTime    = Convert.ToDateTime(dr["Ordertime"].ToString());
            order.State        = Convert.ToInt32(dr["state"].ToString());
            order.UserID       = Convert.ToInt32(dr["UserID"].ToString());
            order.RoomName     = dr["RoomName"].ToString();
            order.YRoomNum     = Convert.ToInt32(dr["yRoomNum"].ToString());
            order.YinDate      = Convert.ToDateTime(dr["yinDate"].ToString());
            order.YoutDate     = Convert.ToDateTime(dr["youtDate"].ToString());
            order.LastTime     = Convert.ToDateTime(dr["lastTime"].ToString());
            order.UserName     = dr["UserName"].ToString();
            order.LinkTel      = dr["LinkTel"].ToString();
            order.yPriceStr    = dr["yPriceStr"].ToString();
            order.ySumPrice    = Convert.ToInt32(dr["ySumPrice"].ToString());
            order.RatePlanName = dr["RatePlanName"].ToString();
            order.HotelID      = Convert.ToInt32(dr["HotelID"].ToString());
            order.UserWeiXinID = dr["UserWeiXinID"].ToString();
            order.sSumPrice    = Convert.ToInt32(dr["sSumPrice"].ToString());
            order.JiFen        = Convert.ToDouble(dr["jf"].ToString());
            order.StateName    = dr["statename"].ToString();
            order.HotelTel     = dr["tel"].ToString();
            order.RoomID       = WeiXinPublic.ConvertHelper.ToInt(dr["RoomID"]).ToString();
            order.RatePlanID   = WeiXinPublic.ConvertHelper.ToInt(dr["RatePlanID"]).ToString();
            order.PayType      = Convert.ToString(dr["paytype"]);
            order.PayMethod    = Convert.ToString(dr["PayMethod"]);
            order.isMeeting    = dr["isMeeting"].ToString();
            return(order);
        }
Пример #2
0
        /// <summary>
        /// 酒店订单提交保存
        /// </summary>
        public static void OrderSave(HotelOrder hotelorder, UserGuarantee uguarantee, string ishourroom, string lastTime, string WeiXinID, out string res, out string did)
        {
            try
            {
                Hotel hotel = Cache.GetHotel(Convert.ToInt32(hotelorder.HotelID));
                hotel.SmsMobile = Cache.GetMobile(hotel.WeiXinID);
                List <hotel3g.Models.Room> rooms = Cache.GetRoomsForDate(hotel, hotelorder.YinDate, hotelorder.YoutDate);
                string RoomName = "", RatePlanName = "";
                string yPriceStr = "";
                int    datePrice = 0;
                foreach (var room in rooms)
                {
                    bool exitLoop = false;
                    foreach (var r in room.RatePlans)
                    {
                        if (r.ID.ToString().Equals(hotelorder.RatePlanID))
                        {
                            RoomName     = room.RoomName;
                            RatePlanName = r.RatePlanName;
                            exitLoop     = true;
                            string result = "", datestr = "";
                            foreach (var rate in r.Rates)
                            {
                                datestr    = rate.Dates.ToString("yyyy-M-dd");
                                result    += "price" + datestr + "|" + rate.Price + "|money" + datestr + "|0|";
                                datePrice += rate.Price;
                            }
                            yPriceStr = result;
                            break;
                        }
                    }
                    if (exitLoop)
                    {
                        break;
                    }
                }
                if (hotel != null)
                {
                    string orderid = "";
                    // string uid = CheckMember(LinkTel, WeiXinID, UserWeiXinID, HotelID, hotel.SubName.ToString(),UserName);
                    //if (!string.IsNullOrEmpty(uid))
                    //{
                    int    roomcount = hotelorder.YRoomNum;
                    int    Unitprice = datePrice * roomcount;
                    string ordercode = GetOrderCode().ToString();
                    Dictionary <string, HotelCloud.SqlServer.DBParam> param = new Dictionary <string, HotelCloud.SqlServer.DBParam> {
                        { "HotelID", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotelorder.HotelID.ToString()
                          } },
                        { "HotelName", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotel.SubName.ToString()
                          } },
                        { "RoomID", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotelorder.RoomID.ToString()
                          } },
                        { "RoomName", new HotelCloud.SqlServer.DBParam {
                              ParamValue = RoomName.ToString()
                          } },
                        { "RatePlanID", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotelorder.RatePlanID.ToString()
                          } },
                        { "RatePlanName", new HotelCloud.SqlServer.DBParam {
                              ParamValue = RatePlanName.ToString()
                          } },
                        { "yinDate", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotelorder.YinDate.ToString()
                          } },
                        { "youtDate", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotelorder.YoutDate.ToString()
                          } },
                        { "ishourroom", new HotelCloud.SqlServer.DBParam {
                              ParamValue = ishourroom.ToString()
                          } },
                        { "ySumPrice", new HotelCloud.SqlServer.DBParam {
                              ParamValue = Unitprice.ToString()
                          } },
                        { "sSumPrice", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotelorder.sSumPrice.ToString()
                          } },
                        { "yRoomNum", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotelorder.YRoomNum.ToString()
                          } },
                        { "PayType", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotelorder.PayType
                          } },
                        { "lastTime", new HotelCloud.SqlServer.DBParam {
                              ParamValue = lastTime.ToString()
                          } },
                        { "UserName", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotelorder.UserName.ToString()
                          } },
                        { "LinkTel", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotelorder.LinkTel.ToString()
                          } },
                        { "UserWeiXinID", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotelorder.UserWeiXinID.ToString()
                          } },
                        { "WeiXinID", new HotelCloud.SqlServer.DBParam {
                              ParamValue = WeiXinID.ToString()
                          } },
                        { "HotelTel", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotel.Tel.ToString()
                          } },
                        { "OrderNO", new HotelCloud.SqlServer.DBParam {
                              ParamValue = ordercode.ToString()
                          } },
                        //memberid {"UserID",new HotelCloud.SqlServer.DBParam{ParamValue=""}},
                        { "UserID", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotelorder.memberid
                          } },

                        { "yPriceStr", new HotelCloud.SqlServer.DBParam {
                              ParamValue = yPriceStr
                          } },
                        { "jifen", new HotelCloud.SqlServer.DBParam {
                              ParamValue = ((int)(hotel.JifenFav * Unitprice)).ToString()
                          } },
                        { "NetPrice", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotelorder.NetPrice.ToString()
                          } },
                        { "RealPrice", new HotelCloud.SqlServer.DBParam {
                              ParamValue = hotelorder.RealPrice.ToString()
                          } },
                        { "state", new HotelCloud.SqlServer.DBParam {
                              ParamValue = "1"
                          } }
                    };
                    string    sql = @"insert into HotelOrder(OrderNO,LinkTel,UserName,UserID,UserWeiXinID,HotelID,HotelName,WeiXinID,RoomID,RoomName,demo,RatePlanID,RatePlanName,yRoomNum,yinDate,youtDate,Ordertime,PayType,lastTime,state,yPriceStr,ySumPrice,sRoomNum,sinDate,soutDate,sPriceStr,sSumPrice,Remark,Source,ip,jifen,NetPrice,RealPrice) values (@OrderNO,@LinkTel,@UserName,@UserID,@UserWeiXinID,@HotelID,@HotelName,@WeiXinID,@RoomID,@RoomName,'',@RatePlanID,@RatePlanName,@yRoomNum,@yinDate,@youtDate,getdate(),@PayType,@lastTime,@state,@yPriceStr,@ySumPrice,0,@yinDate,@youtDate,@yPriceStr,@sSumPrice,'0','3gweb','',@jifen,@NetPrice,@RealPrice) select id = scope_identity()";
                    DataTable DT  = HotelCloud.SqlServer.SQLHelper.Get_DataTable(sql, HotelCloud.SqlServer.SQLHelper.GetCon(), param);
                    if (DT.Rows.Count > 0)
                    {
                        orderid = DT.Rows[0][0].ToString();
                    }

                    if (uguarantee != null)
                    {
                        uguarantee.OrderNo = ordercode;
                        UserGuarantee.SaveUserGuarantee(uguarantee);
                    }
                    if (hotelorder.PayType != "0")  //非预付订单发送短信,预付订单待客人付款完成后发送确认短信
                    {
                        //string tsql = @"insert into Tasks(TaskContent,TaskTime,TaskState,weixinid,hotelid,SendState,mobile,orderNO,TaskType) values(@Content,getdate(),0,@Uwx,@Hid,0,@mobile,@orderNO,'2')";
                        //int createStatus = HotelCloud.SqlServer.SQLHelper.Run_SQL(tsql, HotelCloud.SqlServer.SQLHelper.GetCon(), new Dictionary<string, HotelCloud.SqlServer.DBParam> {
                        //    {"Content",new HotelCloud.SqlServer.DBParam{ParamValue=string.Format("{7}({0})预订{1}间{2}{3}{4}元,{5}入住{6}退房[微可牛]",
                        //        hotelorder.LinkTel.ToString(),hotelorder.YRoomNum.ToString(),
                        //        RoomName.ToString(),RatePlanName.ToString(),hotelorder.sSumPrice,
                        //        hotelorder.YinDate.ToString("yyyy-MM-dd"),hotelorder.YoutDate.ToString("yyyy-MM-dd"),hotelorder.UserName)}},
                        //    {"Uwx",new HotelCloud.SqlServer.DBParam{ParamValue=hotelorder.UserWeiXinID}},
                        //    {"Hid",new HotelCloud.SqlServer.DBParam{ParamValue=hotelorder.HotelID.ToString()}},
                        //    {"mobile",new HotelCloud.SqlServer.DBParam{ParamValue=hotel.SmsMobile}},
                        //    {"orderNO",new HotelCloud.SqlServer.DBParam{ParamValue=orderid.ToString()}},
                        //});

                        //tsql = @"insert into Tasks(TaskContent,TaskTime,TaskState,weixinid,hotelid,SendState,mobile,orderNO,TaskType) values(@Content,getdate(),0,@Uwx,@Hid,0,@mobile,@orderNO,'2')";
                        //HotelCloud.SqlServer.SQLHelper.Run_SQL(tsql, HotelCloud.SqlServer.SQLHelper.GetCon(), new Dictionary<string, HotelCloud.SqlServer.DBParam> { { "Content", new HotelCloud.SqlServer.DBParam { ParamValue = "您的订单已提交,工作人员会尽快与您联系,核实并确认您的订单信息,以工作人员确认为准。[微可牛]" } }, { "Uwx", new HotelCloud.SqlServer.DBParam { ParamValue = hotelorder.UserWeiXinID } }, { "Hid", new HotelCloud.SqlServer.DBParam { ParamValue = hotelorder.HotelID.ToString() } }, { "mobile", new HotelCloud.SqlServer.DBParam { ParamValue = hotelorder.LinkTel.ToString() } }, { "orderNO", new HotelCloud.SqlServer.DBParam { ParamValue = orderid.ToString() } } });
                    }
                    if (!(hotelorder.CouponID.Equals("0") || string.IsNullOrEmpty(hotelorder.CouponID)))
                    {
                        HotelCloud.SqlServer.SQLHelper.Run_SQL("update couponcontent set IsEmploy=1,EmployTime=getdate(),orderID=@orderid where weixinid=@weixinid and userweixinNo=@userweixinNO and id=@couponid", HotelCloud.SqlServer.SQLHelper.GetCon(), new Dictionary <string, HotelCloud.SqlServer.DBParam> {
                            { "orderid", new HotelCloud.SqlServer.DBParam {
                                  ParamValue = orderid
                              } },
                            { "weixinid", new HotelCloud.SqlServer.DBParam {
                                  ParamValue = WeiXinID
                              } },
                            { "userweixinNO", new HotelCloud.SqlServer.DBParam {
                                  ParamValue = hotelorder.UserWeiXinID
                              } },
                            { "couponid", new HotelCloud.SqlServer.DBParam {
                                  ParamValue = hotelorder.CouponID
                              } }
                        });
                    }
                    res = "true"; did = ordercode;
                    //}
                    //else{res = "false"; did = "";}
                }
                else
                {
                    res = "false"; did = "";
                }
            }
            catch { res = "false"; did = ""; }

            if (hotelorder.PayType != "0")  //非预付订单发送短信,预付订单待客人付款完成后发送确认短信
            {
                //Task a = new Task(new WeiXinHelper(WeiXinID, "您的订单已经提交\n我们会马上帮您确认,请稍等!", hotelorder.UserWeiXinID).Send);
                //Task a = new Task(new WeiXinHelper(WeiXinID, "您的订单已提交\n工作人员会尽快与您联系,核实并确认您的订单信息,以工作人员确认为准。", hotelorder.UserWeiXinID).Send);
                //a.Start();
            }
        }