示例#1
0
 public bool CheckEmployeeID(string empid)
 {
     objemployeeproperty             = new EmployeeProperty();
     objemployeeproperty.Employee_ID = empid;
     objEmployeeBll = new Employee_BLL(objemployeeproperty);
     return(objEmployeeBll.CheckEmployeeID());
 }
示例#2
0
        public JsonResult GetEmployees()
        {
            objEmployeeBll = new Employee_BLL();
            DataTable Employee     = objEmployeeBll.SelectAll();
            var       EmployeeJson = JsonConvert.SerializeObject(Employee);
            var       deserilize   = JsonConvert.DeserializeObject(EmployeeJson);

            return(Json(new { Employee = EmployeeJson, Employeedeserialize = deserilize }, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public JsonResult GetEmployeesDepandants(int id)
        {
            Depandants_Property dpndnt = new Depandants_Property();

            dpndnt.Employee_Primary_Id = id;
            objEmployeeBll             = new Employee_BLL(dpndnt);

            DataTable depandants        = objEmployeeBll.SelectDepandant();
            var       EmployeeDepandant = JsonConvert.SerializeObject(depandants);
            var       deserilize        = JsonConvert.DeserializeObject(EmployeeDepandant);

            return(Json(new { Employee = EmployeeDepandant }, JsonRequestBehavior.AllowGet));
        }
示例#4
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));
        }
示例#5
0
        public void GetEmployee()
        {
            Employee_BLL            objemployeeBLL = new Employee_BLL();
            DataTable               dt             = objemployeeBLL.SelectAll();
            List <EmployeeProperty> objEmployeePropertylistItems = new List <EmployeeProperty>();

            foreach (DataRow dr in dt.Rows)
            {
                EmployeeProperty objEmployeeProperty = new EmployeeProperty();
                objEmployeeProperty.EmpName = dr["EmployeeName"].ToString();
                objEmployeeProperty.Id      = Convert.ToInt32(dr["ID"].ToString());
                objEmployeePropertylistItems.Add(objEmployeeProperty);
            }
            ViewBag.EmployeelistItems = objEmployeePropertylistItems;
        }
示例#6
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));
        }
示例#7
0
        public JsonResult GetAttendanceRepotrt(int year, int month)
        {
            int              employeeid = Convert.ToInt32(Session["Emp_ID"].ToString());
            string           from       = year + "-" + month + "-" + 01;
            string           to         = year + "-" + month + "-" + 31;
            EmployeeProperty emp        = new EmployeeProperty();

            emp.Id = employeeid;
            Employee_BLL empbll          = new Employee_BLL(emp);
            int          empattendanceid = empbll.GetEmployeeAttendanceId();

            objattendancebll = new Attendance_BLL();
            DataTable dt          = objattendancebll.SelectEmployeeAttendance(from, to, empattendanceid);
            var       dtserialize = JsonConvert.SerializeObject(dt);

            return(Json(new { data = dtserialize }, JsonRequestBehavior.AllowGet));
        }
示例#8
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));
            }
        }
示例#9
0
        public FileResult DownloadAttendance(int year, int month)
        {
            int              employeeid = Convert.ToInt32(Session["Emp_ID"].ToString());
            string           from       = year + "-" + month + "-" + 01;
            string           to         = year + "-" + month + "-" + 31;
            EmployeeProperty emp        = new EmployeeProperty();

            emp.Id = employeeid;
            Employee_BLL empbll          = new Employee_BLL(emp);
            int          empattendanceid = empbll.GetEmployeeAttendanceId();

            objattendancebll = new Attendance_BLL();
            DataTable dt       = objattendancebll.SelectEmployeeAttendance(from, to, empattendanceid);
            string    fullName = Server.MapPath("~" + "/AttendanceFiles/Attendance Report" + from + to + employeeid);
            bool      flag     = WriteDataTableToExcel(dt, "Attendance Report" + employeeid, fullName);

            if (flag)
            {
                try
                {
                    byte[] fileBytes = System.IO.File.ReadAllBytes(fullName + ".xlsx");
                    string fileName  = Path.GetFileName(fullName + ".xlsx");
                    return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName));
                }
                catch (Exception ex)
                {
                    //StringBuilder sb = new StringBuilder();
                    //sb.Append("log something");

                    //File.AppendAllText(filePath + "log.txt", sb.ToString());
                    //sb.Clear();
                    byte[] fileBytes = new byte[1];
                    return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, ""));
                }
            }
            else
            {
                byte[] fileBytes = System.IO.File.ReadAllBytes(fullName);
                string fileName  = Path.GetFileName("");

                return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, "abc Else Case"));
            }
        }
示例#10
0
        public JsonResult DeleteEmployee(int id)
        {
            objemployeeproperty           = new EmployeeProperty();
            objemployeeproperty.Id        = id;
            objemployeeproperty.TableName = "tbl_Employee";
            objemployeeproperty.Status    = "Deleted";
            objemployeeproperty.U_id      = SessionManager.CurrentUser.ID;
            objEmployeeBll = new Employee_BLL(objemployeeproperty);
            var flag = objEmployeeBll.UpdateStatus();

            if (flag)
            {
                return(Json(new { success = true, statuscode = 200, msg = "Successfull" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { success = false, statuscode = 500, msg = "Failed" }, JsonRequestBehavior.AllowGet));
            }
        }
示例#11
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;
        }
示例#12
0
        public JsonResult AddEmployee(EmployeeProperty empployeepropertys)
        {
            //if (ModelState.IsValid)
            //{
            //add new employee
            if (empployeepropertys.Id == null || empployeepropertys.Id <= 0)
            {
                if (empployeepropertys.ImageFile != null)
                {
                    var file = empployeepropertys.ImageFile;
                    UploadProfilePicture(empployeepropertys);
                }
                empployeepropertys.CreatedDate = DateTime.Now;
                empployeepropertys.IsActive    = true;
                empployeepropertys.Status      = "Active";
                empployeepropertys.U_id        = SessionManager.CurrentUser.ID;
                objEmployeeBll = new Employee_BLL(empployeepropertys);
                var flag = objEmployeeBll.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 id <0 update case
            else
            {
                if (empployeepropertys.ImageFile != null)
                {
                    UploadProfilePicture(empployeepropertys);
                }
                empployeepropertys.CreatedDate = DateTime.Now;
                empployeepropertys.IsActive    = true;
                empployeepropertys.Status      = "Active";
                objEmployeeBll          = new Employee_BLL(empployeepropertys);
                empployeepropertys.U_id = SessionManager.CurrentUser.ID;
                if (empployeepropertys.Depandants != null)
                {
                    try
                    {
                        var Depandant = JsonConvert.SerializeObject(empployeepropertys.Depandants);
                        // List<RootObject> l = new List<RootObject>();
                        // List<Depandants_Property> myDeserializedObjList = (List<Depandants_Property>)JsonConvert.DeserializeObject(empployeepropertys.Depandants);
                        List <RootObject> l = JsonConvert.DeserializeObject <List <RootObject> >(empployeepropertys.Depandants);

                        var targetList = l.Select(x => new Depandants_Property()
                        {
                            ID                  = x.ID,
                            Depand_Name         = x.Depand_Name,
                            RelationShip        = x.RelationShip,
                            Dob                 = Convert.ToDateTime(x.Dob),
                            Medical             = Convert.ToBoolean(x.Medical),
                            Nic                 = x.Nic,
                            Employee_Primary_Id = x.Employee_Primary_Id,
                            Employee_Key        = x.Employee_Key
                        })
                                         .ToList();
                        empployeepropertys.DepandantsList = UtilityClass.ToDataTable(targetList);
                    }
                    catch (Exception ex)
                    {
                    }
                }
                var flag = objEmployeeBll.Update();
                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
            //{
            //    return Json(new { success = false, statuscode = 500, msg = "Please Enter According To Instructions" }, JsonRequestBehavior.AllowGet);
            //   }
        }
示例#13
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));
            }
        }