protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e) { string exception = ""; if (e.CommandName == "Delete") { object[] keys = Grid1.DataKeys[e.RowIndex]; if (SecondManagementCtrl.Delete((string)keys[0], ref exception)) { Alert.ShowInTop("删除成功!", MessageBoxIcon.Information); } else { Alert.ShowInTop("删除失败!\n原因:" + exception, MessageBoxIcon.Error); } } if (e.CommandName == "Reset") { object[] keys = Grid1.DataKeys[e.RowIndex]; if (SecondManagementCtrl.ResetPassword((string)keys[0], ref exception)) { Alert.ShowInTop("重置成功!", MessageBoxIcon.Information); } else { Alert.ShowInTop("重置失败!\n原因:" + exception, MessageBoxIcon.Error); } } bindSecondToGrid(); }
private void bindSecondToGrid() { string exception = ""; DataTable table = new DataTable(); if (DropDownList_Depart.SelectedValue == "0") { if (SecondManagementCtrl.GetAll(ref table, ref exception)) { Grid1.DataSource = table; Grid1.DataBind(); } else { table.Clear(); Grid1.DataSource = table; Grid1.DataBind(); } } else { string depart = DropDownList_Depart.SelectedValue; if (SecondManagementCtrl.GetAllByDepart(ref table, depart, ref exception)) { Grid1.DataSource = table; Grid1.DataBind(); } else { table.Clear(); Grid1.DataSource = table; Grid1.DataBind(); } } }
protected void Button_Submit_Click(object sender, EventArgs e) { string exception = ""; string fileName = Server.MapPath("../../upload/" + ViewState["filename"].ToString()); if (SecondManagementCtrl.AddNewByExl(fileName, ref exception)) { FileUpload_ExcelFile.Reset(); Alert.ShowInTop("上传成功!", MessageBoxIcon.Information); bindSecondToGrid(); } else { FileUpload_ExcelFile.Reset(); Alert.ShowInTop("上传失败!\n失败原因:" + exception, MessageBoxIcon.Error); } }