Exemplo n.º 1
0
        public Employee Get(String EmployeeID)
        {
            Section_DL      objSectionDL = new Section_DL(Connection);
            EmployeeRole_DL objEmpRole   = new EmployeeRole_DL(Connection);
            Employee        objEmp       = new Employee();

            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@EmpID", EmployeeID)
                };

                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_EmployeeByID", paramList);

                if (dt.Rows.Count > 0)
                {
                    objEmp.EmployeeID    = Convert.ToString(dt.Rows[0]["EmpID"]);
                    objEmp.EmployeeName  = Convert.ToString(dt.Rows[0]["EmpName"]);
                    objEmp.EmployeeRole  = objEmpRole.Get(Convert.ToInt64(dt.Rows[0]["EmpRoleID"]));
                    objEmp.EmpStatus     = Convert.ToBoolean(dt.Rows[0]["EmpStatus"]);
                    objEmp.EmpType       = Convert.ToString(dt.Rows[0]["EmpType"]);
                    objEmp.OTRatePerHour = Convert.ToDecimal(dt.Rows[0]["OTRatePerHour"]);
                    objEmp.RatePerHour   = Convert.ToDecimal(dt.Rows[0]["RatePerHour"]);
                    objEmp.Section       = Convert.ToInt64(dt.Rows[0]["SectionID"]);
                }

                return(objEmp);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 2
0
        public EmployeeCollec Get()
        {
            Section_DL      objSectionDL      = new Section_DL(Connection);
            EmployeeRole_DL objEmpRole        = new EmployeeRole_DL(Connection);
            EmployeeCollec  objEmployeeCollec = new EmployeeCollec();

            try
            {
                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_Employee");


                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Employee objEmp = new Employee();

                    objEmp.EmployeeID    = Convert.ToString(dt.Rows[i]["EmpID"]);
                    objEmp.EmployeeName  = Convert.ToString(dt.Rows[i]["EmpName"]);
                    objEmp.EmployeeRole  = objEmpRole.Get(Convert.ToInt64(dt.Rows[i]["EmpRoleID"]));
                    objEmp.EmpStatus     = Convert.ToBoolean(dt.Rows[i]["EmpStatus"]);
                    objEmp.EmpType       = Convert.ToString(dt.Rows[i]["EmpType"]);
                    objEmp.OTRatePerHour = Convert.ToDecimal(dt.Rows[i]["OTRatePerHour"]);
                    objEmp.RatePerHour   = Convert.ToDecimal(dt.Rows[i]["RatePerHour"]);
                    objEmp.Section       = Convert.ToInt64(dt.Rows[i]["SectionID"]);

                    objEmployeeCollec.Add(objEmp);
                }
                return(objEmployeeCollec);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }