Example #1
0
        /// <summary>
        /// Get Countries by Level
        /// </summary>
        /// <param name="level">int level</param>
        /// <returns>List Countries by Level</returns>
        public List <CountriesViewModel> GetByLevel(int level)
        {
            List <CountriesViewModel> listByLevel = new List <CountriesViewModel>();
            string        sqlQuery = $"SELECT * FROM Countries WHERE Level = {level}";
            SqlDataReader reader   = helper.ExecDataReader(sqlQuery);

            while (reader.Read())
            {
                CountriesViewModel data = new CountriesViewModel
                {
                    Id           = int.Parse(reader["Id"].ToString()),
                    Name         = reader["Name"].ToString(),
                    Code         = reader["Code"].ToString(),
                    Description  = reader["Description"].ToString(),
                    Level        = int.Parse(reader["Level"].ToString()),
                    Type         = reader["Type"].ToString(),
                    ParentId     = int.Parse(reader["ParentId"].ToString()),
                    IsVisible    = int.Parse(reader["IsVisible"].ToString()),
                    IsState      = bool.Parse(reader["IsState"].ToString()),
                    NameKhongDau = reader["NameKhongDau"].ToString()
                };
                listByLevel.Add(data);
            }
            reader.Close();
            _conn.Close();
            return(listByLevel);
        }
Example #2
0
        /// <summary>
        /// Get allData in VietNam
        /// </summary>
        /// <returns>List<CountriesViewModel> : All Data in VietNam</returns>
        public List <CountriesViewModel> GetAllData()
        {
            List <CountriesViewModel> allData = new List <CountriesViewModel>();
            string sqlQuery = "SELECT * FROM Countries ORDER BY Level";

            SqlDataReader reader = helper.ExecDataReader(sqlQuery);

            while (reader.Read())
            {
                CountriesViewModel Data = new CountriesViewModel
                {
                    Id           = int.Parse(reader["Id"].ToString()),
                    Name         = reader["Name"].ToString(),
                    Code         = reader["Code"].ToString(),
                    Description  = reader["Description"].ToString(),
                    Level        = int.Parse(reader["Level"].ToString()),
                    Type         = reader["Type"].ToString(),
                    ParentId     = int.Parse(reader["ParentId"].ToString()),
                    IsVisible    = int.Parse(reader["IsVisible"].ToString()),
                    IsState      = bool.Parse(reader["IsState"].ToString()),
                    NameKhongDau = reader["NameKhongDau"].ToString()
                };
                allData.Add(Data);
            }
            reader.Close();
            _conn.Close();

            return(allData);
        }
        public ActionResult Create(string CoId)
        {
            NullChecker.NullCheck(new object[] { CoId });

            var curentCompany = unitOfWork.NotExpiredCompanyRepository
                                .GetByID(EncryptionHelper.Unprotect(CoId));

            if (curentCompany == null ||
                !curentCompany.Admins.Any(u => AuthorizationHelper.isRelevant(u.UserId)))
            {
                return(new RedirectToError());
            }
            CountriesViewModel countries = new CountriesViewModel();

            ViewBag.CountryDropDown = countries.countries;


            //PorT SelectList
            var PorTs = from PorT e in Enum.GetValues(typeof(PorT))
                        select new { Id = e, Name = Resource.EnumTypes.ResourceManager.GetString(e.ToString()) };

            ViewBag.portDropdown = new SelectList(PorTs, "Id", "Name");

            ViewData["company"] = CoId;

            return(View());
        }
        async void GetCountriesList(object sender, EventArgs e)
        {
            CountriesViewModel cvm = MSProApp.Locator.CountriesVM;

            WaitLabel.IsVisible           = true;
            GetCountriesListBtn.IsEnabled = false;
            await cvm.GetCountiesListThread();

            CountriesToSelect.ItemsSource = cvm.ExitCountries;
            SelectedCountries.ItemsSource = cvm.SelectedCountriesList;

            TotalCountriesLabel.Text      = AppStrings.TotalCountries + " " + cvm.TotalCountries.ToString();
            TotalExitRelaysLabel.Text     = AppStrings.TotalExitRelays + " " + cvm.ExitIPsNum.ToString();
            WaitLabel.IsVisible           = false;
            GetCountriesListBtn.IsEnabled = true;

            SelectedCountriesModeLabel.Text = cvm.SelectedCountriesModeLabelText;
            SelectedCitiesModeLabel.Text    = cvm.SelectedCitiesModeLabelText;
            GetCountriesListBtn.Text        = cvm.GetCountriesListBtnText;
            WaitLabel.Text = cvm.WaitLabelText;
            SelectedCountriesLabel.Text  = cvm.SelectedCountriesLabelText;
            ApplySelectedCountries.Text  = cvm.ApplySelectedCountriesText;
            CancelSelectedCountries.Text = cvm.CancelSelectedCountriesText;
            AddCountryBtn.Text           = cvm.AddCountryBtnText;
            RemoveCountryBtn.Text        = cvm.RemoveCountryBtnText;
        }
Example #5
0
        public ActionResult PlanRequest(string Plan, PlanType planType)
        {
            if (Plan == null)
            {
                return(new RedirectToError());
            }

            PlanRequestViewModel viewmodel = new PlanRequestViewModel();

            if (planType == PlanType.Company && !PlansPrices.CompanyPlans.ContainsKey(Plan))
            {
                return(new RedirectToError());
            }
            else if (planType == PlanType.Store && !PlansPrices.StorePlans.ContainsKey(Plan))
            {
                return(new RedirectToError());
            }
            else
            {
                viewmodel.plan = Plan;
                CountriesViewModel countries = new CountriesViewModel();
                viewmodel.country = countries.countries;

                return(View(viewmodel));
            }

            //var payTypes = from PayType e in Enum.GetValues(typeof(PayType))
            //               select new { Id = e, Name = Resource.EnumTypes.ResourceManager.GetString(e.ToString()) };
            //viewmodel.payTypeToSelectList = new SelectList(payTypes, "Id", "Name");
            ////PayBank SelectList
            //var payBanks = from PayBank e in Enum.GetValues(typeof(PayBank))
            //               select new { Id = e, Name = Resource.EnumTypes.ResourceManager.GetString(e.ToString()) };
            //viewmodel.bankTypeToSelectList = new SelectList(payBanks, "Id", "Name");
        }
Example #6
0
        public List <CountriesViewModel> GetCountryList()
        {
            Query   = "SELECT * FROM CountriesViewModel";
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Reader = Command.ExecuteReader();
            while (Reader.Read())
            {
                nameOfCountry  = Reader["Name"].ToString();
                aboutOfCountry = Reader["About"].ToString();
            }
            Reader.Close();
            Connection.Close();


            Query   = "SELECT COUNT(Name) AS NoOfCity,SUM(NoOfDwellers) AS NoOfTotalDwellers FROM CountriesViewModel";
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Reader = Command.ExecuteReader();
            List <CountriesViewModel> yCountryList = new List <CountriesViewModel>();

            while (Reader.Read())
            {
                CountriesViewModel aCountry = new CountriesViewModel();
                aCountry.CountryName      = nameOfCountry;
                aCountry.CountryAbout     = aboutOfCountry;
                aCountry.NoOfCities       = (int)Reader["NoOfCity"];
                aCountry.NoOfCityDwellers = (int)Reader["NoOfTotalDwellers"];
                yCountryList.Add(aCountry);
            }
            Reader.Close();
            Connection.Close();

            return(yCountryList);
        }
        public ActionResult Edit(string CoId)
        {
            NullChecker.NullCheck(new object[] { CoId });

            var CoToEdit = unitOfWork.NotExpiredCompanyRepository
                           .GetByID(EncryptionHelper.Unprotect(CoId));

            if (!CoToEdit.Admins.Any(c => AuthorizationHelper.isRelevant(c.UserId)))
            {
                return(new RedirectToNotFound());
            }

            CountriesViewModel countries = new CountriesViewModel();

            ViewBag.CountryDropDown = countries.counts(CoToEdit.State);
            ViewBag.StateDropDown   = countries.states(CoToEdit.State);

            //PorT SelectList
            var PorTs = from CompanySize e in Enum.GetValues(typeof(CompanySize))
                        select new { Id = e, Name = Resource.EnumTypes.ResourceManager.GetString(e.ToString()) };

            ViewBag.CoSizeDropdown = new SelectList(PorTs, "Id", "Name");

            var catss = CoToEdit.Categories.Select(u => u.catID);

            ViewData["Cats"]    = String.Join(",", catss);
            ViewData["company"] = CoId;

            return(View(CoToEdit));
        }
        public ActionResult Edit(string PrId)
        {
            NullChecker.NullCheck(new object[] { PrId });

            var productToEdit = unitOfWork.ProductRepository
                                .GetByID(EncryptionHelper.Unprotect(PrId));

            if (productToEdit.company is CompanyExpired ||
                !productToEdit.company.Admins.Any(u => AuthorizationHelper.isRelevant(u.UserId)))
            {
                return(new RedirectToError());
            }

            CountriesViewModel countries = new CountriesViewModel();

            ViewBag.CountryDropDown = countries.countries;


            //PorT SelectList
            var PorTs = from PorT e in Enum.GetValues(typeof(PorT))
                        select new { Id = e, Name = Resource.EnumTypes.ResourceManager.GetString(e.ToString()) };

            ViewBag.portDropdown = new SelectList(PorTs, "Id", "Name");

            ViewData["product"] = PrId;
            var catss = productToEdit.categories.Select(u => u.catID);

            ViewData["Cats"] = String.Join(",", catss);
            return(View(productToEdit));
        }
        public IActionResult Index(SortingInputModel sorting, int pageId = 1)
        {
            if (sorting.OrderBy == null)
            {
                sorting = new SortingInputModel()
                {
                    Ascending = true,
                    OrderBy   = "Name",
                };
            }

            var orderBySelector = GetOrderBySelector(sorting);
            var skip            = DefaultItemsPerPage * (pageId - 1);

            var countriesViewModel = new CountriesViewModel()
            {
                Countries = this.countriesService
                            .GetMany <CountryViewModel>(
                    orderBySelector: orderBySelector,
                    asc: sorting.Ascending,
                    skip: skip,
                    take: DefaultItemsPerPage),

                Common = new CommonViewModel()
                {
                    Pagination = this.GetPaginationModel(pageId, this.countriesService.Count()),
                    Sorting    = sorting,
                },
            };

            return(this.View(countriesViewModel));
        }
Example #10
0
        public ActionResult Create()
        {
            CountriesViewModel countries = new CountriesViewModel();

            ViewBag.CountryDropDown = countries.countries;
            return(PartialView());
        }
Example #11
0
        /// <summary>
        /// Get all Ward by District
        /// </summary>
        /// <param name="IdDistrict"></param>
        /// <returns>List<CountriesViewModel></returns>
        public List <CountriesViewModel> GetAllWardByDistrict(int IdDistrict)
        {
            List <CountriesViewModel> listWard = new List <CountriesViewModel>();
            string sqlQuery = "SELECT * FROM Countries WHERE ParentId = @ParentId ORDER BY Name";

            object[] _params = new object[] { new SqlParameter("ParentId", IdDistrict.ToString()) };

            SqlDataReader reader = helper.ExecDataReader(sqlQuery, _params);

            while (reader.Read())
            {
                CountriesViewModel Ward = new CountriesViewModel
                {
                    Id           = int.Parse(reader["Id"].ToString()),
                    Code         = reader["Code"].ToString(),
                    Name         = reader["Name"].ToString(),
                    Description  = reader["Description"].ToString(),
                    Level        = int.Parse(reader["Level"].ToString()),
                    Type         = reader["Type"].ToString(),
                    ParentId     = int.Parse(reader["ParentId"].ToString()),
                    IsVisible    = int.Parse(reader["IsVisible"].ToString()),
                    IsState      = bool.Parse(reader["IsState"].ToString()),
                    NameKhongDau = reader["NameKhongDau"].ToString()
                };
                listWard.Add(Ward);
            }
            reader.Close();
            _conn.Close();
            return(listWard);
        }
Example #12
0
        void CancelCountriesList(object sender, EventArgs e)
        {
            CountriesViewModel cvm = MSProApp.Locator.CountriesVM;

            cvm.CancelSelectedCountriesList();

            DisplayAlert("Mask Surf Pro", AppStrings.CountriesCancelled, AppStrings.OK);
        }
        // Get all countries
        public static CountriesViewModel GetCountries()
        {
            CountriesViewModel model = new CountriesViewModel();

            model.Countries = Startup.openAQHelper.GetCountries();

            return(model);
        }
Example #14
0
        public ActionResult Recipies(int recipieId)
        {
            CountriesViewModel myView = new CountriesViewModel()
            {
                Recipie = _worldRecipiesRepository.GetRecipie(recipieId)
            };

            return(View(myView));
        }
Example #15
0
        public ActionResult Update([DataSourceRequest] DataSourceRequest request, CountriesViewModel item)
        {
            if (item != null && ModelState.IsValid)
            {
                repo.Update(item);
            }

            return(Json(new[] { item }.ToDataSourceResult(request, ModelState)));
        }
Example #16
0
        private void paisesMenuItem_Click(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
            var paisesWin       = new CountriesView();
            var paisesViewModel = new CountriesViewModel();

            paisesWin.DataContext = paisesViewModel;

            paisesWin.ShowDialog();
        }
Example #17
0
        public ActionResult Index(int countryId)
        {
            CountriesViewModel myView = new CountriesViewModel()
            {
                Recipies = _worldRecipiesRepository.GetRecipies(countryId).ToList()
            };

            return(View(myView));
        }
Example #18
0
        public ActionResult Destroy([DataSourceRequest] DataSourceRequest request, CountriesViewModel item)
        {
            if (item != null)
            {
                repo.Destroy(item);
            }

            return(Json(new[] { item }.ToDataSourceResult(request, ModelState)));
        }
Example #19
0
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                try
                {
                    var isEmail = unitOfWork.UserRepository.Get(u => u.Email == model.Email).Any();
                    if (isEmail)
                    {
                        throw new MembershipCreateUserException(MembershipCreateStatus.DuplicateEmail);
                    }

                    string confirmationToken = WebSecurity.CreateUserAndAccount(
                        model.UserName,
                        model.Password, new
                    {
                        model.Birthday,
                        model.Email,
                        model.stateID,
                        model.firstName,
                        model.firstNameEN,
                        model.lastName,
                        model.lastNameEN,
                        model.gender
                    }, true);

                    try
                    {
                        UserMailer.Registraion(new MailRgisterConfirmationViewModel
                        {
                            EmailAddress = model.Email,
                            DisplayName  = model.firstName + " " + model.lastName,
                            UserName     = model.UserName,
                            Token        = confirmationToken
                        }).Send();
                    }
                    catch
                    {
                        ViewData["errorMess"] = ControllerError.registerActivationEmailError;
                        ViewData["link"]      = Url.Action("ResendConfirmationToken", "Account");
                        return(View("~/Views/Error/CustomError.cshtml"));
                    }
                    return(RedirectToAction("RegisterStepTwo", "Account"));
                }
                catch (MembershipCreateUserException e)
                {
                    CountriesViewModel countries = new CountriesViewModel();
                    ViewBag.CountryDropDown = countries.countries;
                    ModelState.AddModelError("", GetErrorMessage(e.StatusCode));
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
        void AddSelectedCountry(object sender, EventArgs e)
        {
            CountriesViewModel cvm      = MSProApp.Locator.CountriesVM;
            string             Selected = CountriesToSelect.SelectedItem.ToString().Replace("  ", "|");

            string[] Temp    = Selected.Split('|');
            string   Country = Temp[0];

            cvm.AddSelectedCountry(Country);
        }
        /// <summary>
        ///     Obtiene todos los datos relacionados con el país
        /// </summary>
        /// <returns>La vista con la lista de todos los países</returns>
        public async Task <ActionResult <CountriesViewModel> > GetCountries()
        {
            var countries = await GetRequestData <IEnumerable <Countries> >(AppSettingsConfig.COUNTRIES_KEY);

            var countriesViewModel = new CountriesViewModel()
            {
                Countries = countries.OrderBy(c => c.Country)
            };

            return(View("Index", countriesViewModel));
        }
        protected override void OnAppearing()
        {
            base.OnAppearing();

            CountriesViewModel cvm = MSProApp.Locator.CountriesVM;

            cvm.LoadSettings();
            SelectedCountries.ItemsSource = cvm.SelectedCountriesList;
            TotalCountriesLabel.Text      = AppStrings.TotalCountries + " " + cvm.TotalCountries.ToString();
            TotalExitRelaysLabel.Text     = AppStrings.TotalExitRelays + " " + cvm.ExitIPsNum.ToString();
        }
Example #23
0
        public ActionResult Register()
        {
            if (Request.IsAuthenticated)
            {
                return(RedirectToAction("Home", "UserProfile"));
            }
            CountriesViewModel countries = new CountriesViewModel();

            ViewBag.CountryDropDown = countries.countries;
            return(View());
        }
Example #24
0
        public CountriesViewModel GetCountries()
        {
            CountriesViewModel vm = new CountriesViewModel();

            repository.Execute(session =>
            {
                var contries = session.Query <Entities.Lookup.Country>().ToList();
                vm.Countries = AutoMapper.Mapper.Map <List <Cherries.Models.Lookup.Country> >(contries);
            });
            return(vm);
        }
Example #25
0
        private CountriesViewModel GetByCountryID(int id)
        {
            CountriesBLL CountriesBLL = new HCMBLL.CountriesBLL();

            CountriesBLL = CountriesBLL.GetByCountryID(id);
            CountriesViewModel CountryVM = new CountriesViewModel();

            if (CountriesBLL != null)
            {
                CountryVM.CountryID   = CountriesBLL.CountryID;
                CountryVM.CountryName = CountriesBLL.CountryName;
            }
            return(CountryVM);
        }
        void ApplyCountriesList(object sender, EventArgs e)
        {
            CountriesViewModel cvm = MSProApp.Locator.CountriesVM;

            if (cvm.ApplySelectedCountriesList())
            {
                DisplayAlert("Mask Surf Pro", AppStrings.CountriesSelected, AppStrings.OK);
            }
            else
            {
                DisplayAlert(AppStrings.Warning, AppStrings.CountriesNotSelected, AppStrings.OK);
            }
            SelectedCountries.ItemsSource = cvm.SelectedCountriesList;
        }
        void RemoveSelectedCountry(object sender, EventArgs e)
        {
            if (SelectedCountries.SelectedItem == null)
            {
                return;
            }

            CountriesViewModel cvm      = MSProApp.Locator.CountriesVM;
            string             Selected = SelectedCountries.SelectedItem.ToString().Replace("  ", "|");

            string[] Temp    = Selected.Split('|');
            string   Country = Temp[0];

            cvm.RemoveSelectedCountry(Country);
        }
        public async Task <IActionResult> Accounts(string id)
        {
            var currentUser = await this.GetUserDetailsAsync();

            if (string.IsNullOrEmpty(id) || !id.Equals(currentUser.Id))
            {
                return(RedirectToAction(nameof(Index)));
            }

            var modelPendings = await this.pendingList.AllAsync(currentUser.IdLogin, PendingTransactionCode, currentUser.Sandbox);

            var processMap = await this.countries.ProcessMapByIdAsync(currentUser.Id);

            var modelCountries = this.countries.CountryList(processMap);

            var modelMining = this.mining.MiningByUserId(currentUser.Id);

            var cvm = new CountriesViewModel();

            foreach (var model in modelCountries)
            {
                cvm.CountryList.Add(model);
            }

            foreach (var model in modelMining)
            {
                cvm.MiningList.Add(model);
            }

            foreach (var model in modelPendings)
            {
                cvm.PendingList.Add(model);
            }

            var previousTransactionId = HttpContext.Session.Get <int>("PreviousTransactionId");

            if (previousTransactionId != default(int))
            {
                cvm.PreviousTransaction = this.transaction.PreviousTransaction(previousTransactionId);
            }

            if (HttpContext.Session.Get <DateTime>("StartDate") == default(DateTime))
            {
                HttpContext.Session.Set <DateTime>("StartDate", DateTime.Now);
            }

            return(View(cvm));
        }
Example #29
0
        public ActionResult EditInfo(string UId)
        {
            NullChecker.NullCheck(new object[] { UId });
            var uid = EncryptionHelper.Unprotect(UId);

            if (!AuthorizationHelper.isRelevant((int)uid))
            {
                return(new RedirectToError());
            }
            var user = unitOfWork.ActiveUserRepository.GetByID(uid);
            CountriesViewModel countries = new CountriesViewModel();

            ViewBag.CountryDropDown = countries.counts(user.State);
            ViewBag.StateDropDown   = countries.states(user.State);
            return(View(user));
        }
Example #30
0
        public ActionResult Edit(string expID)
        {
            NullChecker.NullCheck(new object[] { expID });

            CountriesViewModel countries = new CountriesViewModel();

            var expToEdit = unitOfWork.ExperienceRepository
                            .GetByID(EncryptionHelper.Unprotect(expID));

            if (!AuthorizationHelper.isRelevant(expToEdit.userID))
            {
                throw new JsonCustomException(ControllerError.ajaxErrorEducationUser);
            }
            ViewBag.CountryDropDown = countries.counts(expToEdit.State);
            ViewBag.StateDropDown   = countries.states(expToEdit.State);
            return(PartialView(expToEdit));
        }