160 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			160 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | |
| using System;
 | |
| using System.Collections.Generic;
 | |
| 
 | |
| namespace FineUIPro.Web.TestRun.DriverSummary
 | |
| {
 | |
|     public partial class CompleteSummaryEdit : PageBase
 | |
|     {
 | |
|         #region 加载
 | |
|         /// <summary>
 | |
|         /// 页面加载
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 BLL.UserService.InitUserDropDownList(this.drpSummaryPerson, this.CurrUser.LoginProjectId, false);
 | |
|                 string id = Request.Params["id"];
 | |
|                 if (!string.IsNullOrEmpty(id))
 | |
|                 {
 | |
|                     Model.Driver_DriverSummary data = BLL.DriverSummaryService.GetDriverSummaryById(id);
 | |
|                     if (data != null)
 | |
|                     {
 | |
|                         this.hdId.Text = id;
 | |
|                         this.txtDriverSummaryCode.Text = data.DriverSummaryCode;
 | |
|                         if (!string.IsNullOrEmpty(data.SummaryPerson))
 | |
|                         {
 | |
|                             this.drpSummaryPerson.SelectedValue = data.SummaryPerson;
 | |
|                         }
 | |
|                         WindowAtt_Close(null, null);
 | |
|                         WindowAtt2_Close(null, null);
 | |
|                     }
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.drpSummaryPerson.SelectedValue = this.CurrUser.UserId;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 附件上传
 | |
|         /// <summary>
 | |
|         /// 附件上传
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnAttach_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (string.IsNullOrEmpty(this.hdId.Text))   //新增记录
 | |
|             {
 | |
|                 this.hdId.Text = SQLHelper.GetNewID(typeof(Model.Driver_DriverSummary));
 | |
|             }
 | |
|             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverSummary/CompleteSummary&menuId={1}&strParam=1", this.hdId.Text, BLL.Const.CompleteSummaryMenuId)));
 | |
|         }
 | |
|         protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
 | |
|         {
 | |
|             this.lbtnAttach.Text = string.Empty;
 | |
|             string url = string.Empty;
 | |
|             var attLists = BLL.AttachFileService.Getfiles(this.hdId.Text + "#1", BLL.Const.CompleteSummaryMenuId);
 | |
|             if (attLists != null)
 | |
|             {
 | |
|                 List<string> lists = Funs.GetStrListByStr(attLists.AttachUrl, ',');
 | |
|                 if (lists.Count > 0)
 | |
|                 {
 | |
|                     foreach (var item in lists)
 | |
|                     {
 | |
|                         url += item.Substring(item.IndexOf('_') + 1) + "\r\n";
 | |
|                     }
 | |
|                 }
 | |
|                 if (!string.IsNullOrEmpty(url))
 | |
|                 {
 | |
|                     this.lbtnAttach.Text = url;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 签字版附件
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnAttach2_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (string.IsNullOrEmpty(this.hdId.Text))   //新增记录
 | |
|             {
 | |
|                 this.hdId.Text = SQLHelper.GetNewID(typeof(Model.Driver_DriverSummary));
 | |
|             }
 | |
|             PageContext.RegisterStartupScript(WindowAtt2.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverSummary/CompleteSummary&menuId={1}&strParam=2", this.hdId.Text, BLL.Const.CompleteSummaryMenuId)));
 | |
|         }
 | |
| 
 | |
|         protected void WindowAtt2_Close(object sender, WindowCloseEventArgs e)
 | |
|         {
 | |
|             this.lbtnAttach2.Text = string.Empty;
 | |
|             string url = string.Empty;
 | |
|             var attLists = BLL.AttachFileService.Getfiles(this.hdId.Text + "#2", BLL.Const.CompleteSummaryMenuId);
 | |
|             if (attLists != null)
 | |
|             {
 | |
|                 List<string> lists = Funs.GetStrListByStr(attLists.AttachUrl, ',');
 | |
|                 if (lists.Count > 0)
 | |
|                 {
 | |
|                     foreach (var item in lists)
 | |
|                     {
 | |
|                         url += item.Substring(item.IndexOf('_') + 1) + "\r\n";
 | |
|                     }
 | |
|                 }
 | |
|                 if (!string.IsNullOrEmpty(url))
 | |
|                 {
 | |
|                     this.lbtnAttach2.Text = url;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 保存
 | |
|         /// <summary>
 | |
|         /// 保存按钮
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnSave_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (string.IsNullOrEmpty(this.drpSummaryPerson.SelectedValue))
 | |
|             {
 | |
|                 Alert.ShowInTop("请选择总结人", MessageBoxIcon.Warning);
 | |
|                 return;
 | |
|             }
 | |
|             string id = Request.Params["id"];
 | |
|             Model.Driver_DriverSummary newData = new Model.Driver_DriverSummary();
 | |
|             newData.DriverSummaryCode = this.txtDriverSummaryCode.Text.Trim();
 | |
|             newData.SummaryPerson = this.drpSummaryPerson.SelectedValue;
 | |
|             newData.SubmitDate = DateTime.Now;
 | |
|             newData.ProjectId = this.CurrUser.LoginProjectId;
 | |
|             if (!string.IsNullOrEmpty(id))
 | |
|             {
 | |
|                 newData.DriverSummaryId = id;
 | |
|                 BLL.DriverSummaryService.UpdateDriverSummary(newData);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 newData.SummaryType = "3";
 | |
|                 if (!string.IsNullOrEmpty(this.hdId.Text))
 | |
|                 {
 | |
|                     newData.DriverSummaryId = this.hdId.Text.Trim();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     newData.DriverSummaryId = SQLHelper.GetNewID(typeof(Model.Driver_DriverSummary));
 | |
|                     this.hdId.Text = newData.DriverSummaryId;
 | |
|                 }
 | |
|                 BLL.DriverSummaryService.AddDriverSummary(newData);
 | |
|             }
 | |
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | |
|             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |