SVN r424
SVN-Revision: r424
This commit is contained in:
@@ -1130,6 +1130,30 @@ namespace Lskj.Control.Model
|
|||||||
string idvalue = dataTable != null && dataTable.Rows.Count > 0 && dataTable.Columns.Contains("keyvalue") ? dataTable.Rows[0]["keyvalue"] + "" : "";
|
string idvalue = dataTable != null && dataTable.Rows.Count > 0 && dataTable.Columns.Contains("keyvalue") ? dataTable.Rows[0]["keyvalue"] + "" : "";
|
||||||
string fileDownTitle = dataTable != null && dataTable.Rows.Count > 0 && dataTable.Columns.Contains("fileTitle") ? dataTable.Rows[0]["fileTitle"] + "" : "";
|
string fileDownTitle = dataTable != null && dataTable.Rows.Count > 0 && dataTable.Columns.Contains("fileTitle") ? dataTable.Rows[0]["fileTitle"] + "" : "";
|
||||||
if (!string.IsNullOrWhiteSpace(urls))
|
if (!string.IsNullOrWhiteSpace(urls))
|
||||||
|
{
|
||||||
|
string token = "";
|
||||||
|
string loginUrl = $"{SystemInfo.Instance.OAUrl}/Api/SysUserAjaxApi.ashx";
|
||||||
|
HttpTools.setting("application/x-www-form-urlencoded", null, null, HttpTools.Encode.UTF8);
|
||||||
|
Dictionary<string, string> loginPmsDic = new Dictionary<string, string>();
|
||||||
|
loginPmsDic.Add("method", "Login");
|
||||||
|
loginPmsDic.Add("username", ERPInfo.Instance.UserName);
|
||||||
|
loginPmsDic.Add("password", ERPInfo.Instance.InPassWord);
|
||||||
|
HttpWebResponse loginResponse = HttpTools.Post(loginUrl, "", loginPmsDic, HttpTools.Method.POST, out CookieCollection loginCookie, out string loginResult);
|
||||||
|
if (loginResponse != null && !string.IsNullOrEmpty(loginResult))
|
||||||
|
{
|
||||||
|
JObject jObject = JsonConvert.DeserializeObject<JObject>(loginResult);
|
||||||
|
if (jObject.ContainsKey("success"))
|
||||||
|
{
|
||||||
|
if ((jObject["success"] + "").Equals("True"))
|
||||||
|
{
|
||||||
|
if (jObject.ContainsKey("token"))
|
||||||
|
{
|
||||||
|
token = jObject["token"] + "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(token))
|
||||||
{
|
{
|
||||||
string downUrl = string.Format("{0}Api/FileUploadApi.ashx", SystemInfo.Instance.OAUrl);
|
string downUrl = string.Format("{0}Api/FileUploadApi.ashx", SystemInfo.Instance.OAUrl);
|
||||||
Dictionary<string, string> parmarsDic = new Dictionary<string, string>();
|
Dictionary<string, string> parmarsDic = new Dictionary<string, string>();
|
||||||
@@ -1140,9 +1164,11 @@ namespace Lskj.Control.Model
|
|||||||
parmarsDic.Add("urls", urls);
|
parmarsDic.Add("urls", urls);
|
||||||
parmarsDic.Add("moduleid", model.MenuTabName);
|
parmarsDic.Add("moduleid", model.MenuTabName);
|
||||||
parmarsDic.Add("idvalue", idvalue);
|
parmarsDic.Add("idvalue", idvalue);
|
||||||
|
Dictionary<string, string> headerDic = new Dictionary<string, string>();
|
||||||
|
headerDic.Add("Authorization", $"Bearer {token}");
|
||||||
HttpTools.setting("application/x-www-form-urlencoded", null, null);
|
HttpTools.setting("application/x-www-form-urlencoded", null, null);
|
||||||
//HttpWebResponse response = HttpTools.Post(downUrl, "", parmarsDic, HttpTools.Method.POST);
|
//HttpWebResponse response = HttpTools.Post(downUrl, "", parmarsDic, HttpTools.Method.POST);
|
||||||
HttpWebResponse response = HttpTools.Post(downUrl, "", parmarsDic, null, HttpTools.Method.POST);
|
HttpWebResponse response = HttpTools.Post(downUrl, "", parmarsDic, headerDic, HttpTools.Method.POST);
|
||||||
|
|
||||||
string result = new StreamReader(response.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
string result = new StreamReader(response.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||||
if (response != null && !string.IsNullOrEmpty(result))
|
if (response != null && !string.IsNullOrEmpty(result))
|
||||||
@@ -1175,6 +1201,11 @@ namespace Lskj.Control.Model
|
|||||||
response.Close();
|
response.Close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
MessageUtil.Show($"登录验证失败\r\n{loginResult}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
MessageUtil.Show("操作失败,未查询到数据");
|
MessageUtil.Show("操作失败,未查询到数据");
|
||||||
}
|
}
|
||||||
@@ -1470,28 +1501,4 @@ namespace Lskj.Control.Model
|
|||||||
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
||||||
if (dataRows.Length == 0)
|
if (dataRows.Length == 0)
|
||||||
{
|
{
|
||||||
string addColSql = string.Format("alter table P_PrivateDllTab add {0} {1}", colunmField.Key, colunmField.Value);
|
string a
|
||||||
SqlHelper.ExecuteNonQuery(addColSql);//添加列
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string createTabSql = "create table P_PrivateDllTab(id int IDENTITY(1,1) NOT NULL,{0})";
|
|
||||||
string createCol = string.Empty;
|
|
||||||
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
||||||
{
|
|
||||||
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
|
|
||||||
}
|
|
||||||
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
|
|
||||||
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user