protected void ui_save_button_Click(object sender, EventArgs e) { CollectionPoint collectionPoint = new CollectionPoint(); int collectionPoint_id; if (int.TryParse(ui_id_hiddenfield.Value, out collectionPoint_id)) { collectionPoint.id = Convert.ToInt32(ui_id_hiddenfield.Value); } if (String.IsNullOrEmpty(ui_collectionPoint_textbox.Text)) { Response.Cookies.Add(new HttpCookie("flash_message", "Field(s) marked with * can't be empty.") { Path = "/" }); Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-error") { Path = "/" }); return; } collectionPoint.name = ui_collectionPoint_textbox.Text; Message message; if (collectionPoint.id > 0) { message = collectionPointController.actionUpdateCollectionPoint(collectionPoint); } else { message =collectionPointController.actionCreateCollectionPoint(collectionPoint); } //redirecting if (message.condition) { Response.Cookies.Add(new HttpCookie("flash_message", "Successfully Saved.") { Path = "/" }); Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-success") { Path = "/" }); Response.Redirect("~/StoreClerk/CollectionPointDetail.aspx?id=" + collectionPoint.id); } else { Response.Cookies.Add(new HttpCookie("flash_message", message.message) { Path = "/" }); Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-error") { Path = "/" }); Response.Redirect("~/StoreClerk/CollectionPointDetail.aspx?id=" + collectionPoint.id); } }
/// <summary> /// Create a new CollectionPoint object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="name">Initial value of the name property.</param> public static CollectionPoint CreateCollectionPoint(global::System.Int32 id, global::System.String name) { CollectionPoint collectionPoint = new CollectionPoint(); collectionPoint.id = id; collectionPoint.name = name; return collectionPoint; }
/// <summary> /// Deprecated Method for adding a new object to the CollectionPoints EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToCollectionPoints(CollectionPoint collectionPoint) { base.AddObject("CollectionPoints", collectionPoint); }