public DataTable GetUnassignedEmployees()
        {
            EmployeeDataHandler EmployeeHandler = new EmployeeDataHandler();

            UnassignedEmployees = EmployeeHandler.GetunassignedEmployee("Employees");
            return(UnassignedEmployees);
        }
Exemple #2
0
        public string CheckUserName(String user, string id)
        {
            String flag = string.Empty;
            EmployeeDataHandler objEmployeeDataHandler = new EmployeeDataHandler();
            List <Employee>     Employeelist           = new List <Employee>();

            if (id == null)
            {
                DataSet ds = objEmployeeDataHandler.GetEmployee();
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    String UserName = Convert.ToString(dr["UserName"]);
                    if (user == UserName)
                    {
                        flag = "false";
                        return(flag);
                    }
                }
            }
            else
            {
                DataSet ds = objEmployeeDataHandler.GetEmployeeByIDUpdate(id);

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    String UserName = Convert.ToString(dr["UserName"]);
                    if (user == UserName)
                    {
                        flag = "false";
                        return(flag);
                    }
                }
            }
            return(flag = "true");
        }
        public DataTable GetEmployyes()
        {
            EmployeeDataHandler EmployeeHandler = new EmployeeDataHandler();

            EmployeeData = EmployeeHandler.GetEmployees("Employees", "Technician");
            return(EmployeeData);
        }
        public List <Employee> ReadEmployees()
        {
            List <Employee> ReadEmployees = new List <Employee>();
            DataSet         GetClients    = new EmployeeDataHandler().ReadEmployees("Employees");

            foreach (DataRow item in GetClients.Tables["Employees"].Rows)
            {
                ReadEmployees.Add(new Employee(int.Parse(item["EmployeeID"].ToString()), int.Parse(item["DepartmentID"].ToString()), item["EmployeeName"].ToString(), item["EmployeeSurname"].ToString(), item["EmployeePNumber"].ToString(), item["EmployeeType"].ToString(), item["Address"].ToString()));
            }
            return(ReadEmployees);
        }
Exemple #5
0
        public JsonResult update(String id, Employee objEmployee)
        {
            string          res          = string.Empty;
            List <Employee> Employeelist = new List <Employee>();

            try
            {
                // TODO: Add update logic here
                EmployeeDataHandler objEmployeeDataHandler = new EmployeeDataHandler();
                String msg = CheckUserName(objEmployee.UserName, objEmployee.Eid);
                if (msg == "true")
                {
                    bool flag = objEmployeeDataHandler.UpdateDetails(objEmployee);

                    if (flag)
                    {
                        DataSet ds = objEmployeeDataHandler.GetEmployee();
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            Employeelist.Add(
                                new Employee
                            {
                                Eid      = Convert.ToString(dr["Eid"]),
                                Ename    = Convert.ToString(dr["Ename"]),
                                Email    = Convert.ToString(dr["Email"]),
                                Salary   = Convert.ToString(dr["Salary"]),
                                mobile   = Convert.ToString(dr["mobile"]),
                                UserName = Convert.ToString(dr["UserName"]),
                                Password = Convert.ToString(dr["Password"])
                            });
                        }
                        return(Json(Employeelist, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        res = "Error";
                    }
                }
                else
                {
                    return(Json("true", JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                res = "Error";
            }

            return(Json(Employeelist, JsonRequestBehavior.AllowGet));
        }
Exemple #6
0
        public JsonResult Delete(String id)
        {
            string msg = "";
            EmployeeDataHandler objEmployeeDataHandler = new EmployeeDataHandler();

            if (objEmployeeDataHandler.DeleteEmployee(id))
            {
                msg = "Employee Deleted Successfully";
            }
            else
            {
                msg = "Error";
            }
            //return RedirectToAction("Index");
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Exemple #7
0
        public JsonResult Get_databyid(String id)
        {
            EmployeeDataHandler objEmployeeDataHandler = new EmployeeDataHandler();
            List <Employee>     Employeelist           = new List <Employee>();
            DataSet             ds = objEmployeeDataHandler.Get_ByID(id);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                Employeelist.Add(
                    new Employee
                {
                    Eid      = Convert.ToString(dr["Eid"]),
                    Ename    = Convert.ToString(dr["Ename"]),
                    Email    = Convert.ToString(dr["Email"]),
                    Salary   = Convert.ToString(dr["Salary"]),
                    mobile   = Convert.ToString(dr["mobile"]),
                    UserName = Convert.ToString(dr["UserName"]),
                    Password = Convert.ToString(dr["Password"])
                });
            }
            return(Json(Employeelist, JsonRequestBehavior.AllowGet));
        }
Exemple #8
0
 public EmployeeRepository()
 {
     //Instanciere datahandler
     employeeBinder = new EmployeeDataHandler();
 }