/// <summary> /// 发送消息给酒店 /// </summary> /// <param name="order"></param> /// <param name="hotel"></param> private void SendMsg(Model.wx_hotel_dingdan order, wx_hotels_info hotel) { BLL.wx_hotel_admin dBll = new BLL.wx_hotel_admin(); Model.wx_hotel_admin hotelAdmin = null; var users = dBll.GetModelList(String.Format(" HotelId={0}", order.hotelid)); hotelAdmin = users.FirstOrDefault(); if (hotelAdmin != null) { var msg = new ShortMsgDto() { Title = "订单管理", Content = String.Format("订单编号为{0}的订单需订购{1}至{2}{3}{4}间,请您确认是否接受!", order.OrderNumber, order.arriveTime.Value.ToString("yyyy/MM/dd"), order.leaveTime.Value.ToString("yyyy/MM/dd"), order.roomType, order.orderNum ), Type = "HotelOrder", MenuType = "hotel_room", IsShowButton = true, ButtonText = "马上去处理", ButtonUrl = String.Format("/admin/hotel/hotel_dingdan_cz.aspx?id={0}&hotelid={1}", order.id, order.hotelid), ButtonMutipleUrl = "/admin/hotel/hotel_dingdan_manage.aspx", FromUserId = order.openid, ToUserId = hotelAdmin.ManagerId.ToString(), MsgToUserType = MsgUserType.Hotel, MsgFromUserType = MsgUserType.WeChatCustomer }; _shortMsgService.SendMsg(msg); } }
protected void btnRefuse_Click(object sender, EventArgs e) { try { var manager = GetAdminInfo(); new BLL.wx_hotel_room_manage().ManageRoom(roomid, Model.RoomStatus.Refuse, manager.id, "审核不通过", txtComment.Text.Trim()); //发送消息:审核不通过 BLL.wx_hotel_admin dBll = new BLL.wx_hotel_admin(); Model.wx_hotel_admin hotelAdmin = null; var users = dBll.GetModelList(String.Format(" HotelId={0}", hotelid)); hotelAdmin = users.FirstOrDefault(); if (hotelAdmin != null) { var wxUserweixin = GetWeiXinCode(); // var role = new BLL.manager_role().GetModel(manager.role_id); // var hotelsInfo = new BLL.wx_hotels_info().GetModel(hotelid); var msg = new ShortMsgDto() { Title = wxUserweixin.wxName, Content = String.Format("编号为[{0}]的商品[{1}]审核不通过,请修改后发布!", this.lblRoomCode.Text, this.roomType.Text), Type = "HotelRoom", DetailType = "Refuse", MenuType = "hotel_room", IsShowButton = true, ButtonText = "马上去修改", ButtonUrl = String.Format("/admin/hotel/hotel_room_info.aspx?action=Edit&hotelid={0}&roomid={1}", hotelid, roomid), ButtonMutipleUrl = "/admin/hotel/hotel_room.aspx?action=Edit", FromUserId = manager.id.ToString(), ToUserId = hotelAdmin.ManagerId.ToString(), MsgToUserType = MsgUserType.Hotel, MsgFromUserType = MsgUserType.Scenic }; _shortMsgService.SendMsg(msg); } } catch (Exception ex) { JscriptMsg("操作失败!", Utils.CombUrlTxt("hotel_room.aspx", "action={0}&hotelid={1}", action, hotelid.ToString()), "Error"); } AddAdminLog(MXEnums.ActionEnum.Audit.ToString(), string.Format("房间【id={0}】审核不通过。", roomid)); //记录日志 JscriptMsg("操作成功!", Utils.CombUrlTxt("hotel_room.aspx", "action={0}&hotelid={1}", action, hotelid.ToString()), "Success"); }
public int Add(Model.wx_hotel_admin model) { using (IDbConnection db = DbFactory.GetOpenedConnection()) { StringBuilder queryBuilder = new StringBuilder(); queryBuilder.Append("Insert Into [dbo].[wx_hotel_admin]"); queryBuilder.Append(" (ManagerId, HotelId)"); queryBuilder.Append("Values"); queryBuilder.Append(" (@ManagerId,@HotelId)"); queryBuilder.Append("Select @Id=Scope_Identity()"); DynamicParameters dynamicParameters = new DynamicParameters(); dynamicParameters.AddDynamicParams(model); dynamicParameters.Add("@Id", dbType: DbType.Int32, direction: ParameterDirection.Output); db.Execute(queryBuilder.ToString(), dynamicParameters); return(dynamicParameters.Get <int>("@Id")); } }
private bool IsHotelAdmin(int id) { BLL.wx_hotel_admin dBll = new BLL.wx_hotel_admin(); Model.wx_hotel_admin hotelAdmin = dBll.GetModel(id); //酒店管理员 if (hotelAdmin != null) { return(true); } BLL.wx_hotel_user suBll = new BLL.wx_hotel_user(); Model.wx_hotel_user hotelUser = suBll.GetModel(id); if (hotelUser != null) { return(true); } return(false); }
public int GetHotelId() { if (IsAdminLogin()) { Model.manager admin = GetAdminInfo(); BLL.wx_hotel_admin hotelAdminBll = new BLL.wx_hotel_admin(); Model.wx_hotel_admin hotelAdmin = hotelAdminBll.GetModel(admin.id); if (hotelAdmin != null) { return(hotelAdmin.HotelId); } BLL.wx_hotel_user suBll = new BLL.wx_hotel_user(); Model.wx_hotel_user hotelUser = suBll.GetModel(admin.id); if (hotelUser != null) { return(hotelUser.HotelId); } return(0); } return(0); }
private bool DoAdd() { Model.manager adminEntity = GetAdminInfo(); //取得管理员信息 Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); //固定为餐饮管理员的角色 model.role_id = hotel_admin_role; model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; model.is_lock = MyCommFun.Str2Int(rblIsLock.SelectedValue); //检测用户名是否重复 if (bll.Exists(txtUserName.Text.Trim())) { return false; } model.user_name = txtUserName.Text.Trim(); //获得6位的salt加密字符串 model.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.add_time = DateTime.Now; model.wxNum = 0; model.agentId = GetAdminInfo().id; model.qq = string.Empty; model.email = txtEmail.Text; model.reg_ip = MXRequest.GetIP(); model.agentLevel = -1; model.remark = txtRemark.Text; model.agentId = adminEntity.id; int addId = bll.Add(model); if (addId > 0) { //添加商铺与管理人员的关联 BLL.wx_hotel_admin adminBll = new BLL.wx_hotel_admin(); Model.wx_hotel_admin hotelAdmin = new Model.wx_hotel_admin(); hotelAdmin.ManagerId = addId; hotelAdmin.HotelId = hotelid; int addShopAdminId = adminBll.Add(hotelAdmin); if (addShopAdminId <= 0) { bll.Delete(addId); addId = 0; } } if (addId > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加酒店超级管理员:" + model.user_name); //记录日志 return true; } return false; }
private bool DoAdd() { Model.manager adminEntity = GetAdminInfo(); //取得管理员信息 Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); //固定为餐饮管理员的角色 model.role_id = hotel_admin_role; model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; model.is_lock = MyCommFun.Str2Int(rblIsLock.SelectedValue); //检测用户名是否重复 if (bll.Exists(txtUserName.Text.Trim())) { return(false); } model.user_name = txtUserName.Text.Trim(); //获得6位的salt加密字符串 model.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.add_time = DateTime.Now; model.wxNum = 0; model.agentId = GetAdminInfo().id; model.qq = string.Empty; model.email = txtEmail.Text; model.reg_ip = MXRequest.GetIP(); model.agentLevel = -1; model.remark = txtRemark.Text; model.agentId = adminEntity.id; int addId = bll.Add(model); if (addId > 0) { //添加商铺与管理人员的关联 BLL.wx_hotel_admin adminBll = new BLL.wx_hotel_admin(); Model.wx_hotel_admin hotelAdmin = new Model.wx_hotel_admin(); hotelAdmin.ManagerId = addId; hotelAdmin.HotelId = hotelid; int addShopAdminId = adminBll.Add(hotelAdmin); if (addShopAdminId <= 0) { bll.Delete(addId); addId = 0; } } if (addId > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加酒店超级管理员:" + model.user_name); //记录日志 return(true); } return(false); }
public int Add(Model.wx_hotel_admin model) { return(_dal.Add(model)); }
/// <summary> /// 审核不通过 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnRefuse_Click(object sender, EventArgs e) { int sucCount = 0; int errorCount = 0; var manager = GetAdminInfo(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //Model.wx_hotel_room model = roomBll.GetModel(id); //model.Status = Model.RoomStatus.Refuse; try { manageBll.ManageRoom(id, Model.RoomStatus.Refuse, manager.id, "审核不通过", ""); sucCount += 1; //发送消息:审核后发送消息 Model.wx_hotel_room room = roomBll.GetModel(id); BLL.wx_hotel_admin dBll = new BLL.wx_hotel_admin(); Model.wx_hotel_admin hotelAdmin = null; var users = dBll.GetModelList(String.Format(" HotelId={0}", hotelid)); hotelAdmin = users.FirstOrDefault(); if (hotelAdmin != null) { var wxUserweixin = GetWeiXinCode(); // var role = new BLL.manager_role().GetModel(manager.role_id); // var hotelsInfo = new BLL.wx_hotels_info().GetModel(hotelid); var msg = new ShortMsgDto() { Title = wxUserweixin.wxName, Content = String.Format("编号为[{0}]的商品[{1}]审核不通过,请修改后发布!", room.RoomCode, room.roomType), Type = "HotelRoom", DetailType = "Refuse", MenuType = "hotel_room", IsShowButton = true, ButtonText = "马上去修改", ButtonUrl = String.Format("/admin/hotel/hotel_room_info.aspx?action=Edit&hotelid={0}&roomid={1}", hotelid, id), ButtonMutipleUrl = "/admin/hotel/hotel_room.aspx?action=Edit", FromUserId = manager.id.ToString(), ToUserId = hotelAdmin.ManagerId.ToString(), MsgToUserType = MsgUserType.Hotel, MsgFromUserType = MsgUserType.Scenic }; _shortMsgService.SendMsg(msg); } } catch (Exception ex) { errorCount += 1; } } } AddAdminLog(MXEnums.ActionEnum.Audit.ToString(), "信息" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("审核不通过,成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("hotel_room.aspx", "action={0}&hotelid={1}&keywords={2}", action, hotelid.ToString(), this.keywords), "Success"); }
/// <summary> /// 审核通过 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAgree_Click(object sender, EventArgs e) { int sucCount = 0; int errorCount = 0; var manager = GetAdminInfo(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //Model.wx_hotel_room model = roomBll.GetModel(id); //model.Status = Model.RoomStatus.Agree; try { manageBll.ManageRoom(id, Model.RoomStatus.Agree, manager.id, "审核通过", ""); //using (TransactionScope scope = new TransactionScope()) //{ // roomBll.Update(model); // Model.wx_hotel_room_manage manageInfo = new Model.wx_hotel_room_manage(); // manageInfo.RoomId = model.id; // manageInfo.Operator = GetAdminInfo().id; // manageInfo.OperateName = "审核通过"; // manageInfo.OperateTime = DateTime.Now; // manageInfo.Comment = "通过啊啊啊啊啊啊啊"; // manageBll.Add(manageInfo); //scope.Complete(); sucCount += 1; //发送消息:审核后发送消息 Model.wx_hotel_room room = roomBll.GetModel(id); BLL.wx_hotel_admin dBll = new BLL.wx_hotel_admin(); Model.wx_hotel_admin hotelAdmin = null; var users = dBll.GetModelList(String.Format(" HotelId={0}", hotelid)); hotelAdmin = users.FirstOrDefault(); if (hotelAdmin != null) { var wxUserweixin = GetWeiXinCode(); // var role = new BLL.manager_role().GetModel(manager.role_id); // var hotelsInfo = new BLL.wx_hotels_info().GetModel(hotelid); var msg = new ShortMsgDto() { Title = wxUserweixin.wxName, Content = String.Format("编号为[{0}]的商品[{1}]已审核通过,可以发布啦!", room.RoomCode, room.roomType), Type = "HotelRoom", DetailType = "Agree", MenuType = "hotel_room", IsShowButton = true, ButtonText = "马上去发布", ButtonUrl = String.Format( "/admin/hotel/hotel_room_info.aspx?action=View&hotelid={0}&roomid={1}", hotelid, id), ButtonMutipleUrl = "/admin/hotel/hotel_room.aspx?action=Edit", FromUserId = manager.id.ToString(), ToUserId = hotelAdmin.ManagerId.ToString(), MsgToUserType = MsgUserType.Hotel, MsgFromUserType = MsgUserType.Scenic }; _shortMsgService.SendMsg(msg); } //} } catch (Exception ex) { errorCount += 1; } } } // if (sucCount > 0) // { // int id = Convert.ToInt32(((HiddenField)rptList.Items[0].FindControl("hidId")).Value); // Model.wx_hotel_room room = roomBll.GetModel(id); // //发送消息:审核后发送消息 // // BLL.wx_hotel_admin dBll = new BLL.wx_hotel_admin(); // Model.wx_hotel_admin hotelAdmin = null; // var users = dBll.GetModelList(String.Format(" HotelId={0}", hotelid)); // hotelAdmin = users.FirstOrDefault(); // if (hotelAdmin != null) // { // var hotelsInfo = new BLL.wx_hotels_info().GetModel(hotelid); // var msg = new ShortMsgDto() // { // Title = hotelsInfo.hotelName, // Content = String.Format("编号为[{0}]的[{1}]等{2}件商品已审核通过,可以发布啦!", // room.RoomCode, room.roomType, sucCount), // Type = "hotel", // IsShowButton = true, // ButtonText = "马上去发布", // ButtonUrl = "/admin/hotel/hotel_room.aspx?action=Edit", // FromUserId = manager.id, // ToUserId = hotelAdmin.ManagerId, // MsgToUserType = MsgUserType.Hotel, // MsgFromUserType = MsgUserType.Scenic // }; // _shortMsgService.SendMsg(msg); // } // } AddAdminLog(MXEnums.ActionEnum.Audit.ToString(), "信息" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("审核通过,成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("hotel_room.aspx", "action={0}&hotelid={1}&keywords={2}", action, hotelid.ToString(), this.keywords), "Success"); }