void Submit_Click(object sender, EventArgs e) { int customerId; int portId; if (this.AuthorizedFor == AccessLevel.Private) { int.TryParse(this.Customer.SelectedValue, out customerId); } else { customerId = base.Customer.Id; } int.TryParse(this.Port.SelectedValue, out portId); try { decimal weight = decimal.Parse(this.Weight.Text.Trim()); if (weight < 4000 || weight > 30000) { throw new Exception("Het gewicht moet tussen de 4.000 en 30.000 kg zijn."); } if (this.dalCustomer.GetBy(new SearchParameter("Id", customerId)) == null) { throw new Exception("Klant niet gevonden."); } if (this.dalPort.GetBy(new SearchParameter("Id", portId)) == null) { throw new Exception("Bestemming niet gevonden."); } var container = new Container() { Cooling = this.Cooling.Checked, CustomerId = customerId, PortId = portId, Valuable = this.Valuable.Checked, Weight = weight, Gps = this.Gps.Text.Trim().ToUpper(), Active = true }; new DataAccessLayer.Container().Insert(container); this.SetFlash("Container succesvol geplaatst."); } catch (Exception ex) { this.SetFlash("Er is iets foutgegaan bij het aanmelden van de container. (Fout: " + ex.Message + ")", FlashType.Danger); this.Response.Redirect(this.Request.RawUrl); } this.Response.Redirect("?page=Container&method=List"); }
/// <summary> /// Initializes a new instance of the <see cref="Location"/> class. /// </summary> /// <param name="x"> /// The x. /// </param> /// <param name="y"> /// The y. /// </param> /// <param name="z"> /// The z. /// </param> /// <param name="container"> /// The container. /// </param> public Location(int x, int y, int z, Container container) { this.X = x; this.Y = y; this.Z = z; this.Container = container; }