예제 #1
0
        /// <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);
            }
        }
예제 #2
0
 public void SendMsg(string strMsg)
 {
     try
     {
         var user = Session[MXKeys.SESSION_ADMIN_INFO] as Model.manager;
         if (user == null)
         {
             throw new Exception("用户未登陆!");
         }
         var msg = JSONHelper.Deserialize <ShortMsgDto>(strMsg);
         msg.FromUserId = user.id.ToString();
         _msgService.SendMsg(msg);
         Context.Response.Write(AjaxResult.Success(null).ToCamelString());
     }
     catch (UnAuthException jsEx)
     {
         Context.Response.Write(AjaxResult.Error(jsEx.RedirectUrl, jsEx.Code).ToCamelString());
     }
     catch (Exception ex)
     {
         Context.Response.Write(AjaxResult.Error(ex.Message).ToCamelString());
     }
 }
예제 #3
0
        protected void save_room_Click(object sender, EventArgs e)
        {
            Model.wx_hotel_room room = new Model.wx_hotel_room();
            if (action == MXEnums.ActionEnum.Add.ToString())
            {
                room.hotelid        = hotelid;
                room.roomType       = this.roomType.Text;
                room.RoomCode       = roomBll.GetRoomCode(hotelid);
                room.indroduce      = this.indroduce.InnerText;
                room.roomPrice      = Convert.ToDecimal(this.roomPrice.Text);
                room.salePrice      = Convert.ToDecimal(this.salePrice.Text);
                room.facilities     = this.facilities.Value;
                room.UseInstruction = txtUsueIntroduction.Value;
                room.RefundRule     = this.txtRefundRule.Value;
                room.createDate     = DateTime.Now;
                room.Status         = Model.RoomStatus.Submit;

                //room.ExpiryDate_Begin = DateTime.Parse(txtExpiryDate_Begin.Text);
                //room.ExpiryDate_End = DateTime.Parse(txtExpiryDate_End.Text);

                //if (DateTime.Compare(room.ExpiryDate_Begin.Value, room.ExpiryDate_End.Value) > 0)
                //{
                //    JscriptMsg("使用有效期开始时间不能大于结束时间。", "", "error");
                //}

                roomid = roomBll.Add(room);


                for (int i = 1; i <= 6; i++)
                {
                    title     = this.FindControl("title" + i) as TextBox;
                    sortpicid = this.FindControl("sortpicid" + i) as TextBox;
                    roomPic   = this.FindControl("roomPic" + i) as TextBox;
                    roomPictz = this.FindControl("roomPictz" + i) as TextBox;

                    if (title.Text.Trim() != "" && sortpicid.Text.Trim() != "")
                    {
                        pic.roomid     = roomid;
                        pic.title      = title.Text.ToString();
                        pic.sortpicid  = MyCommFun.Str2Int(sortpicid.Text.ToString());
                        pic.roomPic    = roomPic.Text.ToString();
                        pic.roomPictz  = roomPictz.Text.ToString();
                        pic.createDate = DateTime.Now;
                        pic.hotelid    = hotelid;
                        picBll.Add(pic);
                    }
                }
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加房间类型,主键为" + roomid); //记录日志
                JscriptMsg("添加成功!", "hotel_room.aspx?action=" + MXEnums.ActionEnum.Edit.ToString() + "&hotelid=" + hotelid + "", "Success");
            }

            else if (action == MXEnums.ActionEnum.Edit.ToString())
            {
                if (roomid == 0)
                {
                    return;
                }


                room = roomBll.GetModel(roomid);

                room.hotelid    = hotelid;
                room.roomType   = this.roomType.Text;
                room.indroduce  = this.indroduce.InnerText;
                room.roomPrice  = Convert.ToDecimal(this.roomPrice.Text);
                room.salePrice  = Convert.ToDecimal(this.salePrice.Text);
                room.facilities = this.facilities.Value;
                room.Status     = Model.RoomStatus.Submit;

                //room.ExpiryDate_Begin = DateTime.Parse(txtExpiryDate_Begin.Text);
                //room.ExpiryDate_End = DateTime.Parse(txtExpiryDate_End.Text);

                //if (DateTime.Compare(room.ExpiryDate_Begin.Value, room.ExpiryDate_End.Value) > 0)
                //{
                //    JscriptMsg("使用有效期开始时间不能大于结束时间。", "", "error");
                //}

                roomBll.Update(room);

                picBll.Deletepic(roomid);

                for (int i = 1; i <= 6; i++)
                {
                    title     = this.FindControl("title" + i) as TextBox;
                    sortpicid = this.FindControl("sortpicid" + i) as TextBox;
                    roomPic   = this.FindControl("roomPic" + i) as TextBox;
                    roomPictz = this.FindControl("roomPictz" + i) as TextBox;

                    if (title.Text.Trim() != "" && sortpicid.Text.Trim() != "")
                    {
                        pic.hotelid    = hotelid;
                        pic.roomid     = roomid;
                        pic.title      = title.Text.ToString();
                        pic.sortpicid  = MyCommFun.Str2Int(sortpicid.Text.ToString());
                        pic.roomPic    = roomPic.Text.ToString();
                        pic.roomPictz  = roomPictz.Text.ToString();
                        pic.createDate = DateTime.Now;
                        picBll.Add(pic);
                    }
                }
                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改房间类型设置,主键为" + hotelid); //记录日志
                JscriptMsg("修改成功!", "hotel_room.aspx?action=" + MXEnums.ActionEnum.Edit.ToString() + "&hotelid=" + hotelid + "", "Success");
            }


            if (action == MXEnums.ActionEnum.Add.ToString() ||
                action == MXEnums.ActionEnum.Edit.ToString())
            {
                //发送消息:提交审核

                var scenicUser = GetWeiXinCode();
                if (scenicUser != null)
                {
                    var manager    = GetAdminInfo();
                    var hotelsInfo = new BLL.wx_hotels_info().GetModel(hotelid);

                    var msg = new ShortMsgDto()
                    {
                        Title        = hotelsInfo.hotelName,
                        Content      = String.Format("编号为[{0}]的商品[{1}]请您审核!", room.RoomCode, room.roomType),
                        Type         = "HotelRoom",
                        DetailType   = "Audit",
                        MenuType     = "wHotel",
                        IsShowButton = true,
                        ButtonText   = "马上去审核",
                        ButtonUrl    = String.Format("/admin/hotel/hotel_room_info.aspx?action=Audit&hotelid={0}&roomid={1}",
                                                     hotelid, roomid),
                        ButtonMutipleUrl = String.Format("/admin/hotel/hotel_room.aspx?hotelid={0}&action=Audit", hotelid),
                        FromUserId       = manager.id.ToString(),
                        ToUserId         = scenicUser.uId.ToString(),
                        MsgToUserType    = MsgUserType.Scenic,
                        MsgFromUserType  = MsgUserType.Hotel
                    };
                    _shortMsgService.SendMsg(msg);
                }
            }
        }
예제 #4
0
        /// <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");
        }