/// <summary>
        /// 转换为Model
        /// </summary>
        /// <param name="xml"></param>
        /// <returns></returns>
        public static PushMsssageSetting ToModel(string xml)
        {
            if (string.IsNullOrEmpty(xml))
            {
                return(null);
            }
            XmlDocument        xmlDoc = new XmlDocument();
            PushMsssageSetting model  = new PushMsssageSetting();

            try
            {
                xmlDoc.LoadXml(xml);
                //查找根节点
                XmlNodeList nodes = xmlDoc.SelectNodes("//Root/MsgTypes/Type");
                foreach (XmlNode itemNode in nodes)
                {
                    model.PushSetting[(MsgPushType)Enum.Parse(typeof(MsgPushType), itemNode.Attributes["TypeName"].Value)] = bool.Parse(itemNode.Attributes["IsUsed"].Value);
                }
                return(model);
            }
            catch
            {
                return(null);
            }
        }
        /// <summary>
        /// 转换成XML
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static string ToXml(PushMsssageSetting model)
        {
            //TODO:转换成xml结构的算法
            //创建一个xml对象
            XmlDocument xmlDoc = new XmlDocument();
            //创建开头
            XmlDeclaration dec = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", null);

            xmlDoc.AppendChild(dec);
            //创建根节点
            XmlElement root     = xmlDoc.CreateElement("Root");
            XmlElement typeNode = xmlDoc.CreateElement("MsgTypes");

            foreach (var v in model.PushSetting)
            {
                XmlElement FirNode;
                FirNode = xmlDoc.CreateElement("Type");
                FirNode.SetAttribute("TypeName", v.Key.ToString());
                FirNode.SetAttribute("IsUsed", v.Value.ToString());
                typeNode.AppendChild(FirNode);
            }
            root.AppendChild(typeNode);
            //添加根节点
            xmlDoc.AppendChild(root);
            return(xmlDoc.OuterXml);
        }
Example #3
0
        public JsonResult SavePushMsgSetting()
        {
            JsonResult result = null;

            SeatManage.ClassModel.PushMsssageSetting setting = new SeatManage.ClassModel.PushMsssageSetting();
            setting.PushSetting[SeatManage.EnumType.MsgPushType.AdminOperation] = Request.Params["cb_AdminOperation"] == null ? false : true; //cb_AdminOperation.Checked;
            setting.PushSetting[SeatManage.EnumType.MsgPushType.EnterVR]        = Request.Params["cb_EnterVr"] == null ? false : true;        // cb_EnterVr.Checked;
            setting.PushSetting[SeatManage.EnumType.MsgPushType.EnterBlack]     = Request.Params["cb_EnterBlack"] == null ? false : true;     // cb_EnterBlack.Checked;
            setting.PushSetting[SeatManage.EnumType.MsgPushType.LeaveVrBlack]   = Request.Params["cb_LeaveVrBlack"] == null ? false : true;   // cb_LeaveVrBlack.Checked;
            setting.PushSetting[SeatManage.EnumType.MsgPushType.OtherUser]      = Request.Params["cb_OtherUser"] == null ? false : true;      // cb_OtherUser.Checked;
            setting.PushSetting[SeatManage.EnumType.MsgPushType.TimeOut]        = Request.Params["cb_TimeOut"] == null ? false : true;        //cb_TimeOut.Checked;
            setting.PushSetting[SeatManage.EnumType.MsgPushType.UserOperation]  = Request.Params["cb_UserOperation"] == null ? false : true;  // cb_UserOperation.Checked;
            if (SeatManage.Bll.T_SM_SystemSet.SaveMsgPushSet(setting))
            {
                result = Json(new { status = "yes", message = "消息推送规则配置保存成功" }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                result = Json(new { status = "no", message = "消息推送规则配置保存失败" }, JsonRequestBehavior.AllowGet);
            }

            return(result);
        }
Example #4
0
        public ActionResult BlacklistInfo()
        {
            //初始化黑名单设置页面
            SeatManage.ClassModel.BlacklistSetting blacklistset = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting().BlacklistSet;
            ViewBag.IsBlUserdChecked            = blacklistset.Used ? "yes" : "no";
            ViewBag.nbvrcontText                = blacklistset.ViolateTimes.ToString();
            ViewBag.ddlleavemodeSelectedValue   = ((int)blacklistset.LeaveBlacklist).ToString();
            ViewBag.nbleavetimeText             = blacklistset.LimitDays.ToString();
            ViewBag.nbvrovertimeText            = blacklistset.ViolateFailDays.ToString();
            ViewBag.cbBookOverTimeChecked       = blacklistset.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.BookingTimeOut] ? "yes" : "no";
            ViewBag.cbLeaveByAdminChecked       = blacklistset.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin] ? "yes" : "no";
            ViewBag.cbSeatOverTimeChecked       = blacklistset.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.SeatOutTime] ? "yes" : "no";
            ViewBag.cbShortLeaveByAdminChecked  = blacklistset.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.ShortLeaveByAdminOutTime] ? "yes" : "no";
            ViewBag.cbShortLeaveByReaderChecked = blacklistset.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.ShortLeaveByReaderOutTime] ? "yes" : "no";
            ViewBag.cbShortLeaveOverTimeChecked = blacklistset.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.ShortLeaveOutTime] ? "yes" : "no";

            //初始化门禁设置页面
            SeatManage.ClassModel.AccessSetting accset = SeatManage.Bll.T_SM_SystemSet.GetAccessSetting();
            if (accset == null)
            {
                accset = new SeatManage.ClassModel.AccessSetting();
            }

            ViewBag.IsASUserdCheckedForm3          = accset.IsUsed ? "yes" : "no";
            ViewBag.IsELUserdCheckedForm3          = accset.EnterLib ? "yes" : "no";
            ViewBag.IsOLUserdCheckedForm3          = accset.OutLib ? "yes" : "no";
            ViewBag.cbBLIsUsedCheckedForm3         = accset.IsLimitBlackList ? "yes" : "no";
            ViewBag.IsAddrvCheckedForm3            = accset.AddViolationRecords ? "yes" : "no";
            ViewBag.LeaveTimeTextForm3             = accset.LeaveTimeSpan.ToString();
            ViewBag.ddlleavemodeSelectedValueForm3 = ((int)accset.LeaveMode).ToString();
            ViewBag.IsOnSeatCheckedForm3           = accset.IsReleaseOnSeat ? "yes" : "no";
            ViewBag.IsShortLeaveCheckedForm3       = accset.IsComeBack ? "yes" : "no";
            ViewBag.IsBookingCheckedForm3          = accset.IsBookingConfinmed ? "yes" : "no";
            //初始化微信端设置
            SeatManage.ClassModel.PecketBookWebSetting setting = SeatManage.Bll.T_SM_SystemSet.GetPecketWebSetting();
            if (setting == null)
            {
                setting = new SeatManage.ClassModel.PecketBookWebSetting();
            }
            ViewBag.cb_UseBookComfirmChecked     = setting.UseBookComfirm;
            ViewBag.cb_UseBookNextDaySeatChecked = setting.UseBookNextDaySeat;
            ViewBag.cb_UseBookNowDaySeatChecked  = setting.UseBookNowDaySeat;
            ViewBag.cb_UseBookSeatChecked        = setting.UseBookSeat;
            ViewBag.cb_UseCancelBookChecked      = setting.UseCancelBook;
            ViewBag.cb_UseCancelWaitChecked      = setting.UseCancelWait;
            ViewBag.cb_UseCanLeaveChecked        = setting.UseCanLeave;
            ViewBag.cb_UseComeBackChecked        = setting.UseComeBack;
            ViewBag.cb_UseContinueChecked        = setting.UseContinue;
            ViewBag.cb_UseShortLeaveChecked      = setting.UseShortLeave;
            ViewBag.cb_UseWaitSeatChecked        = setting.UseWaitSeat;
            ViewBag.cb_ChangeSeatChecked         = setting.UseChangeSeat;
            ViewBag.cb_SelectSeatChecked         = setting.UseSelectSeat;
            //初始化消息推送
            SeatManage.ClassModel.PushMsssageSetting objPushMsssageSetting = SeatManage.Bll.T_SM_SystemSet.GetMsgPushSet() ?? new SeatManage.ClassModel.PushMsssageSetting();
            ViewBag.cb_AdminOperationChecked = objPushMsssageSetting.PushSetting[SeatManage.EnumType.MsgPushType.AdminOperation];
            ViewBag.cb_EnterVrChecked        = objPushMsssageSetting.PushSetting[SeatManage.EnumType.MsgPushType.EnterVR];
            ViewBag.cb_EnterBlackChecked     = objPushMsssageSetting.PushSetting[SeatManage.EnumType.MsgPushType.EnterBlack];
            ViewBag.cb_LeaveVrBlackChecked   = objPushMsssageSetting.PushSetting[SeatManage.EnumType.MsgPushType.LeaveVrBlack];
            ViewBag.cb_OtherUserChecked      = objPushMsssageSetting.PushSetting[SeatManage.EnumType.MsgPushType.OtherUser];
            ViewBag.cb_TimeOutChecked        = objPushMsssageSetting.PushSetting[SeatManage.EnumType.MsgPushType.TimeOut];
            ViewBag.cb_UserOperationChecked  = objPushMsssageSetting.PushSetting[SeatManage.EnumType.MsgPushType.UserOperation];
            return(View());
        }