private void BindGrid() { DistrictClub dc = new DistrictClub(); DataTable dt = new DataTable(); dt = dc.GetAllClubs(); if (dt.Rows.Count > 0) { lblMsg.Visible = false; RadGrid1.Visible = true; RadGrid1.DataSourceID = string.Empty; RadGrid1.DataSource = dt; RadGrid1.Rebind(); } else { lblMsg.Visible = true; RadGrid1.Visible = false; } }
private void GetClubDetails(int id) { try { DistrictClub obj = new DistrictClub(); obj.Id = id; DataTable dt = new DataTable(); dt = obj.GetClubById(); if (dt.Rows.Count > 0) { // Club Details lblClubName.Text = dt.Rows[0]["club_name"].ToString(); lblClubNo.Text = dt.Rows[0]["ri_club_No"].ToString(); DateTime chrterdate = DateTime.Parse(dt.Rows[0]["charter_date"].ToString()); lblCharterDate.Text = chrterdate.ToString("dd-MMMM-yyyy"); lblMeetingDay.Text = dt.Rows[0]["meeting_day"].ToString(); // lblMeetingTime.Text = dt.Rows[0]["meeting_time"].ToString(); try { DateTime meetingTime = DateTime.Parse(dt.Rows[0]["meeting_time"].ToString()); lblMeetingTime.Text = meetingTime.ToString("hh:mm tt"); } catch { lblMeetingTime.Text = "-"; } lblVenue.Text = dt.Rows[0]["venue1"].ToString() + " " + dt.Rows[0]["venue2"].ToString() + " " + dt.Rows[0]["city"].ToString(); lblDS.Text = dt.Rows[0]["ds"].ToString(); lblAT.Text = dt.Rows[0]["at"].ToString(); lblAG.Text = dt.Rows[0]["ag"].ToString(); lblFlagship.Text = dt.Rows[0]["flagship_text"].ToString(); string strFlagship = dt.Rows[0]["flagship_image"].ToString(); if (strFlagship != "") { imgFlagship.Visible = true; imgFlagship.ImageUrl = "../ProjectFlagship/" + strFlagship; } else { imgFlagship.Visible = false; } DateTime instDate = DateTime.Parse(dt.Rows[0]["installation_date"].ToString()); lblInstallation.Text = instDate.ToString("dd-MMMM-yyyy"); DateTime ocvDate = DateTime.Parse(dt.Rows[0]["ocv_date"].ToString()); lblOcv.Text = ocvDate.ToString("dd-MMMM-yyyy"); //string gps = dt.Rows[0]["gps_latitude"].ToString(); //if (gps != "") //{ // lblGPS.Text = "Latitude : " + dt.Rows[0]["gps_latitude"].ToString() + " " + "Longitude : " + dt.Rows[0]["gps_longitude"].ToString(); //} //else //{ // lblGPS.Text = ""; //} //lblInstTime.Text = dt.Rows[0]["installation_time"].ToString(); //lblInstChiefGuest.Text = dt.Rows[0]["installation_chief_guest"].ToString(); //lblInstVenue.Text = dt.Rows[0]["installation_venue"].ToString(); //lblOcvTime.Text = dt.Rows[0]["ocv_time"].ToString(); //lblTrfStatus.Text = dt.Rows[0]["club_trf_status"].ToString(); //string strLogo = dt.Rows[0]["club_logo"].ToString(); //if(strLogo!="") //{ // imgLogo.Visible = true; // imgLogo.ImageUrl = "../ClubsLogo/" + strLogo; //} //else //{ // imgLogo.Visible = false; //} //string strLocationMap = dt.Rows[0]["location_map"].ToString(); //if (strLocationMap != "") //{ // imgMap.Visible = true; // imgMap.ImageUrl = "../ClubsLogo/" + strLocationMap; //} //else //{ // imgMap.Visible = false; //} } } catch { } }
private void GetClub(int id) { DistrictClub dc = new DistrictClub(); DataTable dt = new DataTable(); dc.Id = id; dt = dc.GetClubById(); //dc.RiClubNo = id; //dt = dc.GetClubByClubId(); if (dt.Rows.Count > 0) { ddlDistNo.SelectedItem.Text = dt.Rows[0]["district_no"].ToString(); txtTitle.Text = dt.Rows[0]["club_name"].ToString(); txtClubNo.Text = dt.Rows[0]["ri_club_no"].ToString(); DDLClubName.SelectedItem.Text = dt.Rows[0]["sponsored_club"].ToString(); charterDate.SelectedDate = DateTime.Parse(dt.Rows[0]["charter_date"].ToString()); DDLDay.SelectedItem.Text = dt.Rows[0]["meeting_day"].ToString(); meetingTime.SelectedDate = DateTime.Parse(dt.Rows[0]["meeting_time"].ToString()); txtVenue1.Text = dt.Rows[0]["venue1"].ToString(); txtVenue2.Text = dt.Rows[0]["venue2"].ToString(); txtLandmark.Text = dt.Rows[0]["landmark"].ToString(); txtCity.Text = dt.Rows[0]["city"].ToString(); txtPin.Text = dt.Rows[0]["pin"].ToString(); txtState.Text = dt.Rows[0]["state"].ToString(); txtCountry.Text = dt.Rows[0]["country"].ToString(); txtLatitude.Text = dt.Rows[0]["gps_latitude"].ToString(); txtLongitude.Text = dt.Rows[0]["gps_longitude"].ToString(); txtWebsite.Text = dt.Rows[0]["website"].ToString(); string strImgLogo = dt.Rows[0]["club_logo"].ToString(); if (strImgLogo != "") { Session["ImageLogo"] = strImgLogo; imgLogo.Visible = true; imgLogo.ImageUrl = "../ClubsLogo/" + strImgLogo; } string strImgMap = dt.Rows[0]["location_map"].ToString(); if (strImgMap != "") { Session["ImageMap"] = strImgMap; imgMap.Visible = true; imgMap.ImageUrl = "../ClubsLogo/" + strImgMap; } DDLMem1.SelectedItem.Text = dt.Rows[0]["ds"].ToString(); DDLMem2.SelectedItem.Text = dt.Rows[0]["ag"].ToString(); DDLMem3.SelectedItem.Text = dt.Rows[0]["at"].ToString(); DDLMem4.SelectedItem.Text = dt.Rows[0]["gc"].ToString(); txtPHF.Text = dt.Rows[0]["phf"].ToString(); txtTRFSM.Text = dt.Rows[0]["trfsm"].ToString(); txtMD.Text = dt.Rows[0]["md"].ToString(); txtPHSM.Text = dt.Rows[0]["phsm"].ToString(); txtArchKlump.Text = dt.Rows[0]["arch_klump"].ToString(); try { installationDate.SelectedDate = DateTime.Parse(dt.Rows[0]["installation_date"].ToString()); } catch { } //try //{ // installationTime.SelectedDate = DateTime.Parse(dt.Rows[0]["installation_time"].ToString()); //} //catch { } string strTime = dt.Rows[0]["installation_time"].ToString(); if (strTime == "Morning") { rbtnTime.SelectedIndex = 0; } if (strTime == "Afternoon") { rbtnTime.SelectedIndex = 1; } if (strTime == "Evening") { rbtnTime.SelectedIndex = 2; } txtChiefGuest.Text = dt.Rows[0]["installation_chief_guest"].ToString(); txtInstallationVenue.Text = dt.Rows[0]["installation_venue"].ToString(); try { ocvDate.SelectedDate = DateTime.Parse(dt.Rows[0]["ocv_date"].ToString()); } catch { } try { ocvTime.SelectedDate = DateTime.Parse(dt.Rows[0]["ocv_time"].ToString()); } catch { } string strTrfStatus = dt.Rows[0]["club_trf_status"].ToString(); if (strTrfStatus == "N/A") { rbtnClubTrfStatus.SelectedIndex = 0; } if (strTrfStatus == "100% PHFSM Club") { rbtnClubTrfStatus.SelectedIndex = 1; } if (strTrfStatus == "100% PHF Club") { rbtnClubTrfStatus.SelectedIndex = 2; } if (strTrfStatus == "100% EREY Club") { rbtnClubTrfStatus.SelectedIndex = 3; } if (strTrfStatus == "100% MD Club") { rbtnClubTrfStatus.SelectedIndex = 4; } txtFlagshipProject.Text = dt.Rows[0]["flagship_text"].ToString(); string strFlagshipImg = dt.Rows[0]["flagship_image"].ToString(); if (strFlagshipImg != "") { Session["FlagshipImg"] = strFlagshipImg; imgFlagship.Visible = true; imgFlagship.ImageUrl = "../ProjectFlagship/" + strFlagshipImg; } } }
private void UpdateDistClub(int id) { try { System.Data.SqlTypes.SqlDateTime nullDate; nullDate = SqlDateTime.Null; int?nullInt = null; DistrictClub dc = new DistrictClub(); dc.Id = id; dc.DistrictNo = int.Parse(ddlDistNo.SelectedItem.Text.ToString()); dc.ClubName = txtTitle.Text.ToString(); try { dc.RiClubNo = int.Parse(txtClubNo.Text.ToString()); } catch { dc.RiClubNo = 0; } string sponsorClub = DDLClubName.SelectedItem.Text.Trim(); if (sponsorClub == "Select") { dc.SponsoredClub = ""; } else { dc.SponsoredClub = DDLClubName.SelectedItem.Text.Trim(); } try { dc.CharterDate = DateTime.Parse(charterDate.SelectedDate.ToString());// DDLDays.SelectedItem.Text + "/" + DDLMonth.SelectedItem.Text + "/" + DDLYear.SelectedItem.Text; } catch { dc.CharterDate = nullDate; } dc.MeetingDay = DDLDay.SelectedItem.Text; try { dc.MeetingTime = DateTime.Parse(meetingTime.SelectedDate.ToString()); } catch { dc.MeetingTime = nullDate; } dc.Venu1 = txtVenue1.Text.Trim(); dc.Venu2 = txtVenue2.Text.Trim(); dc.Landmark = txtLandmark.Text.Trim(); dc.City = txtCity.Text.Trim(); dc.Pin = txtPin.Text.Trim(); dc.State = txtState.Text.Trim(); dc.Country = txtCountry.Text.Trim(); dc.GpsLatitude = txtLatitude.Text.Trim(); dc.GpsLongitude = txtLongitude.Text.Trim(); dc.Website = txtWebsite.Text.Trim(); dc.FacebookLink = txtFacebookLink.Text.Trim(); if (Session["ImageLogo"] != null) { dc.Logo = Session["ImageLogo"].ToString(); } else { dc.Logo = ""; } if (Session["ImageMap"] != null) { dc.LocationMap = Session["ImageMap"].ToString(); } else { dc.LocationMap = ""; } try { dc.InstallationDate = DateTime.Parse(installationDate.SelectedDate.ToString()); } catch { dc.InstallationDate = nullDate; } //try //{ // dc.InstallationTime = DateTime.Parse(installationTime.SelectedDate.ToString()); //} //catch { dc.InstallationTime = nullDate; } try { dc.InstallationTime = rbtnTime.SelectedItem.Text.ToString(); } catch { dc.InstallationTime = ""; } dc.InstallationChiefGuest = txtChiefGuest.Text.Trim(); dc.InstallationVenue = txtInstallationVenue.Text.Trim(); try { dc.OcvDate = DateTime.Parse(ocvDate.SelectedDate.ToString()); } catch { dc.OcvDate = nullDate; } try { dc.OcvTime = DateTime.Parse(ocvTime.SelectedDate.ToString()); } catch { dc.OcvTime = nullDate; } try { dc.Phf = int.Parse(txtPHF.Text.Trim()); } //catch { dc.Phf = nullInt.Value; } catch { dc.Phf = 0; } try { dc.Trfsm = int.Parse(txtTRFSM.Text.Trim()); } catch { dc.Trfsm = 0; } try { dc.Md = int.Parse(txtMD.Text.Trim()); } catch { dc.Md = 0; } try { dc.Phsm = int.Parse(txtPHSM.Text.Trim()); } catch { dc.Phsm = 0; } try { dc.ArchKlump = int.Parse(txtArchKlump.Text.Trim()); } catch { dc.ArchKlump = 0; } dc.DS = DDLMem1.SelectedItem.Text.Trim(); dc.AG = DDLMem2.SelectedItem.Text.Trim(); dc.AT = DDLMem3.SelectedItem.Text.Trim(); dc.GC = DDLMem4.SelectedItem.Text.Trim(); dc.ClubTrfStatus = rbtnClubTrfStatus.SelectedItem.Text.Trim(); dc.FlagshipText = txtFlagshipProject.Text.Trim(); if (Session["FlagshipImg"] != null) { dc.FlagshipImage = Session["FlagshipImg"].ToString(); } else { dc.FlagshipImage = ""; } int exe = dc.UpdateDistrictClub(); if (exe > 0) { showmsg("Record updated successfully !", "view_clubs.aspx"); } } catch { } }
private void AddDistClub() { if (Page.IsValid) { System.Data.SqlTypes.SqlDateTime nullDate; nullDate = SqlDateTime.Null; int?nullInt = null; //string h, m, am, time = ""; //h = DDLTimeH.SelectedItem.Text; //m = DDLTimeM.SelectedItem.Text; //am = DDLTime2.SelectedItem.Text; //time = h + ":" + m + ":" + am; //string ih, im, iam, iTime = ""; //ih = DDLInstallationTimeH.SelectedItem.Text; //im = DDLInstallationTimeM.SelectedItem.Text; //iam = DDLInstallationTimeM.SelectedItem.Text; //iTime = ih + ":" + im + ":" + iam; DistrictClub dc = new DistrictClub(); dc.DistrictNo = int.Parse(ddlDistNo.SelectedItem.Text.ToString()); dc.ClubName = txtTitle.Text.ToString(); try { dc.RiClubNo = int.Parse(txtClubNo.Text.ToString()); } catch { dc.RiClubNo = 0; } string sponsorClub = DDLClubName.SelectedItem.Text.Trim(); if (sponsorClub == "Select") { dc.SponsoredClub = ""; } else { dc.SponsoredClub = DDLClubName.SelectedItem.Text.Trim(); } try { dc.CharterDate = DateTime.Parse(charterDate.SelectedDate.ToString());// DDLDays.SelectedItem.Text + "/" + DDLMonth.SelectedItem.Text + "/" + DDLYear.SelectedItem.Text; } catch { dc.CharterDate = nullDate; } dc.MeetingDay = DDLDay.SelectedItem.Text; try { dc.MeetingTime = DateTime.Parse(meetingTime.SelectedDate.ToString()); } catch { dc.MeetingTime = nullDate; } dc.Venu1 = txtVenue1.Text.Trim(); dc.Venu2 = txtVenue2.Text.Trim(); dc.Landmark = txtLandmark.Text.Trim(); dc.City = txtCity.Text.Trim(); dc.Pin = txtPin.Text.Trim(); dc.State = txtState.Text.Trim(); dc.Country = txtCountry.Text.Trim(); dc.GpsLatitude = txtLatitude.Text.Trim(); dc.GpsLongitude = txtLongitude.Text.Trim(); dc.Website = txtWebsite.Text.Trim(); dc.FacebookLink = txtFacebookLink.Text.Trim(); if (Session["ImageLogo"] != null) { dc.Logo = Session["ImageLogo"].ToString(); } else { dc.Logo = ""; } if (Session["ImageMap"] != null) { dc.LocationMap = Session["ImageMap"].ToString(); } else { dc.LocationMap = ""; } try { dc.InstallationDate = DateTime.Parse(installationDate.SelectedDate.ToString()); } catch { dc.InstallationDate = nullDate; } //try //{ // dc.InstallationTime = DateTime.Parse(installationTime.SelectedDate.ToString()); //} //catch { dc.InstallationTime = nullDate; } try { dc.InstallationTime = rbtnTime.SelectedItem.Text.ToString(); } catch { dc.InstallationTime = ""; } dc.InstallationChiefGuest = txtChiefGuest.Text.Trim(); dc.InstallationVenue = txtInstallationVenue.Text.Trim(); try { dc.OcvDate = DateTime.Parse(ocvDate.SelectedDate.ToString()); } catch { dc.OcvDate = nullDate; } try { dc.OcvTime = DateTime.Parse(ocvTime.SelectedDate.ToString()); } catch { dc.OcvTime = nullDate; } try { dc.Phf = int.Parse(txtPHF.Text.Trim()); } //catch { dc.Phf = nullInt.Value; } catch { dc.Phf = 0; } try { dc.Trfsm = int.Parse(txtTRFSM.Text.Trim()); } catch { dc.Trfsm = 0; } try { dc.Md = int.Parse(txtMD.Text.Trim()); } catch { dc.Md = 0; } try { dc.Phsm = int.Parse(txtPHSM.Text.Trim()); } catch { dc.Phsm = 0; } try { dc.ArchKlump = int.Parse(txtArchKlump.Text.Trim()); } catch { dc.ArchKlump = 0; } dc.DS = DDLMem1.SelectedItem.Text.Trim(); dc.AG = DDLMem2.SelectedItem.Text.Trim(); dc.AT = DDLMem3.SelectedItem.Text.Trim(); dc.GC = DDLMem4.SelectedItem.Text.Trim(); dc.ClubTrfStatus = rbtnClubTrfStatus.SelectedItem.Text.Trim(); dc.FlagshipText = txtFlagshipProject.Text.Trim(); if (Session["FlagshipImg"] != null) { dc.FlagshipImage = Session["FlagshipImg"].ToString(); } else { dc.FlagshipImage = ""; } int exe = dc.AddClub(); if (exe > 0) { int pid = GetClubId(); UpdateIWClubId(pid); clear(); string jv = "<script>alert('Record Added Successfully');</script>"; ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "alert", jv, false); } } }
protected void btnSendDistrictDirectoryData_Click(object sender, EventArgs e) { int clubId = 0; string email = "-"; string clubName = "-"; string clubNo = "-"; string charterDate = "-"; string mettingDay = "-"; string strMeetingTime = "-"; string venue = "-"; string ds = "-"; string at = "-"; string ag = "-"; string flagshipText = "-"; string strFlagship = ""; int members = 0; int womenMembers = 0; int iw, rotract, interact, srCitizen, rcc = 0; foreach (GridDataItem item in RadGrid1.MasterTableView.Items) { try { CheckBox chkbox = (CheckBox)item.FindControl("chkActive"); Label lblClubId = (Label)item.FindControl("lblClubId"); Label lblEmail = (Label)item.FindControl("lblEmail"); if (chkbox.Checked) { clubId = Int32.Parse(lblClubId.Text.ToString()); //GetClubDetails(clubId); iw = GetIw(clubId); rotract = GetRotaract(clubId); interact = GetInteract(clubId); srCitizen = GetSrCitizen(clubId); rcc = GetRcc(clubId); //GetBodDetails(clubId); BindGridview(clubId); BindPresident(clubId); BindSecretary(clubId); DataTable dt = new DataTable(); DBconnection obj = new DBconnection(); obj.SetCommandSP = "z_GetMaleFemaleMembersByClubId"; obj.AddParam("@club_id", clubId); dt = obj.ExecuteTable(); if (dt.Rows.Count > 0) { members = int.Parse(dt.Rows[0]["Total"].ToString()); womenMembers = int.Parse(dt.Rows[0]["WomenMembers"].ToString()); } try { DistrictClub obj1 = new DistrictClub(); obj1.Id = clubId; DataTable dt1 = new DataTable(); dt1 = obj1.GetClubById(); if (dt1.Rows.Count > 0) { // Club Details clubName = dt1.Rows[0]["club_name"].ToString(); clubNo = dt1.Rows[0]["ri_club_No"].ToString(); DateTime chrterdate = DateTime.Parse(dt1.Rows[0]["charter_date"].ToString()); charterDate = chrterdate.ToString("dd-MMMM-yyyy"); mettingDay = dt1.Rows[0]["meeting_day"].ToString(); try { DateTime meetingTime = DateTime.Parse(dt1.Rows[0]["meeting_time"].ToString()); strMeetingTime = meetingTime.ToString("hh:mm tt"); } catch { strMeetingTime = "-"; } venue = dt1.Rows[0]["venue1"].ToString() + " " + dt1.Rows[0]["venue2"].ToString() + " " + dt1.Rows[0]["city"].ToString(); ds = dt1.Rows[0]["ds"].ToString(); at = dt1.Rows[0]["at"].ToString(); ag = dt1.Rows[0]["ag"].ToString(); flagshipText = dt1.Rows[0]["flagship_text"].ToString(); strFlagship = dt1.Rows[0]["flagship_image"].ToString(); //if (strFlagship != "") //{ // imgFlagship.Visible = true; // imgFlagship.ImageUrl = "../ClubsLogo/" + strFlagship; //} //else //{ // imgFlagship.Visible = false; //} } } catch { } email = lblEmail.Text.ToString(); if (email != "") { try { SendMailtoDistDirectory(email, clubId, clubName, clubNo, charterDate, members, womenMembers, iw, rotract, interact, srCitizen, rcc, venue, mettingDay, strMeetingTime, ds, at, ag, flagshipText, strFlagship); } catch { } } } chkbox.Checked = false; } catch { } } }