コード例 #1
0
        public HttpResponseMessage GetCitiesByProvinceID(int provinceId)
        {
            ResultMsg resultMsg = new ResultMsg();

            try
            {
                string provinceCode = string.Empty;
                using (IProvince repository = new ProvinceRepository())
                {
                    provinceCode = repository.Find(provinceId).ProvinceCode;
                }
                using (ICity repository = new CityRepository())
                {
                    var list = repository.FindAll(o => o.ProvinceCode == provinceCode);
                    resultMsg.code = 0;
                    resultMsg.data = list;
                }
            }
            catch (Exception ex)
            {
                resultMsg.code = (int)StatusCodeEnum.Error;
                resultMsg.msg  = ex.Message;
            }
            return(resultMsg.toJson());
        }
コード例 #2
0
ファイル: Test.cs プロジェクト: gtmorais/wcf_structuremap
        public void GetEstados()
        {
            ProvinceRepository province = new ProvinceRepository();
            var result = province.GetProvinces();

            Assert.IsTrue(result != null);
        }
コード例 #3
0
        public ActionResult <ProvinceResponseModel> GetProvince()
        {
            ProvinceResponseModel res = new ProvinceResponseModel();

            try
            {
                ProvinceRepository repo = new ProvinceRepository(db);

                var query = repo.GetAll();

                var res2 = (from y in query
                            select new ProviceOutputModel
                {
                    ProvinceID = y.ID,
                    Kode = y.Kode,
                    Provinsi = y.Provinsi
                }).OrderBy(x => x.Provinsi).ToList();

                res.data     = res2;
                res.Message  = "Success get data";
                res.Response = true;
                return(res);
            }
            catch (Exception ex)
            {
                res.Message  = ex.Message;
                res.Response = false;
                return(res);
            }
        }
コード例 #4
0
        void LoadEntities(string worldId)
        {
            IBiomeRepository    biomeRepository    = new BiomeRepository(Path.Combine(ApplicationPaths.WorldsDirectory, worldId, "biomes.xml"));
            IBorderRepository   borderRepository   = new BorderRepository(Path.Combine(ApplicationPaths.WorldsDirectory, worldId, "borders.xml"));
            ICultureRepository  cultureRepository  = new CultureRepository(Path.Combine(ApplicationPaths.WorldsDirectory, worldId, "cultures.xml"));
            IFactionRepository  factionRepository  = new FactionRepository(Path.Combine(ApplicationPaths.WorldsDirectory, worldId, "factions.xml"));
            IFlagRepository     flagRepository     = new FlagRepository(Path.Combine(ApplicationPaths.WorldsDirectory, worldId, "flags.xml"));
            IHoldingRepository  holdingRepository  = new HoldingRepository(Path.Combine(ApplicationPaths.WorldsDirectory, worldId, "holdings.xml"));
            IProvinceRepository provinceRepository = new ProvinceRepository(Path.Combine(ApplicationPaths.WorldsDirectory, worldId, "provinces.xml"));
            IResourceRepository resourceRepository = new ResourceRepository(Path.Combine(ApplicationPaths.WorldsDirectory, worldId, "resources.xml"));
            IUnitRepository     unitRepository     = new UnitRepository(Path.Combine(ApplicationPaths.WorldsDirectory, worldId, "units.xml"));
            IWorldRepository    worldRepository    = new WorldRepository(ApplicationPaths.WorldsDirectory);

            IEnumerable <Biome>    biomeList    = biomeRepository.GetAll().ToDomainModels();
            IEnumerable <Border>   borderList   = borderRepository.GetAll().ToDomainModels();
            IEnumerable <Culture>  cultureList  = cultureRepository.GetAll().ToDomainModels();
            IEnumerable <Faction>  factionList  = factionRepository.GetAll().ToDomainModels();
            IEnumerable <Flag>     flagList     = flagRepository.GetAll().ToDomainModels();
            IEnumerable <Province> provinceList = provinceRepository.GetAll().ToDomainModels();
            IEnumerable <Resource> resourceList = resourceRepository.GetAll().ToDomainModels();
            IEnumerable <Unit>     unitList     = unitRepository.GetAll().ToDomainModels();

            armies    = new ConcurrentDictionary <Tuple <string, string>, Army>();
            biomes    = new ConcurrentDictionary <string, Biome>(biomeList.ToDictionary(biome => biome.Id, biome => biome));
            borders   = new ConcurrentDictionary <Tuple <string, string>, Border>(borderList.ToDictionary(border => new Tuple <string, string>(border.SourceProvinceId, border.TargetProvinceId), border => border));
            cultures  = new ConcurrentDictionary <string, Culture>(cultureList.ToDictionary(culture => culture.Id, culture => culture));
            factions  = new ConcurrentDictionary <string, Faction>(factionList.ToDictionary(faction => faction.Id, faction => faction));
            flags     = new ConcurrentDictionary <string, Flag>(flagList.ToDictionary(flag => flag.Id, flag => flag));
            holdings  = new ConcurrentDictionary <string, Holding>();
            provinces = new ConcurrentDictionary <string, Province>(provinceList.ToDictionary(province => province.Id, province => province));
            relations = new ConcurrentDictionary <Tuple <string, string>, Relation>();
            resources = new ConcurrentDictionary <string, Resource>(resourceList.ToDictionary(resource => resource.Id, resource => resource));
            units     = new ConcurrentDictionary <string, Unit>(unitList.ToDictionary(unit => unit.Id, unit => unit));
            world     = worldRepository.Get(worldId).ToDomainModel();
        }
コード例 #5
0
        public ActionResult <ProvinceDetailResponseModel> GetProvinceDetail(Guid provinceID)
        {
            ProvinceDetailResponseModel res = new ProvinceDetailResponseModel();

            try
            {
                ProvinceRepository repo = new ProvinceRepository(db);

                var query = repo.GetAll();

                var res2 = (from y in query
                            where y.ID == provinceID
                            select new ProviceOutputModel
                {
                    ProvinceID = y.ID,
                    Kode = y.Kode,
                    Provinsi = y.Provinsi
                }).FirstOrDefault();

                res.data     = res2;
                res.Message  = "Success get data";
                res.Response = true;
                return(res);
            }
            catch (Exception ex)
            {
                res.Message  = ex.Message;
                res.Response = false;
                return(res);
            }
        }
コード例 #6
0
 public ActionResult AddNew(ProvinceViewModel provinceViewModel)
 {
     try
     {
         if (ModelState.IsValid)
         {
             ProvinceRepository provinceRepository = new ProvinceRepository(new AutoSolutionContext());
             bool IsExist = provinceRepository.isExist(provinceViewModel.ProvinceName);
             if (!IsExist)
             {
                 Province province = new Province();
                 province.ProvinceName = provinceViewModel.ProvinceName;
                 province.ProvinceCode = provinceViewModel.ProvinceCode;
                 province.IsActive     = true;
                 _unitOfWork.Province.Add(province);
                 _unitOfWork.Complete();
                 _unitOfWork.Dispose();
                 return(RedirectToAction("GetProvince"));
             }
             else
             {
                 return(RedirectToAction("GetProvince"));
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
     return(View());
 }
コード例 #7
0
        private void populateComboBoxProvince(ComboBox comboBox)
        {
            try
            {
                // Clear ComboBox first so that this method can be called again later if
                // necessary.
                comboBox.Items.Clear();

                ProvinceList provinces = ProvinceRepository.GetProvinces();

                foreach (Province province in provinces)
                {
                    string provinceAbbreviation = province.Abbreviation;
                    comboBox.Items.Add(provinceAbbreviation);
                }
            }

            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message, "DB Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Processing Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #8
0
 public BusinessEntityRepository(ERPDatabaseEntities context)
 {
     EntityRepository                = new EntityRepository(context);
     AddressRepository               = new AddressRepository(context);
     AddressTypeRepository           = new AddressTypeRepository(context);
     BusinessEntityAddressRepository = new BusinessEntityAddressRepository(context);
     DistrictRepository              = new DistrictRepository(context);
     ProvinceRepository              = new ProvinceRepository(context);
     WardRepository = new WardRepository(context);
 }
コード例 #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public List <ProvinceModel> GetProvinces()
        {
            var items = ProvinceRepository.GetAll();

            if (items != null)
            {
                return(items.Select(p => p.ToModel()).ToList());
            }
            return(new List <ProvinceModel>());
        }
コード例 #10
0
        private void LoadProvinces()
        {
            ProvinceRepository provRepos = new ProvinceRepository();

            foreach (Province prov in provRepos.GetProvinces())
            {
                this.DDListPro.Items.Add(new ListItem(prov.Name, prov.ID.ToString()));
            }

            DDListPro.DataBind();
        }
コード例 #11
0
ファイル: Home.ascx.cs プロジェクト: Milkyway94/vexe
    protected string LoadProvince()
    {
        ProvinceRepository prorepo = new ProvinceRepository();
        StringBuilder      str     = new StringBuilder("");

        foreach (var item in prorepo.All())
        {
            str.Append("<option value='" + item.MaTinh + "'>" + item.TenTinh + "</option>");
        }
        return(str.ToString());
    }
コード例 #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public DatatablesView <ProvinceModel> GetProvincesByPaging(DataTablesPaging request)
        {
            int total       = 0;
            var pagingItems = ProvinceRepository.GetItemsByPaging(request, out total);
            var items       = new List <ProvinceModel>();

            foreach (var pagingItem in pagingItems)
            {
                var item = pagingItem.ToModel();
                items.Add(item);
            }
            return(new DatatablesView <ProvinceModel>(request.Draw, total, pagingItems.Count, items));
        }
コード例 #13
0
        private void LoadProvinces()
        {
            ProvinceRepository provRepos = new ProvinceRepository();

            this.ddProvince.Items.Add(new ListItem("--", Constants.NOID.ToString()));

            foreach (Province prov in provRepos.GetProvinces())
            {
                this.ddProvince.Items.Add(new ListItem(prov.FullName, prov.ID.ToString()));
            }

            ddProvince.DataBind();
        }
コード例 #14
0
        public IActionResult Index()

        {
            //List<Province> provinceList = new List<Province>();
            var provinceRepository  = new ProvinceRepository();
            var geographyRepository = new GeographyRepository();
            var raceRepository      = new RaceRepository();

            ViewBag.ProvinceList  = provinceRepository.GetProvinces().OrderBy(Province => Province.Name);
            ViewBag.GeographyList = geographyRepository.GetGeography().OrderBy(Geography => Geography.Name);
            ViewBag.RaceList      = raceRepository.GetRaces().OrderBy(Race => Race.Name);

            return(View());
        }
 public AddressService(
     ProvinceRepository provinceRepository,
     DistrictRepository disctrictRepository,
     WardRepository wardRepository,
     StreetRepository streetRepository,
     IUnitOfWork unitOfWork
     )
 {
     _provinceRepository  = provinceRepository;
     _disctrictRepository = disctrictRepository;
     _wardRepository      = wardRepository;
     _streetRepository    = streetRepository;
     _unitOfWork          = unitOfWork;
 }
コード例 #16
0
        private async Task showProvinces()
        {
            if (!(thisApp.AllProvinces?.Count > 0))
            {
                //Get the provinces
                ProvinceRepository r = new ProvinceRepository();
                try
                {
                    provinces.Add(new Province {
                        ID = 0, Code = "00", Name = "All Provinces"
                    });
                    thisApp.AllProvinces = await r.GetProvinces();

                    foreach (Province p in thisApp.AllProvinces.OrderBy(d => d.Name))
                    {
                        provinces.Add(p);
                    }

                    ddlProvinces.ItemsSource   = provinces;
                    ddlProvinces.SelectedIndex = 0;
                }

                catch (Exception ex)
                {
                    if (ex.InnerException != null)
                    {
                        if (ex.GetBaseException().Message.Contains("connection with the server"))
                        {
                            await DisplayAlert("Error", "No connection with the server. Check that the Web Service is running and available and then click the Refresh button.", "Ok");
                        }
                        else
                        {
                            await DisplayAlert("Error", "If the problem persists, please call your system administrator.", "Ok");
                        }
                    }
                    else
                    {
                        if (ex.Message.Contains("NameResolutionFailure"))
                        {
                            await DisplayAlert("Internet Access Error ", "Cannot resolve the Uri: " + Jeeves.DBUri.ToString(), "Ok");
                        }
                        else
                        {
                            await DisplayAlert("General Error ", ex.Message, "Ok");
                        }
                    }
                }
            }
        }
コード例 #17
0
        public ActionResult DangKimoi()
        {
            using (var _districtService = new DistrictRepository())
            {
                ViewBag.Districts = _districtService.GetDistrictByProvinceId(79);
            }
            using (var _wardService = new WardRepository())
            {
                ViewBag.Wards = _wardService.GetWardByDistrictId(760);
            }
            using (var _provinceService = new ProvinceRepository())
            {
                ViewBag.Provinces = _provinceService.GetProvinceByCountryId(237);
            }
            using (var _CapTruongService = new CapTruongRepository())
            {
                ViewBag.CapTruongs = _CapTruongService.GetCapTruongs();
            }
            using (var _monDuTuyen = new MonDuTuyenRepository())
            {
                ViewBag.MonDays = _monDuTuyen.GetMonDuTuyens();
            }
            using (var _hinhThucDaoTao = new HinhThucDaoTaoRepository())
            {
                ViewBag.HinhThucDaoTaos = _hinhThucDaoTao.GetHinhThucDaoTaos();
            }
            using (var _xepLoaiHocLuc = new XepLoaiHocLucRepository())
            {
                ViewBag.XepLoaiHocLucs = _xepLoaiHocLuc.GetXepLoaiHocLucs();
            }
            using (var _chuyenNghanhDaoTao = new ChuyenNganhDaoTaoRepository())
            {
                ViewBag.ChuyenNganhDaoTaos = _chuyenNghanhDaoTao.GetChuyenNganhDaoTaos();
            }
            using (var _bangTotNghiep = new BangTotNghiepRepository())
            {
                ViewBag.BangTotNghieps = _bangTotNghiep.GetBangTotNghieps();
            }
            using (var _schoolService = new SchoolRepository())
            {
                ViewBag.Schools = _schoolService.GetSchoolsByDistrictAndCapHoc(760, 4);
            }
            using (var _trinhdoDaoTao = new TrinhDoCaoNhatRepository())
            {
                ViewBag.TrinhDoCaoNhats = _trinhdoDaoTao.GetTrinhDoCaoNhats();
            }

            return(View());
        }
コード例 #18
0
        private void ClientEditDialog_Load(object sender, EventArgs e)
        {
            provinces = ProvinceRepository.GetProvinces();
            setBindings();
            populateComboBox();

            if (IsAddClient) // AddClient Dialog
            {
                maskedTextBoxClientCode.ReadOnly = false;
            }
            else // EditClient Dialog
            {
                selectProvince();
                textBoxCompanyName.Select();
                textBoxCompanyName.SelectAll();
            }
        }
コード例 #19
0
ファイル: ProvinceBL.cs プロジェクト: RomyPutra/BillBackup
        public AddProvinceOutputModel Save(AddProviceInputModel data)
        {
            ProvinceRepository repo = new ProvinceRepository(db);

            Province temp = new Province();

            temp.Kode           = data.Kode;
            temp.Provinsi       = data.Provinsi;
            temp.CreateByUserID = data.UserID;
            temp.CreateDate     = DateTime.Now;

            var res = repo.Insert(temp);

            AddProvinceOutputModel xres = new AddProvinceOutputModel();

            xres.ProvinsiID = res.ID;

            return(xres);
        }
コード例 #20
0
ファイル: ProvinceBL.cs プロジェクト: RomyPutra/BillBackup
        public DeleteProviceOutputModel Delete(DeleteProvinceInputModel data)
        {
            ProvinceRepository repo = new ProvinceRepository(db);

            Province temp = new Province();

            temp.ID = data.ProvinsiID;
            temp.DeletedByUserID = data.UserID;
            temp.DeletedDate     = DateTime.Now;

            var res = repo.DeleteProvince(temp);

            DeleteProviceOutputModel xres = new DeleteProviceOutputModel();

            xres.Message = "Success";


            return(xres);
        }
コード例 #21
0
        public HttpResponseMessage GetProvinces()
        {
            ResultMsg resultMsg = new ResultMsg();

            try
            {
                using (IProvince repository = new ProvinceRepository())
                {
                    var list = repository.FindAll();
                    resultMsg.code = 0;
                    resultMsg.data = list;
                }
            }
            catch (Exception ex)
            {
                resultMsg.code = (int)StatusCodeEnum.Error;
                resultMsg.msg  = ex.Message;
            }
            return(resultMsg.toJson());
        }
コード例 #22
0
ファイル: ProvinceBL.cs プロジェクト: RomyPutra/BillBackup
        public SyncProvinceAPIResponseModel SyncProviceFromAPI(string baseURL)
        {
            RestClient rest = new RestClient(baseURL);

            RestRequest req = new RestRequest("provinsi", Method.GET);

            req.AddHeader("Accept", "application/json");

            req.AddHeader("Content-Type", "application/json");


            var res = rest.Execute(req);

            var result = JsonConvert.DeserializeObject <SyncProvinceAPIResponseModel>(res.Content);



            List <Province> listTemp = new List <Province>();

            if (!result.error)
            {
                var today = DateTime.Now;
                foreach (var x in result.provinsi)
                {
                    Province temp = new Province();
                    temp.ID             = Guid.NewGuid();
                    temp.Kode           = Convert.ToInt32(x.id);
                    temp.Provinsi       = x.nama;
                    temp.CreateByUserID = Guid.Empty;
                    temp.CreateDate     = today;

                    listTemp.Add(temp);
                }

                ProvinceRepository repo = new ProvinceRepository(db);

                repo.InsertList(listTemp);
            }

            return(result);
        }
コード例 #23
0
        // GET: PlaceOrder
        public ActionResult Index(int?id)
        {
            if (id == 1)
            {
                var province = new ProvinceRepository(new AutoSolutionContext());
                var city     = new CityRepository(new AutoSolutionContext());
                ShipmentViewModel shipmentViewModel = new ShipmentViewModel()
                {
                    ProvincesList = province.GetProvinces(),
                    CitiesList    = city.GetCities(),
                    CartWrapper   = (CartWrapper)Session["AddToCart"]
                };
                return(View("Shipment", shipmentViewModel));
            }
            else if (Session["UserID"] != null)
            {
                int Id       = Convert.ToInt32(Session["UserId"]);
                var user     = _unitOfWork.User.GetByID(Id);
                var province = new ProvinceRepository(new AutoSolutionContext());
                var city     = new CityRepository(new AutoSolutionContext());
                ShipmentViewModel shipmentViewModel = new ShipmentViewModel()
                {
                    UserId        = user.UserId,
                    First_Name    = user.FirstName,
                    Last_Name     = user.LastName,
                    MobileNumber  = user.MobileNumber,
                    ProvincesList = province.GetProvinces(),
                    CitiesList    = city.GetCities(),
                    CartWrapper   = (CartWrapper)Session["AddToCart"]
                };

                return(View("Shipment", shipmentViewModel));
            }
            else
            {
                return(View("Check"));
            }
        }
コード例 #24
0
ファイル: ProvinceBL.cs プロジェクト: RomyPutra/BillBackup
        public EditProviceOutputModel Edit(EditProviceInputModel data)
        {
            ProvinceRepository repo = new ProvinceRepository(db);

            Province temp = new Province();

            temp.ID                 = data.ProvinsiID;
            temp.Kode               = data.Kode;
            temp.Provinsi           = data.Provinsi;
            temp.LastUpdateByUserID = data.UserID;
            temp.LastUpdateDate     = DateTime.Now;

            var res = repo.Update(temp);

            EditProviceOutputModel xres = new EditProviceOutputModel();


            xres.ProvinsiID = data.ProvinsiID;
            xres.Kode       = data.Kode;
            xres.Provinsi   = data.Provinsi;


            return(xres);
        }
コード例 #25
0
 public ServiceAccessor(AnhSanPhamRepository anhSanPhamRepository, BannerKhuyenMaiRepository bannerKhuyenMaiRepository, BinhLuanRepository binhLuanRepository, ChiTietDonHangRepository chiTietDonHangRepository, CountryRepository countryRepository, DistrictRepository districtRepository, DonHangRepository donHangRepository, LoaiSpRepository loaiSpRepository, NhaCungCapRepository nhaCungCapRepository, NhaSanXuatRepository nhaSanXuatRepository, ParameterRepository parameterRepository, ProvinceRepository provinceRepository, Core.Repository.SanPhamRepository sanPhamRepository, ThongSoKiThuatRepository thongSoKiThuatRepository, ThongSoRepository thongSoRepository, TraLoiRepository traLoiRepository, TrangThaiDonHangRepository trangThaiDonHangRepository, TrangThaiSanPhamRepository trangThaiSanPhamRepository, VoucherRepository voucherRepository, VoucherTypeRepository voucherTypeRepository, WardRepository wardRepository)
 {
     this.anhSanPhamRepository       = anhSanPhamRepository;
     this.bannerKhuyenMaiRepository  = bannerKhuyenMaiRepository;
     this.binhLuanRepository         = binhLuanRepository;
     this.chiTietDonHangRepository   = chiTietDonHangRepository;
     this.countryRepository          = countryRepository;
     this.districtRepository         = districtRepository;
     this.donHangRepository          = donHangRepository;
     this.loaiSpRepository           = loaiSpRepository;
     this.nhaCungCapRepository       = nhaCungCapRepository;
     this.nhaSanXuatRepository       = nhaSanXuatRepository;
     this.parameterRepository        = parameterRepository;
     this.provinceRepository         = provinceRepository;
     this.sanPhamRepository          = sanPhamRepository;
     this.thongSoKiThuatRepository   = thongSoKiThuatRepository;
     this.thongSoRepository          = thongSoRepository;
     this.traLoiRepository           = traLoiRepository;
     this.trangThaiDonHangRepository = trangThaiDonHangRepository;
     this.trangThaiSanPhamRepository = trangThaiSanPhamRepository;
     this.voucherRepository          = voucherRepository;
     this.voucherTypeRepository      = voucherTypeRepository;
     this.wardRepository             = wardRepository;
 }
コード例 #26
0
        public ActionResult CapNhatThuyenChuyen(string id, string cmnd)
        {
            using (var _thuyenchuyenService = new ThuyenChuyenRepository())
            {
                ThuyenChuyen thuyenChuyen = _thuyenchuyenService.CheckThuyenChuyenExistedByIdAndCMND(id, cmnd);
                if (thuyenChuyen == null || (thuyenChuyen.StatusId != 5 && thuyenChuyen.StatusId != null))
                {
                    return(RedirectToRoute("thuyenchuyenkiemtramatruong"));
                }

                using (var _districtService = new DistrictRepository())
                {
                    ViewBag.DistrictsNoiSinh = _districtService.GetDistrictByProvinceId(thuyenChuyen.Ward.District.ProvinceId);
                    ViewBag.DistrictsHKTT    = _districtService.GetDistrictByProvinceId(thuyenChuyen.Ward1.District.ProvinceId);
                    ViewBag.Districts        = _districtService.GetDistrictByProvinceId(79);
                }
                using (var _wardService = new WardRepository())
                {
                    ViewBag.WardsNoiSinh = _wardService.GetWardByDistrictId(thuyenChuyen.Ward.DistrictID);
                    ViewBag.WardsHKTT    = _wardService.GetWardByDistrictId(thuyenChuyen.Ward1.DistrictID);
                }
                using (var _provinceService = new ProvinceRepository())
                {
                    ViewBag.Provinces = _provinceService.GetProvinceByCountryId(237);
                }
                using (var _CapTruongService = new CapTruongRepository())
                {
                    ViewBag.CapTruongs = _CapTruongService.GetCapTruongs();
                }
                using (var _monDuTuyen = new MonDuTuyenRepository())
                {
                    ViewBag.MonDays = _monDuTuyen.GetMonDuTuyens();
                }
                using (var _hinhThucDaoTao = new HinhThucDaoTaoRepository())
                {
                    ViewBag.HinhThucDaoTaos = _hinhThucDaoTao.GetHinhThucDaoTaos();
                }
                using (var _xepLoaiHocLuc = new XepLoaiHocLucRepository())
                {
                    ViewBag.XepLoaiHocLucs = _xepLoaiHocLuc.GetXepLoaiHocLucs();
                }
                using (var _chuyenNghanhDaoTao = new ChuyenNganhDaoTaoRepository())
                {
                    ViewBag.ChuyenNganhDaoTaos = _chuyenNghanhDaoTao.GetChuyenNganhDaoTaos();
                }
                using (var _bangTotNghiep = new BangTotNghiepRepository())
                {
                    ViewBag.BangTotNghieps = _bangTotNghiep.GetBangTotNghieps();
                }
                using (var _schoolService = new SchoolRepository())
                {
                    ViewBag.SchoolsDCT = _schoolService.GetSchoolsByDistrictAndCapHoc(thuyenChuyen.School.Ward.DistrictID, thuyenChuyen.School.CapTruongId);
                    ViewBag.SchoolsCD  = _schoolService.GetSchoolsByDistrictAndCapHoc(thuyenChuyen.School1.Ward.DistrictID, thuyenChuyen.School1.CapTruongId);
                }
                using (var _trinhdoDaoTao = new TrinhDoCaoNhatRepository())
                {
                    ViewBag.TrinhDoCaoNhats = _trinhdoDaoTao.GetTrinhDoCaoNhats();
                }
                ViewBag.ThuyenChuyen = thuyenChuyen;
                return(View());
            }
        }
コード例 #27
0
        static void Main(string[] args)
        {
            ParkingContext _context = new ParkingContext();

            IProvinceRepository Province = new ProvinceRepository(_context);
            var Provinces = Province.GetProvinceAll();

            foreach (var item in Provinces)
            {
                Console.WriteLine("{0} :{1}", item.ProvinceCode, item.ProvinceName);
            }

            IParkingRateRepository rate = new ParkingRateRepository(_context);
            var ParkingRate             = rate.GetParkingRate();

            foreach (var item in ParkingRate)
            {
                Console.WriteLine("{0} :{1} :{2} :{3} ", item.Id, item.Rate, item.Hours, item.Order);
            }

            IUserRepository users = new UserRepository(_context);
            var             admin = users.GetUserIdByUserName("Admin");

            Console.WriteLine("UserId Admin :{0}", admin.Id);

            IParkingRecordRepository parking = new ParkingRecordRepository(_context);
            var totalcar = parking.GetCarParking();

            Console.WriteLine("TotalCar :{0}", totalcar);
            var daetail = parking.GetDataParkingRecordById(5);

            if (daetail != null)
            {
                Console.WriteLine("License :{0}", daetail.LicensePlate);
                Console.WriteLine("ProvinceCode :{0}", daetail.ProvinceCode);
                Console.WriteLine("TimeIn :{0}", daetail.Timein);
                Console.WriteLine("TimeOut :{0}", daetail.TimeOut);
                Console.WriteLine("TotalPrice:{0:C2}", daetail.TotalPrice);
            }
            Console.WriteLine("------------------------------------------------------------");
            Console.WriteLine("---------------------CheckbalanceByYear---------------------");
            Console.WriteLine("------------------------------------------------------------");
            var daetail5 = parking.CheckbalanceByYear(2019);

            if (daetail5 != null)
            {
                var totalprice = daetail5.TotalPrice;
                Console.WriteLine("Totalprice :{0:C2}", totalprice);
                foreach (var item in daetail5.ListParkingRecords)
                {
                    Console.WriteLine("License :{0}", item.LicensePlate);
                    Console.WriteLine("ProvinceCode :{0}", item.ProvinceCode);
                    Console.WriteLine("TimeIn :{0}", item.Timein);
                    Console.WriteLine("TimeOut :{0}", item.TimeOut);
                    Console.WriteLine("TotalPrice:{0:C2}", item.TotalPrice);
                }
            }

            //var useMax = _context.ParkingRecords.Where(pr => pr.Timein != null && pr.Timeout == null)
            //	.GroupBy(x => x.ProvinceCode, (x, y) => new
            //	{
            //		ProvinceName = y.Max(z => z.ProvinceCode),
            //		Total = x,
            //	}).ToList();
            //foreach (var item in useMax)
            //{
            //	Console.WriteLine("Total :{0}", item.Total);
            //	Console.WriteLine("ProvinceName :{0}", item.ProvinceName);
            //}
            //var grouped = from b in _context.ParkingRecords
            //			  group b.Id by b.Province.ProvinceName into g
            //			  select new
            //			  {
            //				  Key = g.Key,
            //				  Unit = g.Count()
            //			  };
            //var result = grouped.ToList().OrderByDescending(x=>x.Unit);
            var result = parking.GetTopProvinceUse();

            foreach (var item in result)
            {
                Console.WriteLine("ProvinceName :{0}", item.ProvinceName);
                Console.WriteLine("Unit :{0}", item.Total);
            }
        }
コード例 #28
0
 /// <summary>
 /// Method to build generic list of keyValue pair represinging Priovince Abbreviation and
 /// full name for display purpose;
 /// </summary>
 /// <returns>Returns interface of KeyValuePair required for Province comboBox</returns>
 public static IList <KeyValuePair <string, string> > GetProvinces()
 {
     return(ProvinceRepository.GetProvinces()
            .Select(x => new KeyValuePair <string, string>(x.Abbreviation, x.ProvinceDisplay))
            .ToList());
 }
コード例 #29
0
 public ProvinceController(IConfiguration configuration)
 {
     provinceRepository = new ProvinceRepository(configuration);
 }
コード例 #30
0
 public EmployeeController(EmployeeRepository repo, ProvinceRepository prepo)
 {
     _repo  = repo;
     _prepo = prepo;
 }