static void Main(string[] args) { string connStr = ConfigurationManager.ConnectionStrings["FuelEntities"].ConnectionString; _regionManager = new RegionManager(connStr); _AZSManager = new AZSManager(connStr); _FuelManager = new FuelinAZSManager(connStr); var regions = _regionManager.GetAll(); var AZSes = _AZSManager.GetAll(); var fuel = _FuelManager.GetAll(); }
static void Start() { try { MyClass mc = new MyClass(); string connStr = ConfigurationManager.ConnectionStrings["FuelEntities"].ConnectionString; _regionManager = new RegionManager(connStr); _azsManager = new AZSManager(connStr); _fuelManager = new FuelManager(connStr); string fn = "1"; string an = "1"; string rn = "1"; decimal pr = 1; var regions = _regionManager.GetAll(); var azs = _azsManager.GetAll(); var fuel = _fuelManager.GetAll(); var res = from f in fuel join a in azs on f.AZSid equals a.id join r in regions on a.RegionId equals r.id select new { Name = f.F_Name, AName = a.AZS_Name, Region = r.RegionName, Price = f.F_Price }; foreach (var r in res) { Console.WriteLine(r.Name + "->" + r.AName + "->" + r.Region + "->" + r.Price); fn = r.Name; an = r.AName; rn = r.Region; pr = Convert.ToDecimal(r.Price); } Console.WriteLine(fn + " " + an + " " + rn + " " + pr); mc.fuel_N = fn; mc.azs_N = an; mc.region_N = rn; mc.PRICE = pr; } catch (Exception ex) { Console.WriteLine(ex.Message); } }