コード例 #1
0
ファイル: UserGuarantee.cs プロジェクト: weikeniu/3gweikeniu
 public static void SaveUserGuarantee(UserGuarantee uguarantee)
 {
     string str    = "insert into UserGuarantee(orderNo,hotelId,bankType,bankCardNo,bankCVV,validTime,cardholder,identityCard,identityType,remark,createDate,modifiedDate) values(@orderNo,@hotelId,@bankType,@bankCardNo,@bankCVV,@validTime,@cardholder,@identityCard,@identityType,@remark,@datetime,@datetime)";
     int    result = SQLHelper.Run_SQL(str, SQLHelper.GetCon(), new Dictionary <string, DBParam> {
         { "orderNo", new DBParam {
               ParamValue = uguarantee.OrderNo
           } },
         { "hotelId", new DBParam {
               ParamValue = uguarantee.HotelId
           } },
         { "bankType", new DBParam {
               ParamValue = uguarantee.BankType
           } },
         { "bankCardNo", new DBParam {
               ParamValue = uguarantee.BankCardNo
           } },
         { "bankCVV", new DBParam {
               ParamValue = uguarantee.BankCVV
           } },
         { "validTime", new DBParam {
               ParamValue = uguarantee.ValidTime
           } },
         { "cardholder", new DBParam {
               ParamValue = uguarantee.Cardholder
           } },
         { "identityCard", new DBParam {
               ParamValue = uguarantee.IdentityCard
           } },
         { "identityType", new DBParam {
               ParamValue = uguarantee.IdentityType
           } },
         { "remark", new DBParam {
               ParamValue = string.Empty
           } },
         { "datetime", new DBParam {
               ParamValue = DateTime.Now.ToString()
           } }
     });
 }
コード例 #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();
            }
        }