Example #1
0
        public List <IEmployeeBO> displayallDB()
        {
            try
            {
                List <IEmployeeBO> list = new List <IEmployeeBO>();
                string             str  = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
                SqlConnection      conn = new SqlConnection(str);
                conn.Open();
                SqlCommand command = new SqlCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "displayallBGC";
                command.Connection  = conn;
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    int         adminid          = Convert.ToInt32(reader["AdministratorID"]);
                    string      bgcstatus        = Convert.ToString(reader["bgcStatus"]);
                    DateTime    statuschangetime = Convert.ToDateTime(reader["StatusChangeTime"]);
                    string      employeename     = Convert.ToString(reader["EmployeeName"]);
                    IEmployeeBO obj = EmployeeBOFactory.CreateEmp2(adminid, bgcstatus, statuschangetime, employeename);

                    list.Add(obj);
                }
                return(list);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        public int editEmployeeDB(IEmployeeBO objBo)
        {
            int rowAffected;

            try
            {
                SqlConnection conn = new SqlConnection();
                string        str  = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
                conn.ConnectionString = str;
                conn.Open();
                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "sp_updateempdetails";
                command.Parameters.AddWithValue("@EmployeeName", objBo.EmployeeName);
                command.Parameters.AddWithValue("@UnitHeadID", objBo.UnitHeadID);
                command.Parameters.AddWithValue("@Designation", objBo.Designation);
                command.Parameters.AddWithValue("@CTC", objBo.CTC);

                rowAffected = command.ExecuteNonQuery();
                conn.Close();
                return(rowAffected);
            }
            catch (Exception)
            {
            }
            return(0);
        }
Example #3
0
 public int addadminDB(IEmployeeBO obj)
 {
     try
     {
         //List<IEmployeeBO> list = new List<IEmployeeBO>();
         string        str  = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
         SqlConnection conn = new SqlConnection(str);
         conn.Open();
         SqlCommand command = new SqlCommand();
         command.CommandType = CommandType.StoredProcedure;
         command.CommandText = "addBGCadmin";
         command.Parameters.AddWithValue("@AdministratorID", 0);
         command.Parameters.AddWithValue("@EmployeeID", obj.EmployeeID);
         command.Parameters.AddWithValue("@role_ID", obj.RoleID);
         command.Parameters.AddWithValue("@bgcStatus", obj.BgcStatus);
         command.Parameters.AddWithValue("@StatusChangetime", obj.StatusChangeTime);
         command.Parameters["@AdministratorID"].Direction = ParameterDirection.Output;
         command.Connection = conn;
         int check = command.ExecuteNonQuery();
         if (check > 0)
         {
             return(check);
         }
         return(0);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #4
0
        public List <IEmployeeBO> displayeverythingDB()
        {
            try
            {
                List <IEmployeeBO> newlist = new List <IEmployeeBO>();
                string             str     = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
                SqlConnection      conn    = new SqlConnection(str);
                conn.Open();
                SqlCommand command = new SqlCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "displayeverything";
                command.Connection  = conn;
                SqlDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    int employeeid = Convert.ToInt32(reader["employee_ID"]);

                    IEmployeeBO obj = EmployeeBOFactory.createemp1(employeeid);

                    newlist.Add(obj);
                }
                return(newlist);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
 public int displayapprovedDB(IEmployeeBO obj)
 {
     try
     {
         List <IEmployeeBO> newlist = new List <IEmployeeBO>();
         string             str     = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
         SqlConnection      conn    = new SqlConnection(str);
         conn.Open();
         SqlCommand command = new SqlCommand();
         command.CommandType = CommandType.StoredProcedure;
         command.CommandText = "updateBGCadmin";
         command.Connection  = conn;
         command.Parameters.AddWithValue("@AdministratorID", obj.AdministratorID);
         command.Parameters.AddWithValue("@bgcStatus", obj.BgcStatus);
         command.Parameters.AddWithValue("@StatusChangeTime", obj.StatusChangeTime);
         int check = command.ExecuteNonQuery();
         if (check > 0)
         {
             return(check);
         }
         return(0);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #6
0
        public int editEmployees(IEmployeeBO objBo)
        {
            IEmployeeDAL objDAL = EmployeeDALFactory.createEmployeeDAL();
            int          obj1   = objDAL.editEmployeeDB(objBo);

            return(obj1);
        }
Example #7
0
        protected void BtnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                string       empName     = txtEmpName.Text;
                string       designation = txtdesignation.Text;
                Int32        ctc         = Convert.ToInt32(txtctc.Text);
                Int32        unitHead    = Convert.ToInt32(txtUnitHead.Text);
                IEmployeeBO  objBo       = EmployeeBOFactory.createEmployeeBO(empName, designation, ctc, unitHead);
                IEmployeeBLL objBll      = EmployeeFactoryBLL.createEmployeeBLL();
                int          res         = objBll.editEmployees(objBo);

                if (res > 0)
                {
                    Response.Write("<script>if(confirm('Employee Details Updated  Successfully.')){document.location='EditEmployeeDetails.aspx';}</script>");
                }
                else
                {
                    Response.Write("<script>if(confirm('Employee not Details Updated  Successfully.')){document.location='EditEmployeeDetails.aspx';}</script>");
                }
            }
            catch (Exception)
            {
            }
        }
Example #8
0
        //CRUD3
        public int addEmployee(IEmployeeBO obj)
        {
            IEmployeeDAL objDAL = EmployeeDALFactory.createEmployeeDAL();
            int          result = objDAL.addEmployeeDB(obj);

            return(result);
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                IEmployeeBLL objEmployeeMng = EmployeeFactoryBLL.createEmployeeBLobj();
                IEmployeeBO  objEmployee    = EmployeeBOFactory.createEmpBO();
                objEmployee.EmployeeName = txtempname.Text;
                objEmployee.DOJ          = DateTime.Parse(txtdoj.Text);
                objEmployee.DOB          = DateTime.Parse(txtdob.Text);
                objEmployee.Location     = txtloc.Text;
                objEmployee.Gender       = txtgend.Text;
                objEmployee.CTC          = Convert.ToInt32(txtctc.Text);
                objEmployee.Designation  = txtdesignation.Text;
                objEmployee.UnitHeadID   = Convert.ToInt32(ddlunithead.SelectedValue);

                objEmployee.ProjectId = 100001;
                int           ID    = objEmployeeMng.addEmployee(objEmployee);
                int           id    = Int32.Parse(Session["CandID"].ToString());
                ICandidateBLL obj   = CandidateFactoryBLL.createCandidateBLobj();
                ICandidateBO  objBo = CandidateFactoryBO.createEmployeeBO(id);

                obj.deleteCandidate(id);
                Response.Write("<script>if(confirm('Details Submitted Successfully.    Employee ID :" + ID + "')){document.location='AddSelectedCandidates_HR.aspx';}</script>");
            }

            catch (Exception)
            { }
        }
Example #10
0
 protected void BGCgrdview_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     try
     {
         GridViewRow  row                  = BGCgrdview.Rows[e.RowIndex];
         Label        lbladminid2          = (Label)row.FindControl("lbladminid2");
         DropDownList ddlstatus            = (DropDownList)row.FindControl("ddlstatus");
         Label        lblStatusChangeTime2 = (Label)row.FindControl("lblStatusChangeTime2");
         int          adminid              = Convert.ToInt32(lbladminid2.Text);
         string       status               = ddlstatus.SelectedValue;
         DateTime     statuschangetime     = DateTime.Now;
         IEmployeeBO  objbo                = EmployeeBOFactory.CreateEmployee(adminid, status, statuschangetime);
         IEmployeeBLL objbll               = EmployeeFactoryBLL.createnew();
         int          check                = objbll.displayapproved(objbo);
         if (check > 0)
         {
             BGCgrdview.EditIndex = -1;
             bgcdata();
         }
         else
         {
             Response.Redirect("<script>alert('Employee details are not updated please update again')</script>");
         }
     }
     catch (Exception ex)
     {
         Response.Write("<script>alert('Exception: " + ex.Message + "');</script>");
     }
 }
Example #11
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string       username = txtusername.Text;
            string       password = txtpassword.Text;
            IEmployeeBO  obj      = EmployeeFBO.CheckEmployee(username, password);
            IEmployeeBLL obj1     = EmployeeFaBLL.createnew();

            obj1.RegisterEmp(obj);
        }
Example #12
0
        public void Register(IEmployeeBO obj)
        {
            string str = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            using (SqlConnection conn = new SqlConnection(str))
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.CommandText = "Registertest";
                cmd.Parameters.AddWithValue("@username", obj.Username);
                cmd.Parameters.AddWithValue("@password", obj.Password);
                conn.Open();
                cmd.Connection = conn;
                cmd.ExecuteNonQuery();
            }
        }
Example #13
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string       username = txtusername.Text;
            string       password = txtpassword.Text;
            IEmployeeBO  objBO    = EmployeeFBO.CheckEmployee(username, password);
            IEmployeeBLL objBLL   = EmployeeFaBLL.createnew();
            int          check    = objBLL.CheckEmp(objBO);

            if (check == 1)
            {
                Label3.Text = "Successfully loggedIn";
            }
            else
            {
                Label3.Text = "Login notSuccessfull";
            }
        }
        protected void submit_button_Click(object sender, EventArgs e)
        {
            try
            {
                //for (int i = 0; i <= 5; i++)
                //{
                int         employeeid       = Convert.ToInt32(ddlAdmin.SelectedItem.Text);
                string      status           = "Pending";
                DateTime    statusChangeTime = DateTime.Now;
                int         role_id          = 3;
                int         administratorID  = 0;
                IEmployeeBO empadd           = EmployeeBOFactory.createemp(employeeid, status, statusChangeTime, role_id, administratorID);

                IEmployeeBLL       empbll = EmployeeFactoryBLL.createnew();
                List <IEmployeeBO> list   = empbll.everythingdisplay();
                //foreach (IEmployeeBO item in list)
                //{
                //    if(item.EmployeeID==500002)
                //    Response.Write("found");
                //}
                var match = list.Exists(p => p.EmployeeID == employeeid);
                if (match == false)
                {
                    int check = empbll.addadmin(empadd);
                    ddlAdmin.Items.Remove(ddlAdmin.SelectedItem.Text);

                    if (check > 0)
                    {
                        binddata();
                    }
                }

                else
                {
                    Response.Write("<script>alert('The employee selected is already a BGC ADMINISTRATOR please select another employee.');</script>");
                    ddlAdmin.Items.Remove(ddlAdmin.SelectedItem.Text);


                    binddata();
                }
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('Exception: " + ex.Message + "');</script>");
            }
        }
Example #15
0
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                LblEmpID.Visible       = true;
                LblEmpName.Visible     = true;
                LblDesgn.Visible       = true;
                LblCTC.Visible         = true;
                LblUnitHeadID.Visible  = true;
                txtEmpID.Visible       = true;
                txtEmpName.Visible     = true;
                txtdesignation.Visible = true;
                txtctc.Visible         = true;
                rectc.Visible          = true;
                redesignation.Visible  = true;
                rfvctc.Visible         = true;
                rfvdesignation.Visible = true;

                txtUnitHead.Visible = true;
                BtnUpdate.Visible   = true;
                BtnCancel.Visible   = true;
                BtnSubmit.Visible   = false;
                LblEmpID1.Visible   = false;
                ddlEmpID.Visible    = false;
                int id = Convert.ToInt32(ddlEmpID.SelectedValue);

                Session["empid"] = ddlEmpID.SelectedValue;
                txtEmpID.Text    = Session["empid"].ToString();
                IEmployeeBO  objBo  = EmployeeBOFactory.createEmployeeBO(id);
                IEmployeeBLL objBll = EmployeeFactoryBLL.createEmployeeBLL();
                txtEmpName.Text = objBll.getEmpName(id);

                txtUnitHead.Text    = Convert.ToString(objBll.getUnitHeadId(id));
                txtctc.Text         = Convert.ToString(objBll.getctc(id));
                txtdesignation.Text = objBll.getDesignation(id);

                txtUnitHead.DataBind();

                txtEmpName.DataBind();
                ddlEmpID.Items.Insert(0, "--Select--");
            }
            catch (Exception)
            {
            }
        }
Example #16
0
        //CRUD 3


        public int addEmployeeDB(IEmployeeBO objBO)
        {
            string        str        = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
            SqlConnection connection = new SqlConnection(str);

            connection.Open();
            SqlCommand command = new SqlCommand();

            command.CommandType = CommandType.StoredProcedure;
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "sp_insertEmploy";
            command.Connection  = connection;
            command.Parameters.AddWithValue("@EmployeeName", objBO.EmployeeName);
            command.Parameters.AddWithValue("@UnitHeadID", objBO.UnitHeadID);
            command.Parameters.AddWithValue("@ProjectID", objBO.ProjectId);
            command.Parameters.AddWithValue("@DOB", objBO.DOB);
            command.Parameters.AddWithValue("@DOJ", objBO.DOJ);
            command.Parameters.AddWithValue("@Gender", objBO.Gender);
            command.Parameters.AddWithValue("@CTC", objBO.CTC);
            command.Parameters.AddWithValue("@Designation", objBO.Designation);
            command.Parameters.AddWithValue("@Location", objBO.Location);
            command.Parameters.AddWithValue("@Role1", "Employee");
            command.Parameters.AddWithValue("@Experience", 0);
            command.Parameters.AddWithValue("@Password", "ChangePwd");
            command.Parameters.AddWithValue("@EmployeeID", 0);
            command.Parameters.AddWithValue("@IsNew", 1);

            command.Parameters["@EmployeeID"].Direction = ParameterDirection.Output;


            int result = command.ExecuteNonQuery();

            connection.Close();
            if (result > 0)
            {
                return(Convert.ToInt32(command.Parameters["@EmployeeID"].Value));
            }
            else
            {
                return(result);
            }
        }
Example #17
0
        public List <IEmployeeBO> viewEmployeeDB()
        {
            List <IEmployeeBO> list = new List <IEmployeeBO>();

            try
            {
                SqlConnection conn = new SqlConnection();
                string        str  = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
                conn.ConnectionString = str;
                conn.Open();
                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "sp_displayEmployee";
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    int         empID         = Convert.ToInt32(reader["EmployeeID"]);
                    DateTime    dateOfBirth   = Convert.ToDateTime(reader["DOB"]);
                    DateTime    dateOfJoining = Convert.ToDateTime(reader["DOJ"]);
                    string      designation   = Convert.ToString(reader["Designation"]);
                    string      location      = Convert.ToString(reader["Location"]);
                    string      gender        = Convert.ToString(reader["Gender"]);
                    Int32       ctc           = Convert.ToInt32(reader["CTC"]);
                    int         unitHeadID    = Convert.ToInt32(reader["UnitHeadiD"]);
                    int         projectID     = Convert.ToInt32(reader["ProjectID"]);
                    IEmployeeBO objBO         = EmployeeBOFactory.createEmployeeBO(empID, dateOfBirth, dateOfJoining, designation, location, gender, ctc, unitHeadID, projectID);

                    list.Add(objBO);
                }
            }
            catch (Exception)
            {
            }
            return(list);
        }
Example #18
0
        public int CheckEmployee(IEmployeeBO obj)
        {
            string str = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            using (SqlConnection conn = new SqlConnection(str))
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.CommandText = "logintest";
                cmd.Parameters.AddWithValue("@username", obj.Username);
                cmd.Parameters.AddWithValue("@password", obj.Password);
                conn.Open();
                cmd.Connection = conn;
                int reader = Convert.ToInt32(cmd.ExecuteScalar());
                if (reader > 0)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="EmployeeController"/> class.
 /// </summary>
 /// <param name="EmployeeBO">The _ userbo.</param>
 public EmployeeController(IEmployeeBO _varEmployeeBO)
 {
     _EmployeeBO = _varEmployeeBO;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EmployeeController"/> class.
 /// </summary>
 /// <param name="EmployeeBO">The _ userbo.</param>
 public EmployeeController(IEmployeeBO  _varEmployeeBO)
 {
     _EmployeeBO = _varEmployeeBO;
 }
Example #21
0
        public int addadmin(IEmployeeBO obj)
        {
            IEmployeeDAL obj2 = EmployeeDALFactory.createDAL();

            return(obj2.addadminDB(obj));
        }
Example #22
0
        public int CheckEmp(IEmployeeBO obj)
        {
            IEmployeeDAL obj1 = EmployeeFaDAL.CreateDAL();

            return(obj1.CheckEmployee(obj));
        }
Example #23
0
        public void RegisterEmp(IEmployeeBO obj)
        {
            IEmployeeDAL obj1 = EmployeeFaDAL.CreateDAL();

            obj1.Register(obj);
        }
Example #24
0
        public int displayapproved(IEmployeeBO obj)
        {
            IEmployeeDAL obj4 = EmployeeDALFactory.createDAL();

            return(obj4.displayapprovedDB(obj));
        }
Example #25
0
 /// <summary>
 /// GrpcEmployeeServiceImpl
 /// </summary>
 /// <param name="_employeeBO"></param>
 public GrpcEmployeeServiceImpl(IEmployeeBO _employeeBO)
 {
     _EmployeeBO = _employeeBO;
 }
 public EmployeeServiceController()
 {
     objEmployeeBO = new EmployeeBO();
     objManagerBO  = new ManagerBO();
 }