189 lines
		
	
	
		
			8.5 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			189 lines
		
	
	
		
			8.5 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using BLL;
							 | 
						|||
| 
								 | 
							
								using Newtonsoft.Json.Linq;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Data;
							 | 
						|||
| 
								 | 
							
								using System.Data.SqlClient;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								using System.Web.UI.WebControls;
							 | 
						|||
| 
								 | 
							
								using AspNet = System.Web.UI.WebControls;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace FineUIPro.Web.CQMS.QualityActivity.QCManage
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class QCGroupRegistrationEdit : PageBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 主键
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        public string QCGroupRegistrationId
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return (string)ViewState["QCGroupRegistrationId"];
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            set
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ViewState["QCGroupRegistrationId"] = value;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        protected void Page_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (!IsPostBack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                // BLL.UnitService.InitProjectUnitDropDownList(this.drpUnitId, this.CurrUser.LoginProjectId, true);
							 | 
						|||
| 
								 | 
							
								                BLL.UnitService.InitAllUnitDownList(this.drpUnitId, true);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                QCGroupRegistrationId = Request.Params["QCGroupRegistrationId"];
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(QCGroupRegistrationId))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    hdId.Text = this.QCGroupRegistrationId;
							 | 
						|||
| 
								 | 
							
								                    Model.QCManage_QCGroupRegistration QCGroupRegistration = BLL.QCManage_QCGroupRegistrationService.GetQCGroupRegistrationByQCGroupRegistrationId(QCGroupRegistrationId);
							 | 
						|||
| 
								 | 
							
								                    this.txtCode.Text = QCGroupRegistration.Code;
							 | 
						|||
| 
								 | 
							
								                    this.txtName.Text = QCGroupRegistration.Name;
							 | 
						|||
| 
								 | 
							
								                    if (!string.IsNullOrEmpty(QCGroupRegistration.CompileMan))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.txtCompileMan.Text = UserService.GetUserNameByUserId(QCGroupRegistration.CompileMan);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (QCGroupRegistration.CompileDate != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", QCGroupRegistration.CompileDate);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (!string.IsNullOrEmpty(QCGroupRegistration.UnitId))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.drpUnitId.SelectedValue = QCGroupRegistration.UnitId;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    txtSubjects.Text = QCGroupRegistration.Subjects;
							 | 
						|||
| 
								 | 
							
								                    txtProcess.Text = QCGroupRegistration.Process;
							 | 
						|||
| 
								 | 
							
								                    txtAchievement.Text = QCGroupRegistration.Achievement;
							 | 
						|||
| 
								 | 
							
								                    txtAwardName.Text = QCGroupRegistration.AwardName;
							 | 
						|||
| 
								 | 
							
								                    if (!string.IsNullOrEmpty(QCGroupRegistration.AwardType))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        drpAwardType.SelectedValue = QCGroupRegistration.AwardType;
							 | 
						|||
| 
								 | 
							
								                        if (QCGroupRegistration.AwardType == "1") {
							 | 
						|||
| 
								 | 
							
								                            drpAwardLevel.Items.Add(new ListItem("鲁班奖", "1"));
							 | 
						|||
| 
								 | 
							
								                            drpAwardLevel.Items.Add(new ListItem("国优奖", "2"));
							 | 
						|||
| 
								 | 
							
								                            drpAwardLevel.Items.Add(new ListItem("省部级", "3"));
							 | 
						|||
| 
								 | 
							
								                            drpAwardLevel.Items.Add(new ListItem("市级", "4"));
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        else if (QCGroupRegistration.AwardType == "2") {
							 | 
						|||
| 
								 | 
							
								                            drpAwardLevel.Items.Add(new ListItem("省部级", "5"));
							 | 
						|||
| 
								 | 
							
								                            drpAwardLevel.Items.Add(new ListItem("集团级", "6"));
							 | 
						|||
| 
								 | 
							
								                            drpAwardLevel.Items.Add(new ListItem("企业级", "7"));
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (!string.IsNullOrEmpty(QCGroupRegistration.AwardLevel))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        drpAwardLevel.SelectedValue = QCGroupRegistration.AwardLevel;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    txtAwardingUnit.Text = QCGroupRegistration.AwardingUnit;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.txtCompileMan.Text = this.CurrUser.UserName;
							 | 
						|||
| 
								 | 
							
								                    txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void Grid1_Sort(object sender, GridSortEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void imgBtnFile_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (string.IsNullOrEmpty(hdId.Text))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                hdId.Text = SQLHelper.GetNewID();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../../AttachFile/webuploader.aspx?type=1&toKeyId={0}&path=FileUpload/QCGroupRegistration&menuId={1}", hdId.Text, BLL.Const.ProjectQCGroupRegistrationListMenuId)));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void btnSave_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Saveinspection("save");
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 保存
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        public void Saveinspection(string saveType)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Model.QCManage_QCGroupRegistration QCGroupRegistration = new Model.QCManage_QCGroupRegistration();
							 | 
						|||
| 
								 | 
							
								            QCGroupRegistration.ProjectId = this.CurrUser.LoginProjectId;
							 | 
						|||
| 
								 | 
							
								            QCGroupRegistration.Code = this.txtCode.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            QCGroupRegistration.Name = this.txtName.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            QCGroupRegistration.CompileMan = this.CurrUser.UserId;
							 | 
						|||
| 
								 | 
							
								            QCGroupRegistration.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text.Trim());
							 | 
						|||
| 
								 | 
							
								            if (this.drpUnitId.SelectedValue != BLL.Const._Null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                QCGroupRegistration.UnitId = this.drpUnitId.SelectedValue;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            QCGroupRegistration.Subjects = txtSubjects.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            QCGroupRegistration.Process = txtProcess.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            QCGroupRegistration.Achievement = txtAchievement.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            QCGroupRegistration.AwardName = txtAwardName.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(this.drpAwardType.SelectedValue))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                QCGroupRegistration.AwardType = this.drpAwardType.SelectedValue;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(this.drpAwardLevel.SelectedValue))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                QCGroupRegistration.AwardLevel = this.drpAwardLevel.SelectedValue;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            QCGroupRegistration.AwardingUnit = txtAwardingUnit.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(this.QCGroupRegistrationId))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                QCGroupRegistration.QCGroupRegistrationId = this.QCGroupRegistrationId;
							 | 
						|||
| 
								 | 
							
								                QCManage_QCGroupRegistrationService.UpdateQCGroupRegistration(QCGroupRegistration);
							 | 
						|||
| 
								 | 
							
								                LogService.AddSys_Log(CurrUser, QCGroupRegistration.Code, QCGroupRegistration.QCGroupRegistrationId, Const.ProjectQCGroupRegistrationListMenuId, "修改QC小组注册");
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (string.IsNullOrEmpty(hdId.Text))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    QCGroupRegistration.QCGroupRegistrationId = SQLHelper.GetNewID();
							 | 
						|||
| 
								 | 
							
								                    QCGroupRegistrationId = QCGroupRegistration.QCGroupRegistrationId;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    QCGroupRegistration.QCGroupRegistrationId = hdId.Text;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                QCManage_QCGroupRegistrationService.AddQCGroupRegistration(QCGroupRegistration);
							 | 
						|||
| 
								 | 
							
								                LogService.AddSys_Log(CurrUser, QCGroupRegistration.Code, QCGroupRegistration.QCGroupRegistrationId, Const.ProjectQCGroupRegistrationListMenuId, "增加QC小组注册");
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        
							 | 
						|||
| 
								 | 
							
								        protected void Change_AwardType(object sender, EventArgs eventArgs)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            
							 | 
						|||
| 
								 | 
							
								            drpAwardLevel.Items.Clear();
							 | 
						|||
| 
								 | 
							
								            drpAwardLevel.Items.Add(new ListItem("-请选择-", ""));
							 | 
						|||
| 
								 | 
							
								    
							 | 
						|||
| 
								 | 
							
								            if (drpAwardType.SelectedValue == "1") {
							 | 
						|||
| 
								 | 
							
								                drpAwardLevel.Items.Add(new ListItem("鲁班奖", "1"));
							 | 
						|||
| 
								 | 
							
								                drpAwardLevel.Items.Add(new ListItem("国优奖", "2"));
							 | 
						|||
| 
								 | 
							
								                drpAwardLevel.Items.Add(new ListItem("省部级", "3"));
							 | 
						|||
| 
								 | 
							
								                drpAwardLevel.Items.Add(new ListItem("市级", "4"));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else if (drpAwardType.SelectedValue == "2") {
							 | 
						|||
| 
								 | 
							
								                drpAwardLevel.Items.Add(new ListItem("省部级", "5"));
							 | 
						|||
| 
								 | 
							
								                drpAwardLevel.Items.Add(new ListItem("集团级", "6"));
							 | 
						|||
| 
								 | 
							
								                drpAwardLevel.Items.Add(new ListItem("企业级", "7"));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            // 设置选中第一项
							 | 
						|||
| 
								 | 
							
								            if (drpAwardLevel.Items.Count > 0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                drpAwardLevel.SelectedIndex = 0;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |