public int CreateBGCDAL(IBGCCheckBO objBO) { try { SqlConnection conn = new SqlConnection(); string str = ConfigurationManager.ConnectionStrings["conn"].ConnectionString; conn.ConnectionString = str; conn.Open(); SqlCommand comm = new SqlCommand(); comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "CreateBGCSchedule"; comm.Connection = conn; comm.Parameters.AddWithValue("@FromDate", objBO.FromDate); comm.Parameters.AddWithValue("@ToDate", objBO.ToDate); comm.Parameters.AddWithValue("@AdminID", objBO.AdminID); comm.Parameters.AddWithValue("@VacancyID", objBO.VacancyID); SqlDataReader reader = comm.ExecuteReader(); while (reader.Read()) { int BGCID = Convert.ToInt32(reader["BGCID"]); return(BGCID); } return(0); //int rows=comm.ExecuteNonQuery(); } catch { throw; } }
public IBGCCheckBO LoginDALAdmin(string Uname) { try { IBGCCheckBO objBO = FactoryBO.BGCCheckFactoryBO.CreateBGCCheck(); SqlConnection conn = new SqlConnection(); string str = ConfigurationManager.ConnectionStrings["conn"].ConnectionString; conn.ConnectionString = str; conn.Open(); SqlCommand comm = new SqlCommand(); comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "BGC_login"; comm.Parameters.AddWithValue("@AdministratorID", Uname); objBO.EmpID = Convert.ToInt32(Uname); comm.Connection = conn; SqlDataReader reader = comm.ExecuteReader(); while (reader.Read()) { objBO.RoleID = Convert.ToInt32(reader["role_ID"]); objBO.EmpPass = Convert.ToString(reader["Password"]); return(objBO); } return(objBO); } catch { throw; } }
public int ChangePwdBLL(IBGCCheckBO objBO) { try { IBGCUpdatesDAL objDAL = FactoryDAL.BGCUpdatesFactoryDAL.CreateUpdatesDAL(); int msg = objDAL.ChangePwdDAL(objBO); return(msg); } catch { throw; } }
public int CreateBGCBLL(IBGCCheckBO objBO) { try { IBGCUpdatesDAL objDAL = FactoryDAL.BGCUpdatesFactoryDAL.CreateUpdatesDAL(); int BGCid = objDAL.CreateBGCDAL(objBO); return(BGCid); } catch { throw; } }
public IBGCCheckBO Login_BGCAdmin(string Uname) { try { IBGCCheckBO objBO = FactoryBO.BGCCheckFactoryBO.CreateBGCCheck(); IBGCUpdatesDAL objDAL = FactoryDAL.BGCUpdatesFactoryDAL.CreateUpdatesDAL(); objBO = objDAL.LoginDALAdmin(Uname); return(objBO); } catch { throw; } }
protected void BtnChange_Click(object sender, EventArgs e) { try { string oldPass = TxtOldPass.Text; string newPass = TxtNewPass.Text; string confirmPass = TxtConfirmPass.Text; if (oldPass != "ChangePwd") { Response.Write("<script>alert('Please enter a valid Password')</script>"); } else if (oldPass == newPass) { Response.Write("<script>alert('Please enter a new Password')</script>"); } else if (newPass != confirmPass) { Response.Write("<script>alert('Password Mismatch')</script>"); } else { IBGCCheckBO objBO = FactoryBO.BGCCheckFactoryBO.CreateBGCCheck(); IBGCUpdatesBLL objBLL = FactoryBLL.BGCUpdatesFactoryBLL.CreateUpdatesBLL(); // objBO.EmpPass = oldPass; objBO.EmpID = Convert.ToInt32(Session["newEmp"]); objBO.NewEmpPass = confirmPass; int ret = objBLL.ChangePwdBLL(objBO); if (ret == 1) { Response.Write("<script>alert('Your password is updated successfully. Please login again with the new credentials to activate your account.');window.location ='Login1.aspx';</script>"); } else { Response.Write("<script>alert('Your password could not be updated. Please enter valid credentials.')</script>"); } //Response.Write("<script>alert('"+msg+"')</script>"); } } catch (Exception ex) { Response.Write("<script>alert('Exception: " + ex.Message + "');window.location ='Login1.aspx';</script>"); } }
public int ChangePwdDAL(IBGCCheckBO objBO) { try { int ret; // IBGCCheckBO objBO = FactoryBO.BGCCheckFactoryBO.CreateBGCCheck(); SqlConnection conn = new SqlConnection(); string str = ConfigurationManager.ConnectionStrings["conn"].ConnectionString; conn.ConnectionString = str; conn.Open(); SqlCommand comm = new SqlCommand(); comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "ChangePwd"; comm.Parameters.AddWithValue("@EmployeeID", objBO.EmpID); // comm.Parameters.AddWithValue("@Password", objBO.EmpPass); comm.Parameters.AddWithValue("@NewPwd", objBO.NewEmpPass); //objBO.EmpID = Convert.ToInt32(Uname); comm.Connection = conn; int rows = comm.ExecuteNonQuery(); if (rows > 0) { // msg = "Password Updated"; ret = 1; } else { // msg = "Could not Update your Password. Please enter valid Credentials"; ret = 0; } // SqlDataReader reader = comm.ExecuteReader(); //while (reader.Read()) //{ // objBO.EmpRole = Convert.ToString(reader["Role1"]); // objBO.EmpPass = Convert.ToString(reader["Password"]); // return objBO; //} return(ret); } catch { throw; } }
//protected void DdlVacancyID_SelectedIndexChanged(object sender, EventArgs e) //{ //} protected void CreateBGCScheduleButton_Click(object sender, EventArgs e) { try { IBGCCheckBO objBO = FactoryBO.BGCCheckFactoryBO.CreateBGCCheck(); objBO.AdminID = Convert.ToInt32(DdlAdminID.SelectedItem.Text); objBO.VacancyID = Convert.ToInt32(DdlVacancyID.SelectedItem.Text); objBO.FromDate = Convert.ToDateTime(TextBoxFromDate.Text); objBO.ToDate = Convert.ToDateTime(TextBoxToDate.Text); IBGCUpdatesBLL objBLL = FactoryBLL.BGCUpdatesFactoryBLL.CreateUpdatesBLL(); int BGCID = objBLL.CreateBGCBLL(objBO); Response.Write("<script>alert('BGC schedule is created successfully. BGC ID: " + BGCID + "')</script>"); CreateBGCScheduleButton.Enabled = false; } catch (Exception ex) { Response.Write("<script>alert('Exception: " + ex.Message + "');window.location ='Login1.aspx';</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { try { IBGCCheckBO objBO = FactoryBO.BGCCheckFactoryBO.CreateBGCCheck(); IBGCUpdatesBLL objBLL = FactoryBLL.BGCUpdatesFactoryBLL.CreateUpdatesBLL(); string User = txtusid.Text; string Pass = txtpwd.Text; Session["Pwd"] = Pass; if (User.Length == 6) { objBO = objBLL.Login_BGC(User); if (objBO.EmpPass == Pass) { if (objBO.EmpRole == "Employee") { Session["newEmp"] = User; Response.Redirect("Emloyee.aspx"); } else if (objBO.EmpRole == "Unit Head") { Response.Redirect("Homepage_UnitHead.aspx"); } else if (objBO.EmpRole == "HR") { Response.Redirect("Homepage_HR.aspx"); } else { // not employee Response.Write("<script>alert('Please enter a valid Username or Password')</script>"); } } else { //not employee Response.Write("<script>alert('Please enter a valid Username or Password')</script>"); } } else if (User.Length == 3) { objBO = objBLL.Login_BGCAdmin(User); Session["BGCAdministratorID"] = User; if (objBO.RoleID == 3 && objBO.EmpPass == Pass) { // if(objBO.EmpPass==Pass) // { Response.Redirect("Homepage_BGCAdmin.aspx"); // } } else { //not BGC admin Response.Write("<script>alert('Please enter a valid Username or Password')</script>"); } } { //not Admin Response.Write("<script>alert('Please enter a valid Username or Password')</script>"); } } catch (Exception ex) { Response.Write("<script>alert('Exception: " + ex.Message + "');window.location ='Login1.aspx';</script>"); } }