public void btnSave_Clicked(object sender, EventArgs e) { MonkData db = new MonkData(); Monks.jkp_Address address; if(AddressId != null) { address = db.jkp_Addresses.First(p=>p.Add_ID == AddressId); } else { address = new Monks.jkp_Address(); address.Add_ID = Guid.NewGuid(); } address.Add_Street = txtAddress.Text; address.Add_State = txtState.Text; address.Add_PostalCode = txtZip.Text; address.Add_Country = txtCountry.Text; address.Add_City = txtCity.Text; if(AddressId == null) db.jkp_Addresses.InsertOnSubmit(address); db.SubmitChanges(); mvAddEdit.ActiveViewIndex = 1; }
/// <summary> /// Creates a jkp_address object for a user /// </summary> /// <returns></returns> private Monks.jkp_Address Create_jkp_Address() { Monks.jkp_Address jAddress = new Monks.jkp_Address(); jAddress.Add_City = txtCity.Text; jAddress.Add_Street = txtAddress.Text; jAddress.Add_State = txtState.Text; jAddress.Add_PostalCode = txtPostalCode.Text; jAddress.Add_Country = ddlCountry.SelectedItem.Text; jAddress.Add_ID = Guid.NewGuid(); return jAddress; }
protected void Page_Load(object sender, EventArgs e) { Session.Add("UserId", UserId); Monks.jkp_Person jPerson = db.aspnet_Memberships.First(p => p.UserId == UserId).jkp_Person; Session.Add("PersonId", jPerson.Per_ID); Session.Add("PersonAddressId", jPerson.Per_Add_ID.Value.ToString()); if (jPerson.jkp_Address == null) { Monks.jkp_Address address = new Monks.jkp_Address(); address.Add_ID = Guid.NewGuid(); db.jkp_Addresses.InsertOnSubmit(address); jPerson.jkp_Address = address; db.SubmitChanges(); jPerson = db.aspnet_Memberships.First(p => p.UserId == UserId).jkp_Person; } //get list of PCR tuples matching the person ID var userAttendingRetreatList = from u in db.jkp_PersonAttendingRetreats where u.PAR_PersonId == jPerson.Per_ID select u; List<Monks.jkp_Retreat> retreats = new List<Monks.jkp_Retreat>(); foreach (Monks.jkp_PersonAttendingRetreat retreat in userAttendingRetreatList) { retreats.Add(retreat.jkp_Retreat); } rpRetreats.DataSource = retreats; rpRetreats.DataBind(); var userInRoles = db.aspnet_UsersInRoles.Where(p => p.UserId == UserId); if (userInRoles.Count() == 0) fieldsetRoles.Visible = false; else { rpRolesIn.DataSource = userInRoles; rpRolesIn.DataBind(); } }
private void detach_jkp_Addresses(jkp_Address entity) { this.SendPropertyChanging(); entity.jkp_Sangha = null; }