107 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			107 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using BLL;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace FineUIPro.Web.TestRun.DriverSummary
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class MonthSummaryEdit : PageBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        #region 加载
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 页面加载
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Page_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (!IsPostBack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                BLL.UnitWorkService.InitUnitWorkDropDownList(this.drpUnitWorkId, this.CurrUser.LoginProjectId, true);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                string id = Request.Params["id"];
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(id))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Model.Driver_DriverSummary data = BLL.DriverSummaryService.GetDriverSummaryById(id);
							 | 
						|||
| 
								 | 
							
								                    if (data != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.hdId.Text = id;
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(data.UnitWorkId))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.drpUnitWorkId.SelectedValue = data.UnitWorkId;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        this.txtDriverSummaryCode.Text = data.DriverSummaryCode;
							 | 
						|||
| 
								 | 
							
								                        this.txtSummary.Text = data.Summary;
							 | 
						|||
| 
								 | 
							
								                        this.txtSummaryPerson.Text = BLL.UserService.GetUserNameByUserId(data.SummaryPerson);
							 | 
						|||
| 
								 | 
							
								                        this.txtSubmitDate.Text = data.SubmitDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.SubmitDate) : "";
							 | 
						|||
| 
								 | 
							
								                        this.txtRemark.Text = data.Remark;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.txtSummaryPerson.Text = this.CurrUser.UserName;
							 | 
						|||
| 
								 | 
							
								                    this.txtSubmitDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #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/MonthSummary&menuId={1}", this.hdId.Text, BLL.Const.MonthSummaryMenuId)));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 保存
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 保存按钮
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnSave_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string id = Request.Params["id"];
							 | 
						|||
| 
								 | 
							
								            Model.Driver_DriverSummary newData = new Model.Driver_DriverSummary();
							 | 
						|||
| 
								 | 
							
								            if (this.drpUnitWorkId.SelectedValue != BLL.Const._Null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                newData.UnitWorkId = this.drpUnitWorkId.SelectedValue;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            newData.DriverSummaryCode = this.txtDriverSummaryCode.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.Summary = this.txtSummary.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.SummaryPerson = this.CurrUser.UserId;
							 | 
						|||
| 
								 | 
							
								            newData.SubmitDate = Funs.GetNewDateTime(this.txtSubmitDate.Text.Trim());
							 | 
						|||
| 
								 | 
							
								            newData.Remark = this.txtRemark.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.ProjectId = this.CurrUser.LoginProjectId;
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(id))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                newData.DriverSummaryId = id;
							 | 
						|||
| 
								 | 
							
								                BLL.DriverSummaryService.UpdateDriverSummary(newData);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                newData.SummaryType = "1";
							 | 
						|||
| 
								 | 
							
								                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
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |