//GridProjectAndPeople行命令 protected void GridProjectAndPeople_RowCommand(object sender, GridCommandEventArgs e) { try { List <int> selections = publicmethod.GridCount(GridProjectAndPeople, CBoxSelect); string Person = GridProjectAndPeople.Rows[e.RowIndex].Values[2].ToString(); string strs = bllUser.FindByLoginName(Session["LoginName"].ToString()).UserName; if (Person != strs && Convert.ToInt32(Session["SecrecyLevel"]) != 5) { string str = "您无对此行操作的权限!此行信息为" + Person + "录入,请与管理员联系!"; CBoxSelect.SetCheckedState(e.RowIndex, false); Alert.ShowInTop(str); } if (selections.Count == 0) { btnDelete.Enabled = false; return; } if (selections.Count != 0) { btnDelete.Enabled = true; return; } } catch (Exception ex) { publicmethod.SaveError(ex, this.Request); } }
//行点击事件 protected void Grid_Files_RowCommand(object sender, GridCommandEventArgs e) { try { string Person = Grid_Files.Rows[e.RowIndex].Values[2].ToString(); string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; if (Person != username && Convert.ToInt32(Session["SecrecyLevel"]) != 5) { string str = "您无对此行操作的权限!此行信息为" + Person + "录入,请与管理员联系!"; CBoxSelect.SetCheckedState(e.RowIndex, false); Alert.ShowInTop(str); } if (pm.GridCount(Grid_Files, CBoxSelect).Count == 0) { btnDelete.Enabled = false; return; } if (pm.GridCount(Grid_Files, CBoxSelect).Count != 0) { btnDelete.Enabled = true; return; } } catch (Exception ex) { pm.SaveError(ex, this.Request); } }
//编辑 protected void ButtonUpdate_Click(object sender, EventArgs e) { List <int> selections = new List <int>(); for (int i = 0; i < Grid_FurtherStudy.RecordCount; i++) { if (CBoxSelect.GetCheckedState(i)) { selections.Add(i); } } if (selections.Count() != 0) { if (selections.Count() == 1) { int rowID = Convert.ToInt32(Grid_FurtherStudy.DataKeys[selections[0]][0]); Session["FurID"] = rowID; //ButtonUpdate.OnClientClick = Window_UpdateFutherStudy.GetShowReference("Update_FutherStudy.aspx", "编辑"); Alert.Show("你确定要修改该行数据吗!", "确认消息", MessageBoxIcon.Information, Window_UpdateFutherStudy.GetShowReference("Update_FutherStudy.aspx", "编辑"), Target.Top); } else { Alert.Show("一次仅可以对一行进行编辑!"); } } else { Alert.Show("请选择一行!"); } }
protected void People_Info_RowCommand(object sender, GridCommandEventArgs e) { try { List <int> selections = publicmethod.GridCount(People_Info, CBoxSelect); if (Convert.ToInt32(Session["SecrecyLevel"]) != 5) { string str = "您无对此行操作的权限,请与管理员联系!"; CBoxSelect.SetCheckedState(e.RowIndex, false); Alert.ShowInTop(str); } if (selections.Count() == 0) { btnResetPWD.Enabled = false; return; } if (selections.Count() != 0) { btnResetPWD.Enabled = true; return; } } catch (Exception ex) { publicmethod.SaveError(ex, this.Request); } }
//GridProjectStudent行命令 protected void GridBasicCode_RowCommand(object sender, GridCommandEventArgs e) { try { if (Convert.ToInt32(Session["SecrecyLevel"]) != 5) { string str = "您无对此行操作的权限,请与管理员联系!"; CBoxSelect.SetCheckedState(e.RowIndex, false); Alert.ShowInTop(str); } if (publicmethod.GridCount(GridBasicCode, CBoxSelect).Count == 0) { btnDelete.Enabled = false; return; } if (publicmethod.GridCount(GridBasicCode, CBoxSelect).Count != 0) { btnDelete.Enabled = true; return; } } catch (Exception ex) { publicmethod.SaveError(ex, this.Request); } }
protected void Grid_Platform_RowCommand(object sender, FineUI.GridCommandEventArgs e) { try { string strs = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName; string Person = Grid_Platform.Rows[e.RowIndex].Values[2].ToString(); if (Person != strs && Convert.ToInt32(Session["SecrecyLevel"]) != 5) { string str = "您无对此行操作的权限!此行信息为" + Person + "录入,请与管理员联系!"; CBoxSelect.SetCheckedState(e.RowIndex, false); Alert.ShowInTop(str); } if (publicmethod.GridCount(Grid_Platform, CBoxSelect).Count == 0) { //Alert.ShowInTop("请选中需删除的数据!"); btnDelete.Enabled = false; return; } if (publicmethod.GridCount(Grid_Platform, CBoxSelect).Count != 0) { btnDelete.Enabled = true; return; } } catch (Exception ex) { publicmethod.SaveError(ex, this.Request); } }
//GridProjectStudent行命令 protected void GridProjectStudent_RowCommand(object sender, FineUI.GridCommandEventArgs e) { try { if (Session["LoginName"].ToString() == "") { Response.Redirect("login.aspx"); Alert.Show("登录超时!"); } string Person = GridProjectStudent.Rows[e.RowIndex].Values[2].ToString(); string strs = bllUser.FindByLoginName(Session["LoginName"].ToString()).UserName; if (Person != strs && Convert.ToInt32(Session["SecrecyLevel"]) != 5) { string str = "您无对此行操作的权限!此行信息为" + Person + "录入,请与管理员联系!"; CBoxSelect.SetCheckedState(e.RowIndex, false); Alert.ShowInTop(str); } if (publicmethod.GridCount(GridProjectStudent, CBoxSelect).Count == 0) { btnDelete.Enabled = false; return; } if (publicmethod.GridCount(GridProjectStudent, CBoxSelect).Count != 0) { btnDelete.Enabled = true; return; } } catch (Exception ex) { publicmethod.SaveError(ex, this.Request); } }
protected void gd_UnitAPeople_RowClick(object sender, GridRowClickEventArgs e) { string person = gd_UnitAPeople.Rows[e.RowIndex].Values[0].ToString(); BLHelper.BLLUser user = new BLLUser(); string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; if (Convert.ToInt32(Session["SecrecyLevel"]) != 5 && person != username) { string str = "您没有对此行操作的权限!此行为" + person + "录入,请与管理员联系!"; Alert.ShowInTop(str); CBoxSelect.SetCheckedState(e.RowIndex, false); } if (pm.GridCount(gd_UnitAPeople, CBoxSelect).Count == 0) { btn_Delete.Enabled = false; return; } else { btn_Delete.Enabled = true; return; } }
//行点击事件 protected void Grid_Award_RowCommand(object sender, FineUI.GridCommandEventArgs e) { try { string Person = Grid_Award.Rows[e.RowIndex].Values[2].ToString(); string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; if (Person != username && Convert.ToInt32(Session["SecrecyLevel"]) != 5) { string str = "您无对此行操作的权限!此行信息为" + Person + "录入,请与管理员联系!"; CBoxSelect.SetCheckedState(e.RowIndex, false); Alert.ShowInTop(str); return; } int m; //取整数(不是四舍五入,全舍) int Pages = (int)Math.Floor(Convert.ToDouble(Grid_Award.RecordCount / this.Grid_Award.PageSize)); if (Grid_Award.PageIndex == Pages) { m = (Grid_Award.RecordCount - this.Grid_Award.PageSize * Grid_Award.PageIndex); } else { m = this.Grid_Award.PageSize; } List <int> selections = new List <int>(); for (int i = 0; i < m; i++) { if (CBoxSelect.GetCheckedState(i)) { selections.Add(i); } } if (selections.Count == 0) { btnDelete.Enabled = false; //Alert.ShowInTop("请至少选择一项!"); return; } else { btnDelete.Enabled = true; } } catch (Exception ex) { pm.SaveError(ex, this.Request); } }
protected void Grid_NAReporting_RowCommand(object sender, FineUI.GridCommandEventArgs e) { //int LecturesID = Convert.ToInt32(Grid_NAReporting.DataKeys[e.RowIndex][0].ToString()); string strs = Session["LoginName"].ToString(); strs = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName; //Common.Entities.UnitLectures unitLectures = BLLNAR.FindByUnitLecturesID(LecturesID); string Person = Grid_NAReporting.Rows[e.RowIndex].Values[2].ToString(); if (Person != strs && Convert.ToInt32(Session["SecrecyLevel"]) != 5) { string str = "您无对此行操作的权限!此行信息为" + Person + "录入,请与管理员联系!"; CBoxSelect.SetCheckedState(e.RowIndex, false); Alert.ShowInTop(str); } int m; //取整数(不是四舍五入,全舍) int Pages = (int)Math.Floor(Convert.ToDouble(Grid_NAReporting.RecordCount / this.Grid_NAReporting.PageSize)); if (Grid_NAReporting.PageIndex == Pages) { m = (Grid_NAReporting.RecordCount - this.Grid_NAReporting.PageSize * Grid_NAReporting.PageIndex); } else { m = this.Grid_NAReporting.PageSize; } List <int> selections = new List <int>(); for (int i = 0; i < m; i++) { if (CBoxSelect.GetCheckedState(i)) { selections.Add(i); } } if (selections.Count == 0) { btnDelete.Enabled = false; //Alert.ShowInTop("请至少选择一项!"); return; } else { btnDelete.Enabled = true; } }
//全选按钮 protected void btnSelect_All_Click(object sender, EventArgs e) { Grid_Files.SelectAllRows(); int[] select = Grid_Files.SelectedRowIndexArray; int m; //取整数(不是四舍五入,全舍) int Pages = (int)Math.Floor(Convert.ToDouble(Grid_Files.RecordCount / this.Grid_Files.PageSize)); if (Grid_Files.PageIndex == Pages) { m = (Grid_Files.RecordCount - this.Grid_Files.PageSize * Grid_Files.PageIndex); } else { m = this.Grid_Files.PageSize; } bool isCheck = false; for (int i = 0; i < m; i++) { if (CBoxSelect.GetCheckedState(i) == false) { isCheck = true; } } if (isCheck) { foreach (int item in select) { CBoxSelect.SetCheckedState(item, true); } btnDelete.Enabled = true; btnSelect_All.Text = "取消全选"; } else { foreach (int item in select) { CBoxSelect.SetCheckedState(item, false); } btnDelete.Enabled = false; btnSelect_All.Text = "全选"; } }
//行点击事件 protected void Grid_FurtherStudy_RowCommand(object sender, GridCommandEventArgs e) { string Person = Grid_FurtherStudy.Rows[e.RowIndex].Values[0].ToString(); BLHelper.BLLUser user = new BLHelper.BLLUser(); string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; if (Person != username && Convert.ToInt32(Session["SecrecyLevel"]) != 5) { string str = "您无对此行操作的权限!此行信息为" + Person + "录入,请与管理员联系!"; CBoxSelect.SetCheckedState(e.RowIndex, false); Alert.ShowInTop(str); } if (pm.GridCount(Grid_FurtherStudy, CBoxSelect).Count == 0) { btnDelete.Enabled = false; } else { btnDelete.Enabled = true; } }
//删除 protected void btn_Delete_Click(object sender, EventArgs e) { int sum = 0; for (int i = 0; i < gd_MoneyGive.RecordCount; i++) { if (CBoxSelect.GetCheckedState(i)) { sum++; if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { fund.Delete(Convert.ToInt32(gd_MoneyGive.DataKeys[i][0].ToString())); } else { op.LoginIP = " "; op.LoginName = Session["LoginName"].ToString(); op.OperationContent = "FundInformation"; op.OperationDataID = Convert.ToInt32(gd_MoneyGive.DataKeys[i][0].ToString()); op.OperationTime = DateTime.Now; op.OperationType = "删除"; blop.Insert(op); fund.UpdateIsPass(Convert.ToInt32(gd_MoneyGive.DataKeys[i][0].ToString()), false); } } } gd_MoneyGiveData(); if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { Alert.ShowInTop("删除成功!"); } else { Alert.ShowInTop("您的操作已经提交,请等待管理员确认!"); } btn_Delete.Enabled = false; }
//编辑选中行 protected void btnUpdate_Click(object sender, EventArgs e) { try { List <int> selections = new List <int>(); for (int i = 0; i < Grid_NAReporting.RecordCount; i++) { if (CBoxSelect.GetCheckedState(i)) { selections.Add(i); } } if (selections.Count() != 0) { if (selections.Count() == 1) { int rowID = Convert.ToInt32(Grid_NAReporting.DataKeys[selections[0]][0]); Session["NewAcademicReportingID"] = rowID; Alert.Show("你确定要修改该行数据吗!", "确认消息", MessageBoxIcon.Information, Window_Update.GetShowReference("UpdateNAReporting.aspx", "编辑报告信息"), Target.Top); } else { Alert.Show("一次仅可以对一行进行编辑!"); } } else { Alert.Show("请选择一行!"); } } catch (Exception ex) { BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); } }
//删除选中的单位讲学信息 protected void btnDelete_Click(object sender, EventArgs e) { try { List <int> selections = new List <int>(); for (int i = 0; i < Grid_NAReporting.RecordCount; i++) { if (CBoxSelect.GetCheckedState(i)) { selections.Add(i); } } if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { for (int i = 0; i < selections.Count(); i++) { int NAReportingID = Convert.ToInt32(Grid_NAReporting.DataKeys[selections[i]][0].ToString()); Common.Entities.NewAcademicReporting newacademicreporting = BLLNAR.FindByNAReportingID(NAReportingID); if (newacademicreporting.AttachmentID != null) { if (BllAttachment.SelectAttachmentName(Convert.ToInt32(newacademicreporting.AttachmentID)) != "") { //删除附件文件 string path = BllAttachment.FindPath(Convert.ToInt32(newacademicreporting.AttachmentID)); if (path != "") { publicMethod.DeleteFile(Convert.ToInt32(newacademicreporting.AttachmentID), path); //删除附件表中的数据 BllAttachment.Delete(Convert.ToInt32(newacademicreporting.AttachmentID));//删除成功返回true } } } //删除单位讲学信息 BLLNAR.Delete(NAReportingID);//删除成功返回true } Grid_NAReporting.PageIndex = 0; Grid_NAReporting.PageSize = 20; btnDelete.Enabled = false; BindData(); btnSelect_All.Text = "全选"; Alert.ShowInTop("删除数据成功!"); } else { for (int i = 0; i < selections.Count(); i++) { //BLLNAR.ChangePass(Convert.ToInt32(Grid_NAReporting.DataKeys[selections[i]][0]), false); operate.LoginName = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName; operate.OperationTime = DateTime.Now; operate.LoginIP = " "; operate.OperationContent = "NewAcademicReporting"; operate.OperationType = "删除"; operate.OperationDataID = Convert.ToInt32(Grid_NAReporting.DataKeys[selections[i]][0]); BLLOP.Insert(operate); } Grid_NAReporting.PageIndex = 0; Grid_NAReporting.PageSize = 20; //DropDownList_Agency.SelectedValue = "0"; btnDelete.Enabled = false; BindData(); btnSelect_All.Text = "全选"; Alert.ShowInTop("操作已经提交,请等待管理员确认!"); } } catch (Exception ex) { BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); } }
//删除获奖信息 protected void btnDelete_Click(object sender, EventArgs e) { //如果为超级管理员操作则直接删除,否则将IsPass置为false 向管理员发送删除信息 try { int m; //取整数(不是四舍五入,全舍) int Pages = (int)Math.Floor(Convert.ToDouble(Grid_Award.RecordCount / this.Grid_Award.PageSize)); if (Grid_Award.PageIndex == Pages) { m = (Grid_Award.RecordCount - this.Grid_Award.PageSize * Grid_Award.PageIndex); } else { m = this.Grid_Award.PageSize; } List <int> selections = new List <int>(); for (int i = 0; i < m; i++) { if (CBoxSelect.GetCheckedState(i)) { selections.Add(i); } } if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { for (int i = 0; i < selections.Count(); i++) { int AcademicMeetingID = Convert.ToInt32(Grid_Award.DataKeys[selections[i]][0].ToString()); //删除获奖附件文件->删除附件表中的信息->删除学术会议信息 int AttactID = award.FindAttachmentID(AcademicMeetingID); string strPath; if (AttactID != 0) { strPath = BLLAttachment.FindPath(AttactID); if (strPath != "") { //删除附件文件 pm.DeleteFile(AttactID, strPath); //在附件表中删除附件数据 BLLAttachment.Delete(AttactID); } } //删除获奖信息 award.Delete(Convert.ToInt32(Grid_Award.DataKeys[selections[i]][0].ToString())); } Alert.ShowInTop("删除成功!"); btnSelect_All.Text = "全选"; } else { //录入人(非管理员)操作 for (int i = 0; i < selections.Count(); i++) { award.UpdateIsPass(Convert.ToInt32(Grid_Award.DataKeys[selections[i]][0]), false); //BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName operate.LoginName = Session["LoginName"].ToString(); operate.OperationTime = DateTime.Now; operate.LoginIP = " "; operate.OperationContent = "Award"; operate.OperationType = "删除"; operate.OperationDataID = Convert.ToInt32(Grid_Award.DataKeys[selections[i]][0]); op.Insert(operate); //BindData(); Alert.ShowInTop("操作已经提交,请等待管理员确认!"); } } Grid_Award.PageIndex = 0; Grid_Award.PageSize = 20; btnDelete.Enabled = false; InitData(); btnSelect_All.Text = "全选"; } catch (Exception ex) { BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); return; } }