private void GetLoginOn(HttpContext context) { UsersBLL bll = new UsersBLL(); ReturnModel ReturnModel = new ReturnModel(); //int IsManager = 0; int result = 0; try { string LoginName = context.Request.Params["LoginName"]; string Password = context.Request.Params["Password"]; string CardID = context.Request.Params["CardID"]; //string IsRemember = context.Request.Params["IsRemember"]; if (!string.IsNullOrEmpty(LoginName) && !string.IsNullOrEmpty(Password) && !string.IsNullOrEmpty(CardID)) { Users users = new Users(); string PwdKey = LinkFun.getPwdKey(); Password = DESEncrypt.Encrypt(PwdKey, Password);//旧密码加密 ReturnModel = bll.VerificationPassword(LoginName, Password, CardID); if (ReturnModel.IsSuccess) { int UserID = (int)ReturnModel.Data; result = UserID; MerchantFrontCookieBLL.SetMerchantFrontCookie(UserID, LoginName); #region 改造前端登录方法存储到缓存 UsersBLL bllUsers = new UsersBLL(); Users model = bllUsers.GetModel(UserID); if (model != null) { string key = ComPage.memberModelCacheDependency + model.UserID; ComPage.SetBWJSCache(key, Guid.NewGuid(), null, DateTime.Now.AddMinutes(ComPage.SafeToDouble(LinkFun.ConfigString("FrontEndCookieExpires", "120"))), TimeSpan.Zero); HttpCookie cookie = new HttpCookie(LinkFun.ConfigString("FrontEndCookieName", "BWJSFrontEnd20180108")); cookie.Expires = DateTime.Now.AddMinutes(ComPage.SafeToDouble(LinkFun.ConfigString("FrontEndCookieExpires", "120"))); cookie.Values.Add("Id", HttpContext.Current.Server.UrlEncode(model.UserID.ToString())); System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); System.Web.HttpContext.Current.Response.AppendCookie(cookie); model.LastAccessIP = HttpContext.Current.Request.UserHostAddress; model.LoginTimes = ComPage.SafeToInt(model.LoginTimes) + 1; model.RecordUpdateTime = DateTime.Now; model.IsLogined = 1; bllUsers.Update(model); } #endregion } } context.Response.Write(ObjectToJson(ReturnModel)); } catch (Exception ex) { context.Response.Write(ex); } }
/// <summary> /// 操作日志 /// </summary> /// <param name="logContent">日志内容</param> /// <param name="companyId">渠道编号</param> /// <param name="businessType">业务类型1网贷2保险3信用卡</param> /// <param name="relationId">关联编号</param> /// <returns>操作日志添加结果</returns> static public int OperationLogAdd(int relationId, string logContent, int companyId = 1, int businessType = 1) { int result = -1; try { int userId = -1; string realName = string.Empty; int departmentId = -1; string departmentName = string.Empty; LoginUserCookie currentUser = MerchantFrontCookieBLL.GetMerchantFrontUserCookie(); if (currentUser != null) { UsersBLL op = new UsersBLL(); Users model = new Users(); model = op.GetModel(currentUser.LoginUserID); userId = currentUser.LoginUserID; departmentId = model.DepartmentID; if (model != null) { realName = model.UserName; DepartmentInfoBLL opDepartment = new DepartmentInfoBLL(); DepartmentInfo modelDepartmentInfo = new DepartmentInfo(); modelDepartmentInfo = opDepartment.GetModel(departmentId); if (modelDepartmentInfo != null) { departmentName = modelDepartmentInfo.DepartmentName; } } } StackTrace st = new StackTrace(true); MethodBase mb = st.GetFrame(1).GetMethod(); string clsString = mb.DeclaringType.FullName; string mName = mb.Name; OperationLogBLL opOperationLog = new OperationLogBLL(); OperationLog modelOperationLog = new OperationLog(); modelOperationLog.BusinessType = businessType; modelOperationLog.RelationId = relationId; modelOperationLog.LogContent = logContent; modelOperationLog.Ip = System.Web.HttpContext.Current.Request.UserHostAddress; modelOperationLog.UserId = userId; modelOperationLog.RealName = realName; modelOperationLog.CreateDate = DateTime.Now; modelOperationLog.DepartmentId = departmentId; modelOperationLog.DepartmentName = departmentName; modelOperationLog.CreateDate = DateTime.Now; result = opOperationLog.Add(modelOperationLog); } catch (Exception ex) { ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }
public void GetUsersOne(HttpContext context) { var UsersID = context.Request.QueryString["UsersID"]; UsersBLL bll = new UsersBLL(); Users u = new Users(); if (!string.IsNullOrEmpty(UsersID)) { u = bll.GetModel(Convert.ToInt32(UsersID)); } context.Response.Write(SerializerHelper.SerializeObject(u)); }
private void InitData(int id) { Users model = bll.GetModel(id); if (model != null) { txtMail.Text = model.email; txtPass.Text = model.password; txtTel.Text = model.telephone; txtTrueName.Text = model.trueName; txtUserName.Text = model.userName; ddlState.SelectedValue = model.state + ""; linkModify.NavigateUrl = "modfyPass.aspx?username=" + model.userName; linkModify.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { string username = Request.Form["username"]; string password = Request.Form["password"]; int uid; if (username == "username") { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('请输入用户名');});</script>"); return; } if (password == "password") { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('请输入密码');});</script>"); return; } AdminsBLL adminBLL = new AdminsBLL(); if (adminBLL.GetModelList("AdminAccount = '" + username + "'").Count > 0) { if (adminBLL.GetModelList("AdminAccount = '" + username + "' and AdminPwd = '" + password + "'").Count > 0) { int aid = adminBLL.GetModelList("AdminAccount = '" + username + "' and AdminPwd = '" + password + "'")[0].AdminID; HttpContext.Current.Session["aid"] = aid; Response.Redirect("a_MainPage.aspx"); } else { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('用户名或密码错误');});</script>"); return; } } else { Regex rex_telnumber = new Regex(@"^1([38]\d|5[0-35-9]|7[3678])\d{8}$"); if (!rex_telnumber.IsMatch(username)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('请检查用户名是否有误');});</script>"); return; } UsersBLL userBll = new UsersBLL(); List <Users> userList; Users user = new Users(); // 对密码进行MD5加密(基于base64编码)然后与数据库中的密码值进行比对 var bytes = Encoding.UTF8.GetBytes(password); using (var md5 = MD5.Create()) { var hash = md5.ComputeHash(bytes); password = Convert.ToBase64String(hash); } userList = userBll.GetModelList("TelNumber = " + decimal.Parse(username) + " and Pwd = '" + password + "'"); if (userBll.GetModelList("TelNumber = " + decimal.Parse(username)).Count > 0) { if (userBll.GetModelList("TelNumber = " + decimal.Parse(username) + " and Pwd = '" + password + "'").Count > 0) { uid = userList[0].Uid; user = userBll.GetModel(uid); user.LoginStatus = 1; user.LastLoginTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); userBll.Update(user); //HttpCookie httpCookie = new HttpCookie("uid") //{ // Value = uid.ToString(), // Expires = DateTime.Now.AddMinutes(15); //}; //HttpContext.Current.Response.Cookies.Add(httpCookie); HttpContext.Current.Session["uid"] = uid; //uid = Encode(usersList[0].Uid.ToString(), "iRanania"); Response.Redirect("u_MainPage.aspx?uid=" + uid); } else { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('用户名或密码错误');});</script>"); return; } } else { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('用户不存在');});</script>"); return; } } } if (!string.IsNullOrEmpty(Request.QueryString["res"])) { if (int.Parse(Request.QueryString["res"]) == 5) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('请先登录');});</script>"); } } SignUpAdd = "Sign up.aspx"; }
public bool OrderApplyAdd(OrderApplyViewModel viewModel, out string msg) { msg = "ok"; using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString)) { conn.Open(); using (SqlTransaction trans = conn.BeginTransaction()) { try { int ApplyId = dalOrderApply.Add(viewModel.orderApply, trans, conn);// if (ApplyId < 0) { return(false); } else { viewModel.insurantInfo.OrderApplyID = ApplyId; viewModel.applicantInfo.OrderApplyID = ApplyId; viewModel.applicationData.OrderApplyID = ApplyId; viewModel.otherInfo.OrderApplyID = ApplyId; #region 创建人赋值 //LoginUserCookie cookie = MerchantFrontCookieBLL.GetMerchantFrontUserCookie(); int createUserId = MerchantFrontCookieBLL.GetMerchantFrontUserId(); //int createUserId= cookie.LoginUserID; try { UsersBLL opUsersBLL = new UsersBLL(); Users modelUsers = opUsersBLL.GetModel(createUserId); if (modelUsers != null) { departmentId = modelUsers.DepartmentID; } } catch { } viewModel.insurantInfo.CreatUserID = createUserId; viewModel.applicantInfo.CreatUserID = createUserId; viewModel.applicationData.CreatUserID = createUserId; viewModel.otherInfo.CreatUserID = createUserId; viewModel.orderApply.CreatUserID = createUserId; viewModel.orderApply.DepartmentId = departmentId; #endregion } int retCatId = dalApplicationData.Add(viewModel.applicationData, trans, conn); // int retInfoId = dalApplicantInfo.Add(viewModel.applicantInfo, trans, conn); // int retInsurantId = dalInsurantInfo.Add(viewModel.insurantInfo, trans, conn); // int retotherId = otherInfoDAL.Add(viewModel.otherInfo, trans, conn); //调用Mofang业务BaoxianDataBLL BaoxianDataBLL baoxianBLL = new BaoxianDataBLL(); OrderApplyInputModel orderModel = new OrderApplyInputModel(); orderModel.applicantinfo = new ApplicantInfo(); orderModel.applicantinfo.cName = viewModel.applicantInfo.CName; orderModel.applicantinfo.eName = viewModel.applicantInfo.EName; orderModel.applicantinfo.cardType = viewModel.applicantInfo.CardType; orderModel.applicantinfo.cardCode = viewModel.applicantInfo.CardCode; orderModel.applicantinfo.sex = viewModel.applicantInfo.Sex; orderModel.applicantinfo.birthday = viewModel.applicantInfo.BirthDay; orderModel.applicantinfo.mobile = viewModel.applicantInfo.Mobile; orderModel.applicantinfo.email = viewModel.applicantInfo.Email; orderModel.applicantinfo.cardPeriod = viewModel.applicantInfo.CardPeriod; orderModel.applicantinfo.job = viewModel.applicantInfo.Job; orderModel.applicationdata = new ApplicationData(); orderModel.applicationdata.applicationDate = viewModel.applicationData.ApplicationDate; orderModel.applicationdata.startDate = viewModel.applicationData.StartDate; orderModel.applicationdata.endDate = viewModel.applicationData.EndDate; orderModel.insurantInfo = new InsurantInfo(); orderModel.insurantInfo.birthday = viewModel.insurantInfo.Birthday; orderModel.insurantInfo.cardCode = viewModel.insurantInfo.CardCode; orderModel.insurantInfo.cardPeriod = viewModel.insurantInfo.CardPeriod; orderModel.insurantInfo.cardType = viewModel.insurantInfo.CardType; orderModel.insurantInfo.cName = viewModel.insurantInfo.CName; orderModel.insurantInfo.count = viewModel.insurantInfo.Count; orderModel.insurantInfo.eName = viewModel.insurantInfo.EName; orderModel.insurantInfo.mobile = viewModel.insurantInfo.Mobile; orderModel.insurantInfo.relationId = viewModel.insurantInfo.RelationID; orderModel.insurantInfo.sex = viewModel.insurantInfo.Sex; orderModel.insurantInfo.singlePrice = viewModel.insurantInfo.SinglePrice; orderModel.insurantInfo.email = viewModel.insurantInfo.Email; orderModel.insurantInfo.job = viewModel.insurantInfo.Job; orderModel.caseCode = viewModel.caseCode; orderModel.transNo = viewModel.transNo; int Days = 0; try { TimeSpan ts = Convert.ToDateTime(viewModel.applicationData.EndDate) - Convert.ToDateTime(viewModel.applicationData.StartDate); Days = ts.Days; if (Days == 0) { msg = "投保时间差有误!"; } } catch (Exception ex) { ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } orderModel.insurantDateLimit = Days.ToString(); orderModel.otherInfo = new OtherInfo(); orderModel.otherInfo.provCityId = viewModel.otherInfo.ProvCityID; orderModel.otherInfo.cardPeriod = viewModel.otherInfo.CardPeriod.ToString("yyyy-MM-dd"); orderModel.otherInfo.notifyAnswerId = viewModel.otherInfo.NotifyAnswerID.ToString(); orderModel.otherInfo.priceArgsId = viewModel.otherInfo.PriceArgsID; orderModel.otherInfo.visaCity = viewModel.otherInfo.VisaCity; orderModel.otherInfo.destination = viewModel.otherInfo.Destination; orderModel.otherInfo.tripPurposeId = viewModel.otherInfo.TripPurposeId; orderModel.otherInfo.propertyAddress = viewModel.otherInfo.PropertyAddress; orderModel.otherInfo.relatedPersonHouse = viewModel.otherInfo.RelatedPersonHouse; OrderApplyOutputModel outPutModel = baoxianBLL.OrderApply(orderModel); OrderPayViewModel orderPayViewModel = new OrderPayViewModel(); orderPayViewModel.transNo = outPutModel.transNo; orderPayViewModel.insureNum = outPutModel.insureNum; orderPayViewModel.price = outPutModel.price; orderPayViewModel.caseCode = orderModel.insurantInfo.cardCode; orderPayViewModel.customkey = orderModel.customkey; msg = SerializerHelper.SerializeObject(outPutModel); if (outPutModel.respstat == "0000") { trans.Commit();//提交事务 Model.OrderApply oOrderApply = new Model.OrderApply(); OrderApplyBLL orderbll = new OrderApplyBLL(); oOrderApply = orderbll.GetModel(ApplyId); oOrderApply.InsureNum = orderPayViewModel.insureNum; oOrderApply.Price = orderPayViewModel.price; oOrderApply.Respmsg = outPutModel.respmsg; oOrderApply.Respstat = outPutModel.respstat; oOrderApply.DepartmentId = departmentId; bool flag = dalOrderApply.Update(oOrderApply); if (!flag) { ExceptionLogBLL.WriteExceptionLogToDB("更新OrderApply表失败"); } else //没问题后提交返利设置 { #region 获取渠道返利设置 if (ApplyId > 0) { CompanyRebate modelSys_CompanyRebate = new CompanyRebate(); CompanyRebateBLL opSys_CompanyRebateBLL = new CompanyRebateBLL(); StringBuilder where = new StringBuilder(); where.AppendFormat("IsDeleted=0 and casecode='{0}'", viewModel.caseCode); DataSet ds = opSys_CompanyRebateBLL.GetList(where.ToString()); DataTable dt = null; if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; } if (dt != null && dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; modelSys_CompanyRebate = opSys_CompanyRebateBLL.DataRowToModel(dr); if (modelSys_CompanyRebate != null) { /* * 总价=订单金额 * 总部毛利=总价*产品分成百分比(魔方提供 我方后台管理设置渠道各产品返回分成百分比) * 商家利润=总部毛利*商家返利百分比(我方后台管理设置渠各产品商家分成百分比) * 代理商利润=总部毛利*代理商返利百分比(我方后台管理设置渠各产品商家分成百分比) * 总部净利润=总部毛利-商家利润-代理商利润 */ decimal orderMoney = viewModel.TotalPrice; decimal hqRebate = modelSys_CompanyRebate.CompanyRebatePer; decimal hqMoney = orderMoney * (hqRebate / 100); decimal agentRebate = modelSys_CompanyRebate.AgentRebate; decimal agentMoney = hqMoney * (agentRebate / 100); decimal merchantRebate = modelSys_CompanyRebate.MerchantRebate; decimal merchantMoney = hqMoney * (merchantRebate / 100); decimal netProfit = hqMoney - agentMoney - merchantMoney; #region 订单返利信息入库 OrderRebateBLL opSys_OrderRebate = new OrderRebateBLL(); OrderRebate modelSys_OrderRebate = new OrderRebate(); modelSys_OrderRebate.TransNo = viewModel.transNo; modelSys_OrderRebate.CompanyId = 1; modelSys_OrderRebate.UserId = viewModel.orderApply.UserID; modelSys_OrderRebate.OrderApplyId = ApplyId; modelSys_OrderRebate.CompanyRebateId = modelSys_CompanyRebate.CompanyRebateId; modelSys_OrderRebate.OrderMoney = orderMoney; modelSys_OrderRebate.HQRebate = hqRebate; modelSys_OrderRebate.HQMoney = hqMoney; modelSys_OrderRebate.MerchantRebate = merchantRebate; modelSys_OrderRebate.MerchantMoney = merchantMoney; modelSys_OrderRebate.AgentRebate = agentRebate; modelSys_OrderRebate.AgentMoney = agentMoney; modelSys_OrderRebate.NetProfit = netProfit; modelSys_OrderRebate.PayStatus = 0; modelSys_OrderRebate.IsSettled = 0; modelSys_OrderRebate.IsCancel = 0; modelSys_OrderRebate.SettlementDate = null; modelSys_OrderRebate.CreateDate = DateTime.Now; modelSys_OrderRebate.Remark = modelSys_CompanyRebate.RebateName; modelSys_OrderRebate.IsDeleted = 0; int orderRebateId = opSys_OrderRebate.Add(modelSys_OrderRebate); if (orderRebateId < 0) { ExceptionLogBLL.WriteExceptionLogToDB("订单返利信息添加失败"); } #endregion #region 订单支付申请预先入库 OrderPayApplyBLL opSys_OrderPayApplyBLL = new OrderPayApplyBLL(); OrderPayApply modelSys_OrderPayApply = new OrderPayApply(); modelSys_OrderPayApply.OrderRebateId = orderRebateId; modelSys_OrderPayApply.OrderMoney = orderMoney; modelSys_OrderPayApply.PayOrderNumber = string.Empty; modelSys_OrderPayApply.PayStatus = 0; modelSys_OrderPayApply.PayPlatform = 1; modelSys_OrderPayApply.PayMethod = 1; modelSys_OrderPayApply.PayCode = string.Empty; modelSys_OrderPayApply.PayText = string.Empty; modelSys_OrderPayApply.PayJson = string.Empty; modelSys_OrderPayApply.CreateDate = DateTime.Now; modelSys_OrderPayApply.Remark = modelSys_CompanyRebate.RebateName; modelSys_OrderPayApply.IsDeleted = 0; int res1 = opSys_OrderPayApplyBLL.Add(modelSys_OrderPayApply); if (res1 < 0) { ExceptionLogBLL.WriteExceptionLogToDB("订单支付申请预先入库失败"); } #endregion } } else { ExceptionLogBLL.WriteExceptionLogToDB("获取渠道返利设置信息获取失败"); } } #endregion } } else { trans.Rollback(); } return(true); } catch (Exception ex) { ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); return(false); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { rgCount = userbll.GetModelList("").Count; if (rgCount % 5 == 0) { rgMaxPage = rgCount / 5; } else { rgMaxPage = rgCount / 5 + 1; } } // 页面加载时获取房型信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "load") { string sqlStrByPage = "select * from (" + " select ROW_NUMBER() over(order by Uid ASC) AS Row, Uid, TelNumber, Fname, IdCard, CheckinCount" + " from Users) T where T.Row between 1 and 5"; Response.Write(Get_Serialize_Data_FromSql(connectString, sqlStrByPage)); Response.End(); } } // Ajax分页查询房型信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "rgByPage") { rgNowPage = int.Parse(Request["rgNowPage"]); StringBuilder sqlPage = new StringBuilder(); sqlPage.AppendFormat("select * from (" + " select ROW_NUMBER() over(order by Uid ASC) AS Row, Uid, TelNumber, Fname, IdCard, CheckinCount" + " from Users) T where T.Row between {0} and {1}", (rgNowPage - 1) * 5 + 1, rgNowPage * 5); Response.Write(Get_Serialize_Data_FromSql(connectString, sqlPage.ToString())); Response.End(); } } // Reset if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "update") { int uid = int.Parse(Request["uid"]); Users user = userbll.GetModel(uid); string pwd = user.Idcard.Substring(12, 6); var bytes = Encoding.UTF8.GetBytes(pwd); using (var md5 = System.Security.Cryptography.MD5.Create()) { var hash = md5.ComputeHash(bytes); pwd = Convert.ToBase64String(hash); } user.Pwd = pwd; Response.Write(userbll.Update(user) ? 1 : 0); Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["uid"] == null) { ClientScript.RegisterClientScriptBlock(ClientScript.GetType(), "login", "<script>notlogined();</script>"); return; } uid = Request.QueryString["uid"]; //uid = Decode(Request.QueryString["uid"], "iRanania"); UsersBLL userBll = new UsersBLL(); userName = userBll.GetModel(int.Parse(uid)).Fname; if (!string.IsNullOrEmpty(Request.QueryString["res"])) { if (int.Parse(Request.QueryString["res"]) == 0) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('没有预定');});</script>"); } else if (int.Parse(Request.QueryString["res"]) == 1) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('预定成功');});</script>"); } else if (int.Parse(Request.QueryString["res"]) == 2) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('退房成功');});</script>"); } else if (int.Parse(Request.QueryString["res"]) == 3) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('密码修改成功');});</script>"); } else if (int.Parse(Request.QueryString["res"]) == 4) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('您的房间已被管理员退回');});</script>"); } } } // 检测是否已经存在预定订单 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "check") { string _uid = Request.QueryString["uid"]; //string _uid = Decode(Request.QueryString["uid"], "iRanania"); CheckInBLL ckbll = new CheckInBLL(); if (ckbll.GetModelList("Uid = " + _uid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)").Count != 0) { Response.Write(-1); Response.End(); } else { Response.Write(1); Response.End(); } } } // 检测是否可以退房 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "checkout") { string _uid = Request.QueryString["uid"]; //string _uid = Decode(Request.QueryString["uid"], "iRanania"); CheckInBLL ckbll = new CheckInBLL(); if (ckbll.GetModelList("Uid = " + _uid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)").Count != 0) { Response.Write(1); Response.End(); } else { Response.Write(-1); Response.End(); } } } // 检测是否可以订购额外服务 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "eservice") { string _uid = Request.QueryString["uid"]; //string _uid = Decode(Request.QueryString["uid"], "iRanania"); CheckInBLL ckbll = new CheckInBLL(); if (ckbll.GetModelList("Uid = " + _uid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)").Count != 0) { Response.Write(1); Response.End(); } else { Response.Write(-1); Response.End(); } } } // 退出登录 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "logout") { string _uid = Request.QueryString["uid"]; //string _uid = Decode(Request.QueryString["uid"], "iRanania"); UsersBLL userbll = new UsersBLL(); Users user = userbll.GetModel(int.Parse(_uid)); user.LoginStatus = 0; userbll.Update(user); //HttpContext.Current.Session["uid"] = null; Response.Write(1); Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { // 处理GET请求 if (!IsPostBack) { if (Request.QueryString["uid"] == null) { ClientScript.RegisterClientScriptBlock(ClientScript.GetType(), "login", "<script>notlogined();</script>"); return; } uid = Request.QueryString["uid"]; Init_gRoom(); } // 处理POST请求 // 获取房间信息 if (!string.IsNullOrEmpty(Request["postTag"])) { // 获取单人房-硬板床 if (Request["postTag"] == "sh_room_bed_type") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); //and (GStatus = 0 or Gstatus = 1 or Gstatus = 4) shRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", 1, 3).Tables[0]); shNowPage = 1; JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(shRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } // 获取单人房-软榻床 if (Request["postTag"] == "ss_room_bed_type") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); //and (GStatus = 0 or Gstatus = 1 or Gstatus = 4) ssRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", 1, 3).Tables[0]); ssNowPage = 1; JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(ssRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } // 获取双人房-硬板床 if (Request["postTag"] == "dh_room_bed_type") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); //and (GStatus = 0 or Gstatus = 1 or Gstatus = 4) dhRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", 1, 3).Tables[0]); dhNowPage = 1; JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(dhRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } // 获取双人房-软榻床 if (Request["postTag"] == "ds_room_bed_type") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); //and (GStatus = 0 or Gstatus = 1 or Gstatus = 4) dsRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", 1, 3).Tables[0]); dsNowPage = 1; JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(dsRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } // 获取总统套房-软榻床 if (Request["postTag"] == "ps_room_bed_type") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); //and (GStatus = 0 or Gstatus = 1 or Gstatus = 4) psRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", 1, 3).Tables[0]); psNowPage = 1; JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(psRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } // 获取总统套房-大圆床 if (Request["postTag"] == "pc_room_bed_type") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); //and (GStatus = 0 or Gstatus = 1 or Gstatus = 4) pcRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", 1, 3).Tables[0]); pcNowPage = 1; JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(pcRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } // 结算界面数据获取 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "tempInfo") { Gid = int.Parse(Request["gid"]); RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); roomInfoTemp = guestRoomBll.GetModel(Gid); CheckInBLL ckbll = new CheckInBLL(); List <CheckIn> cklist = ckbll.GetModelList("Gid = " + Gid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)"); // 返回已选时间, 天数 guestRoomInfoWithCkTime gsRoomInfo = new guestRoomInfoWithCkTime() { roomInfo = guestRoomBll.GetModel(Gid) }; for (int i = 0; i < cklist.Count; i++) { gsRoomInfo.ckDateTime.Add(cklist[i].CheckinTime.ToString()); gsRoomInfo.ckDays.Add(cklist[i].CheckinDays); } JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(gsRoomInfo); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } // 预定模块 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "reserve") { Gid = int.Parse(Request["gid"]); RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); string startDate = Request["startdate"]; int selectDays = int.Parse(Request["selectdays"]); uid = Request.QueryString["uid"]; string[] dateArr = startDate.Split('-'); DateTime startDateTime = new DateTime(int.Parse(dateArr[0]), int.Parse(dateArr[1]), int.Parse(dateArr[2]), 0, 0, 0); CheckInBLL ckbll = new CheckInBLL(); List <CheckIn> cklist = new List <CheckIn>(); // 如果传来的日期为默认今天,且今天被选了,则返回-1 if (startDateTime.Date == DateTime.Now.Date) { cklist = ckbll.GetModelList("Gid = " + Gid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2) and CONVERT(varchar(10),CheckinTime,120) = (Datename(year,GetDate()) + '-' + Datename(month,GetDate()) + '-' + Datename(day,GetDate()))"); if (cklist.Count != 0) { Response.Write(-1); Response.End(); } cklist = ckbll.GetModelList("Gid = " + Gid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2) and CONVERT(varchar(10),CheckinTime,120) < (Datename(year,GetDate()) + '-' + Datename(month,GetDate()) + '-' + Datename(day,GetDate()))"); if (cklist.Count != 0) { for (int b = 0; b < cklist.Count; b++) { if (startDateTime.Date >= DateTime.Parse(cklist[b].CheckinTime.ToString()).Date&& startDateTime.Date <= DateTime.Parse(cklist[b].CheckinTime.ToString()).AddDays(int.Parse(cklist[b].CheckinDays.ToString())).Date) { Response.Write(-1); Response.End(); } } } } cklist = ckbll.GetModelList("Gid = " + Gid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)"); // 如果传来的日期为在数据库中已经被选,则返回-2 DateTime selectMinDate, selectMaxDate, dbMinDate, dbMaxDate; selectMinDate = new DateTime(int.Parse(dateArr[0]), int.Parse(dateArr[1]), int.Parse(dateArr[2]), 0, 0, 0); selectMaxDate = selectMinDate.AddDays(selectDays - 1); for (int b = 0; b < cklist.Count; b++) { dbMinDate = DateTime.Parse(cklist[b].CheckinTime.ToString()); dbMaxDate = dbMinDate.AddDays(int.Parse(cklist[b].CheckinDays.ToString()) - 1); if (selectMinDate <= dbMinDate && selectMaxDate >= dbMinDate) { Response.Write(-2); Response.End(); } if (selectMinDate >= dbMinDate && selectMinDate <= dbMaxDate) { Response.Write(-2); Response.End(); } } // 可以插入了 reserveObj = guestRoomBll.GetModel(Gid); DateTime orderCreateTime = DateTime.Now; decimal oid = decimal.Parse(orderCreateTime.ToString("yyyy-MM-dd-HH-mm").Replace("-", "")) * 10000 + Gid; UsersBLL userBll = new UsersBLL(); Users user = userBll.GetModel(int.Parse(uid)); // 服务订单,用于接下来的额外服务预定 ServiceOrder serviceOrder = new ServiceOrder() { Oid = oid, Uid = user.Uid, esOrderCreateTime = DateTime.Parse(orderCreateTime.ToString("yyyy-MM-dd HH:mm:ss")), esOrderContent = "", esOrderTotalPrice = 0, esOrderStatus = 0 }; ServiceOrderBLL orderBLL = new ServiceOrderBLL(); orderBLL.Add(serviceOrder); // 插入住房信息表,如果后期前台退回订单 则会删除该条 // 住房信息订单,每个用户预定房间后都会生成一条 CheckIn checkin = new CheckIn() { Oid = oid, Gid = Gid, Uid = user.Uid, cTotalPrice = reserveObj.RoomPrice * selectDays, CheckinTime = startDateTime, CheckinDays = selectDays, CheckinStatus = 0 }; CheckInBLL ckBll = new CheckInBLL(); ckBll.Add(checkin); long cid = long.Parse(ckBll.GetList("Uid = " + uid + " and CheckinStatus = 0").Tables[0].Rows[0][0].ToString()); if (cid != 0) { Response.Write(cid); } else { Response.Write(-5); } Response.End(); } } // 单人房-硬板床Ajax分页查询 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "shByPage") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); shNowPage = int.Parse(Request["shNowPage"]); shNowPage = shNowPage < 1 ? 1 : shNowPage; shNowPage = shNowPage > shMaxPage ? shMaxPage : shNowPage; shRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", (shNowPage - 1) * 3 + 1, shNowPage * 3).Tables[0]); JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(shRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } // 单人房-软榻床Ajax分页查询 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "ssByPage") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); ssNowPage = int.Parse(Request["ssNowPage"]); ssNowPage = ssNowPage < 1 ? 1 : ssNowPage; ssNowPage = ssNowPage > ssMaxPage ? ssMaxPage : ssNowPage; ssRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", (ssNowPage - 1) * 3 + 1, ssNowPage * 3).Tables[0]); JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(ssRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } // 双人房-硬板床Ajax分页查询 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "dhByPage") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); dhNowPage = int.Parse(Request["dhNowPage"]); dhNowPage = dhNowPage < 1 ? 1 : dhNowPage; dhNowPage = dhNowPage > dhMaxPage ? dhMaxPage : dhNowPage; dhRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", (dhNowPage - 1) * 3 + 1, dhNowPage * 3).Tables[0]); JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(dhRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } // 双人房-软榻床Ajax分页查询 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "dsByPage") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); dsNowPage = int.Parse(Request["dsNowPage"]); dsNowPage = dsNowPage < 1 ? 1 : dsNowPage; dsNowPage = dsNowPage > dsMaxPage ? dsMaxPage : dsNowPage; dsRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", (dsNowPage - 1) * 3 + 1, dsNowPage * 3).Tables[0]); JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(dsRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } // 总统套房-软榻床Ajax分页查询 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "psByPage") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); psNowPage = int.Parse(Request["psNowPage"]); psNowPage = psNowPage < 1 ? 1 : psNowPage; psNowPage = psNowPage > psMaxPage ? psMaxPage : psNowPage; psRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", (psNowPage - 1) * 3 + 1, psNowPage * 3).Tables[0]); JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(psRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } // 总统套房-大圆床Ajax分页查询 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "pcByPage") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); pcNowPage = int.Parse(Request["pcNowPage"]); pcNowPage = pcNowPage < 1 ? 1 : pcNowPage; pcNowPage = pcNowPage > pcMaxPage ? pcMaxPage : pcNowPage; pcRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", (pcNowPage - 1) * 3 + 1, pcNowPage * 3).Tables[0]); JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(pcRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } }