SVN r424
SVN-Revision: r424
This commit is contained in:
@@ -1131,48 +1131,79 @@ namespace Lskj.Control.Model
|
||||
string fileDownTitle = dataTable != null && dataTable.Rows.Count > 0 && dataTable.Columns.Contains("fileTitle") ? dataTable.Rows[0]["fileTitle"] + "" : "";
|
||||
if (!string.IsNullOrWhiteSpace(urls))
|
||||
{
|
||||
string downUrl = string.Format("{0}Api/FileUploadApi.ashx", SystemInfo.Instance.OAUrl);
|
||||
Dictionary<string, string> parmarsDic = new Dictionary<string, string>();
|
||||
parmarsDic.Add("userid", ERPInfo.Instance.UserId);
|
||||
parmarsDic.Add("username", ERPInfo.Instance.UserName);
|
||||
parmarsDic.Add("password", ERPInfo.Instance.InPassWord);
|
||||
parmarsDic.Add("method", "DownLoadFiels");
|
||||
parmarsDic.Add("urls", urls);
|
||||
parmarsDic.Add("moduleid", model.MenuTabName);
|
||||
parmarsDic.Add("idvalue", idvalue);
|
||||
HttpTools.setting("application/x-www-form-urlencoded", null, null);
|
||||
//HttpWebResponse response = HttpTools.Post(downUrl, "", parmarsDic, HttpTools.Method.POST);
|
||||
HttpWebResponse response = HttpTools.Post(downUrl, "", parmarsDic, null, HttpTools.Method.POST);
|
||||
|
||||
string result = new StreamReader(response.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||
if (response != null && !string.IsNullOrEmpty(result))
|
||||
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 jsonObject = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(result);
|
||||
string isSuccess = jsonObject["success"] + "";
|
||||
if (isSuccess.Equals("True", StringComparison.CurrentCultureIgnoreCase))
|
||||
JObject jObject = JsonConvert.DeserializeObject<JObject>(loginResult);
|
||||
if (jObject.ContainsKey("success"))
|
||||
{
|
||||
string zipPathUrl = jsonObject["data"] + "";
|
||||
string downLoadUrl = string.Format("{0}{1}", SystemInfo.Instance.OAUrl, zipPathUrl.TrimStart('/'));
|
||||
FrmSelectDownload frmSelectDownload = new FrmSelectDownload();
|
||||
frmSelectDownload.URL = downLoadUrl;
|
||||
|
||||
frmSelectDownload.ModelId = model.MenuTabName;
|
||||
frmSelectDownload.MenuName = model.MenuName;
|
||||
frmSelectDownload.MenuId = model.Id + "";
|
||||
|
||||
string[] szName = zipPathUrl.Split('/');
|
||||
string fileTitle = !string.IsNullOrWhiteSpace(fileDownTitle) ? fileDownTitle : szName[szName.Length - 1];
|
||||
frmSelectDownload.FileName = fileTitle;
|
||||
//frmSelectDownload.TopMost = true;
|
||||
frmSelectDownload.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show(jsonObject["msg"] + "");
|
||||
if ((jObject["success"] + "").Equals("True"))
|
||||
{
|
||||
if (jObject.ContainsKey("token"))
|
||||
{
|
||||
token = jObject["token"] + "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
response.GetResponseStream().Close();
|
||||
response.Close();
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
{
|
||||
string downUrl = string.Format("{0}Api/FileUploadApi.ashx", SystemInfo.Instance.OAUrl);
|
||||
Dictionary<string, string> parmarsDic = new Dictionary<string, string>();
|
||||
parmarsDic.Add("userid", ERPInfo.Instance.UserId);
|
||||
parmarsDic.Add("username", ERPInfo.Instance.UserName);
|
||||
parmarsDic.Add("password", ERPInfo.Instance.InPassWord);
|
||||
parmarsDic.Add("method", "DownLoadFiels");
|
||||
parmarsDic.Add("urls", urls);
|
||||
parmarsDic.Add("moduleid", model.MenuTabName);
|
||||
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);
|
||||
//HttpWebResponse response = HttpTools.Post(downUrl, "", parmarsDic, HttpTools.Method.POST);
|
||||
HttpWebResponse response = HttpTools.Post(downUrl, "", parmarsDic, headerDic, HttpTools.Method.POST);
|
||||
|
||||
string result = new StreamReader(response.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||
if (response != null && !string.IsNullOrEmpty(result))
|
||||
{
|
||||
JObject jsonObject = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(result);
|
||||
string isSuccess = jsonObject["success"] + "";
|
||||
if (isSuccess.Equals("True", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
string zipPathUrl = jsonObject["data"] + "";
|
||||
string downLoadUrl = string.Format("{0}{1}", SystemInfo.Instance.OAUrl, zipPathUrl.TrimStart('/'));
|
||||
FrmSelectDownload frmSelectDownload = new FrmSelectDownload();
|
||||
frmSelectDownload.URL = downLoadUrl;
|
||||
|
||||
frmSelectDownload.ModelId = model.MenuTabName;
|
||||
frmSelectDownload.MenuName = model.MenuName;
|
||||
frmSelectDownload.MenuId = model.Id + "";
|
||||
|
||||
string[] szName = zipPathUrl.Split('/');
|
||||
string fileTitle = !string.IsNullOrWhiteSpace(fileDownTitle) ? fileDownTitle : szName[szName.Length - 1];
|
||||
frmSelectDownload.FileName = fileTitle;
|
||||
//frmSelectDownload.TopMost = true;
|
||||
frmSelectDownload.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show(jsonObject["msg"] + "");
|
||||
}
|
||||
}
|
||||
response.GetResponseStream().Close();
|
||||
response.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show($"登录验证失败\r\n{loginResult}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1470,28 +1501,4 @@ namespace Lskj.Control.Model
|
||||
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
||||
if (dataRows.Length == 0)
|
||||
{
|
||||
string addColSql = string.Format("alter table P_PrivateDllTab add {0} {1}", colunmField.Key, colunmField.Value);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
string a
|
||||
Reference in New Issue
Block a user