|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 根据用户名获取公告列表 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="user"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("GG_Notice/notices")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object getNotices(string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | List<object> columnNameList = new List<object>(); | 
|---|
|  |  |  | var sql = "select top(10) m.HMakeDate as 日期, m.HLevel as 状况, m.HContext as 主题 " + | 
|---|
|  |  |  | ", m.HContext as 内容" + | 
|---|
|  |  |  | ", m.HSendMan as 发送人, s.HReceiveMan as 接收人, d.HName as 发送部门 " + | 
|---|
|  |  |  | " from OA_InformBillMain as m" + | 
|---|
|  |  |  | " inner join OA_InformBillSub as s on m.HInterID = s.HInterID" + | 
|---|
|  |  |  | " left join Gy_Department d on m.HDeptID = d.HItemID" + | 
|---|
|  |  |  | " where 1 = 1 and" + " s.HReceiveMan =" + "'" + user + "'" + | 
|---|
|  |  |  | " order by m.HMakeDate desc"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ds = new SQLHelper.ClsCN().RunProcReturn(sql, "OA_InformBillMain"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //添加列名 | 
|---|
|  |  |  | foreach (DataColumn col in ds.Tables[0].Columns) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Type dataType = col.DataType; | 
|---|
|  |  |  | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
|---|
|  |  |  | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "Sucess!"; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | objJsonResult.list = columnNameList; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch(Exception ex) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|