Ejemplo n.º 1
0
        public IList <EmployeeExt> GetEmployeeExt()
        {
            List <EmployeeExt> lst = new List <EmployeeExt>();

            using (var context = (HRM_ROHTOEntities)Activator.CreateInstance(typeof(HRM_ROHTOEntities), _connectionStr))
            {
                foreach (var item in context.TBL_EMPLOYEE)
                {
                    TBL_DEPARTMENT department = context.TBL_DEPARTMENT.FirstOrDefault(x => x.DepartmentID == item.DepartmentID);
                    TBL_POSITION   position   = context.TBL_POSITION.FirstOrDefault(x => x.PositionID == item.PositionID1);
                    EmployeeExt    ext        = new EmployeeExt
                    {
                        EmployeeID     = item.EmployeeID,
                        EmployeeCode   = item.EmployeeCode,
                        FullName       = item.FullName,
                        ContractNo     = item.ContractNo,
                        CardNumber     = item.CardNumber,
                        DepartmentName = department != null ? department.DepartmentName : "",
                        PositionName   = position != null ? position.PositionName : "",
                        IsLeaveOut     = item.IsLeaveOut == true ? "Nghỉ việc" : "Đang làm"
                    };
                    lst.Add(ext);
                }
            }
            lst.OrderBy(n => n.DepartmentName).ThenBy(n => n.EmployeeCode);
            return(lst);
        }
Ejemplo n.º 2
0
        public ActionResult Delete(int PositionID)
        {
            // Ghi log
            TBL_POSITION oldPosition = DA_Position.Instance.GetById(PositionID);

            WriteLog("Position", "Edit", oldPosition, null);

            DA_Position.Instance.Delete(PositionID);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        public ActionResult Edit(int PositionID)
        {
            TBL_POSITION cus = DA_Position.Instance.GetById(PositionID);

            if (cus == null)
            {
                return(HttpNotFound());
            }
            return(View(cus));
        }
Ejemplo n.º 4
0
        public ActionResult Create(TBL_POSITION item)
        {
            try
            {
                DA_Position.Instance.Insert(item);

                // Ghi log
                WriteLog("Position", "Create", null, item);

                return(RedirectToAction("Index"));
            }
            catch { return(View()); }
        }
Ejemplo n.º 5
0
        public ActionResult Edit(TBL_POSITION item)
        {
            try
            {
                DA_Position.Instance.Update(item);

                // Ghi log
                TBL_POSITION oldPosition = DA_Position.Instance.GetById(item.PositionID);
                WriteLog("Position", "Edit", oldPosition, item);

                return(RedirectToAction("Index"));
            }
            catch { return(View()); }
        }