Beispiel #1
0
        public ActionResult ShowEmployee(int id)
        {
            objemployeeproperty    = new EmployeeProperty();
            objemployeeproperty.Id = id;
            objEmployeeBll         = new Employee_BLL(objemployeeproperty);
            DataTable dt = objEmployeeBll.SelectOne();

            ViewBag.Employee   = dt;
            ViewBag.EmployeeID = objemployeeproperty.Id;
            GetDesignations();
            GetDepartments();
            GetDeputaion();
            GetEmptype();
            return(View("AddEmployee", objemployeeproperty));
        }
Beispiel #2
0
        public ActionResult ShowEmployeeInfo()
        {
            objemployeeproperty               = new EmployeeProperty();
            objemployeeproperty.Id            = Convert.ToInt32(Session["Emp_ID"].ToString());
            objemployeeproperty.EmployeeLogin = true;
            objEmployeeBll = new Employee_BLL(objemployeeproperty);
            DataTable dt = objEmployeeBll.SelectOne();

            ViewBag.Employee   = dt;
            ViewBag.EmployeeID = objemployeeproperty.Id;
            GetDesignations();
            GetDepartments();
            GetDeputaion();
            GetEmptype();
            return(View("AddEmployee", objemployeeproperty));
        }
Beispiel #3
0
        public JsonResult GetEmployeeByID(int id)
        {
            objemployeeproperty    = new EmployeeProperty();
            objemployeeproperty.Id = id;
            objEmployeeBll         = new Employee_BLL(objemployeeproperty);
            DataTable dt = objEmployeeBll.SelectOne();

            if (dt.Rows.Count > 0)
            {
                var Empserialize = JsonConvert.SerializeObject(dt);

                return(Json(new { status = true, code = 200, message = "No user Found", data = Empserialize }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { status = true, code = 404, message = "No user Found", data = "" }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #4
0
        public void GetEmployeeInfo()
        {
            int employeeId = Convert.ToInt32(Session["Emp_ID"]);
            EmployeeProperty objemployeeproperty = new EmployeeProperty();

            objemployeeproperty.Id = employeeId;
            Employee_BLL            objEmployeeBll   = new Employee_BLL(objemployeeproperty);
            DataTable               dt               = objEmployeeBll.SelectOne();
            List <EmployeeProperty> EmployeeProperty = new List <EmployeeProperty>();

            foreach (DataRow dr in dt.Rows)
            {
                EmployeeProperty objEmployeeProperty = new EmployeeProperty();
                objEmployeeProperty.Casual_Leaves = Convert.ToInt32(dr["Casual_Leaves"].ToString());
                objEmployeeProperty.Annual_Leaves = Convert.ToInt32(dr["Annual_Leaves"].ToString());
                EmployeeProperty.Add(objEmployeeProperty);
            }
            ViewBag.EmployeeInfo = EmployeeProperty;
        }
Beispiel #5
0
        public JsonResult AddTask(Project_Property Project)
        {
            if (ModelState.IsValid)
            {
                EmployeeProperty objempproperty = new EmployeeProperty();
                objempproperty.Id = Project.Resource_Id;
                Employee_BLL objemployeebll = new Employee_BLL(objempproperty);
                DataTable    dt             = objemployeebll.SelectOne();
                foreach (DataRow dr in dt.Rows)
                {
                    Project.Employee_Cost = Math.Round(Convert.ToDecimal(dr["TotalSalary"].ToString()) / 270, 2);
                }
                //add new employee
                if (Project.Project_Id == null || Project.Project_Id <= 0)
                {
                    Project.DateCreated = DateTime.Now;

                    Project.Status       = "Active";
                    Project.Is_Active    = true;
                    Project.In_Progress  = false;
                    Project.Is_Completed = false;

                    Project.Remarks = "";

                    //Project.Employee_Cost=
                    objProjectBll = new Project_BLL(Project);
                    var flag = objProjectBll.InsertTask();
                    if (flag)
                    {
                        return(Json(new { success = true, statuscode = 200, msg = "Successfully inserted" }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { success = false, statuscode = 500, msg = "Failed" }, JsonRequestBehavior.AllowGet));
                    }
                }
                //when id <0 update case
                else
                {
                    Project.DateCreated = DateTime.Now;

                    Project.Status = "Active";

                    objProjectBll = new Project_BLL(Project);
                    var flag = objProjectBll.Insert();
                    if (flag)
                    {
                        return(Json(new { success = true, statuscode = 200, msg = "Successfully inserted" }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { success = false, statuscode = 500, msg = "Failed" }, JsonRequestBehavior.AllowGet));
                    }
                }
            }
            //when model state is not valid
            else
            {
                var errors = ModelState.Select(x => x.Value.Errors)
                             .Where(y => y.Count > 0)
                             .ToList();
                return(Json(new { success = false, statuscode = 500, msg = "Please Enter According To Instructions" }, JsonRequestBehavior.AllowGet));
            }
        }