//编辑选中行 protected void btnUpdate_Click(object sender, EventArgs e) { try { int m; //取整数(不是四舍五入,全舍) int Pages = (int)Math.Floor(Convert.ToDouble(Grid_LibraryRecord_Contract.RecordCount / this.Grid_LibraryRecord_Contract.PageSize)); List <int> selections = new List <int>(); if (Grid_LibraryRecord_Contract.PageIndex == Pages) { m = (Grid_LibraryRecord_Contract.RecordCount - this.Grid_LibraryRecord_Contract.PageSize * Grid_LibraryRecord_Contract.PageIndex); } else { m = this.Grid_LibraryRecord_Contract.PageSize; } for (int i = 0; i < m; i++) { if (BoxSelect_ContractRecord.GetCheckedState(i)) { selections.Add(i); } } if (selections.Count() != 0) { if (selections.Count() == 1) { int rowID = Convert.ToInt32(Grid_LibraryRecord_Contract.DataKeys[selections[0]][0]); Session["LibraryRecordID"] = rowID; Alert.Show("你确定要修改该行数据吗!", "确认消息", MessageBoxIcon.Information, Window_Update.GetShowReference("Update_ContractRecord.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 Grid_LibraryRecord_Contract_RowCommand(object sender, FineUI.GridCommandEventArgs e) { int LibraryRecordID = Convert.ToInt32(Grid_LibraryRecord_Contract.DataKeys[e.RowIndex][0].ToString()); //string Person = BLLLibraryRecord.FindByLibreryRecordID(LibraryRecordID).EntryPerson; string Person = Grid_LibraryRecord_Contract.Rows[e.RowIndex].Values[2].ToString(); string strs = Session["LoginName"].ToString(); strs = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName; if (Person != strs && Convert.ToInt32(Session["SecrecyLevel"]) != 5) { string str = "您无对此行操作的权限!此行信息为" + Person + "录入,请与管理员联系!"; BoxSelect_ContractRecord.SetCheckedState(e.RowIndex, false); Alert.ShowInTop(str); } int m; //取整数(不是四舍五入,全舍) int Pages = (int)Math.Floor(Convert.ToDouble(Grid_LibraryRecord_Contract.RecordCount / this.Grid_LibraryRecord_Contract.PageSize)); if (Grid_LibraryRecord_Contract.PageIndex == Pages) { m = (Grid_LibraryRecord_Contract.RecordCount - this.Grid_LibraryRecord_Contract.PageSize * Grid_LibraryRecord_Contract.PageIndex); } else { m = this.Grid_LibraryRecord_Contract.PageSize; } List <int> selections = new List <int>(); for (int i = 0; i < m; i++) { if (BoxSelect_ContractRecord.GetCheckedState(i)) { selections.Add(i); } } if (selections.Count == 0) { btnDelete.Enabled = false; //Alert.ShowInTop("请至少选择一项!"); return; } else { btnDelete.Enabled = true; } }
//删除借阅记录 protected void btnDelete_Click(object sender, EventArgs e) { try { int m; //取整数(不是四舍五入,全舍) int Pages = (int)Math.Floor(Convert.ToDouble(Grid_LibraryRecord_Contract.RecordCount / this.Grid_LibraryRecord_Contract.PageSize)); List <int> selections = new List <int>(); if (Grid_LibraryRecord_Contract.PageIndex == Pages) { m = (Grid_LibraryRecord_Contract.RecordCount - this.Grid_LibraryRecord_Contract.PageSize * Grid_LibraryRecord_Contract.PageIndex); } else { m = this.Grid_LibraryRecord_Contract.PageSize; } for (int i = 0; i < m; i++) { if (BoxSelect_ContractRecord.GetCheckedState(i)) { selections.Add(i); } } if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { for (int i = 0; i < selections.Count(); i++) { BLLLibraryRecord.Delete(Convert.ToInt32(Grid_LibraryRecord_Contract.DataKeys[selections[i]][0].ToString())); } //刷新 DropDownListContract.SelectedValue = "0"; Grid_LibraryRecord_Contract.PageIndex = 0; Grid_LibraryRecord_Contract.PageSize = 20; btnDelete.Enabled = false; BindData(); Alert.ShowInTop("删除数据成功!"); } else { for (int i = 0; i < selections.Count(); i++) { BLLContract.UpdateIsPass(Convert.ToInt32(Grid_LibraryRecord_Contract.DataKeys[selections[i]][0]), false); operate.LoginName = Session["LoginName"].ToString(); operate.OperationTime = DateTime.Now; operate.LoginIP = " "; operate.OperationContent = "Contract"; operate.OperationType = "删除"; operate.OperationDataID = Convert.ToInt32(Grid_LibraryRecord_Contract.DataKeys[selections[i]][0]); op.Insert(operate); } //刷新 DropDownListContract.SelectedValue = "0"; Grid_LibraryRecord_Contract.PageIndex = 0; Grid_LibraryRecord_Contract.PageSize = 20; btnDelete.Enabled = false; BindData(); Alert.ShowInTop("操作已经提交,请等待管理员确认!"); } } catch (Exception ex) { BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); } }