1
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using Model;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.UI.WebControls;
|
||||
@@ -825,5 +827,188 @@ namespace BLL
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
#region 获取集团单位列表
|
||||
|
||||
/// <summary>
|
||||
/// 获取集团单位列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.BaseInfoItem> getUnitLists()
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
List<Model.BaseInfoItem> list = new List<Model.BaseInfoItem>();
|
||||
try
|
||||
{
|
||||
string baseurl = $"{SysConstSetService.CNCECPath}/api/Unit/getUnitLists";
|
||||
// string baseurl = "http://localhost:7143/api/Unit/getUnitLists";
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", ServerService.GetToken().Token }
|
||||
};
|
||||
var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, newToken, null);
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
responeData.code = Funs.GetNewIntOrZero(obj["code"].ToString());
|
||||
responeData.message = obj["message"].ToString();
|
||||
if (responeData.code == 1)
|
||||
{
|
||||
JArray getData = JArray.Parse(obj["data"].ToString());
|
||||
if (getData.Count() > 0)
|
||||
{
|
||||
foreach (var item in getData)
|
||||
{
|
||||
var q = new Model.BaseInfoItem();
|
||||
q.BaseInfoId = item["BaseInfoId"].ToString();
|
||||
q.BaseInfoName = item["BaseInfoName"].ToString();
|
||||
q.BaseInfoCode = item["BaseInfoCode"].ToString();
|
||||
list.Add(q);
|
||||
}
|
||||
}
|
||||
responeData.message = "获取成功:集团单位数" + getData.Count().ToString() + "条";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "获取失败:" + ex.Message;
|
||||
ErrLogInfo.WriteLog("获取集团单位列表!", ex);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 根据单位获取项目列表
|
||||
|
||||
/// <summary>
|
||||
/// 获取集团单位列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.BaseInfoItem> getProjectListByUnitId(string userId)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
List<Model.BaseInfoItem> list = new List<Model.BaseInfoItem>();
|
||||
try
|
||||
{
|
||||
string baseurl = $"{SysConstSetService.CNCECPath}/api/Unit/getProjectListByUnitId?unitId=" + userId + "&projectName=" + "&pageIndex=0";
|
||||
// string baseurl = "http://localhost:7143/api/Unit/getProjectListByUnitId?unitId=" + userId + "&projectName=" + "&pageIndex=0" ;
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", ServerService.GetToken().Token }
|
||||
};
|
||||
var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, newToken, null);
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
responeData.code = Funs.GetNewIntOrZero(obj["code"].ToString());
|
||||
responeData.message = obj["message"].ToString();
|
||||
if (responeData.code == 1)
|
||||
{
|
||||
JArray getData = JArray.Parse(obj["data"].ToString());
|
||||
if (getData.Count() > 0)
|
||||
{
|
||||
foreach (var item in getData)
|
||||
{
|
||||
var q = new Model.BaseInfoItem();
|
||||
q.BaseInfoId = item["BaseInfoId"].ToString();
|
||||
q.BaseInfoName = item["BaseInfoName"].ToString();
|
||||
q.BaseInfoCode = item["BaseInfoCode"].ToString();
|
||||
list.Add(q);
|
||||
}
|
||||
}
|
||||
responeData.message = "获取成功:集团项目数" + getData.Count().ToString() + "条";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "获取失败:" + ex.Message;
|
||||
ErrLogInfo.WriteLog("获取集团项目数!", ex);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 根据单位id获取单位信息列表
|
||||
|
||||
/// <summary>
|
||||
/// 获取集团单位列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string getUnitApiUrlByUnitId(string userId)
|
||||
{
|
||||
string url = "";
|
||||
try
|
||||
{
|
||||
string baseurl = $"{SysConstSetService.CNCECPath}/api/Unit/getUnitApiUrlByUnitId?unitId=" + userId;
|
||||
// string baseurl = "http://localhost:7143/api/Unit/getUnitApiUrlByUnitId?unitId=" + userId;
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", ServerService.GetToken().Token }
|
||||
};
|
||||
var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, newToken, null);
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
if (Funs.GetNewIntOrZero(obj["code"].ToString()) == 1)
|
||||
{
|
||||
if (obj["data"] != null)
|
||||
{
|
||||
JObject dataObj = obj["data"] as JObject;
|
||||
if (dataObj != null && dataObj["BaseInfoCode"] != null)
|
||||
{
|
||||
url = dataObj["BaseInfoCode"].ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrLogInfo.WriteLog("获取失败!", ex);
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 获取分公司表下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName"></param>
|
||||
/// <param name="isShowPlease"></param>
|
||||
public static void InitBranchUnitDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "UnitId";
|
||||
dropName.DataTextField = "UnitName";
|
||||
dropName.DataSource = BLL.UnitService.GetMainAndSubUnitList();
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前单位下分公司拉选项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Unit> GetMainAndSubUnitList()
|
||||
{
|
||||
return (from x in Funs.DB.Base_Unit where x.UnitId == BLL.Const.UnitId_SEDIN || x.IsBranch == true select x).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user