Пример #1
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)
            {
            }
        }
Пример #2
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)
            {
            }
        }
Пример #3
0
        protected void bindData()
        {
            try
            {
                for (int i = 0; i < 5; i++)
                {
                    List <IEmployeeBO> list   = EmployeeBOFactory.createEmployeeBO();
                    IEmployeeBLL       objBLL = EmployeeFactoryBLL.createEmployeeBLL();
                    list = objBLL.ViewEmployee();
                    grdEmployee.DataSource = list;

                    if (list.Count != 0)
                    {
                        grdEmployee.DataBind();
                    }
                    else
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Employee Doesnot Exit')", true);
                    }
                }
            }catch (Exception)
            { }
        }
Пример #4
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);
        }