/// <summary>
        /// 根据类别获取新闻通知
        /// </summary>
        /// <returns></returns>
        public List <HCQ2_Model.AppModel.Message> GetNoticeByType(HCQ2_Model.AppModel.NoticeModel notice, string appUrl)
        {
            HCQ2_Model.AppModel.Message        mes   = new HCQ2_Model.AppModel.Message();
            List <HCQ2_Model.AppModel.Message> rlist = new List <HCQ2_Model.AppModel.Message>();
            List <T_MessageNotice>             list  = new List <T_MessageNotice>();
            T_ItemCodeBLL      codeList     = new T_ItemCodeBLL();
            T_ItemCodeMenumBLL codeMenuList = new T_ItemCodeMenumBLL();
            string             news_type    = codeMenuList.GetByItemId(codeList.GetByItemCode("NewsType").item_id).
                                              Where(o => o.code_value == notice.type).FirstOrDefault()?.code_name;
            var data = GetAllMess().Where(o => o.m_type == news_type).Skip((notice.rows * notice.page) - notice.rows).Take(notice.rows);

            if (data.Count() > 0)
            {
                list = data.ToList();
                foreach (var item in list)
                {
                    mes = new HCQ2_Model.AppModel.Message();
                    mes.notice_title     = item.m_title;
                    mes.notice_content   = "";
                    mes.notice_type      = item.m_type;
                    mes.notice_image     = null;
                    mes.notice_image_src = "";
                    mes.release_name     = item.create_user_name;
                    if (!string.IsNullOrEmpty(item.create_date.ToString()))
                    {
                        mes.release_date = Convert.ToDateTime(item.create_date).ToString("yyyy-MM-dd");
                    }
                    rlist.Add(mes);
                }
            }
            return(rlist);
        }
Beispiel #2
0
        private string GetItemCodeMenuTreeJson(List <T_ItemCodeMenum> list)
        {
            T_ItemCodeMenumBLL     codeMenuBll = new T_ItemCodeMenumBLL();
            List <T_ItemCodeMenum> listMenu    = codeMenuBll.GetItemCodeMenu();

            sbChild.Append("[");
            T_ItemCodeMenum itemCodeMenum = new T_ItemCodeMenum();

            for (int i = 0; i < list.Count; i++)
            {
                if (i != 0)
                {
                    sbChild.Append(" , ");
                }
                itemCodeMenum = list[i];
                sbChild.Append(AddModleItemMenu(itemCodeMenum));
                var data = listMenu.Where(o => o.code_pid == itemCodeMenum.code_id);
                if (data.Count() > 0)
                {
                    sbChild.Append(" ,nodes:  ");
                    GetItemCodeMenuTreeJson(data.ToList());
                    sbChild.Append(" } ");
                }
                else
                {
                    sbChild.Append(" } ");
                }
            }
            sbChild.Append("]");
            return(sbChild.ToString());
        }
Beispiel #3
0
        /// <summary>
        /// 获取所有的字典目录树t_itemcode第一级目录
        /// </summary>
        /// <returns></returns>
        public string GetItemTreeJson(List <T_ItemCode> listItemCode)
        {
            T_ItemCodeMenumBLL     codeMenuBll = new T_ItemCodeMenumBLL();
            List <T_ItemCodeMenum> listMenu    = codeMenuBll.GetItemCodeMenu();

            sbJson.Append("[");
            T_ItemCode itemCode = new T_ItemCode();

            for (int i = 0; i < listItemCode.Count; i++)
            {
                if (i != 0)
                {
                    sbJson.Append(" , ");
                }
                itemCode = listItemCode[i];
                sbJson.Append(AddModleItem(itemCode));
                var data = listMenu.Where(o => o.item_id == itemCode.item_id && o.code_pid == 0);
                if (data.Count() > 0)
                {
                    sbJson.Append(" ,nodes:  ");
                    sbJson.Append(GetItemCodeMenuTreeJson(data.ToList()));
                    sbChild = new StringBuilder();
                    sbJson.Append(" } ");
                }
                else
                {
                    sbJson.Append(" } ");
                }
            }
            sbJson.Append("]");
            return(sbJson.ToString());
        }
Beispiel #4
0
        /// <summary>
        /// 编辑数据字典
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public bool EditItemCode(object obj)
        {
            bool           isAccess        = false;
            FormCollection param           = (FormCollection)obj;
            int            code_id         = int.Parse(param["code_id"]);
            int            item_id         = int.Parse(param["item_id"]);
            string         item_type       = param["item_type"];
            string         input_item_name = param["input_name"];
            string         input_item_code = param["input_code"];
            string         input_item_note = param["input_note"];
            string         code_type       = param["code_type"];

            if (item_type == "M")
            {
                T_ItemCode itemcode = new T_ItemCode();
                itemcode.item_name = input_item_name;
                itemcode.item_code = input_item_code;
                itemcode.item_note = input_item_note;
                isAccess           = base.Modify(itemcode, o => o.item_id == item_id, "item_name", "item_code", "item_note") > 0;
            }
            else if (item_type == "N")
            {
                T_ItemCodeMenumBLL menu_bll = new T_ItemCodeMenumBLL();
                T_ItemCodeMenum    menu     = new T_ItemCodeMenum();
                menu.code_name  = input_item_name;
                menu.code_value = input_item_code;
                menu.code_note  = input_item_note;
                menu.code_type  = code_type;
                isAccess        = menu_bll.Modify(menu, o => o.code_id == code_id, "code_name", "code_value", "code_note", "code_type") > 0;
            }

            return(isAccess);
        }
Beispiel #5
0
        /// <summary>
        /// 删除数据字典
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public bool DeleteItemCode(object obj)
        {
            bool           isAccess  = false;
            FormCollection param     = (FormCollection)obj;
            string         code_type = param["item_type"];

            if (code_type == "M")
            {
                int item_id = int.Parse(param["item_id"]);
                isAccess = base.Delete(o => o.item_id == item_id) > 0;
                T_ItemCodeMenumBLL menuBll = new T_ItemCodeMenumBLL();
                menuBll.Delete(o => o.item_id == item_id);
            }
            else if (code_type == "N")
            {
                int code_id = int.Parse(param["code_id"]);
                T_ItemCodeMenumBLL menuBll = new T_ItemCodeMenumBLL();
                isAccess = menuBll.Delete(o => o.code_id == code_id) > 0;
                menuBll.Delete(o => o.code_pid == code_id);
            }
            return(isAccess);
        }
Beispiel #6
0
        /// <summary>
        /// 根据企业类别统计人数
        /// </summary>
        /// <returns></returns>
        public List <Dictionary <string, object> > GetCompayQXLB()
        {
            List <Dictionary <string, object> > rList = new List <Dictionary <string, object> >();
            Dictionary <string, object>         rDic  = new Dictionary <string, object>();

            StringBuilder sbSql = new StringBuilder();

            sbSql.AppendFormat("select a.QXLB,PersonCount=(select COUNT(*) from A01 where UnitID=b.UnitID) from B01 b");
            sbSql.AppendFormat(" inner join T_CompProInfo a on b.in_compay=a.com_id");
            sbSql.AppendFormat(" where in_compay>0 order by in_compay");
            DataTable dt = HCQ2_Common.SQL.SqlHelper.ExecuteDataTable(sbSql.ToString());

            double                 totlePerson = Convert.ToDouble(dt.Compute("sum(PersonCount)", "true"));
            T_ItemCode             itemCode    = new T_ItemCodeBLL().GetByItemCode("QYLSZBFB");
            List <T_ItemCodeMenum> menuList    = new T_ItemCodeMenumBLL().GetByItemId(itemCode.item_id);

            double percent01 = 0;
            double percent02 = 0;

            foreach (var item in menuList)
            {
                rDic = new Dictionary <string, object>();

                rDic.Add("name", item.code_name);
                var data = dt.Select("QXLB='" + item.code_value + "'");
                if (data.Count() > 0)
                {
                    double count = Convert.ToDouble(data.CopyToDataTable().Compute("sum(PersonCount)", "true"));
                    rDic.Add("value", count / totlePerson);

                    if (item.code_value == "01")
                    {
                        percent01 = count / totlePerson;
                    }
                    if (item.code_value == "02")
                    {
                        percent02 = count / totlePerson;
                    }
                }
                else
                {
                    rDic.Add("value", 0);

                    if (item.code_value == "01")
                    {
                        percent01 = 0;
                    }
                    if (item.code_value == "02")
                    {
                        percent02 = 0;
                    }
                }

                if (item.code_value != "01" && item.code_value != "02")
                {
                    rList.Add(rDic);
                }
            }

            //合并工程类总包和工程类分包
            rDic = new Dictionary <string, object>();
            rDic.Add("name", "建筑");
            rDic.Add("value", (percent01 + percent02));
            rList.Add(rDic);

            return(rList);
        }
Beispiel #7
0
        /// <summary>
        /// 新增数据字典
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public bool AddItemCode(object obj)
        {
            bool           isAccess = false;
            FormCollection param    = (FormCollection)obj;
            string         code_id  = param["code_id"];
            string         item_id  = param["item_id"];

            string input_item_name = param["input_name"];
            string input_item_code = param["input_code"];
            string input_item_note = param["input_note"];
            string input_code_type = param["input_code_type"];

            if (string.IsNullOrEmpty(item_id) && string.IsNullOrEmpty(code_id))
            {
                //如果有相同的code,则不能添加。
                if (base.Select(o => o.item_code == input_item_code).Count() > 0)
                {
                    return(isAccess);
                }

                //添加字典说明表
                T_ItemCode itemCode = new T_ItemCode();
                itemCode.item_name    = input_item_name;
                itemCode.item_code    = input_item_code;
                itemCode.item_note    = input_item_note;
                itemCode.creator_date = DateTime.Now;
                itemCode.creator_id   = HCQ2UI_Helper.OperateContext.Current.Usr.user_id;
                itemCode.creator_name = HCQ2UI_Helper.OperateContext.Current.Usr.user_name;
                isAccess = base.Add(itemCode) > 0;
            }
            else if (!string.IsNullOrEmpty(item_id) && string.IsNullOrEmpty(code_id))
            {
                //添加第一层字典表
                T_ItemCodeMenumBLL codeBll = new T_ItemCodeMenumBLL();

                //如果有相同的code,则不能添加。
                if (codeBll.GetByItemId(int.Parse(item_id)).Where(o => o.code_value == input_item_code).Count() > 0)
                {
                    return(isAccess);
                }

                T_ItemCodeMenum codeMenu = codeBll.GetByItemId(int.Parse(item_id)).Where(o => o.code_pid == 0).LastOrDefault();
                int?            maxOrder = codeMenu != null ? codeMenu.code_order + 1 : 1;
                codeMenu            = new T_ItemCodeMenum();
                codeMenu.item_id    = int.Parse(item_id);
                codeMenu.code_name  = input_item_name;
                codeMenu.code_value = input_item_code;
                codeMenu.code_note  = input_item_note;
                codeMenu.if_system  = 0;
                codeMenu.if_child   = 0;
                codeMenu.code_pid   = 0;
                codeMenu.code_order = maxOrder;
                if (!string.IsNullOrEmpty(input_code_type))
                {
                    codeMenu.code_type = input_code_type;
                }
                isAccess = codeBll.Add(codeMenu) > 0;
            }
            else if (!string.IsNullOrEmpty(item_id) && !string.IsNullOrEmpty(code_id))
            {
                //添加字典表字典的子节点
                T_ItemCodeMenumBLL codeBll = new T_ItemCodeMenumBLL();

                //如果有相同的code,则不能添加。
                if (codeBll.GetByItemId(int.Parse(item_id)).Where(o => o.code_value == input_item_code).Count() > 0)
                {
                    return(isAccess);
                }

                T_ItemCodeMenum codeMenu = codeBll.GetByItemId(int.Parse(item_id)).Where(o => o.code_pid == int.Parse(code_id)).Max();
                int?            maxOrder = codeMenu != null ? codeMenu.code_order + 1 : 1;
                codeMenu            = new T_ItemCodeMenum();
                codeMenu.item_id    = int.Parse(item_id);
                codeMenu.code_name  = input_item_name;
                codeMenu.code_value = input_item_code;
                codeMenu.code_note  = input_item_note;
                codeMenu.if_system  = 0;
                codeMenu.if_child   = 0;
                codeMenu.code_pid   = int.Parse(code_id);
                codeMenu.code_order = maxOrder;
                if (!string.IsNullOrEmpty(input_code_type))
                {
                    codeMenu.code_type = input_code_type;
                }
                isAccess = codeBll.Add(codeMenu) > 0;
            }
            return(isAccess);
        }
Beispiel #8
0
        /// <summary>
        /// 返回页面的json
        /// </summary>
        /// <returns></returns>
        public string ReturnPageJson(object obj)
        {
            FormCollection         param             = (FormCollection)obj;
            T_ItemCodeMenumBLL     _bll_codeitemmenu = new T_ItemCodeMenumBLL();
            List <T_ItemCodeMenum> list = _bll_codeitemmenu.GetItemCodeMenu();
            int page = int.Parse(param["page"]);
            int rows = int.Parse(param["rows"]);

            if (!string.IsNullOrEmpty(param["item_id"]))
            {
                list = list.Where(o => o.item_id == int.Parse(param["item_id"])).ToList();
            }
            if (!string.IsNullOrEmpty(param["code_id"]))
            {
                list = list.Where(o => o.code_id == int.Parse(param["code_id"])).ToList();
            }
            if (!string.IsNullOrEmpty(param["txtSearchName"]))
            {
                list = list.Where(o => o.code_name.Contains(param["txtSearchName"])).ToList();
            }

            List <T_ItemCode> listItemCode = GetItemCode();

            if (!string.IsNullOrEmpty(param["item_id"]))
            {
                listItemCode = listItemCode.Where(o => o.item_id == int.Parse(param["item_id"])).ToList();
            }
            if (!string.IsNullOrEmpty(param["code_id"]))
            {
                listItemCode = listItemCode.Where(o => o.item_id == -1).ToList();
            }
            if (!string.IsNullOrEmpty(param["txtSearchName"]))
            {
                listItemCode = listItemCode.Where(o => o.item_name.Contains(param["txtSearchName"])).ToList();
            }

            DisplayCode        dis         = new DisplayCode();
            List <DisplayCode> displayList = new List <DisplayCode>();

            if (listItemCode.Count() > 0)
            {
                for (int i = 0; i < listItemCode.Count(); i++)
                {
                    dis            = new DisplayCode();
                    dis.code_id    = 0;
                    dis.code_name  = listItemCode[i].item_name;
                    dis.code_value = listItemCode[i].item_code;
                    dis.code_note  = listItemCode[i].item_note;
                    dis.item_id    = listItemCode[i].item_id;
                    dis.item_type  = "M";
                    displayList.Add(dis);
                }
            }
            if (list.Count() > 0)
            {
                for (int i = 0; i < list.Count(); i++)
                {
                    dis            = new DisplayCode();
                    dis.code_id    = list[i].code_id;
                    dis.code_name  = list[i].code_name;
                    dis.code_value = list[i].code_value;
                    dis.code_note  = list[i].code_note;
                    dis.item_id    = list[i].item_id;
                    dis.code_type  = list[i].code_type;
                    dis.item_type  = "N";
                    displayList.Add(dis);
                }
            }
            return(HCQ2_Common.ReturnJson.GetReturnJson <DisplayCode>(displayList, page, rows));
        }