예제 #1
0
        /// <summary>
        /// 删除部门
        /// </summary>
        /// <param name="RowID"></param>
        /// <returns></returns>
        public ActionResult Delete(string RowID)
        {
            bll = operateContext.bllSession;
            string returnJson = bll.B01.Delete(o => o.RowID == RowID) > 0 ? "ok" : "find";

            if (returnJson == "ok")
            {
                B01    unit   = bll.B01.GetByRowID(RowID);
                string UnitID = unit.UnitID;
                bll.A01.Delete(o => o.UnitID == UnitID);
            }
            return(Content(returnJson));
        }
예제 #2
0
        public int AddWGJG01(WGJG01_Template model)
        {
            B01 b01 = DBSession.IB01DAL.Select(s => s.UnitID == model.UnitID).FirstOrDefault();

            if (b01 == null)
            {
                return(0);
            }
            WGJG01_Template wg = new WGJG01_Template()
            {
                B0001    = (b01.KeyParent.Equals(".")) ? model.UnitID : b01.KeyParent,
                B0002    = "",//(model.UnitID.Length == 3) ? "" : model.UnitID,
                UnitID   = model.UnitID,
                RowID    = EncryptHelper.Md5Encryption(OnlyCodeHelper.CreateOnlyCode()),
                WGJG0101 = model.WGJG0101,
                WGJG0103 = model.WGJG0103,
                WGJG0104 = model.WGJG0104,
                WGJG0106 = model.WGJG0106,
                WGJG0203 = model.WGJG0203,
                WGJGDAY  = model.WGJGDAY
            };

            return(Add(wg));
        }
예제 #3
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);
                }
            }
        }