2023-03-14 增加公司模板设置界面
This commit is contained in:
@@ -58,6 +58,8 @@ namespace FineUIPro.Web.CQMS.Plan
|
||||
this.drpPerson.DataSource = (from x in Funs.DB.Person_Persons where x.UnitId == Const.UnitId_SEDIN && x.DepartId == Const.Depart_constructionId select x).ToList();
|
||||
this.drpPerson.DataBind();
|
||||
Funs.FineUIPleaseSelect(this.drpPerson);
|
||||
BLL.Base_CompanytemplateService.InitBase_CompanyTemplateDownList(drpCompanyTemplate, true);
|
||||
IsHiddendrpCompanyTemplate();
|
||||
if (!string.IsNullOrEmpty(MainPlanId))
|
||||
{
|
||||
Model.Plan_MainPlan MainPlan = BLL.CQMS_MainPlanService.GetMainPlanByMainPlanId(MainPlanId);
|
||||
@@ -484,25 +486,61 @@ namespace FineUIPro.Web.CQMS.Plan
|
||||
if (!Directory.Exists(newPath))
|
||||
{
|
||||
Directory.CreateDirectory(newPath);
|
||||
}
|
||||
if (e.EventArgument == "Yes")
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
File.Copy(rootPath + Const.CQMSPlanTemplateUrl, path);
|
||||
|
||||
}
|
||||
}
|
||||
else if (e.EventArgument == "No")
|
||||
if (drpCompanyTemplate.SelectedValue!=Const._Null)
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
var stream= File.Create(path);
|
||||
stream.Close();
|
||||
}
|
||||
var template = BLL.Base_CompanytemplateService.GetBase_CompanyTemplateById(drpCompanyTemplate.SelectedValue);
|
||||
File.Copy(rootPath + template.FilePath, path);
|
||||
|
||||
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}|CQMSMainPlan", MainPlanId, "查看 -")));
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetHideReference());
|
||||
}
|
||||
private void GetCompanyTemplate()
|
||||
{
|
||||
string rootPath = Funs.RootPath;
|
||||
var model = BLL.CQMS_MainPlanService.GetMainPlanByMainPlanId(MainPlanId);
|
||||
string filepath = model.FilePath;
|
||||
string path = rootPath + filepath;
|
||||
DirectoryInfo pathInfo = new DirectoryInfo(path);
|
||||
string newPath = pathInfo.Parent.FullName;
|
||||
if (!Directory.Exists(newPath))
|
||||
{
|
||||
Directory.CreateDirectory(newPath);
|
||||
}
|
||||
if (drpCompanyTemplate.SelectedValue != Const._Null)
|
||||
{
|
||||
var template = BLL.Base_CompanytemplateService.GetBase_CompanyTemplateById(drpCompanyTemplate.SelectedValue);
|
||||
File.Copy(rootPath + template.FilePath, path);
|
||||
|
||||
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}|CQMSMainPlan", MainPlanId, "查看 -")));
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetHideReference());
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否隐藏选择模板
|
||||
/// </summary>
|
||||
protected void IsHiddendrpCompanyTemplate()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(MainPlanId))
|
||||
{
|
||||
Model.Plan_MainPlan MainPlan = BLL.CQMS_MainPlanService.GetMainPlanByMainPlanId(MainPlanId);
|
||||
if (!File.Exists(Funs.RootPath + MainPlan.FilePath))
|
||||
{
|
||||
|
||||
drpCompanyTemplate.Hidden= false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
drpCompanyTemplate.Hidden = false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
protected void btnEditWord_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -512,12 +550,12 @@ namespace FineUIPro.Web.CQMS.Plan
|
||||
Model.Plan_MainPlan MainPlan = BLL.CQMS_MainPlanService.GetMainPlanByMainPlanId(MainPlanId);
|
||||
if (!File.Exists(Funs.RootPath + MainPlan.FilePath))
|
||||
{
|
||||
|
||||
PageContext.RegisterStartupScript(Confirm.GetShowReference("是否使用公司模板?",
|
||||
String.Empty,
|
||||
MessageBoxIcon.Question,
|
||||
PageManager1.GetCustomEventReference("Yes"), // 第一个参数 false 用来指定当前不是AJAX请求
|
||||
PageManager1.GetCustomEventReference("No")));
|
||||
GetCompanyTemplate();
|
||||
//PageContext.RegisterStartupScript(Confirm.GetShowReference("是否使用公司模板?",
|
||||
// String.Empty,
|
||||
// MessageBoxIcon.Question,
|
||||
// PageManager1.GetCustomEventReference("Yes"), // 第一个参数 false 用来指定当前不是AJAX请求
|
||||
// PageManager1.GetCustomEventReference("No")));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -529,14 +567,9 @@ namespace FineUIPro.Web.CQMS.Plan
|
||||
else
|
||||
{
|
||||
SaveMainPlan("save");
|
||||
|
||||
PageContext.RegisterStartupScript(Confirm.GetShowReference("是否使用公司模板?",
|
||||
String.Empty,
|
||||
MessageBoxIcon.Question,
|
||||
PageManager1.GetCustomEventReference("Yes"), // 第一个参数 false 用来指定当前不是AJAX请求
|
||||
PageManager1.GetCustomEventReference("No")));
|
||||
GetCompanyTemplate();
|
||||
}
|
||||
//PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}", filepath, "查看 -")));
|
||||
}
|
||||
//PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}", filepath, "查看 -")));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user