public EmployeeInfo GetEmployee(EmployeeRequest request)
        {
            if (request.LicenseKey != "SuperSecret123")
            {
                throw new WebFaultException <string>(
                          "Wrong license key",
                          HttpStatusCode.Forbidden);
            }
            else
            {
                Employee employee = null;
                string   cs       = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

                using (SqlConnection con = new SqlConnection(cs))
                {
                    SqlCommand cmd = new SqlCommand("spGetEmployee", con);
                    cmd.CommandType = CommandType.StoredProcedure;

                    SqlParameter parameterId = new SqlParameter();
                    parameterId.ParameterName = "@Id";
                    parameterId.Value         = request.EmployeeId;

                    cmd.Parameters.Add(parameterId);

                    con.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        if ((EmployeeType)reader["EmployeeType"] == EmployeeType.FullTimeEmployee)
                        {
                            employee = new FullTimeEmployee
                            {
                                Type          = EmployeeType.FullTimeEmployee,
                                MonthlySalary = Convert.ToInt32(reader["MonthlySalary"])
                            };
                        }
                        else
                        {
                            employee = new PartTimeEmployee
                            {
                                Type        = EmployeeType.PartTimeEmployee,
                                HourlyPay   = Convert.ToInt32(reader["HourlyPay"]),
                                HoursWorked = Convert.ToInt32(reader["HoursWorked"])
                            };
                        }
                        employee.Id          = Convert.ToInt32(reader["Id"]);
                        employee.Name        = reader["Name"].ToString();
                        employee.Gender      = reader["Gender"].ToString();
                        employee.DateOfBirth = Convert.ToDateTime(reader["DateOfBirth"]);
                    }
                }
                return(new EmployeeInfo(employee));
            }
        }
Esempio n. 2
0
        public EmployeeInfo GetEmployee(EmployeeRequest request)
        {
            Console.WriteLine("License Key:" + request.LicenseKey);
            Employee emp = default(Employee);
            string   cs  = ConfigurationManager.ConnectionStrings["subhasishConnectionString"].ConnectionString;

            using (SqlConnection con = new SqlConnection(cs))
            {
                SqlCommand cmd = new SqlCommand("spGetEmployee", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                SqlParameter parameterId = new SqlParameter();
                parameterId.ParameterName = "@Id";
                parameterId.Value         = request.EmployeeId;

                cmd.Parameters.Add(parameterId);
                con.Open();

                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    if ((EmployeeType)reader["EmployeeType"] == EmployeeType.FullTimeEmployee)
                    {
                        emp = new FullTimeEmployee()
                        {
                            Id           = Convert.ToInt32(reader["Id"]),
                            Name         = reader["Name"].ToString(),
                            Gender       = reader["Gender"].ToString(),
                            DateOfBirth  = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type         = EmployeeType.FullTimeEmployee,
                            AnnualSalary = Convert.ToInt32(reader["AnnualSalary"])
                        };
                    }
                    else
                    {
                        emp = new PartTimeEmployee()
                        {
                            Id          = Convert.ToInt32(reader["Id"]),
                            Name        = reader["Name"].ToString(),
                            Gender      = reader["Gender"].ToString(),
                            DateOfBirth = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type        = EmployeeType.PartTimeEmployee,
                            HourlyPay   = Convert.ToInt32(reader["HourlyPay"]),
                            HoursWorked = Convert.ToInt32(reader["HoursWorked"])
                        };
                    }
                }
            }



            return(new EmployeeInfo(emp));
        }
Esempio n. 3
0
        public Employee GetEmployee(int id)
        {
            Console.WriteLine("GetEmployee Called @: " + DateTime.Now);
            Employee employee = null;
            string   cs       = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            using (SqlConnection con = new SqlConnection(cs))
            {
                SqlCommand cmd = new SqlCommand("spGetEmployee", con);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter parameterId = new SqlParameter();
                parameterId.ParameterName = "@Id";
                parameterId.Value         = id;
                cmd.Parameters.Add(parameterId);
                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    if ((EmployeeType)reader["EmployeeType"] == EmployeeType.FullTimeEmployee)
                    {
                        employee = new FullTimeEmployee
                        {
                            Id   = Convert.ToInt32(reader["Id"]),
                            Name = reader["Name"].ToString(),
                            //Gender = reader["Gender"].ToString(),
                            DateOfBirth  = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type         = EmployeeType.FullTimeEmployee,
                            AnnualSalary = Convert.ToInt32(reader["AnnualSalary"])
                        };
                    }
                    else
                    {
                        employee = new PartTimeEmployee
                        {
                            Id   = Convert.ToInt32(reader["Id"]),
                            Name = reader["Name"].ToString(),
                            //Gender = reader["Gender"].ToString(),
                            DateOfBirth = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type        = EmployeeType.PartTimeEmployee,
                            HourlyPay   = Convert.ToInt32(reader["HourlyPay"]),
                            HoursWorked = Convert.ToInt32(reader["HoursWorked"]),
                        };
                    }
                }
            }

            if (_lastSavedEmployee != null && _lastSavedEmployee.Id == id)
            {
                employee.ExtensionData = _lastSavedEmployee.ExtensionData;
            }

            return(employee);
        }
Esempio n. 4
0
        public Employee GetEmployee(int Id)
        {
            Employee employee = null;
            string   cs       = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            using (SqlConnection con = new SqlConnection(cs))
            {
                SqlCommand cmd = new SqlCommand("spGetEmployee", con);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter parameterId = new SqlParameter();
                parameterId.ParameterName = "@Id";
                parameterId.Value         = Id;
                cmd.Parameters.Add(parameterId);
                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    if ((EmployeeType)reader["EmployeeType"] == EmployeeType.FullTimeEmployee)
                    {
                        employee = new FullTimeEmployee
                        {
                            Id           = Convert.ToInt32(reader["Id"]),
                            Name         = reader["Name"].ToString(),
                            Gender       = reader["Gender"].ToString(),
                            DateOfBirth  = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type         = EmployeeType.FullTimeEmployee,
                            AnnualSalary = Convert.ToInt32(reader["AnnualSalary"]),
                            //City = Convert.ToString(reader["City"])              // commented for implementing Extensible Data Object
                        };
                    }
                    else
                    {
                        employee = new PartTimeEmployee
                        {
                            Id          = Convert.ToInt32(reader["Id"]),
                            Name        = reader["Name"].ToString(),
                            Gender      = reader["Gender"].ToString(),
                            DateOfBirth = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type        = EmployeeType.PartTimeEmployee,
                            HourlyPay   = Convert.ToInt32(reader["HourlyPay"]),
                            HoursWorked = Convert.ToInt32(reader["HoursWorked"]),
                            //City = Convert.ToString(reader["City"])
                        };
                    }
                }
            }
            if (lastEmployee?.Id == employee.Id)
            {
                employee.ExtensionData = lastEmployee.ExtensionData;
            }
            return(employee);
        }
 public Employee GetEmployee(int Id)
 {
     Employee employee = null;
     string cs = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
     using (SqlConnection con = new SqlConnection(cs))
     {
         SqlCommand cmd = new SqlCommand("spGetEmployee", con);
         cmd.CommandType = CommandType.StoredProcedure;
         SqlParameter parameterId = new SqlParameter();
         parameterId.ParameterName = "@EmployeeId";
         parameterId.Value = Id;
         cmd.Parameters.Add(parameterId);
         con.Open();
         SqlDataReader reader = cmd.ExecuteReader();
         while(reader.Read())
         {
             if ((EmployeeType)reader["EmployeeType"] == EmployeeType.FullTimeEmployee)
             {
                 employee = new FullTimeEmployee
                 {
                     EmployeeId = Convert.ToInt32(reader["EmployeeId"]),
                     Name = reader["Name"].ToString(),
                     Gender = reader["Gender"].ToString(),
                     dob = Convert.ToDateTime(reader["dob"]),
                     City = reader["City"].ToString(),
                     DepartmentId = Convert.ToInt32(reader["DepartmentId"]),
                     Type = EmployeeType.FullTimeEmployee,
                     AnnualSalary = Convert.ToInt32(reader["AnnualSalary"])
                 };
             }
             else
             {
                 employee = new PartTimeEmployee
                 {
                     EmployeeId = Convert.ToInt32(reader["EmployeeId"]),
                     Name = reader["Name"].ToString(),
                     Gender = reader["Gender"].ToString(),
                     dob = Convert.ToDateTime(reader["dob"]),
                     City = reader["City"].ToString(),
                     DepartmentId = Convert.ToInt32(reader["DepartmentId"]),
                     Type = EmployeeType.PartTimeEmployee,
                     HourlyPay = Convert.ToInt32(reader["HourlyPay"]),
                     HoursWorked = Convert.ToInt32(reader["HoursWorked"])
                 };
             }
         }
     }
     return employee;
 }
        //public Employee GetEmployee(int Id = 0)
        public EmployeeInfo GetEmployee(EmployeeRequest request)
        {
            Employee employee = null;//new Employee();
            string cs = ConfigurationManager.ConnectionStrings["DDBC"].ConnectionString;
            using (SqlConnection conn = new SqlConnection(cs))
            {
                SqlCommand cmd = new SqlCommand("spGetEmployee", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter parameterId = new SqlParameter();
                parameterId.ParameterName = "@Id";
                parameterId.SqlValue = request.EmployeeId;//Id;

                cmd.Parameters.Add(parameterId);

                conn.Open();

                SqlDataReader reader = cmd.ExecuteReader();
                while(reader.Read())
                {
                    if((EmployeeType)reader["EmployeeType"] == EmployeeType.FullTimeEmployee)
                    {
                        employee = new FullTimeEmployee
                        {
                            Id = Convert.ToInt32(reader["Id"]),
                            Name = reader["Name"].ToString(),
                            DateOfBirth = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type = EmployeeType.FullTimeEmployee,
                            AnnualSalary = Convert.ToInt32(reader["AnnualSalary"])
                        };
                    }
                    else
                    {
                        employee = new PartTimeEmployee
                        {
                            Id = Convert.ToInt32(reader["Id"]),
                            Name = reader["Name"].ToString(),
                            DateOfBirth = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type = EmployeeType.PartTimeEmployee,
                            HourlyPay = Convert.ToInt32(reader["HourlyPay"]),
                            HoursWorked = Convert.ToInt32(reader["HoursWorked"])
                        };
                    }
                }
            }

            //return employee;
            return new EmployeeInfo(employee);
        }
Esempio n. 7
0
        public EmployeeInfo GetEmployee(EmplpoyeeRequest empRequest)
        {
            //for(int i=0;i<=100;i++){
            //    Thread.Sleep(50);
            //    Callback.progress(i);
            //}
            Employee employee = null;
            string   cs       = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            using (SqlConnection con = new SqlConnection(cs))
            {
                SqlCommand cmd = new SqlCommand("spGetEmployee", con);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter idParm = new SqlParameter("@Id", empRequest.EmployeeId);
                cmd.Parameters.Add(idParm);
                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    if ((EmployeeType)reader["EmployeeType"] == EmployeeType.FullTimeEmployee)
                    {
                        employee = new FullTimeEmployee
                        {
                            Id           = Convert.ToInt32(reader["Id"]),
                            Name         = (reader["Name"]).ToString(),
                            Gender       = (reader["Gender"]).ToString(),
                            DateOfBirth  = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type         = EmployeeType.FullTimeEmployee,
                            AnnualSalary = Convert.ToInt32(reader["AnnualSalary"])
                        };
                    }
                    else
                    {
                        employee = new PartTimeEmployee
                        {
                            Id          = Convert.ToInt32(reader["Id"]),
                            Name        = (reader["Name"]).ToString(),
                            Gender      = (reader["Gender"]).ToString(),
                            DateOfBirth = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type        = EmployeeType.PartTimeEmployee,
                            HourlyPay   = Convert.ToInt32(reader["HourlyPay"]),
                            HoursWorked = Convert.ToInt32(reader["HoursWorked"])
                        };
                    }
                }
            }
            return(new EmployeeInfo(employee));
        }
Esempio n. 8
0
        public Employee GetEmployee(int id)
        {
            Employee employee = null;
            string   cs       = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            using (SqlConnection con = new SqlConnection(cs))
            {
                // spGetEmployee is the name of the stored procedure
                // so we have to tell to the command Object
                SqlCommand cmd = new SqlCommand("spGetEmployee", con);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter parameterId = new SqlParameter();
                parameterId.ParameterName = "@Id";
                parameterId.Value         = id;
                cmd.Parameters.Add(parameterId);
                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    if ((EmployeeType)(reader["EmployeeType"]) == EmployeeType.FullTimeEmployee)
                    {
                        employee = new FullTimeEmployee
                        {
                            Id            = Convert.ToInt32(reader["Id"]),
                            Name          = reader["Name"].ToString(),
                            Gender        = reader["Gender"].ToString(),
                            DateOfBirth   = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type          = EmployeeType.FullTimeEmployee,
                            AnnualSallary = Convert.ToInt32(reader["AnnualSalary"])
                        };
                    }
                    else
                    {
                        employee = new PartTimeEmployee
                        {
                            Id          = Convert.ToInt32(reader["Id"]),
                            Name        = reader["Name"].ToString(),
                            Gender      = reader["Gender"].ToString(),
                            DateOfBirth = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type        = EmployeeType.PartTimeEmployee,
                            HourlyPay   = Convert.ToInt32(reader["HourlyPay"]),
                            HoursWorked = Convert.ToInt32(reader["HoursWorked"])
                        };
                    }
                }
            }
            return(employee);
        }
        public Employee GetEmployee(int id)
        {
            Employee employee = null;// we dont need any more create here new employee, because in while loop we create instance of derived class type
            string   cs       = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            using (SqlConnection con = new SqlConnection(cs))
            {
                SqlCommand cmd = new SqlCommand("spGetEmployee", con);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter parameterId = new SqlParameter();
                parameterId.ParameterName = "@Id";
                parameterId.Value         = id;
                cmd.Parameters.Add(parameterId);
                con.Open();

                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    if ((EmployeeType)reader["EmployeeType"] == EmployeeType.FullTimeEmployee)
                    {
                        employee = new FullTimeEmployee
                        {
                            Id           = Convert.ToInt32(reader["Id"]),
                            Name         = reader["Name"].ToString(),
                            Gender       = reader["Gender"].ToString(),
                            DateOfBirth  = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type         = EmployeeType.FullTimeEmployee,
                            AnnualSalary = Convert.ToInt32(reader["AnnualSalary"])
                        };
                    }
                    else
                    {
                        employee = new PartTimeEmployee
                        {
                            Id          = Convert.ToInt32(reader["Id"]),
                            Name        = reader["Name"].ToString(),
                            Gender      = reader["Gender"].ToString(),
                            DateOfBirth = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type        = EmployeeType.PartTimeEmployee,
                            HourlyPay   = Convert.ToInt32(reader["HourlyPay"]),
                            HoursWorked = Convert.ToInt32(reader["HoursWorked"]),
                        };
                    }
                }
            }
            return(employee);
        }
Esempio n. 10
0
        public EmployeeInfo GetEmployeeMessageContract(EmployeeRequest employeeRequest)
        {
            Console.WriteLine($"License Key: {employeeRequest.LicenseKey}");
            Employee employee = null;
            string   cs       = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            using (SqlConnection con = new SqlConnection(cs))
            {
                SqlCommand cmd = new SqlCommand("spGetEmployee", con);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter parameterId = new SqlParameter();
                parameterId.ParameterName = "@Id";
                parameterId.Value         = employeeRequest.EmployeeID;
                cmd.Parameters.Add(parameterId);
                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    if ((EmployeeType)reader["EmployeeType"] == EmployeeType.FullTime)
                    {
                        employee = new FullTimeEmployee
                        {
                            ID   = Convert.ToInt32(reader["ID"]),
                            Name = reader["Name"].ToString(),
                            //Gender = reader["Gender"].ToString(),
                            DateOfBirth  = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type         = EmployeeType.FullTime,
                            AnnualSalary = Convert.ToInt32(reader["AnnualSalary"])
                        };
                    }
                    else
                    {
                        employee = new PartTimeEmployee
                        {
                            ID   = Convert.ToInt32(reader["ID"]),
                            Name = reader["Name"].ToString(),
                            //Gender = reader["Gender"].ToString(),
                            DateOfBirth = Convert.ToDateTime(reader["DateOfBirth"]),
                            Type        = EmployeeType.PartTime,
                            HourlyPay   = Convert.ToInt32(reader["HourlyPay"]),
                            HoursWorked = Convert.ToInt32(reader["HoursWorked"]),
                        };
                    }
                }
            }
            return(new EmployeeInfo(employee));
        }
Esempio n. 11
0
        public Employee GetEmployee(int id)
        {
            Employee employee = null;
            string   cs       = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            using (SqlConnection con = new SqlConnection(cs))
            {
                SqlCommand cmd = new SqlCommand("spGetEmployee", con);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter parameterId = new SqlParameter();
                parameterId.ParameterName = "@Id";
                parameterId.Value         = id;

                cmd.Parameters.Add(parameterId);

                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    if ((EmployeeType)reader["EmployeeType"] == EmployeeType.FullTimeEmployee)
                    {
                        employee = new FullTimeEmployee
                        {
                            Type          = EmployeeType.FullTimeEmployee,
                            MonthlySalary = Convert.ToInt32(reader["MonthlySalary"])
                        };
                    }
                    else
                    {
                        employee = new PartTimeEmployee
                        {
                            Type        = EmployeeType.PartTimeEmployee,
                            HourlyPay   = Convert.ToInt32(reader["HourlyPay"]),
                            HoursWorked = Convert.ToInt32(reader["HoursWorked"])
                        };
                    }
                    employee.Id          = Convert.ToInt32(reader["Id"]);
                    employee.Name        = reader["Name"].ToString();
                    employee.Gender      = reader["Gender"].ToString();
                    employee.DateOfBirth = Convert.ToDateTime(reader["DateOfBirth"]);
                }
            }
            return(employee);
        }
Esempio n. 12
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        EmployeeService.EmployeeServiceClient client = new EmployeeService.EmployeeServiceClient();
        EmployeeService.Employee employee            = null;
        string message = string.Empty;

        if (((EmployeeService.EmployeeType)Convert.ToInt32(ddlEmployeeType.SelectedValue)) == EmployeeService.EmployeeType.FullTimeEmployee)
        {
            employee = new EmployeeService.FullTimeEmployee
            {
                ID          = Convert.ToInt32(txtID.Text),
                Name        = txtName.Text,
                Gender      = txtGender.Text,
                DateOfBirth = Convert.ToDateTime(txtDateOfBirth.Text),
                Type        = EmployeeService.EmployeeType.FullTimeEmployee,



                AnnualSalary = Convert.ToInt32(txtAnnualSalary.Text),
            };
            client.SaveEmployee(employee);
            lblMessage.Text = "Employee saved";
        }
        else if (((EmployeeService.EmployeeType)Convert.ToInt32(ddlEmployeeType.SelectedValue)) == EmployeeService.EmployeeType.PartTimeEmployee)
        {
            employee = new EmployeeService.PartTimeEmployee
            {
                ID          = Convert.ToInt32(txtID.Text),
                Name        = txtName.Text,
                Gender      = txtGender.Text,
                DateOfBirth = Convert.ToDateTime(txtDateOfBirth.Text),
                Type        = EmployeeService.EmployeeType.PartTimeEmployee,
                HourlyPay   = Convert.ToInt32(txtHourlyPay.Text),
                HoursWorked = Convert.ToInt32(txtHoursWorked.Text),
            };
            client.SaveEmployee(employee);
            lblMessage.Text = "Employee saved";
        }
        else
        {
            lblMessage.Text = "Please select Employee Type";
        }
    }
Esempio n. 13
0
            protected override void Seed(EmployeeContext context)
            {
                FullTimeEmployee employee = new FullTimeEmployee();

                employee.Name         = "Вася";
                employee.DateOfBirth  = new DateTime(1986, 04, 21);
                employee.Gender       = Gender.Male;
                employee.MonthSallary = 4000;
                employee.EmployeeType = EmployeeType.FullTimeEmployee;

                PartTimeEmployee employee2 = new PartTimeEmployee();

                employee2.Name         = "Соня";
                employee2.DateOfBirth  = new DateTime(1989, 02, 10);
                employee2.Gender       = Gender.Female;
                employee2.HourlyPay    = 250;
                employee2.HoursWorked  = 16;
                employee2.EmployeeType = EmployeeType.PartTimeEmployee;

                context.Employees.Add(employee);
                context.Employees.Add(employee2);
                context.SaveChanges();
            }
Esempio n. 14
0
        public bool EditEmployee(int id, Employee newEmployeeData)
        {
            bool result = false;

            try
            {
                using (EmployeeContext context = new EmployeeContext())
                {
                    Employee employee = context.Employees.FirstOrDefault(e => e.Id == id);

                    if (employee != null)
                    {
                        employee.Name         = newEmployeeData.Name;
                        employee.DateOfBirth  = newEmployeeData.DateOfBirth;
                        employee.Gender       = newEmployeeData.Gender;
                        employee.EmployeeType = newEmployeeData.EmployeeType;

                        if (employee is FullTimeEmployee &&
                            newEmployeeData is FullTimeEmployee)
                        {
                            (employee as FullTimeEmployee).MonthSallary =
                                (newEmployeeData as FullTimeEmployee).MonthSallary;
                        }
                        else if (employee is PartTimeEmployee &&
                                 newEmployeeData is PartTimeEmployee)
                        {
                            (employee as PartTimeEmployee).HourlyPay =
                                (newEmployeeData as PartTimeEmployee).HourlyPay;
                            (employee as PartTimeEmployee).HoursWorked =
                                (newEmployeeData as PartTimeEmployee).HoursWorked;
                        }
                        else
                        {
                            if (newEmployeeData is FullTimeEmployee)
                            {
                                FullTimeEmployee newEmployee = new FullTimeEmployee();
                                newEmployee.Id           = employee.Id;
                                newEmployee.Name         = employee.Name;
                                newEmployee.DateOfBirth  = employee.DateOfBirth;
                                newEmployee.Gender       = employee.Gender;
                                newEmployee.EmployeeType = EmployeeType.FullTimeEmployee;
                                newEmployee.MonthSallary = (newEmployeeData as FullTimeEmployee).MonthSallary;

                                context.Employees.Remove(employee);
                                context.SaveChanges();
                                context.Employees.Add(newEmployee);
                            }
                            else if (newEmployeeData is PartTimeEmployee)
                            {
                                PartTimeEmployee newEmployee = new PartTimeEmployee();
                                newEmployee.Id           = employee.Id;
                                newEmployee.Name         = employee.Name;
                                newEmployee.DateOfBirth  = employee.DateOfBirth;
                                newEmployee.Gender       = employee.Gender;
                                newEmployee.EmployeeType = EmployeeType.PartTimeEmployee;
                                newEmployee.HourlyPay    = (newEmployeeData as PartTimeEmployee).HourlyPay;
                                newEmployee.HoursWorked  = (newEmployeeData as PartTimeEmployee).HoursWorked;

                                context.Employees.Remove(employee);
                                context.SaveChanges();
                                context.Employees.Add(newEmployee);
                            }
                        }

                        context.SaveChanges();

                        result = true;
                    }
                }
            }
            catch
            {
                result = false;
            }

            return(result);
        }