Exemplo n.º 1
0
        public JsonResult GetInsteadDeportations()
        {
            InsteadDeportationsBLL InsteadDeportationsBLL = new InsteadDeportationsBLL()
            {
                Search   = Search,
                Order    = Order,
                OrderDir = OrderDir,
                StartRec = StartRec,
                PageSize = PageSize
            };
            var data = InsteadDeportationsBLL.GetInsteadDeportations(out TotalRecordsOut, out RecFilterOut)
                       .Select(x => new
            {
                InsteadDeportationID  = x.InsteadDeportationID,
                EmployeeCareerHistory = x.EmployeeCareerHistory,
                //EmployeeCareerHistory = new EmployeesCareersHistoryBLL().GetEmployeeCareerHistoryByEmployeeCareerHistoryID(item.EmployeeCareerHistoryID),
                DeportationDate = x.DeportationDate,
                Amount          = x.Amount,
                Note            = x.Note,
                CreatedBy       = x.CreatedBy,
                CreatedDate     = x.CreatedDate,
            });

            return(Json(new { draw = Convert.ToInt32(Draw), recordsTotal = TotalRecordsOut, recordsFiltered = RecFilterOut, data = data }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult Delete(InsteadDeportationsViewModel InsteadDeportationVM)
        {
            InsteadDeportationsBLL InsteadDeportationsBLL = new InsteadDeportationsBLL();

            InsteadDeportationsBLL.LoginIdentity = UserIdentity;
            InsteadDeportationsBLL.Remove(InsteadDeportationVM.InsteadDeportationID);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public JsonResult GetAllInsteadDeportations()
        {
            var data = new InsteadDeportationsBLL().GetInsteadDeportations()
                       .Select(x => new
            {
                InsteadDeportationID = x.InsteadDeportationID,
                EmployeeCodeNo       = x.EmployeeCareerHistory.EmployeeCode.EmployeeCodeNo,
                EmployeeNameAr       = x.EmployeeCareerHistory.EmployeeCode.Employee.EmployeeNameAr,
                JobName         = x.EmployeeCareerHistory.OrganizationJob.Job.JobName,
                DeportationDate = Globals.Calendar.GetUmAlQuraDate(x.DeportationDate),
                Note            = x.Note,
                Amount          = x.Amount
            });

            return(Json(new { data = data }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        private InsteadDeportationsViewModel GetByInsteadDeportationID(int id)
        {
            InsteadDeportationsBLL       InsteadDeportationBLL = (new InsteadDeportationsBLL()).GetByInsteadDeportationID(id);
            InsteadDeportationsViewModel InsteadDeportationVM  = new InsteadDeportationsViewModel();

            if (InsteadDeportationBLL != null)
            {
                InsteadDeportationVM.InsteadDeportationID   = InsteadDeportationBLL.InsteadDeportationID;
                InsteadDeportationVM.DeportationDate        = InsteadDeportationBLL.DeportationDate.Date;
                InsteadDeportationVM.EmployeeCareersHistory = InsteadDeportationBLL.EmployeeCareerHistory;
                InsteadDeportationVM.Note        = InsteadDeportationBLL.Note;
                InsteadDeportationVM.Amount      = InsteadDeportationBLL.Amount;
                InsteadDeportationVM.CreatedDate = InsteadDeportationBLL.CreatedDate;
                InsteadDeportationVM.CreatedBy   = InsteadDeportationVM.GetCreatedByDisplayed(InsteadDeportationBLL.CreatedBy);
            }
            return(InsteadDeportationVM);
        }
Exemplo n.º 5
0
        public ActionResult Create(InsteadDeportationsViewModel InsteadDeportationVM)
        {
            InsteadDeportationsBLL InsteadDeportation = new InsteadDeportationsBLL();

            InsteadDeportation.DeportationDate       = InsteadDeportationVM.DeportationDate;
            InsteadDeportation.Note                  = InsteadDeportationVM.Note;
            InsteadDeportation.Amount                = InsteadDeportationVM.Amount;
            InsteadDeportation.EmployeeCareerHistory = new EmployeesCareersHistoryBLL()
            {
                EmployeeCareerHistoryID = (int)InsteadDeportationVM.EmployeeCareerHistoryID
            };
            InsteadDeportation.LoginIdentity = new EmployeesCodesBLL()
            {
                EmployeeCodeID = int.Parse(Session["EmployeeCodeID"].ToString())
            };
            Result result = InsteadDeportation.Add();

            if ((System.Type)result.EnumType == typeof(AllowanceValidationEnum))
            {
                InsteadDeportationsBLL InsteadDeportationEntity = (InsteadDeportationsBLL)result.Entity;
                if (result.EnumMember == AllowanceValidationEnum.Done.ToString())
                {
                    // Session["InsteadDeportationID"] = ((InsteadDeportationsBLL)result.Entity).InsteadDeportationID;
                    InsteadDeportationVM.InsteadDeportationID = ((InsteadDeportationsBLL)result.Entity).InsteadDeportationID;
                }
                else if (result.EnumMember == AllowanceValidationEnum.RejectedBecauseOfNotAllowedForJob.ToString())     //not in jobAllowance table
                {
                    throw new CustomException(Resources.Globalization.ValidationAllowanceNotAllowedForJobText);
                }
                else if (result.EnumMember == AllowanceValidationEnum.RejectedBecauseOfStoped.ToString())               //allowance inactive
                {
                    throw new CustomException(Resources.Globalization.ValidationAllowanceStopedText);
                }
                else if (result.EnumMember == AllowanceValidationEnum.RejectedBecauseOfStopedForJob.ToString())     // job inactive
                {
                    throw new CustomException(Resources.Globalization.ValidationAllowanceStopedForJobText);
                }
            }

            //return View(InsteadDeportationVM);
            return(Json(new { InsteadDeportationID = InsteadDeportationVM.InsteadDeportationID }, JsonRequestBehavior.AllowGet));
        }