xinjiang/SGGL/FineUIPro.Web/HSSE/EduTrain/TaskRecordView.aspx.cs

90 lines
3.9 KiB
C#

using System;
using System.Linq;
using BLL;
namespace FineUIPro.Web.HSSE.EduTrain
{
public partial class TaskRecordView : PageBase
{
#region
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
var q = BLL.TrainingItemService.GetTrainingItemByTrainingItemId(Request.QueryString["TrainingEduItemId"]);
if (q != null)
{
this.txtTrainingEduItemCode.Text = q.TrainingItemCode;
this.txtTrainingEduItemName.Text = q.TrainingItemName;
//this.txtSummary.Text = q.Summary;
//this.txtInstallationNames.Text = q.InstallationNames;
//if (!string.IsNullOrEmpty(q.PictureUrl))
//{
// this.trImageUrl.Visible = true;
// this.divPictureUrl.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", q.PictureUrl);
// this.divBeImageUrl.InnerHtml = BLL.UploadAttachmentService.ShowImage("../", q.PictureUrl);
//}
if (!string.IsNullOrEmpty(q.AttachUrl))
{
this.divAttachUrl.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../../", q.AttachUrl);
}
}
else
{
var q1 = BLL.CompanyTrainingItemService.GetCompanyTrainingItemById(Request.QueryString["TrainingEduItemId"]);
if (q1 != null)
{
this.txtTrainingEduItemCode.Text = q1.CompanyTrainingItemCode;
this.txtTrainingEduItemName.Text = q1.CompanyTrainingItemName;
//this.txtSummary.Text = q.Summary;
//this.txtInstallationNames.Text = q.InstallationNames;
//if (!string.IsNullOrEmpty(q.PictureUrl))
//{
// this.trImageUrl.Visible = true;
// this.divPictureUrl.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", q.PictureUrl);
// this.divBeImageUrl.InnerHtml = BLL.UploadAttachmentService.ShowImage("../", q.PictureUrl);
//}
this.divAttachUrl.InnerHtml = GetBtnFileUrl(q1.CompanyTrainingItemId);
}
}
}
}
#endregion
public static string GetBtnFileUrl(object toKey)
{
string fileUrl = string.Empty;
if (toKey != null)
{
Model.AttachFile file = Funs.DB.AttachFile.FirstOrDefault(e => e.ToKeyId == toKey.ToString());
if (file != null && !string.IsNullOrEmpty(file.AttachUrl))
{
string url = file.AttachUrl.Replace('\\', '/');
fileUrl = BLL.UploadAttachmentService.ShowAttachment2("../../", url);
}
}
return fileUrl;
}
#region
/// <summary>
/// 上传附件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAttachUrlC_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Training&menuId={1}&type=-1", Request.QueryString["TrainingEduItemId"], BLL.Const.TrainDBMenuId)));
}
#endregion
}
}