/// <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); }
/// <summary> /// 首页显示数据源JSON /// </summary> /// <param name="obj"></param> /// <returns></returns> public string ReturnPageJson(object obj) { FormCollection param = (FormCollection)obj; T_ItemCodeBLL itemCodeBll = new T_ItemCodeBLL(); T_ItemCode item_code = itemCodeBll.GetByItemCode("food_type"); List <T_ItemCodeMenum> list = GetByItemId(item_code.item_id); int page = int.Parse(param["page"]); int rows = int.Parse(param["rows"]); if (!string.IsNullOrEmpty(param["txtSearchName"])) { list = list.Where(o => o.code_name.Contains(param["txtSearchName"])).ToList(); } var data = list.Skip((page * rows) - rows).Take(rows).OrderByDescending(o => o.code_order); return("{\"total\":" + list.Count() + ",\"rows\":" + HCQ2_Common.JsonHelper.ObjectToJson(data) + "}"); }
/// <summary> /// 添加商品分类 /// </summary> /// <param name="code_name"></param> /// <param name="code_value"></param> /// <param name="code_note"></param> /// <returns></returns> public bool AddGoodsType(string code_name, string code_value, string code_note) { T_ItemCodeBLL itemCodeBll = new T_ItemCodeBLL(); T_ItemCode item_code = itemCodeBll.GetByItemCode("food_type"); if (item_code != null) { List <T_ItemCodeMenum> list = GetByItemId(item_code.item_id); T_ItemCodeMenum Menu = new T_ItemCodeMenum(); Menu.item_id = item_code.item_id; Menu.code_name = code_name; Menu.code_value = code_value; Menu.code_note = code_note; Menu.code_pid = 0; Menu.if_system = 0; Menu.if_child = 0; Menu.code_order = list == null ? 1 : list[list.Count() - 1].code_order + 1; return(base.Add(Menu) > 0); } else { return(false); } }
/// <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); }