示例#1
0
        /// <summary>
        /// 根据ID删除信件
        /// </summary>
        /// <param name="to_id"></param>
        /// <returns></returns>
        public bool DeleteTodo(int to_id)
        {
            T_TodoList todo = new T_TodoList();

            todo.to_remove = 1;
            return(base.Modify(todo, o => o.to_id == to_id, "to_remove") > 0);
        }
示例#2
0
        /// <summary>
        /// 回复待办事宜 只有收件人是一个人的情况下才允许回复
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public bool ReTodoContent(object obj)
        {
            FormCollection param = (FormCollection)obj;
            T_TodoList     todo  = new T_TodoList();

            todo.re_content = param["re_content"].Trim();
            todo.re_date    = todo.to_send_date = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            int todo_id = int.Parse(param["to_id"]);

            return(base.Modify(todo, o => o.to_id == todo_id, "re_content", "re_date") > 0);
        }
示例#3
0
        /// <summary>
        /// 写信
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public bool NewTodo(object obj)
        {
            FormCollection param    = (FormCollection)obj;
            List <T_User>  userList = HCQ2UI_Helper.OperateContext.Current.bllSession.T_User.Select(o => o.user_id > 0);

            string[] sendUserName = param["to_user_id"].Split(';');
            string   sendUserID   = "";

            for (int i = 0; i < sendUserName.Length; i++)
            {
                string user_name = sendUserName[i];
                var    data      = userList.Where(o => o.user_name == user_name);
                if (data.Count() > 0)
                {
                    if (string.IsNullOrEmpty(sendUserID))
                    {
                        sendUserID = data.FirstOrDefault().user_id.ToString();
                    }
                    else
                    {
                        sendUserID += ";" + data.FirstOrDefault().user_id.ToString();
                    }
                }
            }

            T_TodoList todo = new T_TodoList();

            todo.to_user_id   = sendUserID;
            todo.to_user_name = param["to_user_id"];
            todo.to_title     = param["to_title"];
            todo.to_content   = param["content"];

            todo.to_send_user_id   = HCQ2UI_Helper.OperateContext.Current.Usr.user_id;
            todo.to_send_user_name = HCQ2UI_Helper.OperateContext.Current.Usr.user_name;
            todo.to_send_date      = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            if (HCQ2UI_Helper.OperateContext.Current.Usr.login_name == "develop")
            {
                todo.is_system = 1;
            }
            else
            {
                todo.is_system = 0;
            }
            todo.to_remove = 0;

            return(base.Add(todo) > 0);
        }
示例#4
0
        /// <summary>
        /// 自动写入上报提示
        /// </summary>
        /// <param name="user_id"></param>
        public void WriteRepostLog(int user_id)
        {
            List <HCQ2_Model.TreeModel.B01PerTreeModel> treeList = HCQ2UI_Helper.OperateContext.Current.bllSession.B01.GetB01PerData(user_id);

            if (treeList.Count() > 0)
            {
                List <B01>    unitList  = new B01BLL().GetB01Info();
                StringBuilder sbContent = new StringBuilder();
                //根据项目挨个循环,获取上报未上报项目,人员信息
                foreach (var item in treeList)
                {
                    if (sbContent.Length > 0)
                    {
                        sbContent.Append("<br />");
                    }
                    string UnitID = item.UnitID;
                    B01    Unit   = unitList.Where(o => o.UnitID == UnitID).FirstOrDefault();
                    if (Unit.if_upload == "1")
                    {
                        sbContent.AppendFormat("<strong style='color:Blue'>" + Unit.UnitName + "</strong>:项目信息<strong>已经上报!</strong>");
                    }
                    else
                    {
                        sbContent.AppendFormat("<strong style='color:Red'>" + Unit.UnitName + "</strong>:项目信息<strong style='color:red;'>未上报!</strong>");
                    }

                    List <A01> userList = new A01BLL().GetByUnitID(UnitID);

                    List <A01> accUserList = userList.Where(o => o.if_uparchive == "1").ToList();
                    if (accUserList.Count() > 0)
                    {
                        sbContent.AppendFormat("<br /><strong style='color:blue;'>已上报的人员总数");
                        sbContent.AppendFormat(":{0}</strong>", accUserList.Count());
                    }

                    List <A01> lowUserList = userList.Where(o => o.if_uparchive == "0" || o.if_uparchive == null || o.if_uparchive == "").ToList();
                    if (lowUserList.Count() > 0)
                    {
                        sbContent.AppendFormat("<br /><strong style='color:red;'>未上报的人员总数");
                        sbContent.AppendFormat(":{0}</strong>", lowUserList.Count());
                    }
                }

                //推送
                if (sbContent.Length > 0)
                {
                    List <T_TodoList> todoList = Select(o => o.to_user_id == user_id.ToString() &&
                                                        o.to_title.Contains("上报消息") && o.to_send_user_id == 1 && o.to_send_user_name == "管理员");
                    if (todoList.Count() > 0)
                    {
                        foreach (var to in todoList)
                        {
                            int to_id = to.to_id;
                            Delete(o => o.to_id == to_id);
                        }
                    }

                    T_TodoList todo = new T_TodoList();
                    todo.to_user_id        = user_id.ToString();
                    todo.to_user_name      = HCQ2UI_Helper.OperateContext.Current.Usr.user_name;
                    todo.to_title          = "上报消息" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    todo.to_content        = sbContent.ToString();
                    todo.to_send_user_id   = 1;
                    todo.to_send_user_name = "管理员";
                    todo.to_send_date      = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    todo.is_system         = 1;
                    todo.to_remove         = 0;
                    Add(todo);
                }
            }
        }