Ejemplo n.º 1
0
        public JsonResult GetActiveEServiceProxy(int EServiceTypeID)
        {
            int    OrganizationID        = this.WindowsUserOrganizationID;
            string ManagerEmployeeCodeNo = this.WindowsUserIdentity;

            EServicesProxiesBLL EServiceProxy
                = new EServicesProxiesBLL().GetActiveByFromEmployeeCodeID(this.WindowsEmployeeCode.EmployeeCodeID, (EServicesTypesEnum)EServiceTypeID);

            EServicesProxiesViewModel VM = new EServicesProxiesViewModel();

            if (EServiceProxy != null)
            {
                VM.EServiceProxyID = EServiceProxy.EServiceProxyID;
                VM.StartDate       = EServiceProxy.StartDate;
                VM.EndDate         = EServiceProxy.EndDate;
                VM.ToEmployee      = new EmployeesViewModel()
                {
                    EmployeeCodeID = EServiceProxy.ToEmployee.EmployeeCodeID,
                    EmployeeCodeNo = EServiceProxy.ToEmployee.EmployeeCodeNo,
                    EmployeeNameAr = EServiceProxy.ToEmployee.Employee.EmployeeNameAr
                };
            }
            return(Json(new
            {
                data = VM
            }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public ActionResult CreateEServiceProxy(EServicesProxiesViewModel EServiceProxyVM)
        {
            int OrganizationID = this.WindowsUserOrganizationID;
            EServicesProxiesBLL EServiceProxy = new EServicesProxiesBLL();

            EServiceProxy.StartDate    = EServiceProxyVM.StartDate;
            EServiceProxy.FromEmployee = new EmployeesCodesBLL()
            {
                EmployeeCodeID = EServiceProxyVM.FromEmployee.EmployeeCodeID.Value
            };
            EServiceProxy.ToEmployee = new EmployeesCodesBLL()
            {
                EmployeeCodeID = EServiceProxyVM.ToEmployee.EmployeeCodeID.Value
            };
            EServiceProxy.Notes        = EServiceProxyVM.Notes;
            EServiceProxy.EServiceType = new EServicesTypesBLL()
            {
                EServiceTypeID = EServiceProxyVM.EServiceType.EServiceTypeID
            };
            EServiceProxy.LoginIdentity = this.WindowsEmployeeCode;
            Result result = EServiceProxy.Add();

            EServicesProxiesChartViewModel ChartVM =
                this.MapToChartVM(new EmployeesCodesBLL().GetAllEmployeesManagersByOrganizationID(OrganizationID,
                                                                                                  (EServicesTypesEnum)EServiceProxyVM.EServiceType.EServiceTypeID, EServiceProxyVM.ToEmployee.EmployeeCodeID.Value).FirstOrDefault(),
                                  EServiceProxyVM.ToEmployee.EmployeeCodeID.Value);

            if (result.EnumMember == EServicesProxiesEnum.Done.ToString())
            {
                // done
            }
            else if (result.EnumMember == EServicesProxiesEnum.RejectedBecauseLoginManagerIsSameAsProxyEmployee.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationEServicesProxiesLoginManagerIsSameAsProxyEmployeeText);
            }
            else if (result.EnumMember == EServicesProxiesEnum.RejectedBecauseThereIsAlreadyActiveProxyExist.ToString())
            {
                string msg = string.Format(Resources.Globalization.ValidationEServicesProxiesThereIsAlreadyActiveProxyExistsText,
                                           ((EServicesProxiesBLL)result.Entity).ToEmployee.Employee.EmployeeNameAr);
                throw new CustomException(msg);
            }
            else if (result.EnumMember == EServicesProxiesEnum.RejectedBecauseStartDateRequried.ToString())
            {
                throw new CustomException(string.Format(Resources.Globalization.RequiredFieldText, Resources.Globalization.StartDateText));
            }
            else if (result.EnumMember == EServicesProxiesEnum.RejectedBecauseThereIsPendingEVacationRequestExist.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationEServicesProxiesThereIsPendingEVacationRequestExistText);
            }
            else if (result.EnumMember == EServicesProxiesEnum.RejectedBecauseThereIsVacationExist.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationEServicesProxiesThereIsVacationExistText);
            }

            return(Json(new { node = ChartVM }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public ActionResult MyEServicesProxies()
        {
            EServicesProxiesViewModel VM = new EServicesProxiesViewModel();

            VM.EServiceTypes = this.GetEServiceTypes(true);
            VM.WindowsUserOrganizationStructures = this.WindowsUserOrganizationStructures;
            VM.Organization = new OrganizationStructureViewModel()
            {
                OrganizationID = this.WindowsUserOrganizationID
            };
            VM.WindowsEmployeeCode = this.WindowsEmployeeCode;
            return(View(VM));
        }
Ejemplo n.º 4
0
        // GET: EServicesProxies
        public ActionResult Index()
        {
            EServicesProxiesViewModel VM = new EServicesProxiesViewModel();

            VM.EServiceTypes = this.GetEServiceTypes();
            VM.WindowsUserOrganizationStructures = this.WindowsUserOrganizationStructures;
            VM.Organization = new OrganizationStructureViewModel()
            {
                OrganizationID = this.WindowsUserOrganizationID
            };
            VM.WindowsEmployeeCode = this.WindowsEmployeeCode;
            //VM.StartDate = DateTime.Now;
            return(View(VM));
        }