Beispiel #1
0
        public override SystemNotify CreateSystemNotify(string subject, string Content, IEnumerable <Guid> receiveRoles, IEnumerable <int> receiveUserIDs, DateTime beginDate, DateTime endDate, int dispatcherID, string dispatcherIP)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = @"INSERT INTO bx_SystemNotifies(Subject, BeginDate, EndDate, ReceiveRoles, ReceiveUserIDs, Content, DispatcherID, DispatcherIP) VALUES( @Subject, @BeginDate, @EndDate,@ReceiveRoles, @ReceiveUserIDs, @Content, @DispatcherID, @DispatcherIP);
        SELECT * FROM bx_SystemNotifies WHERE NotifyID = @@IDENTITY;
";
                query.CreateParameter <string>("@Subject", subject, SqlDbType.NVarChar, 200);
                query.CreateParameter <DateTime>("@BeginDate", beginDate, SqlDbType.DateTime);
                query.CreateParameter <DateTime>("@EndDate", endDate, SqlDbType.DateTime);
                query.CreateParameter <string>("@ReceiveRoles", StringUtil.Join(receiveRoles, ","), SqlDbType.Text);
                query.CreateParameter <string>("@ReceiveUserIDs", StringUtil.Join(receiveUserIDs, ","), SqlDbType.VarChar, 2000);
                query.CreateParameter <string>("@Content", Content, SqlDbType.NVarChar, 2000);
                query.CreateParameter <int>("@DispatcherID", dispatcherID, SqlDbType.Int);
                query.CreateParameter <string>("@DispatcherIP", dispatcherIP, SqlDbType.VarChar, 200);

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    SystemNotify result = null;

                    while (reader.Next)
                    {
                        result = new SystemNotify(reader);
                    }

                    return(result);
                }
            }
        }
        public ActionResult SystemNotify()
        {
            SystemNotify             A    = new SystemNotify();
            List <G3_Monitor_Notice> list = new List <G3_Monitor_Notice>();

            using (Monitor_Notice db = new Monitor_Notice())
            {
                var reuslt = db.G3_Monitor_Notice.ToList();
                foreach (var item in reuslt)
                {
                    if (item.status == 1)
                    {
                        G3_Monitor_Notice Data = new G3_Monitor_Notice();
                        Data.Id              = item.Id;
                        Data.User            = item.User;
                        Data.MeasurementDate = item.MeasurementDate;
                        Data.Object          = item.Object;
                        Data.status          = item.status;

                        list.Add(Data);
                    }
                }
            }
            A.NotifyList    = list;
            ViewBag.Message = "需求管理";
            return(View(A));
        }
Beispiel #3
0
        public void UpdateSystemNotify(int operatorUserID, string subject, int notifyID, string Content, IEnumerable <Guid> receiveRoles, IEnumerable <int> receiveUserIDs, DateTime beginDate, DateTime endDate)
        {
            if (subject == string.Empty)
            {
                subject = string.Format("{0:yyyy-MM-dd HH:mm}", DateTimeUtil.Now);
            }

            if (AllSettings.Current.BackendPermissions.Can(operatorUserID, BackendPermissions.Action.Manage_SystemNotify))
            {
                if (ValidateSystemNotifyData(Content, receiveRoles, receiveUserIDs, beginDate, endDate))
                {
                    SystemNotify notify = NotifyDao.Instance.UpdateSystemNotify(notifyID, subject, Content, receiveRoles, receiveUserIDs, beginDate, endDate, operatorUserID, IPUtil.GetCurrentIP());
                    SystemNotifyProvider.Update();

                    if (OnSystemNotifyUpdated != null)
                    {
                        OnSystemNotifyUpdated(notify);
                    }
                }
            }
            else
            {
                ThrowError(new NoPermissionManageSystemNoyify());
            }
        }
Beispiel #4
0
        public SystemNotifyProxy Notify_GetSystemNotify(int notifyID)
        {
            if (!CheckClient())
            {
                return(null);
            }

            SystemNotify temp = NotifyBO.Instance.GetSystemNotify(notifyID);

            return(ProxyConverter.GetSystemNotifyProxy(temp));
        }
Beispiel #5
0
        public SystemNotify ProxyToSystemNotify(SystemNotifyProxy proxy)
        {
            if (proxy == null)
            {
                return(null);
            }

            SystemNotify result = new SystemNotify();

            foreach (NotifyActionProxy action in proxy.Actions)
            {
                result.Actions.Add(new NotifyAction(action.Title, action.Url, action.IsDialog));
            }

            result.BeginDate  = proxy.BeginDate;
            result.ClientID   = proxy.ClientID;
            result.Content    = proxy.Content;
            result.CreateDate = proxy.CreateDate;

            result.DataTable = new StringTable();

            foreach (StringKeyValueProxy keyValue in proxy.DataTable)
            {
                result.DataTable.Add(keyValue.Key, keyValue.Value);
            }

            result.DispatcherID   = proxy.DispatcherID;
            result.DispatcherIP   = proxy.DispatcherIP;
            result.EndDate        = proxy.EndDate;
            result.IsRead         = proxy.IsRead;
            result.Keyword        = proxy.Keyword;
            result.NotifyID       = proxy.NotifyID;
            result.CreateDate     = proxy.PostDate;
            result.ReadUserIDs    = proxy.ReadUserIDs;
            result.ReceiveUserIDs = new List <int>(proxy.ReceiveUserIDs);
            result.ReceiveRoles   = new List <Guid>(proxy.ReceiveRoles);
            result.Subject        = proxy.Subject;
            result.TypeID         = proxy.TypeID;
            result.TypeName       = proxy.TypeName;
            result.UpdateDate     = proxy.UpdateDate;
            result.UserID         = proxy.UserID;

            return(result);
        }
Beispiel #6
0
        public override SystemNotify GetSystemNotify(int notifyID)
        {
            SystemNotify notify = null;

            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = "DELETE FROM bx_SystemNotifies WHERE EndDate< GETDATE(); SELECT * FROM bx_SystemNotifies WHERE NotifyID = @NotifyID;";
                query.CreateParameter <int>("@NotifyID", notifyID, SqlDbType.Int);

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        notify = new SystemNotify(reader);
                    }
                    return(notify);
                }
            }
        }
Beispiel #7
0
        public static void IgnoreNotify(int userID, int notifyID)
        {
            SystemNotify notify = null;

            notifyID = Math.Abs(notifyID);
            foreach (SystemNotify sn in CurrentSystemNotifys)
            {
                if (sn.NotifyID == notifyID)
                {
                    notify = sn;
                    break;
                }
            }

            if (notify != null)
            {
                string s = notify.ReadUserIDs;
                if (string.IsNullOrEmpty(s))
                {
                    s = string.Empty;
                }
                if (!s.StartsWith(","))
                {
                    s = "," + s;
                }

                AuthUser user = UserBO.Instance.GetUserFromCache <AuthUser>(userID);
                if (user != null)
                {
                    user.SystemNotifyVersion = DateTimeUtil.Now.Ticks;//刷新用户的系统通知列表
                    s += user.UserID + ",";
                }
                notify.ReadUserIDs = s;
                NotifyDao.Instance.SetSystemNotifyReadUserIDs(notify.NotifyID, s);
            }
        }
Beispiel #8
0
 void NotifyBO_OnSystemNotifyCreate(SystemNotify notify)
 {
     this.CreateInstruct(0, InstructType.Notify_SystemNotifyCreate, ProxyConverter.GetSystemNotifyProxy(notify));
 }
Beispiel #9
0
 void NotifyBO_OnSystemNotifyCreate(SystemNotify notify)
 {
     this.CreateInstruct(0, InstructType.Notify_SystemNotifyCreate, ProxyConverter.GetSystemNotifyProxy(notify));
 }
Beispiel #10
0
        public static SystemNotifyProxy GetSystemNotifyProxy(SystemNotify notify)
        {

            if (notify == null)
                return null;

            SystemNotifyProxy systemNotifyProxy = new SystemNotifyProxy();

            foreach (NotifyAction action in notify.Actions)
            {
                systemNotifyProxy.Actions.Add(new NotifyActionProxy(action.Title, action.Url, action.IsDialog));
            }

            systemNotifyProxy.BeginDate = notify.BeginDate;
            systemNotifyProxy.ClientID = notify.ClientID;
            systemNotifyProxy.Content = notify.Content;
            systemNotifyProxy.CreateDate = notify.CreateDate;

            systemNotifyProxy.DataTable = new List<StringKeyValueProxy>();

            foreach (string key in notify.DataTable.Keys)
            {
                systemNotifyProxy.DataTable.Add(new StringKeyValueProxy(key, notify.DataTable[key]));
            }

            systemNotifyProxy.DispatcherID = notify.DispatcherID;
            systemNotifyProxy.DispatcherIP = notify.DispatcherIP;
            systemNotifyProxy.EndDate = notify.EndDate;
            systemNotifyProxy.IsRead = notify.IsRead;
            systemNotifyProxy.Keyword = notify.Keyword;
            systemNotifyProxy.NotifyID = notify.NotifyID;
            systemNotifyProxy.PostDate = notify.CreateDate;
            systemNotifyProxy.ReadUserIDs = notify.ReadUserIDs;
            systemNotifyProxy.ReceiveUserIDs = notify.ReceiveUserIDs;
            systemNotifyProxy.ReceiveRoles = notify.ReceiveRoles;
            systemNotifyProxy.Subject = notify.Subject;
            systemNotifyProxy.TypeID = notify.TypeID;
            systemNotifyProxy.TypeName = notify.TypeName;
            systemNotifyProxy.UpdateDate = notify.UpdateDate;
            systemNotifyProxy.Url = notify.Url;
            systemNotifyProxy.UserID = notify.UserID;

            //systemNotifyProxy.ReceiveUserIDs = new int[notify.ReceiveUserIDs.Count];
            //systemNotifyProxy.ReceiveRoles = new Guid[notify.ReceiveRoles.Count];

            //notify.ReceiveRoles.CopyTo(systemNotifyProxy.ReceiveRoles);
            //notify.ReceiveUserIDs.CopyTo(systemNotifyProxy.ReceiveUserIDs);

            //if (notify.ReadUserIDs != null)
            //{
            //    systemNotifyProxy.ReadedUserIDs = notify.ReadUserIDs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            //}
            //else
            //{
            //    systemNotifyProxy.ReadedUserIDs = new string[0];
            //}

            //systemNotifyProxy.BeginDate = notify.BeginDate;
            //systemNotifyProxy.EndDate = notify.EndDate;
            //systemNotifyProxy.Content = notify.Content;
            //systemNotifyProxy.Subject = notify.Subject;

            return systemNotifyProxy;
        }
Beispiel #11
0
        public static SystemNotifyProxy GetSystemNotifyProxy(SystemNotify notify)
        {
            if (notify == null)
            {
                return(null);
            }

            SystemNotifyProxy systemNotifyProxy = new SystemNotifyProxy();

            foreach (NotifyAction action in notify.Actions)
            {
                systemNotifyProxy.Actions.Add(new NotifyActionProxy(action.Title, action.Url, action.IsDialog));
            }

            systemNotifyProxy.BeginDate  = notify.BeginDate;
            systemNotifyProxy.ClientID   = notify.ClientID;
            systemNotifyProxy.Content    = notify.Content;
            systemNotifyProxy.CreateDate = notify.CreateDate;

            systemNotifyProxy.DataTable = new List <StringKeyValueProxy>();

            foreach (string key in notify.DataTable.Keys)
            {
                systemNotifyProxy.DataTable.Add(new StringKeyValueProxy(key, notify.DataTable[key]));
            }

            systemNotifyProxy.DispatcherID   = notify.DispatcherID;
            systemNotifyProxy.DispatcherIP   = notify.DispatcherIP;
            systemNotifyProxy.EndDate        = notify.EndDate;
            systemNotifyProxy.IsRead         = notify.IsRead;
            systemNotifyProxy.Keyword        = notify.Keyword;
            systemNotifyProxy.NotifyID       = notify.NotifyID;
            systemNotifyProxy.PostDate       = notify.CreateDate;
            systemNotifyProxy.ReadUserIDs    = notify.ReadUserIDs;
            systemNotifyProxy.ReceiveUserIDs = notify.ReceiveUserIDs;
            systemNotifyProxy.ReceiveRoles   = notify.ReceiveRoles;
            systemNotifyProxy.Subject        = notify.Subject;
            systemNotifyProxy.TypeID         = notify.TypeID;
            systemNotifyProxy.TypeName       = notify.TypeName;
            systemNotifyProxy.UpdateDate     = notify.UpdateDate;
            systemNotifyProxy.Url            = notify.Url;
            systemNotifyProxy.UserID         = notify.UserID;

            //systemNotifyProxy.ReceiveUserIDs = new int[notify.ReceiveUserIDs.Count];
            //systemNotifyProxy.ReceiveRoles = new Guid[notify.ReceiveRoles.Count];

            //notify.ReceiveRoles.CopyTo(systemNotifyProxy.ReceiveRoles);
            //notify.ReceiveUserIDs.CopyTo(systemNotifyProxy.ReceiveUserIDs);

            //if (notify.ReadUserIDs != null)
            //{
            //    systemNotifyProxy.ReadedUserIDs = notify.ReadUserIDs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            //}
            //else
            //{
            //    systemNotifyProxy.ReadedUserIDs = new string[0];
            //}

            //systemNotifyProxy.BeginDate = notify.BeginDate;
            //systemNotifyProxy.EndDate = notify.EndDate;
            //systemNotifyProxy.Content = notify.Content;
            //systemNotifyProxy.Subject = notify.Subject;

            return(systemNotifyProxy);
        }