private void GetRIPresident(int id) { RIPresident rip = new RIPresident(); rip.Id = id; DataTable dt = new DataTable(); dt = rip.GetRIPresident(); if (dt.Rows.Count > 0) { txtDistNo.Text = dt.Rows[0]["district_no"].ToString(); txtParticepant.Text = dt.Rows[0]["participant"].ToString(); txtData.Content = dt.Rows[0]["description"].ToString(); DDLYear.SelectedItem.Text = dt.Rows[0]["year"].ToString(); txtFName.Text = dt.Rows[0]["fname"].ToString(); txtMName.Text = dt.Rows[0]["mname"].ToString(); txtLName.Text = dt.Rows[0]["lname"].ToString(); txtClubName.Text = dt.Rows[0]["club_name"].ToString(); txtDistrict.Text = dt.Rows[0]["district"].ToString(); txtCountry.Text = dt.Rows[0]["country"].ToString(); txtTheme.Text = dt.Rows[0]["theme"].ToString(); txtConvention.Text = dt.Rows[0]["convention"].ToString(); string president_image = dt.Rows[0]["president_image"].ToString(); string theme_logo = dt.Rows[0]["theme_logo"].ToString(); string convention_image = dt.Rows[0]["convention_image"].ToString(); } }
private void AddRIPresident() { try { RIPresident rip = new RIPresident(); try { rip.District_no = int.Parse(txtDistNo.Text.Trim().ToString()); } catch { rip.District_no = 0; } try { rip.Participant = int.Parse(txtParticepant.Text.Trim().ToString()); } catch { rip.Participant = 0; } rip.Description = txtData.Content; rip.Year = DDLYear.SelectedItem.Text.Trim().ToString(); rip.Fname = txtFName.Text.Trim().ToString(); rip.Mname = txtMName.Text.Trim().ToString(); rip.Lname = txtLName.Text.Trim().ToString(); rip.Club_name = txtClubName.Text.Trim().ToString(); rip.District = txtDistrict.Text.Trim().ToString();// Location rip.Country = txtCountry.Text.Trim().ToString(); rip.Theme = txtTheme.Text.Trim().ToString(); rip.Convention = txtConvention.Text.Trim().ToString(); SaveImages img = new SaveImages(); string pimg = img.AddImages(FileUploadPhoto.PostedFile, "RIPresidentPhotos"); rip.President_image = pimg; string theme_logo = img.AddImages(FileUploadPhoto.PostedFile, "RIPresidentLogo"); rip.Theme_logo = theme_logo; string convention_image = img.AddImages(FileUploadPhoto.PostedFile, "RIPresidentLogo"); rip.Convention_image = convention_image; int exe = rip.AddRIPresident(); if (exe > 0) { clear(); string jv = "<script>alert('Record Added Successfully');</script>"; ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "alert", jv, false); } } catch { } }
private void UpdateRIPresident(int id) { try { RIPresident rip = new RIPresident(); try { rip.District_no = int.Parse(txtDistNo.Text.Trim().ToString()); } catch { rip.District_no = 0; } try { rip.Participant = int.Parse(txtParticepant.Text.Trim().ToString()); } catch { rip.Participant = 0; } rip.Description = txtData.Content; rip.Id = id; rip.Year = DDLYear.SelectedItem.Text.Trim().ToString(); rip.Fname = txtFName.Text.Trim().ToString(); rip.Mname = txtMName.Text.Trim().ToString(); rip.Lname = txtLName.Text.Trim().ToString(); rip.Club_name = txtClubName.Text.Trim().ToString(); rip.District = txtDistrict.Text.Trim().ToString(); rip.Country = txtCountry.Text.Trim().ToString(); rip.Theme = txtTheme.Text.Trim().ToString(); rip.Convention = txtConvention.Text.Trim().ToString(); SaveImages img = new SaveImages(); string pimg = img.AddImages(FileUploadPhoto.PostedFile, "RIPresidentPhotos"); rip.President_image = pimg; string theme_logo = img.AddImages(FileUploadPhoto.PostedFile, "RIPresidentLogo"); rip.Theme_logo = theme_logo; string convention_image = img.AddImages(FileUploadPhoto.PostedFile, "RIPresidentLogo"); rip.Convention_image = convention_image; int exe = rip.UpdateRIPresident(); if (exe > 0) { clear(); showmsg("Record updated successfully !", "view_ri_president.aspx"); } } catch { } }