Ejemplo n.º 1
0
Archivo: Test.cs Proyecto: 5509850/vts
        public async Task IntegrationCreateVacation()
        {
            VacationsViewModel vacationsViewModel = (onlineMode) ? FactorySingleton.Factory.Get <VacationsViewModel>() : FactorySingleton.FactoryOffline.Get <VacationsViewModel>();
            List <VTSModel>    vtsList            = await vacationsViewModel.GetVTSList();

            Assert.IsNotNull(vtsList, "Message: GetVTSList error");

            VacationInfoModel vacationInfo = await vacationsViewModel.GetVacationInfo(vtsList[0].Id);

            Assert.IsNotNull(vacationInfo, "Message: GetVacationInfo error");

            var oldcount = vtsList.Count;
            VacationInfoModel vacationInfoNew = await vacationsViewModel.CreateDraftVacationInfo();

            Assert.IsNotNull(vacationInfoNew, "Message: CreateDraftVacationInfo error");
            vacationInfoNew.Type.Value = "TESTING";
            await vacationsViewModel.UpdateDraftVacationInfo(vacationInfoNew);

            if (onlineMode)
            {
                Assert.IsTrue((await vacationsViewModel.SendDraftVacationInfo()), "Message: error SendDraftVacationInfo");
                vtsList = await vacationsViewModel.GetVTSList();

                Assert.AreEqual(vtsList.Count, (oldcount + 1), "Message: error after Create newcount != oldcount + 1");
                VacationInfoModel vacationInfoSaved = await vacationsViewModel.GetVacationInfo(vtsList[vtsList.Count - 1].Id);

                Assert.IsNotNull(vacationInfoSaved, "Message: GetVacationInfo2 error");
                Assert.AreEqual(vacationInfoNew.Type.Value, vacationInfoSaved.Type.Value, "Message: error vacationInfoNew not Equals Type.Value vacationInfoSaved");
            }
        }
Ejemplo n.º 2
0
        public async Task <List <VTSModel> > GetVacationListFromRest(VacationsViewModel viewModel)
        {
            List <VTSModel> listVacations = new List <VTSModel>();

            try {
                var responce = _vacationsDataService.GetResponceModel();
                responce = await _vacationsDataService.GetVacationsListFromRest();

                if (responce.LoginSuccess)
                {
                    viewModel.State = UserState.Authorized;
                }
                else
                {
                    viewModel.State        = UserState.Unauthorized;
                    viewModel.ErrorMessage = responce.ErrorMessage;
                    return(null);
                }

                listVacations = responce.VacationList;
            }
            catch (AggregateException e)
            {
                viewModel.ErrorMessage = e.InnerExceptions[0].Data["message"].ToString();
                listVacations          = null;
            }
            return(await Helper.Complete(listVacations));
        }
Ejemplo n.º 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            RequestWindowFeature(WindowFeatures.ActionBar);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            if (Intent.Extras != null)
            {
                _id = Intent.Extras.GetInt("ID");
            }
            else
            {
                Finish();
            }
            SetContentView(Resource.Layout.VacationDetail);
            _vacationsViewModel = FactorySingleton.Factory.Get <VacationsViewModel>();
            if (_vacationsViewModel.IsOnlineMode)
            {
                ActionBar.SetTitle(Resource.String.editRequest);
            }
            else
            {
                ActionBar.SetTitle(Resource.String.editRequestOffline);
            }

            InintControl();
            FillData();
        }
Ejemplo n.º 4
0
        public async Task <bool> UpdateOrCreateVacationInRest(VacationsViewModel viewModel, VacationInfoModel vacation)
        {
            VacationUpdateResponce responce = null;

            try
            {
                responce = await _vacationsDataService.UpdateOrCreateVacationsRest(vacation);
            }
            catch (AggregateException e)
            {
                viewModel.ErrorMessage = e.InnerExceptions[0].Data["message"].ToString();
            }
            catch (Exception ex)
            {
                viewModel.ErrorMessage = ex.Message;
            }

            if (responce.LoginSuccess)
            {
                viewModel.State        = UserState.Authorized;
                viewModel.ErrorMessage = String.Empty;
            }
            else
            {
                viewModel.State        = UserState.Unauthorized;
                viewModel.ErrorMessage = responce.ErrorMessage;
            }

            return(await Helper.Complete(responce.LoginSuccess));
        }
Ejemplo n.º 5
0
        protected override void FetchDataToControl()
        {
            if (ID == 0)
            {
                return;
            }
            _vacationError.Text = string.Empty;
            _vacationsViewModel = FactorySingleton.Factory.Get <VacationsViewModel>();

            var title = string.Empty;

            if (_vacationsViewModel.IsOnlineMode)
            {
                title = Localize("editRequest");
            }
            else
            {
                title = Localize("editRequestOffline");
            }
            NavigationItem.Title = title;
            NavigationItem.SetHidesBackButton(false, false);

            doneButton       = new UIBarButtonItem();
            doneButton.Title = Localize("done");
            NavigationItem.RightBarButtonItem = doneButton;

            backButton       = new UIBarButtonItem();
            backButton.Title = Localize("cancel_button");
            NavigationItem.LeftBarButtonItem = backButton;
            InintAndLocalizeControl();
            LoadFonts();
        }
Ejemplo n.º 6
0
        public async Task <bool> DeleteVacation(VacationsViewModel viewModel, VTSModel vacation)
        {
            VacationUpdateResponce responce = new VacationUpdateResponce(0, true, string.Empty);

            if (viewModel.IsOnlineMode)
            {
                try
                {
                    responce = await _vacationsDataService.DeleteVacationInRest(vacation);
                }
                catch (AggregateException e)
                {
                    viewModel.ErrorMessage = e.InnerExceptions[0].Data["message"].ToString();
                    return(false);
                }
                catch (Exception ex)
                {
                    viewModel.ErrorMessage = ex.Message;
                    return(false);
                }
            }
            if (responce.LoginSuccess)
            {
                viewModel.State        = UserState.Authorized;
                viewModel.ErrorMessage = String.Empty;
            }
            else
            {
                viewModel.State        = UserState.Unauthorized;
                viewModel.ErrorMessage = responce.ErrorMessage;
            }
            await _vacationsDataService.DeleteVacationsInSql(vacation);

            return(await Helper.Complete(responce.LoginSuccess));
        }
Ejemplo n.º 7
0
 protected override void FetchDataToControl()
 {
     try
     {
         _vacationsViewModel = FactorySingleton.Factory.Get <VacationsViewModel>();
         Task <List <VTSModel> > task = Task.Run(async() => await _vacationsViewModel.GetVTSList());
         task.Wait();
         _listVTSModel = task.Result;
         if (_listVTSModel == null && _vacationsViewModel.State == UserState.Unauthorized)
         {
             GoToLoginScreen();
             return;
         }
         tableSource  = new TableSource(_listVTSModel, this);
         table.Source = tableSource;
         _butnAdd     = new UIBarButtonItem(UIBarButtonSystemItem.Add, ButnAddClicked);
         NavigationItem.RightBarButtonItem = _butnAdd;
         _butnMenu       = new  UIBarButtonItem();
         _butnMenu.Title = Localize("Menu");
         NavigationItem.LeftBarButtonItem = _butnMenu;
         NavigationItem.Title             = Localize("Requests");
     }
     catch (Exception)
     {
     }
 }
Ejemplo n.º 8
0
        private async Task  FillData(View view)
        {
            _vacationsViewModel = FactorySingleton.Factory.Get <VacationsViewModel>();
            _vacationInfo       = await _vacationsViewModel.CreateDraftVacationInfo();

            view.FindViewById <TextView>(Resource.Id.ItemEmployee).Text               = _vacationInfo.Employee.FullName;
            view.FindViewById <TextView>(Resource.Id.ItemApprover).Text               = _vacationInfo.Approver.FullName;
            view.FindViewById <TextView>(Resource.Id.ItemDuration).Text               = String.Format("{0} {1}", ConverterHelper.CalculateDuration(DateTime.Now.Date, DateTime.Now.Date), _vacationsViewModel.Localaizer.Localize("days"));
            view.FindViewById <TextView>(Resource.Id.ItemStatus).Text                 = _vacationInfo.Status.Value;
            view.FindViewById <TextView>(Resource.Id.ItemEmployee).Typeface           = FontLoader.GetFontNormal((Activity)_container.Context);
            view.FindViewById <TextView>(Resource.Id.ItemType).Typeface               = FontLoader.GetFontNormal((Activity)_container.Context);
            view.FindViewById <TextView>(Resource.Id.ItemApprover).Typeface           = FontLoader.GetFontNormal((Activity)_container.Context);
            view.FindViewById <Button>(Resource.Id.ItemStartDateBtn).Typeface         = FontLoader.GetFontNormal((Activity)_container.Context);
            view.FindViewById <Button>(Resource.Id.ItemEndDateBtn).Typeface           = FontLoader.GetFontNormal((Activity)_container.Context);
            view.FindViewById <TextView>(Resource.Id.ItemDuration).Typeface           = FontLoader.GetFontNormal((Activity)_container.Context);
            view.FindViewById <TextView>(Resource.Id.ItemStatus).Typeface             = FontLoader.GetFontNormal((Activity)_container.Context);
            view.FindViewById <TextView>(Resource.Id.ItemError).Typeface              = FontLoader.GetFontNormal((Activity)_container.Context);
            view.FindViewById <Button>(Resource.Id.ItemPickImageFromGallery).Typeface = FontLoader.GetFontNormal((Activity)_container.Context);
            view.FindViewById <Button>(Resource.Id.ItemPickImageFromCamera).Typeface  = FontLoader.GetFontNormal((Activity)_container.Context);
            view.FindViewById <TextView>(Resource.Id.LabelEmployee).Typeface          = FontLoader.GetFontBold((Activity)_container.Context);
            view.FindViewById <TextView>(Resource.Id.LabelType).Typeface              = FontLoader.GetFontBold((Activity)_container.Context);
            view.FindViewById <TextView>(Resource.Id.LabelApprover).Typeface          = FontLoader.GetFontBold((Activity)_container.Context);
            view.FindViewById <TextView>(Resource.Id.LabelDuration).Typeface          = FontLoader.GetFontBold((Activity)_container.Context);
            view.FindViewById <TextView>(Resource.Id.LabelStatus).Typeface            = FontLoader.GetFontBold((Activity)_container.Context);
            view.FindViewById <TextView>(Resource.Id.LabelAttachment).Typeface        = FontLoader.GetFontBold((Activity)_container.Context);
        }
Ejemplo n.º 9
0
Archivo: Test.cs Proyecto: 5509850/vts
        public async Task IntegrationSaveImage()
        {
            VacationsViewModel vacationsViewModel = (onlineMode) ? FactorySingleton.Factory.Get <VacationsViewModel>() : FactorySingleton.FactoryOffline.Get <VacationsViewModel>();
            List <VTSModel>    vtsList            = await vacationsViewModel.GetVTSList();

            Assert.IsNotNull(vtsList, "Message: GetVTSList error");
            VacationInfoModel vacationInfo = await vacationsViewModel.GetVacationInfo(vtsList[0].Id);

            Assert.IsNotNull(vacationInfo, "Message: GetVacationInfo error");
            string path = Path.Combine(Directory.GetCurrentDirectory(), "person.png");

            Assert.IsTrue(File.Exists(path), "Message: test image file not found in TEST project");
            byte[] imageByte = File.ReadAllBytes(path);
            Assert.IsNotNull(imageByte, "Message: File.ReadAllBytes file in byte is NULL");
            vacationsViewModel.Image = imageByte;
            Assert.IsNotNull(vacationsViewModel.Image, "Message: test image byte[] is Null");
            Assert.IsTrue((await vacationsViewModel.UpdateOrCreateVacationInfo(vacationInfo)), "Message: error UpdateOrCreateVacationInfo");
            vacationsViewModel.Image = null;
            VacationInfoModel vacationInfoUpdated = await vacationsViewModel.GetVacationInfo(vtsList[0].Id);

            Assert.IsNotNull(vacationsViewModel.Image, "Message:vacationsViewModel.Image after GetVacationInfo Is Null");
            Assert.AreEqual(vacationsViewModel.Image.Length, imageByte.Length, "Message: Not equal Length Image byte[] from viewmodel and real image");
            Assert.AreEqual(vacationsViewModel.Image[0], imageByte[0], "Message: Not equal first byte Image byte[] from viewmodel and real image");

            vacationsViewModel.Image = null;//delete Image
            Assert.IsNull(vacationsViewModel.Image, "Message: test image byte[] is not Null");
            Assert.IsTrue((await vacationsViewModel.UpdateOrCreateVacationInfo(vacationInfo)), "Message: error UpdateOrCreateVacationInfo");
            vacationInfoUpdated = await vacationsViewModel.GetVacationInfo(vtsList[0].Id);

            Assert.IsNull(vacationsViewModel.Image, "Message:vacationsViewModel.Image after GetVacationInfo Is not Null");
        }
Ejemplo n.º 10
0
Archivo: Test.cs Proyecto: 5509850/vts
        public async Task IntegrationDeleteVacation()
        {
            VacationsViewModel vacationsViewModel = (onlineMode) ? FactorySingleton.Factory.Get <VacationsViewModel>() : FactorySingleton.FactoryOffline.Get <VacationsViewModel>();
            List <VTSModel>    vtsList            = await vacationsViewModel.GetVTSList();

            Assert.IsNotNull(vtsList, "Message: GetVTSList error");
            var oldcount = vtsList.Count;

            Assert.IsTrue(await vacationsViewModel.DeleteVacationInfo(vtsList[vtsList.Count - 1]), "Message: error DeleteVacationInfo");
            Assert.AreNotEqual((await vacationsViewModel.GetVTSList()).Count, oldcount, "Message: error after Delete newcount == oldcount");
        }
Ejemplo n.º 11
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     SetContentView(Resource.Layout.MainScreen);
     _vacationsViewModel      = FactorySingleton.Factory.Get <VacationsViewModel>();
     _listView                = FindViewById <ListView>(Resource.Id.VTSListView);
     _listView.ItemClick     += OnListViewItemClick;
     _listView.ItemLongClick += OnListViewLongClick;
     LoadListView();
     InitDrawer(bundle);
 }
Ejemplo n.º 12
0
Archivo: Test.cs Proyecto: 5509850/vts
        public async Task VacationsViewModel()
        {
            VacationsViewModel vacationsViewModel = (onlineMode) ? FactorySingleton.Factory.Get <VacationsViewModel>() : FactorySingleton.FactoryOffline.Get <VacationsViewModel>();

            Assert.IsNotNull(vacationsViewModel, "Message: Get<VacationsViewModel> is NULL");
            List <VTSModel> vtsList = await vacationsViewModel.GetVTSList();

            Assert.IsNotNull(vtsList, "Message: GetVTSList error");
            Assert.IsNotNull((await vacationsViewModel.GetVacationInfo(vtsList[0].Id)), "Message: GetVacationInfo error");
            Assert.IsNull((await vacationsViewModel.GetVacationInfo(0)), "Message: GetVacationInfo error null by zero ID");
        }
Ejemplo n.º 13
0
        public async Task <VacationInfoModel> GetVacationFromSqlByID(VacationsViewModel viewModel, int ID)
        {
            VacationInfoModel vacation;

            try
            {
                vacation = await _vacationsDataService.GetVacationByIdFromSql(ID);
            }
            catch (AggregateException e)
            {
                viewModel.ErrorMessage = e.InnerExceptions[0].Data["message"].ToString();
                vacation = null;
            }
            return(await Helper.Complete(vacation));
        }
Ejemplo n.º 14
0
        public ActionResult Create()
        {
            EmployeesCodesBLL  AuthorizedPersonBLL = new EmployeesCodesBLL().GetEVacationAuthorizedPersonOfEmployee(WindowsUserIdentity, EServicesTypesEnum.Vacation);
            EmployeesViewModel AuthorizedPerson    = AuthorizedPersonBLL != null ? new EmployeesViewModel()
            {
                EmployeeCodeNo = AuthorizedPersonBLL?.EmployeeCodeNo, EmployeeNameAr = AuthorizedPersonBLL?.Employee?.EmployeeNameAr
            } : null;
            VacationsViewModel VacationVM = new VacationsViewModel()
            {
                VacationType              = new VacationsTypesBLL(),
                EmployeeCodeNo            = WindowsUserIdentity,
                EVacationAuthorizedPerson = AuthorizedPerson
            };

            return(View(VacationVM));
        }
Ejemplo n.º 15
0
Archivo: Test.cs Proyecto: 5509850/vts
        public async Task IntegrationUpdateVacation()
        {
            VacationsViewModel vacationsViewModel = (onlineMode) ? FactorySingleton.Factory.Get <VacationsViewModel>() : FactorySingleton.FactoryOffline.Get <VacationsViewModel>();
            List <VTSModel>    vtsList            = await vacationsViewModel.GetVTSList();

            Assert.IsNotNull(vtsList, "Message: GetVTSList error");
            var oldcount = vtsList.Count;
            VacationInfoModel vacationInfo = await vacationsViewModel.GetVacationInfo(vtsList[0].Id);

            Assert.IsNotNull(vacationInfo, "Message: GetVacationInfo error");
            vacationInfo.Type.Value = "updating";
            Assert.IsTrue((await vacationsViewModel.UpdateOrCreateVacationInfo(vacationInfo)), "Message: error UpdateOrCreateVacationInfo");
            Assert.AreEqual((await vacationsViewModel.GetVTSList()).Count, oldcount, "Message: error after Update newcount != oldcount");
            VacationInfoModel vacationInfoUpdated = await vacationsViewModel.GetVacationInfo(vtsList[0].Id);

            Assert.AreEqual(vacationInfoUpdated.Type.Value, vacationInfo.Type.Value, "Message: error vacationInfoNew not Equals Type.Value vacationInfoSaved");
        }
Ejemplo n.º 16
0
        public ActionResult Create(VacationsViewModel VacationVM)
        {
            BaseVacationsBLL Vacation = null;

            if (!VacationVM.VacationStartDate.HasValue || !VacationVM.VacationEndDate.HasValue)
            {
                throw new CustomException(Resources.Globalization.RequiredStartDateAndEndDateText);
            }

            if (VacationVM.VacationType.VacationTypeID == (int)VacationsTypesEnum.Normal)
            {
                Vacation = GenericFactoryPattern <BaseVacationsBLL, NormalVacationsBLL> .CreateInstance();

                if (VacationVM.NormalVacationTypeID.HasValue)
                {
                    ((NormalVacationsBLL)Vacation).NormalVacationType = new NormalVacationsTypesBLL()
                    {
                        NormalVacationTypeID = VacationVM.NormalVacationTypeID.Value
                    }
                }
                ;
            }

            Vacation.EmployeeCareerHistory = new EmployeesCareersHistoryBLL().GetEmployeeCurrentJob(VacationVM.EmployeeCodeID.Value);
            Vacation.VacationType          = (VacationsTypesEnum)VacationVM.VacationType.VacationTypeID;
            Vacation.VacationStartDate     = VacationVM.VacationStartDate.Value.Date;
            Vacation.VacationEndDate       = VacationVM.VacationEndDate.Value.Date;
            Vacation.Notes = VacationVM.Notes;
            Vacation.IsApprovedFromManager = false;
            Vacation.LoginIdentity         = new EmployeesCodesBLL()
            {
                EmployeeCodeNo = this.WindowsUserIdentity,
                EmployeeCodeID = VacationVM.EmployeeCodeID.Value
            };

            Result result = Vacation.Add();

            if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfBeforeHiringDate.ToString())
            {
                throw new CustomException(string.Format(Resources.Globalization.ValidationVacationBeforeHiringText, ((EmployeesCareersHistoryBLL)result.Entity).JoinDate.ToString(Classes.Helpers.CommonHelper.DateFormat)));
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBeacuseOfEmployeeNotHasActualOrganization.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationEmployeeNotHasActualOrganizationText);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfDuringProbation.ToString())
            {
                throw new CustomException(string.Format(Resources.Globalization.ValidationVacationDuringProbationText, ((EmployeesCareersHistoryBLL)result.Entity).ProbationEndDate.ToString(Classes.Helpers.CommonHelper.DateFormat)));
            }

            else if (result.EnumMember == VacationsValidationEnum.SportsSeasonDoesNotExist.ToString())
            {
                throw new CustomException(Resources.Globalization.SportsSeasonDoesNotExistText);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfInvalidDates.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationInvalidDateText);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfInvalidSportsDates.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationInvalidSportsDateText);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfNoBalance.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationAlreadyReachTheVacationLimitText);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfInvalidStartDate.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationInvalidVacationStartDateText);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfConsumedMaxLimit.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationAlreadyReachTheNormalVacationLimitText);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfNormalVacationBalanceExists.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBecauseOfNormalVacationBalanceExistsText);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfNormalVacationReachedToMaxLimitOfSeparatedDays.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBecauseOfNormalVacationReachedToMaxLimitOfSeparatedDaysText);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfVacationNotAllowedBetween1437and1438.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBecauseOfVacationNotAllowedBetween1437and1438Text);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfVacationOutOfRange.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBecauseOfVacationOutOfRangeText);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseSickExceptionalVacationDatesOutOfRange.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBecauseOfSickExceptionalVacationDatesOutOfRangeText);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfErrorInTimeAttendanceApp.ToString())
            {
                throw new CustomException(Resources.Globalization.ErrorInTimeAttendanceAppText);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfMarriageVacationAcceptedOneTime.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBecauseOfMarriageVacationAcceptedOneTimeText);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfNoActiveProxyCreatedToOtherPerson.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBecauseOfNoActiveProxyCreatedToOtherPersonText);
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfEmployeeHasProxyByOtherPerson.ToString())
            {
                throw new CustomException(string.Format(Resources.Globalization.ValidationBecauseOfThereIsProxyByOtherPersonText, ((EServicesProxiesBLL)result.Entity).FromEmployee?.Employee?.EmployeeNameAr,
                                                        ((EServicesProxiesBLL)result.Entity).StartDate.Date.ToString(Classes.Helpers.CommonHelper.DateFormat)));
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBeacuseOfNotAllowedWeekEndBetweenTwoVacations.ToString())
            {
                throw new CustomException(string.Format(Resources.Globalization.ValidationNotAllowedWeekEndBetweenTwoVacationsText, ((BaseVacationsBLL)result.Entity).VacationStartDate.Date.ToString(Classes.Helpers.CommonHelper.DateFormat),
                                                        ((BaseVacationsBLL)result.Entity).VacationPeriod,
                                                        ((BaseVacationsBLL)result.Entity).VacationEndDate.Date.ToString(Classes.Helpers.CommonHelper.DateFormat),
                                                        ((BaseVacationsBLL)result.Entity).VacationTypeName));
            }

            else if (result.EnumMember == VacationsValidationEnum.RejectedBecauseOfEVacationRequestPendingExist.ToString())
            {
                throw new CustomException(string.Format(Resources.Globalization.ValidationBecauseOfEVacationRequestPendingExistText, ((BaseVacationsBLL)result.Entity).EVacationsRequest.EVacationRequestNo));
            }

            Classes.Helpers.CommonHelper.ConflictValidationMessage(result);

            Session["EVacationRequestNo"] = Vacation.EVacationsRequest.EVacationRequestNo;
            return(Json(new { EVacationRequestNo = Vacation.EVacationsRequest.EVacationRequestNo }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 17
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            RequestWindowFeature(WindowFeatures.ActionBar);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);
            SetContentView(Resource.Layout.CreateScreen);
            _vacationsViewModel = FactorySingleton.Factory.Get <VacationsViewModel>();
            if (_vacationsViewModel.IsOnlineMode)
            {
                ActionBar.SetTitle(Resource.String.newRequest);
            }
            else
            {
                ActionBar.SetTitle(Resource.String.newRequestOffline);
            }
            _vacationInfo = await _vacationsViewModel.CreateDraftVacationInfo();

            if (_vacationInfo == null)
            {
                Intent myIntent = new Intent(this, typeof(MainScreenActivity));
                SetResult(Result.Canceled, myIntent);
                Exit();
                return;
            }
            if (Intent.Extras != null)
            {
                _typevacation = Intent.Extras.GetInt("typevacation");
                switch (_typevacation)
                {
                case VACATION_REQUEST:
                {
                    _vacationInfo.Type.Key   = "VAC";
                    _vacationInfo.Type.Value = "Regular (VAC)";
                    break;
                }

                case SICK_REQUEST:
                {
                    _vacationInfo.Type.Key   = "ILL";
                    _vacationInfo.Type.Value = "Illness (ILL)";
                    break;
                }

                case OVERTIME_REQUEST:
                {
                    _vacationInfo.Type.Key   = "OVT";
                    _vacationInfo.Type.Value = "Overtime (OVT)";
                    break;
                }

                case LIVEWOP_REQUEST:
                {
                    _vacationInfo.Type.Key   = "POV";
                    _vacationInfo.Type.Value = "Without pay (POV)";
                    break;
                }

                case EXCEPTIONAL_REQUEST:
                {
                    _vacationInfo.Type.Key   = "EXV";
                    _vacationInfo.Type.Value = "EXCEPTIONAL (EXV)";
                    break;
                }
                }
                await _vacationsViewModel.UpdateDraftVacationInfo(_vacationInfo);
            }
            else
            {
                Finish();
            }
            FragmentTransaction transaction = FragmentManager.BeginTransaction();

            _fragment = new VacationTabsFragment();
            transaction.Replace(Resource.Id.sample_content_fragment, _fragment);
            transaction.Commit();
        }