protected void lnkBtnDelete_Click(object sender, EventArgs e) { try { lock (this) { LinkButton lnkBtnId = (LinkButton)sender; GridViewRow grdrow = lnkBtnId.NamingContainer as GridViewRow; //ViewState["StudentUserCode"] //Session["EmpUserCode1"] = grd.DataKeys[grdrow.RowIndex].Values["UserCode"].ToString(); EWA_StaffView objEWA = new EWA_StaffView(); BL_StaffView objBAL = new BL_StaffView(); string msgact = ""; objEWA.Action = "DeleteProfile"; objEWA.StaffID = Convert.ToInt32(grd.DataKeys[grdrow.RowIndex].Values["UserCode"].ToString()); objEWA.OrgId = Convert.ToInt32(Session["OrgId"]); if (Convert.ToBoolean(grd.DataKeys[grdrow.RowIndex].Values["IsActive"].ToString())) { objEWA.IsActive = 0; msgact = "Deactivate"; } else { objEWA.IsActive = 1; msgact = "activate"; } int result = objBAL.DeleteFaculty_BL(objEWA); if (result > 0) { msgBox.ShowMessage("Faculty is " + msgact + "..! ", "Successfull", UserControls.MessageBox.MessageStyle.Successfull); select_qry(); } } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); // throw; } }
//Bind Faculty grid #region [Bind Faculty Grid] private void BindFacultyGrid() { try { EWA_StaffView objEWA = new EWA_StaffView(); BL_StaffView objBAL = new BL_StaffView(); objEWA.OrgId = Convert.ToInt32(Session["OrgId"]); objEWA.DepartmentId = ddlDepartment.SelectedValue; objEWA.Designation = ddlDesignation.SelectedValue; DataSet ds = new DataSet(); ds = objBAL.FacultyView_BL(objEWA); if (ds.Tables[0].Rows.Count == 0 || ds == null) { ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdSearchFaculty.DataSource = ds; grdSearchFaculty.DataBind(); int columncount = grdSearchFaculty.Rows[0].Cells.Count; grdSearchFaculty.Rows[0].Cells.Clear(); grdSearchFaculty.Rows[0].Cells.Add(new TableCell()); grdSearchFaculty.Rows[0].Cells[0].ColumnSpan = columncount; grdSearchFaculty.Rows[0].Cells[0].Text = "No Records Found"; } else { grdSearchFaculty.DataSource = ds.Tables[0]; grdSearchFaculty.DataBind(); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
protected void btnGo_Click(object sender, EventArgs e) { Panel3.Visible = true; BL_StaffView objBAL = new BL_StaffView(); EWA_StaffView objEWA = new EWA_StaffView(); try { objEWA.Designation = ddlDesignation.SelectedValue; objEWA.DepartmentId = ddlDepartment.SelectedValue; objEWA.OrgId = Convert.ToInt32(Session["OrgId"]); DataSet ds = new DataSet(); ds = objBAL.BL_GetFacultyIcardData(objEWA); if (ds.Tables[0].Rows.Count > 0) { grdIcard.DataSource = ds.Tables[0]; grdIcard.DataBind(); btnPrintLoad.Visible = true; } else { DataTable dt = new DataTable(); //dt.Columns.Add("UserCode"); //dt.Columns.Add("FullName"); //dt.Rows.Add(); //dt.Rows.Add(); grdIcard.DataSource = dt; grdIcard.DataBind(); btnPrintLoad.Visible = false; } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }