예제 #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 void UploadProfilePicture(EmployeeProperty empprofilepic)
        {
            var    file     = empprofilepic.ImageFile;
            string filename = "";
            string filepath = "";

            try
            {
                filename = System.IO.Path.GetFileName(System.IO.Path.GetRandomFileName() + file.FileName);
                file.SaveAs(Server.MapPath("/ProfileImages/" + filename));

                filepath = "/ProfileImages/" + filename;
                //file.SaveAs(Server.MapPath(filepath));
                string fullPath = Request.MapPath(empprofilepic.ImgPath);
                if (System.IO.File.Exists(fullPath))
                {
                    System.IO.File.Delete(fullPath);
                }

                empprofilepic.ImgPath = filepath;
            }
            catch (Exception ex)
            {
            }
        }
예제 #3
0
        public ActionResult AddEmployee()
        {
            GetDesignations();
            GetDepartments();
            GetEmptype();


            string employeeid = RandomString(8);

            if (CheckEmployeeID(employeeid))
            {
                AddEmployee();
            }
            else
            {
                objemployeeproperty = new EmployeeProperty()
                {
                    Attndnc_id    = 0,
                    Benefit1      = 0,
                    Benefit2      = 0,
                    Allownce1     = 0,
                    Allownce2     = 0,
                    Allownce3     = 0,
                    Total_Package = 0,
                    TotalSalary   = 0
                };
                objemployeeproperty.Employee_ID = employeeid;
            }

            return(View(objemployeeproperty));
        }
예제 #4
0
 private void RemoveUncheckedEmployees()
 {
     foreach (var EmployeeProperty in ProjectAddcheckedListBox.Items)
     {
         if (ProjectAddcheckedListBox.CheckedItems.Contains(EmployeeProperty))
         {
             continue;
         }
         if (EmployeesOnProject.IsEmployeeOnProject(EmployeeProperty.ToString().GetOIBInCheck(), OldName))
         {
             EmployeesOnProject.Remove(EmployeesOnProject.GetRelation(EmployeeProperty.ToString().GetOIBInCheck(), OldName));
         }
     }
 }
예제 #5
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));
        }
예제 #6
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;
        }
예제 #7
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));
        }
예제 #8
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));
        }
예제 #9
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));
            }
        }
예제 #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 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"));
            }
        }
예제 #13
0
        private void EmployeeDeleteButton_Click(object sender, EventArgs e)
        {
            var Employee = new List <Employees>();

            foreach (var EmployeeProperty in EmployeeMenucheckedListBox.CheckedItems)
            {
                Employee.Add(EmployeesList.FindEmployeeByOIB(EmployeeProperty.ToString().GetOIBInCheck()));
            }

            if (Employee.Count == 0)
            {
                return;
            }

            if (DialogResult.Yes == MessageBox.Show("Jeste li sigurni da zelite izbrisati odabrane stavke?", "Oprez!", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation))
            {
                foreach (var employees in Employee)
                {
                    DeleteEmployee(employees);

                    /*var ErrorCounter = 0;
                     * foreach (var Project in EmployeesOnProject.GetProjectsByEmployee(employee.OIB))
                     * {
                     *  if (EmployeesOnProject.TryRemove(
                     *      EmployeesOnProject.GetRelation(employee.OIB, Project.Name))) continue;
                     *  ErrorCounter++;
                     *  EmployeeDeleteError LastEmployeeError = new EmployeeDeleteError();
                     *  LastEmployeeError.ShowDialog();
                     *
                     *  break;
                     * }
                     * if (ErrorCounter == 0)
                     *  EmployeesList.EmployeeDelete(employee);*/
                }
            }

            RefreshEmployeesListBox();
        }
예제 #14
0
 public Employee_DAL(EmployeeProperty objEmp_prop)
 {
     objEmpProp = objEmp_prop;
 }
예제 #15
0
 public Employee_BLL(EmployeeProperty objEmp_Prop)
 {
     objEmpProp = objEmp_Prop;
 }
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(txtUserID.Text))
            {
                CommonClassLibraryGlobal.showError("กรุณากรอก UserID");
                txtUserID.Focus();
                return;
            }

            if (String.IsNullOrWhiteSpace(txtPassword.Text))
            {
                CommonClassLibraryGlobal.showError("กรุณากรอก Password");
                txtPassword.Focus();
                return;
            }

            if (txtUserID.Text.Substring(0, 1) != "S")
            {
                CommonClassLibraryGlobal.showError("UserID นี้ไม่สามารถแก้ไขข้อมูลได้");
                txtPassword.Text = "";
                txtUserID.Text   = "";
                txtUserID.Focus();
                return;
            }


            EmployeeProperty employeeProperty = new EmployeeProperty();

            employeeProperty.EmpCode = txtUserID.Text;

            employeeProperty = employeeController.SearchOne(employeeProperty);

            if (employeeProperty == null)
            {
                CommonClassLibraryGlobal.showError("ไม่พบข้อมูล UserID");
                txtPassword.Text = "";
                txtUserID.Text   = "";
                txtUserID.Focus();
                return;
            }

            if (txtPassword.Text != "FL12345")
            {
                CommonClassLibraryGlobal.showError("UserID / Password ไม่ถูกต้อง");
                txtPassword.Text = "";
                txtUserID.Text   = "";
                txtUserID.Focus();
                return;
            }

            CommonClassLibraryGlobal.OPERATOR_ID = txtUserID.Text;

            switch (CommonClassLibraryGlobal.Login_TYPE_FORM)
            {
            case "Product Spec":

                frmProductSpecSetting frmProduct = new frmProductSpecSetting();
                frmProduct.ShowDialog();
                this.Dispose();
                frmProduct.Close();

                break;

            case "System Spec":

                frmSystem frmSystem = new frmSystem();
                frmSystem.ShowDialog();
                this.Dispose();
                frmSystem.Close();

                break;
            }
        }
예제 #17
0
 set => SetValue(EmployeeProperty, value);
예제 #18
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);
            //   }
        }
예제 #19
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));
            }
        }