diff --git a/SGGL/FineUIPro.Web/PZHGL/GJSX/GJSXListEdit.aspx.cs b/SGGL/FineUIPro.Web/PZHGL/GJSX/GJSXListEdit.aspx.cs index 6db6cb65..e98c97da 100644 --- a/SGGL/FineUIPro.Web/PZHGL/GJSX/GJSXListEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/PZHGL/GJSX/GJSXListEdit.aspx.cs @@ -57,8 +57,8 @@ namespace FineUIPro.Web.PZHGL.GJSX } } - public static DataTable Table=new DataTable (); - + public static DataTable Table = new DataTable(); + private static List GJSX_detail = new List(); #endregion @@ -72,7 +72,7 @@ namespace FineUIPro.Web.PZHGL.GJSX if (!IsPostBack) { string EditType = Request.Params["EditType"]; - string ID= Request.Params["ID"]; + string ID = Request.Params["ID"]; Table = null; UnitService.InitUnitDropDownList(this.DropUnitId, this.CurrUser.LoginProjectId, false); //专业 @@ -90,7 +90,7 @@ namespace FineUIPro.Web.PZHGL.GJSX UserService.InitUserDropDownList(DropNextRecipient, CurrUser.LoginProjectId, false, string.Empty); this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); - if (EditType=="add") + if (EditType == "add") { txtGJSXID.Readonly = true; txtUserID.Readonly = true; @@ -99,11 +99,11 @@ namespace FineUIPro.Web.PZHGL.GJSX this.nextProgress.Visible = false; - //编号 + //编号 string projectCode = BLL.ProjectService.GetProjectCodeByProjectId(this.CurrUser.LoginProjectId); this.txtGJSXID.Text = BLL.SQLHelper.RunProcNewId("Sp_GJSXGetNewCode", "GJSX", "GJSXID", projectCode); - - + + //当前时间 this.Date_CreateDate.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now); ///权限 @@ -142,8 +142,8 @@ namespace FineUIPro.Web.PZHGL.GJSX btnSave.Visible = false; TextIsEnable(false); //使文本不可编辑 - - Model.GJSX gjsx= BLL.GJSXService.GetGJSXById(ID); + + Model.GJSX gjsx = BLL.GJSXService.GetGJSXById(ID); List listStr = new List(); string projectId = this.CurrUser.LoginProjectId; if (gjsx != null) @@ -155,10 +155,10 @@ namespace FineUIPro.Web.PZHGL.GJSX listStr.Add(new SqlParameter("@sql_where", sql)); SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunProc("Sp_GJSX_getlist", parameter); - + if (tb != null && tb.Rows.Count > 0) { - txtGJSXID.Text = gjsx.GJSXID; + txtGJSXID.Text = gjsx.GJSXID; DropUnitId.SelectedValue = gjsx.UnitId; if (!string.IsNullOrEmpty(gjsx.CNProfessional_ID)) { @@ -180,28 +180,28 @@ namespace FineUIPro.Web.PZHGL.GJSX List list_User_ReceiveID = gjsx.User_ReceiveID.Split(',').ToList(); DropUser_ReceiveID.SelectedValueArray = list_User_ReceiveID.ToArray(); } - // Date_CloseDate.Text = tb.Rows[0]["CloseDate"].ToString(); + // Date_CloseDate.Text = tb.Rows[0]["CloseDate"].ToString(); txtDetail.Text = tb.Rows[0]["detail"].ToString(); txtUserID.Text = tb.Rows[0]["username"].ToString().Trim(); Date_CreateDate.Text = tb.Rows[0]["createDate"].ToString(); Date_CompleteDate.Text = tb.Rows[0]["CompleteDate"].ToString(); rblState.SelectedValue = gjsx.State.ToString().Trim(); - + } - if (this.CurrUser.UserId==BLL.Const.sysglyId||this.CurrUser.UserId==BLL.Const.SystemManager)//如果当前登录人是管理员 + if (this.CurrUser.UserId == BLL.Const.sysglyId || this.CurrUser.UserId == BLL.Const.SystemManager)//如果当前登录人是管理员 { - TextIsEnable(true); - txtGJSXID.Readonly = true; - this.Progress_detail.Visible = false; - this.nextProgress.Visible = false; - Grid2Binging(); + TextIsEnable(true); + txtGJSXID.Readonly = true; + this.Progress_detail.Visible = false; + this.nextProgress.Visible = false; + Grid2Binging(); } if (gjsx.UserID == this.CurrUser.UserId) //如果当前登录人是提出人 { rblIsClosed.Visible = false; - if (BLL.GJSXService.GetGJSXById(txtGJSXID.Text).State.Trim()=="1") + if (BLL.GJSXService.GetGJSXById(txtGJSXID.Text).State.Trim() == "1") { TextIsEnable(true); txtGJSXID.Readonly = true; @@ -214,7 +214,7 @@ namespace FineUIPro.Web.PZHGL.GJSX Grid2Binging(); } } - else if(gjsx.User_ReceiveID.Contains(this.CurrUser.UserId)) //接收者 + else if (!string.IsNullOrEmpty(gjsx.User_ReceiveID) && gjsx.User_ReceiveID.Contains(this.CurrUser.UserId)) //接收者 { rblIsClosed.Visible = false; btnSave.Visible = false; @@ -231,7 +231,7 @@ namespace FineUIPro.Web.PZHGL.GJSX btnSave.Visible = false; btnsubmit.Visible = false; } - if (gjsx.User_Acceptance.Contains(this.CurrUser.UserId)) //如果当前登录人为验收人 + if (!string.IsNullOrEmpty(gjsx.User_Acceptance) && gjsx.User_Acceptance.Contains(this.CurrUser.UserId)) //如果当前登录人为验收人 { rblIsClosed.Visible = true; btnSave.Visible = false; @@ -272,16 +272,16 @@ namespace FineUIPro.Web.PZHGL.GJSX //} if (IsClosed_ManyPeople()) { - this.nextProgress.Visible = true; - this.rblIsClosed.Visible = true; + this.nextProgress.Visible = true; + this.rblIsClosed.Visible = true; } else { this.rblIsClosed.Visible = false; - } + } } - if (BLL.GJSXService.GetGJSXById(this.txtGJSXID.Text).State.Trim()=="0") + if (BLL.GJSXService.GetGJSXById(this.txtGJSXID.Text).State.Trim() == "0") { Progress_detail.Enabled = false; nextProgress.Visible = false; @@ -289,33 +289,33 @@ namespace FineUIPro.Web.PZHGL.GJSX } } - + } } /// /// 文本框控件是否启用 /// - private void TextIsEnable( bool isStart ) + private void TextIsEnable(bool isStart) { - txtGJSXID.Enabled = isStart; - DropUnitId.Enabled = isStart; - DropCNProfessional_ID.Enabled = isStart; - txtUserID.Enabled = isStart; - Date_CreateDate.Enabled = isStart; - DropQuestionTypeID.Enabled = isStart; - DropUser_Acceptance.Enabled = isStart; - Date_CompleteDate.Enabled = isStart; - DropUser_ReceiveID.Enabled = isStart; - // Date_CloseDate.Enabled = isStart; - txtDetail.Enabled = isStart; - + txtGJSXID.Enabled = isStart; + DropUnitId.Enabled = isStart; + DropCNProfessional_ID.Enabled = isStart; + txtUserID.Enabled = isStart; + Date_CreateDate.Enabled = isStart; + DropQuestionTypeID.Enabled = isStart; + DropUser_Acceptance.Enabled = isStart; + Date_CompleteDate.Enabled = isStart; + DropUser_ReceiveID.Enabled = isStart; + // Date_CloseDate.Enabled = isStart; + txtDetail.Enabled = isStart; + } - + private void Grid2Binging() { - GJSX_detail = BLL.GJSXItemService.GetGJSXDetailByGJSXID(txtGJSXID.Text ); - if (rblState.SelectedValue.Trim()=="2") + GJSX_detail = BLL.GJSXItemService.GetGJSXDetailByGJSXID(txtGJSXID.Text); + if (rblState.SelectedValue.Trim() == "2") { Model.GJSX_detail detail = new Model.GJSX_detail { @@ -329,8 +329,8 @@ namespace FineUIPro.Web.PZHGL.GJSX GJSX_detail.Add(detail); } - - + + Grid2.RecordCount = GJSX_detail.Count; var table = this.GetPagedDataTable(Grid2, GJSX_detail); Table = table; @@ -354,9 +354,9 @@ namespace FineUIPro.Web.PZHGL.GJSX // 性别 UpdateDataRow("FilePath", rowDict, rowData); - + } - private DataRow FindRowByID(string rowID) + private DataRow FindRowByID(string rowID) { DataTable table = Table; foreach (DataRow row in table.Rows) @@ -371,7 +371,7 @@ namespace FineUIPro.Web.PZHGL.GJSX private void Grid2Save(Grid grid) { Dictionary> modifiedDict = Grid2.GetModifiedDict(); - if (modifiedDict!=null) + if (modifiedDict != null) { foreach (int rowIndex in modifiedDict.Keys) { @@ -380,17 +380,17 @@ namespace FineUIPro.Web.PZHGL.GJSX UpdateDataRow(modifiedDict[rowIndex], row); } } - Model.GJSX_detail _Detail = new Model.GJSX_detail(); - for (int i = 0; i < Table.Rows.Count; i++) - { - _Detail.Cuid = Table.Rows[i]["Cuid"].ToString(); - _Detail.GJSXID = Table.Rows[i]["GJSXID"].ToString(); - _Detail.Progress_user = Table.Rows[i]["Progress_user"].ToString(); - _Detail.Date = DateTime.Parse(Table.Rows[i]["Date"].ToString()); - _Detail.Progress_detail = Table.Rows[i]["Progress_detail"].ToString(); - _Detail.FilePath = Table.Rows[i]["FilePath"].ToString(); + Model.GJSX_detail _Detail = new Model.GJSX_detail(); + for (int i = 0; i < Table.Rows.Count; i++) + { + _Detail.Cuid = Table.Rows[i]["Cuid"].ToString(); + _Detail.GJSXID = Table.Rows[i]["GJSXID"].ToString(); + _Detail.Progress_user = Table.Rows[i]["Progress_user"].ToString(); + _Detail.Date = DateTime.Parse(Table.Rows[i]["Date"].ToString()); + _Detail.Progress_detail = Table.Rows[i]["Progress_detail"].ToString(); + _Detail.FilePath = Table.Rows[i]["FilePath"].ToString(); - Model.GJSX_detail isExit_detail = BLL.GJSXItemService.GetGJSXMXById(_Detail.Cuid); + Model.GJSX_detail isExit_detail = BLL.GJSXItemService.GetGJSXMXById(_Detail.Cuid); if (isExit_detail == null) { @@ -402,11 +402,11 @@ namespace FineUIPro.Web.PZHGL.GJSX BLL.GJSXItemService.UpdateGJSXdetail(_Detail); } } - - - + + + } - private void save(string state) + private void save(string state) { if (this.DropUnitId.SelectedValue == Const._Null) { @@ -513,7 +513,7 @@ namespace FineUIPro.Web.PZHGL.GJSX } } - if (rblIsClosed.SelectedValue== "true") + if (rblIsClosed.SelectedValue == "true") { gjsx.CloseDate = DateTime.Now; } @@ -532,28 +532,28 @@ namespace FineUIPro.Web.PZHGL.GJSX } protected void DropUser_ReceiveID_TextChanged(object sender, EventArgs e) { - if (DropUser_ReceiveID.SelectedItemArray.Length>1) + if (DropUser_ReceiveID.SelectedItemArray.Length > 1) { lblIsManyPeople.Hidden = false; - } + } } private bool IsClosed_ManyPeople() { - bool IsClosed_ManyPeople=true; - List gJSX_Process = BLL.GJSXProcessService.GetProcessListByGJSXID(txtGJSXID.Text); + bool IsClosed_ManyPeople = true; + List gJSX_Process = BLL.GJSXProcessService.GetProcessListByGJSXID(txtGJSXID.Text); foreach (var item in gJSX_Process) { - Model.GJSX_detail gJSX_Detail = BLL.GJSXItemService.GetGJSXItemByGJSXID(txtGJSXID.Text,item); - if (gJSX_Detail==null) + Model.GJSX_detail gJSX_Detail = BLL.GJSXItemService.GetGJSXItemByGJSXID(txtGJSXID.Text, item); + if (gJSX_Detail == null) { - IsClosed_ManyPeople= false; - } + IsClosed_ManyPeople = false; + } } return IsClosed_ManyPeople; - + } /// /// 提交 @@ -562,7 +562,7 @@ namespace FineUIPro.Web.PZHGL.GJSX /// protected void btnsubmit_Click(object sender, EventArgs e) { - if (rblIsClosed.SelectedValue== "true") + if (rblIsClosed.SelectedValue == "true") { save("0"); } @@ -570,14 +570,14 @@ namespace FineUIPro.Web.PZHGL.GJSX { save("2"); } - + string nextreceuserid = DropNextRecipient.SelectedValue; - + BLL.GJSXProcessService.DeleteProcess(this.txtGJSXID.Text); //先删除 List List_GJSXProcess = BLL.GJSXProcessService.GetProcessListByGJSXID(this.txtGJSXID.Text); - foreach (var item in this.DropUser_ReceiveID.SelectedValueArray) - { + foreach (var item in this.DropUser_ReceiveID.SelectedValueArray) + { if (item != BLL.Const._Null) { if (!List_GJSXProcess.Contains(item)) //不存在接收记录 @@ -585,21 +585,21 @@ namespace FineUIPro.Web.PZHGL.GJSX Model.GJSX_Process gJSX_Process = new Model.GJSX_Process() { ProcessID = Guid.NewGuid().ToString(), - GJSXID= txtGJSXID.Text, - UserId =item + GJSXID = txtGJSXID.Text, + UserId = item }; BLL.GJSXProcessService.AddProcess(gJSX_Process); //后添加 } - - } - } - if (Table !=null) + } + } + + if (Table != null) { Grid2.GetModifiedDict(); Grid2Save(Grid2); } - + if (nextreceuserid != null) { Model.GJSX gJSX = BLL.GJSXService.GetGJSXById(txtGJSXID.Text); @@ -688,6 +688,6 @@ namespace FineUIPro.Web.PZHGL.GJSX } #endregion - + } }