public int deletedata(personalBEL objBEL) { int dltresult; SqlCommand cmd = new SqlCommand("spdeletedata", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@id", objBEL.employid); try { if (con.State != ConnectionState.Open) { con.Open(); } dltresult = cmd.ExecuteNonQuery(); return(dltresult); } catch (Exception ex) { throw; } finally { objBEL = null; } }
//public int deletewrkdata(personalBEL objBEL) //{ // int delwrkresult; // try // { // delwrkresult = objDAL.deletedata(objBEL); // if (delwrkresult > 0) // { // return delwrkresult; // } // else // { // return 0; // } // } // catch (Exception ex) // { // throw; // } // finally // { // objBEL = null; // objDAL = null; // } //} //for employee login public int insertemploylogindata(personalBEL objBEL) { int resultinstlogin; try { resultinstlogin = objDAL.insertemploylogindata(objBEL); if (resultinstlogin > 0) { return(resultinstlogin); } else { return(0); } } catch (Exception ex) { throw; } finally { objBEL = null; objDAL = null; } }
public int updatelogindata(personalBEL objBEL) { int resultupdatelgndata; try { resultupdatelgndata = objDAL.updatelogindata(objBEL); if (resultupdatelgndata > 0) { return(resultupdatelgndata); } else { return(0); } } catch (Exception ex) { throw; } finally { objBEL = null; objDAL = null; } }
public int updatewrkdata(personalBEL objBEL) { int updtwrkresult; try { updtwrkresult = objDAL.updatewrkdata(objBEL); if (updtwrkresult > 0) { return(updtwrkresult); } else { return(0); } } catch (Exception ex) { throw; } finally { objBEL = null; objDAL = null; } }
public int updatewrkdata(personalBEL objBEL) { int updtwrkresult; SqlCommand cmd = new SqlCommand("spupdatewrkdata", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@id", objBEL.employid); cmd.Parameters.AddWithValue("@working", objBEL.workingon); cmd.Parameters.AddWithValue("@workstart", objBEL.wrkstrton); cmd.Parameters.AddWithValue("@workcomplete", objBEL.wrkcmplton); cmd.Parameters.AddWithValue("@trainingprogram", objBEL.trngprgm); try { if (con.State != ConnectionState.Open) { con.Open(); } updtwrkresult = cmd.ExecuteNonQuery(); return(updtwrkresult); } catch (Exception ex) { throw; } finally { if (con.State != ConnectionState.Closed) { con.Close(); } objBEL = null; } }
public DataSet getadmnlgnpsrd(personalBEL objBEL) { DataSet ds = new DataSet(); SqlDataAdapter sda = new SqlDataAdapter("adminpswrdlgn", con); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.AddWithValue("@id", objBEL.adminlgnid); try { sda.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { return(ds); } else { return(null); } } catch (Exception) { throw; } finally { objBEL = null; } }
private void bindworkdata() { personalBLL objBLL = new personalBLL(); DataSet ds = new DataSet(); try { ds = objBLL.getwrkdata(); if (ds.Tables[0].Rows.Count > 0) { grdwrkdtlsview.DataSource = ds; grdwrkdtlsview.DataBind(); } else { grdwrkdtlsview.DataSource = null; grdwrkdtlsview.DataBind(); } } catch (Exception ex) { throw; } finally { objBLL = null; objBEL = null; } }
public int updatelogindata(personalBEL objBEL) { int resultupdatelgndata; SqlCommand cmd = new SqlCommand("spupdatelogindata", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@id", objBEL.employid); cmd.Parameters.AddWithValue("@password", objBEL.loginpassword); try { if (con.State != ConnectionState.Open) { con.Open(); } resultupdatelgndata = cmd.ExecuteNonQuery(); return(resultupdatelgndata); } catch (Exception ex) { throw; } finally { if (con.State != ConnectionState.Closed) { con.Close(); } objBEL = null; } }
protected void grdprsnlview_RowDeleting(object sender, GridViewDeleteEventArgs e) { string id = grdprsnlview.DataKeys[e.RowIndex].Value.ToString(); objBEL.employid = id; try { int dltresult = objBLL.deletedata(objBEL); if (dltresult > 0) { lblcomment.Visible = true; lblcomment.Text = "deleted succesfully"; lblcomment.ForeColor = System.Drawing.Color.Green; clearcontrols(); grdprsnlview.EditIndex = -1; Bindpersonaldata(); } else { lblcomment.Visible = true; lblcomment.Text = "deleted was unsuccesfull"; lblcomment.ForeColor = System.Drawing.Color.Red; } } catch (Exception ex) { Response.Write(ex.Message); } finally { objBEL = null; objBLL = null; } }
public int deletedata(personalBEL objBEL) { int dltresult; dltresult = objDAL.deletedata(objBEL); try { if (dltresult > 0) { return(dltresult); } else { return(0); } } catch (Exception ex) { throw; } finally { objDAL = null; objBEL = null; } }
public int insertdata(personalBEL objBEL) { int result; try { result = objDAL.insertdata(objBEL); if (result != 0) { return(result); } else { return(0); } } catch (Exception ex) { throw; } finally { objBEL = null; objDAL = null; } }
protected void btnsbmt_Click(object sender, EventArgs e) { objBEL.employid = txtwrkid.Text.Trim(); objBEL.workingon = txtwrkingon.Text.Trim(); objBEL.wrkstrton = txtwrkstrt.Text.Trim(); objBEL.wrkcmplton = txtwrkcmplt.Text.Trim(); objBEL.trngprgm = txttrngprg.Text.Trim(); int retval; try{ retval = objBLL.insertwrkdata(objBEL); if (retval > 0) { lblcomment.Visible = true; lblcomment.Text = "inserted data sucessfully"; lblcomment.ForeColor = System.Drawing.Color.Green; bindworkdata(); } else { lblcomment.Visible = true; lblcomment.Text = "inserted data sucessfully"; lblcomment.ForeColor = System.Drawing.Color.Red; } } catch (SqlException ex) { if (ex.Errors.Count > 0) { switch (ex.Errors[0].Number) { case 547: clearcontrol(); lblcomment.Visible = true; lblcomment.Text = "there is no such EmployId in our company...!"; lblcomment.ForeColor = System.Drawing.Color.Red; break; default: throw; } } } finally { objBEL = null; objBLL = null; } }
protected void btnsbmt_Click(object sender, EventArgs e) { personalBLL objBLL = new personalBLL(); personalBEL objBEL = new personalBEL(); objBEL.adminlgnid = txtadmnid.Text.Trim(); DataSet ds = new DataSet(); ds = objBLL.getadmnlgnpsrd(objBEL); string pswrd = txtadmpswrd.Text.Trim(); string valid; if (ds != null) { DataTable dt = ds.Tables[0]; valid = dt.Rows[0].Field <string>("adminpswrd"); } else { valid = null; } try { if (pswrd != valid) { lblcomment.Visible = true; lblcomment.Text = "invalid ID and password"; lblcomment.ForeColor = System.Drawing.Color.Red; } else { lblcomment.Visible = false; Session["id"] = txtadmnid.Text.Trim(); { Response.Redirect("admin_edit.aspx"); } } } catch (Exception ex) { Response.Write("Error" + ex.Message); } finally { objBEL = null; objBLL = null; } }
protected void grdprsnlview_RowUpdating(object sender, GridViewUpdateEventArgs e) { objBEL.employid = grdprsnlview.DataKeys[e.RowIndex].Value.ToString(); objBEL.employfullname = ((TextBox)(grdprsnlview.Rows[e.RowIndex].FindControl("txtnameEdit"))).Text.Trim(); objBEL.employdob = ((TextBox)(grdprsnlview.Rows[e.RowIndex].FindControl("txtDOBEdit"))).Text.Trim(); objBEL.employgender = ((TextBox)(grdprsnlview.Rows[e.RowIndex].FindControl("txtgenderEdit"))).Text.Trim(); objBEL.employbloodgrp = ((TextBox)(grdprsnlview.Rows[e.RowIndex].FindControl("txtbldgrpEdit"))).Text.Trim(); objBEL.employmobno1 = ((TextBox)(grdprsnlview.Rows[e.RowIndex].FindControl("txtmob1Edit"))).Text.Trim(); objBEL.employmobno2 = ((TextBox)(grdprsnlview.Rows[e.RowIndex].FindControl("txtmob2Edit"))).Text.Trim(); objBEL.employmailid = ((TextBox)(grdprsnlview.Rows[e.RowIndex].FindControl("txtmailidEdit"))).Text.Trim(); objBEL.employaddress = ((TextBox)(grdprsnlview.Rows[e.RowIndex].FindControl("txtadrEdit"))).Text.Trim(); objBEL.employqualification = ((TextBox)(grdprsnlview.Rows[e.RowIndex].FindControl("txtqalEdit"))).Text.Trim(); objBEL.employdesignation = ((TextBox)(grdprsnlview.Rows[e.RowIndex].FindControl("txtdesgnEdit"))).Text.Trim(); try { int updtresult = objBLL.updatedata(objBEL); if (updtresult > 0) { lblcomment.Visible = true; lblcomment.Text = "Updated sucessfully"; lblcomment.ForeColor = System.Drawing.Color.Green; clearcontrols(); grdprsnlview.EditIndex = -1; Bindpersonaldata(); } else { lblcomment.Visible = true; lblcomment.Text = "Updated was unsucessfull"; lblcomment.ForeColor = System.Drawing.Color.Red; } } catch (Exception ex) { Response.Write(ex.Message); } finally { objBEL = null; objBLL = null; } }
protected void btnsearch_Click(object sender, EventArgs e) { personalBEL objBEL = new personalBEL(); personalBLL objBLL = new personalBLL(); DataSet ds = new DataSet(); objBEL.employid = txtsearch.Text.Trim(); try { ds = objBLL.searchdata(objBEL); string id = txtsearch.Text.Trim(); if (ds != null) { grdprsnlview.DataSource = ds.Tables[0]; grdprsnlview.DataBind(); grdwrkdtlsview.DataSource = ds.Tables[1]; grdwrkdtlsview.DataBind(); txtsearch.Text = string.Empty; lblcomment.Visible = true; lblcomment.Text = id; lblcomment.ForeColor = System.Drawing.Color.BlueViolet; } else { txtsearch.Text = string.Empty; grdprsnlview.DataSource = null; grdprsnlview.DataBind(); grdwrkdtlsview.DataSource = null; grdwrkdtlsview.DataBind(); lblcomment.Visible = true; lblcomment.Text = ("Employees details with " + id + " id does not exists....!"); lblcomment.ForeColor = System.Drawing.Color.Red; } } catch (Exception ex) { Response.Write("Error" + ex.Message); } finally { objBEL = null; objBLL = null; } }
//for search public DataSet searchdata(personalBEL objBEL) { DataSet ds = new DataSet(); try { ds = objDAL.searchdata(objBEL); return(ds); } catch (Exception ex) { throw; } finally { objDAL = null; objBEL = null; } }
public DataSet getadmnlgnpsrd(personalBEL objBEL) { DataSet ds = new DataSet(); try { ds = objDAL.getadmnlgnpsrd(objBEL); return(ds); } catch (Exception ex) { throw; } finally { objDAL = null; objBEL = null; } }
protected void btnsubmit_Click(object sender, EventArgs e) { objBEL.employfullname = txtname.Text.Trim(); objBEL.employdob = txtdob.Text.Trim(); objBEL.employgender = txtgender.Text.Trim(); objBEL.employbloodgrp = txtbldgrp.Text.Trim(); objBEL.employmobno1 = txtmob1.Text.Trim(); objBEL.employmobno2 = txtmob2.Text.Trim(); objBEL.employmailid = txtmailid.Text.Trim(); objBEL.employaddress = txtadrs.Text.Trim(); objBEL.employqualification = txtqal.Text.Trim(); objBEL.employdesignation = txtdesg.Text.Trim(); int retrval; try { retrval = objBLL.insertdata(objBEL); if (retrval != 0) { lblcomment.Visible = true; lblcomment.Text = "inserted data succesfully"; lblcomment.ForeColor = System.Drawing.Color.Green; Bindpersonaldata(); } else { lblcomment.Visible = true; lblcomment.Text = "inserted data was not succesfull"; lblcomment.ForeColor = System.Drawing.Color.Red; } } catch (Exception ex) { Response.Write("ERROR" + ex.Message); } finally { objBEL = null; objBLL = null; } }
public int updatedata(personalBEL objBEL) { int updtresult; SqlCommand cmd = new SqlCommand("spupdateprsnldata", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@id", objBEL.employid); cmd.Parameters.AddWithValue("@name", objBEL.employfullname); cmd.Parameters.AddWithValue("@dob", objBEL.employdob); cmd.Parameters.AddWithValue("@gender", objBEL.employgender); cmd.Parameters.AddWithValue("@bloodgroup", objBEL.employbloodgrp); cmd.Parameters.AddWithValue("@mobile1", objBEL.employmobno1); cmd.Parameters.AddWithValue("@mobile2", objBEL.employmobno2); cmd.Parameters.AddWithValue("@mailid", objBEL.employmailid); cmd.Parameters.AddWithValue("@address", objBEL.employaddress); cmd.Parameters.AddWithValue("@qualification", objBEL.employqualification); cmd.Parameters.AddWithValue("@designation", objBEL.employdesignation); try { if (con.State != ConnectionState.Open) { con.Open(); } updtresult = cmd.ExecuteNonQuery(); return(updtresult); } catch (Exception ex) { throw; } finally { if (con.State != ConnectionState.Closed) { con.Close(); } objBEL = null; } }
//protected void grdwrkdtlsview_RowDeleting(object sender, GridViewDeleteEventArgs e) //{ // personalBEL objBEL = new personalBEL(); // //GridViewRow row = grdwrkdtlsview.SelectedRow; // //string id = grdwrkdtlsview.DataKeys[e.RowIndex].Values.ToString(); // string id = ((TextBox)(grdwrkdtlsview.Rows[e.RowIndex].FindControl("txtwrkidEdit"))).Text.Trim(); // objBEL.employid = id; // int retrval; // try // { // retrval = objBLL.deletewrkdata(objBEL); // if (retrval > 0) // { // lblcomment.Visible = true; // lblcomment.Text = "Deleted data successfully"; // lblcomment.ForeColor = System.Drawing.Color.Green; // clearcontrol(); // grdwrkdtlsview.EditIndex = -1; // bindworkdata(); // } // else // { // lblcomment.Visible = true; // lblcomment.Text = "Deleted data was unsuccessfull"; // lblcomment.ForeColor = System.Drawing.Color.Red; // } // } // catch(Exception ex) // { // Response.Write("Error" + ex.Message); // } // finally // { // objBEL = null; // objBLL = null; // } //} protected void grdwrkdtlsview_RowUpdating(object sender, GridViewUpdateEventArgs e) { objBEL.employid = ((TextBox)(grdwrkdtlsview.Rows[e.RowIndex].FindControl("txtwrkidEdit"))).Text.Trim(); objBEL.workingon = ((TextBox)(grdwrkdtlsview.Rows[e.RowIndex].FindControl("txtprjwrkonEdit"))).Text.Trim(); objBEL.wrkstrton = ((TextBox)(grdwrkdtlsview.Rows[e.RowIndex].FindControl("txtwrkstrtonEdit"))).Text.Trim(); objBEL.wrkcmplton = ((TextBox)(grdwrkdtlsview.Rows[e.RowIndex].FindControl("txtwrkcmpltonEdit"))).Text.Trim(); objBEL.trngprgm = ((TextBox)(grdwrkdtlsview.Rows[e.RowIndex].FindControl("txttrngprgEdit"))).Text.Trim(); int retrval; try { retrval = objBLL.updatewrkdata(objBEL); if (retrval > 0) { lblcomment.Visible = true; lblcomment.Text = "updated data sucessfully"; lblcomment.ForeColor = System.Drawing.Color.Green; clearcontrol(); grdwrkdtlsview.EditIndex = -1; bindworkdata(); } else { lblcomment.Visible = true; lblcomment.Text = "updated data was unsucessfull"; lblcomment.ForeColor = System.Drawing.Color.Red; } } catch (Exception ex) { Response.Write("Error" + ex.Message); } finally { objBEL = null; objBLL = null; } }
protected void grdemploypswrdview_RowUpdating(object sender, GridViewUpdateEventArgs e) { objBEL.employid = ((TextBox)(grdemploypswrdview.Rows[e.RowIndex].FindControl("txtlgnidEdit"))).Text.Trim(); objBEL.loginpassword = ((TextBox)(grdemploypswrdview.Rows[e.RowIndex].FindControl("txtlgnpswrd"))).Text.Trim(); int retrval; try { retrval = objBLL.updatelogindata(objBEL); if (retrval > 0) { lblcomment.Visible = true; lblcomment.Text = "updated data sucessfully"; lblcomment.ForeColor = System.Drawing.Color.Green; clearcontrol(); grdemploypswrdview.EditIndex = -1; bindlogindata(); } else { lblcomment.Visible = true; lblcomment.Text = "updated data was unsucessfull"; lblcomment.ForeColor = System.Drawing.Color.Red; } } catch (Exception ex) { Response.Write("Error" + ex.Message); } finally { objBEL = null; objBLL = null; } }