SVN r536
SVN-Revision: r536
This commit is contained in:
@@ -22,6 +22,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.Control.Model
|
||||
@@ -2787,6 +2788,24 @@ namespace Lskj.Control.Model
|
||||
/// <returns>返回保存成功于否</returns>
|
||||
public bool SaveBaseModuleData(string menuCode, string tableName, string primaryKey, ref string primaryValue, bool isAdd = true, string leftField = "", bool isTip = true, int newVer = 0)
|
||||
{
|
||||
//保存前执行某个右键
|
||||
if (!string.IsNullOrEmpty(SystemModel.BeforeSaveExec))
|
||||
{
|
||||
DataRow menuRow = BaseModuleImpl.GetBaseGridRightMenuById(SystemModel.BeforeSaveExec);
|
||||
if (menuRow != null)
|
||||
{
|
||||
CommonMenu menu = new CommonMenu(Model, this, MainGridEx);
|
||||
//menu.ApplyBefore += new CommonToolApplyEventHandler(OnMenuApplyBefore);
|
||||
//menu.DynamicLinkAfter += new CommonToolAfterDynamicLinkEventHandler(OnDynamicLinkAfter);
|
||||
StaticControl.RightMenuGridView = MainGridEx.GridView;
|
||||
StaticControl.RightMenuMyControl = this;
|
||||
menu.Apply(menuRow);
|
||||
if (!menu.issuccess)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
string execSql = string.Empty;
|
||||
if (string.IsNullOrWhiteSpace(tableName))
|
||||
{
|
||||
@@ -2957,6 +2976,44 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
if (isTip) MessageUtil.Show(ResourceKeys.SaveSuccess);
|
||||
#endregion
|
||||
#region 保存成功后上传附件
|
||||
string idValue = primaryValue;
|
||||
if (!string.IsNullOrWhiteSpace(SystemModel.AttachmentAssociated))
|
||||
{
|
||||
idValue = GetControlValue(SystemModel.AttachmentAssociated);
|
||||
}
|
||||
List<ControlModel> uploadModels = ControlModels.Where(n => n.FileUploadControl).ToList();
|
||||
foreach (ControlModel uploadModel in uploadModels)
|
||||
{
|
||||
BaseUserControl uploadControl = FindControl(uploadModel);
|
||||
if (uploadControl != null && uploadControl is LabelRemarkEdit labelRemarkEdit && !string.IsNullOrEmpty(labelRemarkEdit.filepath) && File.Exists(labelRemarkEdit.filepath))
|
||||
{
|
||||
string filePath = labelRemarkEdit.filepath;
|
||||
string token = UploadFileUtil.Login(SystemInfo.Instance.OAUrl);
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
{
|
||||
string speciesno = "010106";
|
||||
byte[] fileBytes = UploadFileUtil.ConvertFileToBytes(filePath);
|
||||
string fileStream = Convert.ToBase64String(fileBytes);
|
||||
string postUrl = "{0}Api/FileUploadApi.ashx?moduleId={1}&idValue={2}&speciesno={8}&folder={3}&totsize={4}&position={5}&filename={6}&method={7}";
|
||||
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, Model.ModuleCode, HttpUtility.UrlEncode(idValue), "file", fileBytes.Length, 0, HttpUtility.UrlEncode(Path.GetFileName(filePath)), "DoWebUpload", speciesno);
|
||||
bool isUpload = UploadFileUtil.UploadFile(token, postUrl, fileStream, out string fileId, out string rtnMsg);
|
||||
if (!isUpload)
|
||||
{
|
||||
MessageUtil.Show($"自动上传失败\r\n{rtnMsg}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show($"登录失败,自动上传失败");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show($"未选择附件,自动上传失败");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
//if (Autogrowcolumn.Equals(primaryKey, StringComparison.CurrentCultureIgnoreCase))
|
||||
//{
|
||||
// primaryValue = "LskjIdebtity" + SqlHelper.ExecuteScalar(string.Format("SELECT {0} FROM P_EmployeePostTab WHERE {0} = @@IDENTITY", Autogrowcolumn)) + "";
|
||||
@@ -3323,7 +3380,7 @@ namespace Lskj.Control.Model
|
||||
SerSearchBoxDataSource(baseControl, controlValue + "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (baseControl is LabelImageEdit)
|
||||
{
|
||||
LabelImageEdit imageEdit = baseControl as LabelImageEdit;
|
||||
|
||||
Reference in New Issue
Block a user