protected void Page_PreRender(object sender, EventArgs e) { if (Page.Request.Params["id"] != null) { var dm = new DataManager(); SenderProfiles profile = new SenderProfiles() { ID = profileID }; profile.GetById(); hfCityID.Value = profile.CityID; lblCityCost.Text = profile.CityCost; lblCityDeliveryDate.Text = profile.CityDeliveryDate; lblCityDeliveryTerms.Text = profile.CityDeliveryTerms; tbCity.Text = profile.CitySelectedString; ddlRecipientStreetPrefix.Text = profile.AddressPrefix; tbRecipientStreet.Text = profile.AddressStreet; tbRecipientStreetNumber.Text = profile.AddressHouseNumber; tbRecipientKorpus.Text = profile.AddressKorpus; tbRecipientKvartira.Text = profile.AddressKvartira; tbDeliveryDate.Text = profile.SendDate; tbRecipientPhone.Text = profile.RecipientPhone1; tbRecipientPhone2.Text = profile.RecipientPhone2; tbRecipientFirstName.Text = profile.FirstName; tbRecipientLastName.Text = profile.LastName; tbRecipientThirdName.Text = profile.ThirdName; profileName = profile.ProfileName; } }
public void lbDelete_Click(Object sender, EventArgs e) { var lb = (LinkButton)sender; var profile = new UsersProfiles(); var ID = Convert.ToInt32(lb.CommandArgument); SenderProfiles senderProfiles = new SenderProfiles(); senderProfiles.Delete(ID); }
public static string GetProfileNameByID(string id) { if (id != null && id != "") { var profile = new SenderProfiles { ID = Convert.ToInt32(id) }; profile.GetById(); return(profile.ProfileName); } return(null); }
protected void bntCreate_Click(Object sender, EventArgs e) { var senderProfile = new SenderProfiles() { CitySelectedString = tbCity.Text, CityID = hfCityID.Value, CityCost = lblCityCost.Text, CityDeliveryDate = lblCityDeliveryDate.Text, CityDeliveryTerms = lblCityDeliveryTerms.Text, AddressPrefix = ddlRecipientStreetPrefix.Text, AddressStreet = tbRecipientStreet.Text, AddressHouseNumber = tbRecipientStreetNumber.Text, AddressKorpus = tbRecipientKorpus.Text, AddressKvartira = tbRecipientKvartira.Text, RecipientPhone1 = tbRecipientPhone.Text, RecipientPhone2 = tbRecipientPhone2.Text, SendDate = tbDeliveryDate.Text, FirstName = tbRecipientFirstName.Text, LastName = tbRecipientLastName.Text, ThirdName = tbRecipientThirdName.Text }; if (Page.Request.Params["id"] != null) { senderProfile.ID = profileID; senderProfile.Update(); Response.Redirect("~/UserUI/ProfilesEditSender.aspx"); } else { if (tbNewProfile.Text != null && tbNewProfile.Text != "") { lbError.Visible = false; senderProfile.ProfileName = tbNewProfile.Text; senderProfile.ProfileID = UserID.ToString(); senderProfile.Create(); Response.Redirect("~/UserUI/ProfilesEditSender.aspx"); } else { lbError.Visible = true; } } }