SVN r575
SVN-Revision: r575
This commit is contained in:
@@ -24,7 +24,9 @@ namespace Lskj.Control
|
||||
public string FileName = string.Empty;
|
||||
public string URL = string.Empty;
|
||||
public bool isBatchDownLoad = false;
|
||||
|
||||
public bool isprompt = true;
|
||||
public bool isMultiple = false;//是否为忽略多选
|
||||
public bool isOpenvisble = false;//是否为忽略多选
|
||||
public string ModelId= string.Empty;//菜单名称
|
||||
public string MenuName = string.Empty;//右键名称
|
||||
public string MenuId = string.Empty;//菜单ID
|
||||
@@ -53,7 +55,8 @@ namespace Lskj.Control
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!isBatchDownLoad) this.Opacity = 100D;
|
||||
if (!isBatchDownLoad && !isMultiple) this.Opacity = 100D;
|
||||
if (isOpenvisble) this.btnOpen.Visible = false;
|
||||
this.labUrl.EditText = URL;
|
||||
this.labName.EditText = FileName;
|
||||
string FOLDER_NAME = isBatchDownLoad ? ConstModel.Batch_FOLDER_NAME : ConstModel.TEMP_FOLDER_NAME;
|
||||
@@ -67,6 +70,7 @@ namespace Lskj.Control
|
||||
|
||||
|
||||
if (isBatchDownLoad) this.btnDownload.PerformClick();
|
||||
if (isMultiple) this.btnDownload.PerformClick();
|
||||
if (SystemInfo.Instance.HiddenUrl)
|
||||
{
|
||||
this.labUrl.Visible = false;
|
||||
@@ -145,7 +149,7 @@ namespace Lskj.Control
|
||||
MessageUtil.Show("请选择下载路径!");
|
||||
return;
|
||||
}
|
||||
FrmDownload frm = new FrmDownload(labUrl.EditText, labName.EditText, labAddress.EditText);
|
||||
FrmDownload frm = new FrmDownload(labUrl.EditText, labName.EditText, labAddress.EditText,false, isprompt);
|
||||
frm.isBatchPrind = isBatchDownLoad;
|
||||
|
||||
if (frm.ShowDialog() == DialogResult.OK)
|
||||
@@ -321,35 +325,4 @@ namespace Lskj.Control
|
||||
}
|
||||
if (string.IsNullOrEmpty(FileName))
|
||||
{
|
||||
MessageUtil.Show("请填写下载的文件名称!");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(DownloadPath))
|
||||
{
|
||||
MessageUtil.Show("请选择下载路径!");
|
||||
return;
|
||||
}
|
||||
FrmDownload frm = new FrmDownload(URL, FileName, DownloadPath);
|
||||
frm.RightDisplay = RightDisplay;
|
||||
|
||||
if (frm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
frm.Dispose();
|
||||
if (isBatchDownLoad)
|
||||
{
|
||||
PrintFile(labAddress.EditText);
|
||||
File.Delete(labAddress.EditText);
|
||||
}
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Close();
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show("下载附件出错!" + Message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
MessageUtil.Show("请填写下载的文件名��
|
||||
@@ -393,6 +393,7 @@ namespace Lskj.Control.Model
|
||||
|
||||
string actionSql = string.Empty;
|
||||
bool execOnlyOne = IsExecOnlyOne(model, paramListEx, rows, out actionSql);
|
||||
|
||||
bool tipOnlyOne = true; // 执行是否提示一次
|
||||
bool allowBefore = ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.BeforeModuleContextMenu, Model.ModuleCode, model.Id);
|
||||
bool allowAfter = ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleContextMenu, Model.ModuleCode, model.Id);
|
||||
@@ -1223,146 +1224,146 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
else
|
||||
{
|
||||
List<string> procParams = ReplaceHelper.GetParamFields(procName);
|
||||
if (procParams.Count == 0)
|
||||
int filequency = 0;
|
||||
bool isOpenvisble = rows.Count() > 0;
|
||||
foreach (DataRow dataRow in rows)
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ProcNameSettingFault);
|
||||
return false;
|
||||
}
|
||||
string[] paramStr = procParams[0].Replace("{", "").Replace("}", "").Split(',');
|
||||
List<SqlParameter> sqlParamList = new List<SqlParameter>();
|
||||
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
||||
SqlParameter pComfirmFlag = new SqlParameter("@comfirmFlag", SqlDbType.Int);
|
||||
for (int i = 0; i < paramStr.Length; i++)
|
||||
{
|
||||
string item = paramStr[i];
|
||||
if (paramStr[i].Equals("@msg", StringComparison.OrdinalIgnoreCase))
|
||||
List<string> procParams = ReplaceHelper.GetParamFields(procName);
|
||||
if (procParams.Count == 0)
|
||||
{
|
||||
pMsg.Direction = ParameterDirection.InputOutput;
|
||||
pMsg.Value = string.IsNullOrEmpty(paramList[i]) ? "" : paramList[i];
|
||||
sqlParamList.Add(pMsg);
|
||||
MessageUtil.Show(ResourceKeys.ProcNameSettingFault);
|
||||
return false;
|
||||
}
|
||||
else if (paramStr[i].Equals("@comfirmFlag", StringComparison.OrdinalIgnoreCase))
|
||||
string[] paramStr = procParams[0].Replace("{", "").Replace("}", "").Split(',');
|
||||
List<SqlParameter> sqlParamList = new List<SqlParameter>();
|
||||
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
||||
SqlParameter pComfirmFlag = new SqlParameter("@comfirmFlag", SqlDbType.Int);
|
||||
paramList = this.HandleRightMenuParams(model.ParamList, dataRow, null, model.ActionType);
|
||||
for (int i = 0; i < paramStr.Length; i++)
|
||||
{
|
||||
pComfirmFlag.Value = comfirmFlag;
|
||||
sqlParamList.Add(pComfirmFlag);
|
||||
}
|
||||
else
|
||||
{
|
||||
string paramStr1 = paramStr[i];
|
||||
SqlParameter param = new SqlParameter(string.Format("{0}", paramStr1), SqlDbType.VarChar);
|
||||
param.Value = paramList[i];
|
||||
sqlParamList.Add(param);
|
||||
}
|
||||
}
|
||||
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
||||
returnValue.Direction = ParameterDirection.ReturnValue;
|
||||
sqlParamList.Add(returnValue);
|
||||
try
|
||||
{
|
||||
DataSet dataSet = SqlHelper.ExecuteDataSet(4, procName.Replace(procParams[0], "").Trim(), "temp", sqlParamList.ToArray());
|
||||
DataTable dataTable = dataSet.Tables[0];
|
||||
string urls = dataTable != null && dataTable.Rows.Count > 0 && dataTable.Columns.Contains("webpath") ? dataTable.Rows[0]["webpath"] + "" : "";
|
||||
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"] + "" : "";
|
||||
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))
|
||||
string item = paramStr[i];
|
||||
if (paramStr[i].Equals("@msg", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
JObject jObject = JsonConvert.DeserializeObject<JObject>(loginResult);
|
||||
if (jObject.ContainsKey("success"))
|
||||
{
|
||||
if ((jObject["success"] + "").Equals("True"))
|
||||
{
|
||||
if (jObject.ContainsKey("token"))
|
||||
{
|
||||
token = jObject["token"] + "";
|
||||
}
|
||||
}
|
||||
}
|
||||
pMsg.Direction = ParameterDirection.InputOutput;
|
||||
pMsg.Value = string.IsNullOrEmpty(paramList[i]) ? "" : paramList[i];
|
||||
sqlParamList.Add(pMsg);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
else if (paramStr[i].Equals("@comfirmFlag", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string downUrl = string.Format("{0}Api/FileUploadApi.ashx", SystemInfo.Instance.OAUrl);
|
||||
Dictionary<string, string> parmarsDic = new Dictionary<string, string>();
|
||||
parmarsDic.Add("userid", HttpUtility.UrlEncode(ERPInfo.Instance.UserId));
|
||||
parmarsDic.Add("username", HttpUtility.UrlEncode(ERPInfo.Instance.UserName));
|
||||
parmarsDic.Add("password", HttpUtility.UrlEncode(ERPInfo.Instance.InPassWord));
|
||||
parmarsDic.Add("method", HttpUtility.UrlEncode("DownLoadFiels"));
|
||||
parmarsDic.Add("urls", HttpUtility.UrlEncode(urls));
|
||||
parmarsDic.Add("moduleid", HttpUtility.UrlEncode(model.MenuTabName));
|
||||
parmarsDic.Add("idvalue", HttpUtility.UrlEncode(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();
|
||||
pComfirmFlag.Value = comfirmFlag;
|
||||
sqlParamList.Add(pComfirmFlag);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show($"登录验证失败\r\n{loginResult}");
|
||||
string paramStr1 = paramStr[i];
|
||||
SqlParameter param = new SqlParameter(string.Format("{0}", paramStr1), SqlDbType.VarChar);
|
||||
param.Value = paramList[i];
|
||||
sqlParamList.Add(param);
|
||||
}
|
||||
}
|
||||
else
|
||||
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
||||
returnValue.Direction = ParameterDirection.ReturnValue;
|
||||
sqlParamList.Add(returnValue);
|
||||
try
|
||||
{
|
||||
MessageUtil.Show("操作失败,未查询到数据");
|
||||
DataSet dataSet = SqlHelper.ExecuteDataSet(4, procName.Replace(procParams[0], "").Trim(), "temp", sqlParamList.ToArray());
|
||||
DataTable dataTable = dataSet.Tables[0];
|
||||
string urls = dataTable != null && dataTable.Rows.Count > 0 && dataTable.Columns.Contains("webpath") ? dataTable.Rows[0]["webpath"] + "" : "";
|
||||
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"] + "" : "";
|
||||
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);
|
||||
Dictionary<string, string> parmarsDic = new Dictionary<string, string>();
|
||||
parmarsDic.Add("userid", HttpUtility.UrlEncode(ERPInfo.Instance.UserId));
|
||||
parmarsDic.Add("username", HttpUtility.UrlEncode(ERPInfo.Instance.UserName));
|
||||
parmarsDic.Add("password", HttpUtility.UrlEncode(ERPInfo.Instance.InPassWord));
|
||||
parmarsDic.Add("method", HttpUtility.UrlEncode("DownLoadFiels"));
|
||||
parmarsDic.Add("urls", HttpUtility.UrlEncode(urls));
|
||||
parmarsDic.Add("moduleid", HttpUtility.UrlEncode(model.MenuTabName));
|
||||
parmarsDic.Add("idvalue", HttpUtility.UrlEncode(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();
|
||||
if (filequency > 0) frmSelectDownload.isMultiple = true;
|
||||
frmSelectDownload.isprompt = filequency + 1 == rows.Count();
|
||||
frmSelectDownload.URL = downLoadUrl;
|
||||
frmSelectDownload.isOpenvisble = isOpenvisble;
|
||||
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.ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show(jsonObject["msg"] + "");
|
||||
}
|
||||
}
|
||||
response.GetResponseStream().Close();
|
||||
response.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show($"登录验证失败\r\n{loginResult}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show("操作失败,未查询到数据");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SqlException ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageUtil.Show(ex.Message);
|
||||
}
|
||||
int rValue = Convert.ToInt32(returnValue.Value);
|
||||
switch (rValue)
|
||||
{
|
||||
case -1:
|
||||
MessageUtil.Show(string.IsNullOrEmpty(model.ErrorMsg) ? ResourceKeys.OperFault + "\n" + pMsg.Value : model.ErrorMsg);
|
||||
reaultValue = false;
|
||||
break;
|
||||
catch (SqlException ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageUtil.Show(ex.Message);
|
||||
}
|
||||
filequency++;
|
||||
}
|
||||
return reaultValue;
|
||||
}
|
||||
@@ -1498,6 +1499,7 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
isOnlyOne = true;
|
||||
}
|
||||
isOnlyOne = model.ActionType == 5 ? true : isOnlyOne;//批量下载默认只循环一次
|
||||
return isOnlyOne;
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user