void Awake() { area = gameObject.GetComponentInChildren<Area>(); border = gameObject.GetComponentInChildren<CountryBorder>(); state = gameObject.GetComponentInChildren<CountryState>(); provinces = gameObject.GetComponentInChildren<Provinces>(); descriptor = gameObject.GetComponent<CountryDescriptor>(); }
public async Task <ActionResult> DeleteConfirmed(int id) { CountryState state = await db.States.FindAsync(id); db.States.Remove(state); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Abbreviation,CountryId")] CountryState state) { if (ModelState.IsValid) { db.Entry(state).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.CountryId = new SelectList(db.Countries, "Id", "Name", state.CountryId); return(View(state)); }
// GET: States/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CountryState state = await db.States.FindAsync(id); if (state == null) { return(HttpNotFound()); } return(View(state)); }
// GET: States/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CountryState state = await db.States.FindAsync(id); if (state == null) { return(HttpNotFound()); } ViewBag.CountryId = new SelectList(db.Countries, "Id", "Name", state.CountryId); return(View(state)); }
public CountryState getCountryStateForCPPersonal(int custId) { SqlCommand dinsert = new SqlCommand("usp_getcountryStateCPPersonalDtl"); dinsert.Parameters.AddWithValue("@CustId", SqlDbType.Int).Value = custId; DataTable dtList = objcon.GetDtByCommand(dinsert); CountryState list = new CountryState(); if (dtList.Rows.Count > 0) { foreach (DataRow dr in dtList.Rows) { list.StateId = (dr["StateId"].ToString()); list.Country = dr["Country"].ToString(); list.City = dr["City"].ToString(); } } return(list); }
public bool Create(State model, int countryId) { using (var context = new CourseContext()) { State entity = model; Country country = context.Country.Find(countryId); if (country == null) { return(false); } CountryState countryState = new CountryState() { Country = country, State = entity }; context.Add(countryState); context.SaveChanges(); return(true); } }
public static void ReadInfo() { System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); using (var stream = File.Open(@"Resources/CountriesforParcelFedex.xlsx", FileMode.Open, FileAccess.Read)) { // Auto-detect format, supports: // - Binary Excel files (2.0-2003 format; *.xls) // - OpenXml Excel files (2007 format; *.xlsx) using (var reader = ExcelReaderFactory.CreateReader(stream)) { // 2. Use the AsDataSet extension method DataSet result = reader.AsDataSet(); //Excel Pages DataTable data_table = result.Tables[2]; for (int i = 1; i < data_table.Rows.Count; i++) { CountryState countryStateToInsert = new CountryState { Country = data_table.Rows[i][0].ToString(), Prefix = data_table.Rows[i][1].ToString(), StateCode = data_table.Rows[i][2].ToString(), StateName = data_table.Rows[i][3].ToString(), }; countriesState.Add(countryStateToInsert); } /* TextWriter tw = new StreamWriter("CountryStateInfo.txt"); * foreach (CountryState s in countriesState) * { * tw.Write(s.Country + " " + s.StateName + " " + s.StateCode + " " + s.Prefix); * tw.Write("\n"); * } * tw.Close();*/ } } }
void SetCountryState(CountryState newState) { if (newState != countryState) { switch (newState) { case CountryState.Default: countryMaterial.color = defaultColor; break; case CountryState.Wrong: countryTitle.setTitle(gameObject); countryMaterial.color = wrongColor; break; case CountryState.Right: countryMaterial.color = rightColor; break; } countryState = newState; } }
public void init() { countryStates = new CountryState(); AddActionClassesToList(countryStates); }