Exemplo n.º 1
0
        public IActionResult AddJob()
        {
            ClientJobViewModel model  = new ClientJobViewModel();
            string             userId = _userManager.GetUserId(HttpContext.User);
            var clientInfo            = _clientRepository.GetClientByUserId(userId);


            model.ClientID = clientInfo.Id;

            if (model.businessstreams.Count == 0)
            {
                model.businessstreams = new List <SelectListItem>();
                model.businessstreams.Add(new SelectListItem
                {
                    Value = "",
                    Text  = "-- 業界選択 --"
                });

                var businessstreams = _businessRepository.GetAll();

                foreach (var BusinessStrem in businessstreams)
                {
                    model.businessstreams.Add(new SelectListItem
                    {
                        Value = Convert.ToString(BusinessStrem.Id),
                        Text  = BusinessStrem.Name_jp
                    });
                }
            }

            if (model.Provinces.Count == 0)
            {
                model.Provinces = new List <SelectListItem>();
                model.Provinces.Add(new SelectListItem
                {
                    Value = "",
                    Text  = "--Choose--"
                });

                var provinces = _provinceRepository.GetAll();

                foreach (var province in provinces)
                {
                    model.Provinces.Add(new SelectListItem
                    {
                        Value = Convert.ToString(province.Id),
                        Text  = province.Name
                    });
                }
            }

            return(View(model));
        }
Exemplo n.º 2
0
        public void LoadAll()
        {
            LoadProvince();
            LoadCity();
            LoadBrand();
            LoadModel();

            using (var tx = NHibernateSessionManager.GetLocalSession().BeginTransaction())
            {
                var superAdmin = new User(
                    new Employee(
                        new Branch(
                            @"MAI",
                            @"MACSAUTO JAKARTA",
                            new Address(
                                _cityRepository.FindByName(@"ADMINISTRASI JAKARTA BARAT"),
                                @"11720",
                                @"KAPUK"
                                )
                            ),
                        Position.Storemanager,
                        new PersonName(@"SUPERADMIN"),
                        Gender.Male
                        ),
                    @"SUPERADMINMAI",
                    @"SUPERADMINMAI"
                    );

                _userRepository.Insert(superAdmin);

                var provinces = _provinceRepository.GetAll();
                var cities    = _cityRepository.GetAll();

                foreach (var province in provinces)
                {
                    province.CreatedBy = superAdmin.Employee;

                    _provinceRepository.Update(province);
                }

                foreach (var city in cities)
                {
                    city.CreatedBy = superAdmin.Employee;

                    _cityRepository.Update(city);
                }

                tx.Commit();
            }
        }
Exemplo n.º 3
0
        public void SetForm(Add form)
        {
            _form = form;

            _form.BranchCode = string.Format("B{0:00}", _branchRepo.GetLastIndex() + 1);
            _form.Provinces  = _provinceRepo.GetAll();
        }
Exemplo n.º 4
0
        public IActionResult OnGetLoadProvince()
        {
            var province = _provinceRepository.GetAll();

            if (province != null)
            {
                Provinces = new List <Province>();
                var items = province.Where(cd => cd.IsDeleted == false).ToList();
                if (items.Count > 0)
                {
                    foreach (var item in items)
                    {
                        var provinces = new Province
                        {
                            Id            = item.Id,
                            Name          = item.Name,
                            Type          = item.Type,
                            TelephoneCode = item.TelephoneCode,
                            ZipCode       = item.ZipCode,
                            CountryId     = item.CountryId,
                            SortOrder     = item.SortOrder,
                            IsPublished   = item.IsPublished,
                            IsDeleted     = item.IsDeleted,
                            Timestamp     = item.Timestamp,
                        };
                        Provinces.Add(provinces);
                    }
                }
            }
            return(new OkObjectResult(Provinces));
        }
 /// <summary>
 /// The GetProvince
 /// </summary>
 /// <returns>The <see cref="ServiceResult"/></returns>
 public ServiceResult GetProvince()
 {
     return(new ServiceResult(true)
     {
         Data = _repository.GetAll().AsQueryable()
     });
 }
Exemplo n.º 6
0
 public void SetForm(Add view)
 {
     _view = view;
     _view.CustomerCode = string.Format("C{0}{1:00}",
                                        LoginService.LoggedInUserBranch.Code.Substring(1),
                                        _customerRepo.Count() + 1);
     _view.VehicleBrands = _brandRepo.GetAll();
     _view.Provinces     = _provinceRepo.GetAll();
 }
Exemplo n.º 7
0
 public List <ProvinceModel> GetProvinces()
 {
     return(provinceRepository.GetAll().OrderBy(t => t.Name).Select(t => new ProvinceModel()
     {
         Name = t.Name,
         Id = t.Id,
         NameEng = t.NameEng
     }).ToList());
 }
Exemplo n.º 8
0
        public IEnumerable <Province> GetAllProvinces(string name)
        {
            IEnumerable <Province> a = provinceRepository.GetAll().AsEnumerable();

            if (!String.IsNullOrEmpty(name))
            {
                a = a.Where(x => x.Name.Contains(name));
            }
            return(a);
        }
Exemplo n.º 9
0
        public IActionResult Index()
        {
            SearchJobViewModel model = new SearchJobViewModel();

            if (model.businessstreams.Count == 0)
            {
                model.businessstreams = new List <SelectListItem>();
                model.businessstreams.Add(new SelectListItem
                {
                    Value = "",
                    Text  = "-- Choose  --"
                });

                var businessstreams = _businessRepository.GetAll();

                foreach (var BusinessStrem in businessstreams)
                {
                    model.businessstreams.Add(new SelectListItem
                    {
                        Value = Convert.ToString(BusinessStrem.Id),
                        Text  = BusinessStrem.Name
                    });
                }
            }
            if (model.Provinces.Count == 0)
            {
                model.Provinces = new List <SelectListItem>();
                model.Provinces.Add(new SelectListItem
                {
                    Value = "",
                    Text  = "--Choose--"
                });

                var provinces = _provinceRepository.GetAll();

                foreach (var province in provinces)
                {
                    model.Provinces.Add(new SelectListItem
                    {
                        Value = Convert.ToString(province.Id),
                        Text  = province.Name
                    });
                }
            }

            ViewData["HeaderSearch"] = true;
            return(View());
        }
Exemplo n.º 10
0
        public IEnumerable <Province> GetAllProvince()
        {
            List <Province> lstprovince = new List <Province>();

            try
            {
                lstprovince = _provinceRepository.GetAll().ToList();
            }
            catch (Exception ex)
            {
                string FunctionName = string.Format("GetAllProvince('{0}')");
                Common.Logs.LogCommon.WriteError(ex.ToString(), FunctionName);
                return(null);
            }
            return(lstprovince);
        }
        public async Task <IActionResult> GetAllProvinces()
        {
            try
            {
                var allProvinces = await _provinceRepository.GetAll();

                return(Ok(allProvinces));
            }
            catch (System.ArgumentNullException ex)
            {
                return(NotFound());
            }
            catch (Exception e)
            {
                return(BadRequest());
            }
        }
Exemplo n.º 12
0
 public async Task <ActionResult <IEnumerable <Province> > > Getcountries()
 {
     return(Ok(await _provinceRepository.GetAll()));
 }
 public IEnumerable <Province> GetAll()
 {
     return(_provinceRepository.GetAll());
 }
Exemplo n.º 14
0
        public IEnumerable <ProvinceDTO> GetAllProvince()
        {
            IEnumerable <Province> provinces = provinceRepository.GetAll();

            return(provinces.MappingProvinceDtos());
        }
Exemplo n.º 15
0
 public IEnumerable <Province> GetAll() => _provinceRepository.GetAll();