private TAFCert PopulateTAFCert() { TAFCert newCert = new TAFCert(); newCert.Id = 0; newCert.Active = true; newCert.TAFCertificate = ddlGiftCert.SelectedValue; newCert.ZipCodes = txtZip.Text.Trim(); return(newCert); }
protected void btnSaveGiftCert_Click(object sender, EventArgs e) { TAFCert newCert = PopulateTAFCert(); newCert.Id = CertID; TAFCertDAL newDal = new TAFCertDAL(); newDal.SaveTAFContent(newCert); gvTAFCert.DataSource = newDal.GetAllTAFCerts(); gvTAFCert.DataBind(); }
private void Delete(string ID) { int certId = int.Parse(ID); TAFCert newCert = PopulateTAFCert(); newCert.Id = certId; newCert.Active = false; TAFCertDAL newDal = new TAFCertDAL(); newDal.SaveTAFContent(newCert); gvTAFCert.DataSource = newDal.GetAllTAFCerts(); gvTAFCert.DataBind(); }
private void AssignValues(TAFCert newCert) { txtZip.Text = newCert.ZipCodes; int index = 0; foreach (ListItem item in ddlGiftCert.Items) { if (item.Value.Trim().Equals(newCert.TAFCertificate.Trim())) { ddlGiftCert.SelectedIndex = index; break; } index++; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { populateImageDropDown(); TAFCertDAL newDal = new TAFCertDAL(); gvTAFCert.DataSource = newDal.GetAllTAFCerts(); gvTAFCert.DataBind(); if (CertID > 0) { TAFCert newCert = newDal.GetTAFCert(CertID); AssignValues(newCert); btnSaveGiftCert.Text = "Update"; } } }