private void SetTitle(Guid providerID) { CustomerDAC dac = new CustomerDAC(); if (dac.IsUserImageExist(providerID)) { divWithImage.Visible = true; divNoImage.Visible = false; int ImageID = new CustomerBFC().getProviderPrimaryImage(providerID); if (ImageID != 0) { ProviderImage.ImageUrl = "~/ImageHandler.ashx?" + SystemConstants.qs_UserImageID + "=" + ImageID; } else { divWithImage.Visible = false; divNoImage.Visible = true; } } else { divWithImage.Visible = false; divNoImage.Visible = true; } }
private bool AuthUser() { if (Membership.GetUser() != null) { var providerID = new Guid(Membership.GetUser().ProviderUserKey.ToString()); var ownerLogin = new CustomerBFC().CheckActivityOwner(ActivityID, providerID); return(ownerLogin); } else { Response.Redirect("~/Account/Login.aspx"); return(false); } }
protected void CreatedUser(Guid userID) { CustomerBFC bfc = new CustomerBFC(); CustomerDAC dac = new CustomerDAC(); CustomerEDSC.UserProfilesDTRow dr = GetRegistrationData(); dr.UserID = userID; dac.InsertNewUserProfiles(dr); CustomerEDSC.UserRewardDTRow drr = GetRewardData(); drr.UserID = userID; dac.InsertNewRewardUser(drr); var drRef = new CustomerEDSC.UserReferenceDTDataTable().NewUserReferenceDTRow(); drRef.UserID = userID; drRef.ReferenceID = bfc.GenerateUserRefID(dr.LastName, dr.FirstName); dac.insertNewUserReference(drRef); }
protected void ListViewActivities_ItemDataBound(object sender, ListViewItemEventArgs e) { actNo++; Label lblNo = e.Item.FindControl("lblNo") as Label; Label lblPhone = e.Item.FindControl("lblPhone") as Label; Label lblSub = e.Item.FindControl("lblSub") as Label; Label lblAddress = e.Item.FindControl("lblAddress") as Label; Label lblState = e.Item.FindControl("lblState") as Label; Label lblPostCode = e.Item.FindControl("lblPostCode") as Label; Label lblShortDescription = e.Item.FindControl("lblShortDescription") as Label; Label lblSaved = e.Item.FindControl("lblSaved") as Label; HyperLink HlnkReadMore = e.Item.FindControl("HlnkReadMore") as HyperLink; HyperLink HlnkActivitiesName = e.Item.FindControl("HlnkActivitiesName") as HyperLink; HiddenField hdnProviderID = e.Item.FindControl("hdnProviderID") as HiddenField; HiddenField hdnActivityID = e.Item.FindControl("hdnActivityID") as HiddenField; HiddenField hdnisSaved = e.Item.FindControl("hdnisSaved") as HiddenField; LinkButton lnkSaved = e.Item.FindControl("lnkSaved") as LinkButton; System.Web.UI.WebControls.Image imgPreview = e.Item.FindControl("imgPreview") as System.Web.UI.WebControls.Image; string actName = HlnkActivitiesName.Text; actName = actName.Replace(" ", "-"); actName = actName.Replace("/", "-or-"); if (actName.EndsWith(".")) { actName.TrimEnd('.'); } HlnkActivitiesName.NavigateUrl = HlnkReadMore.NavigateUrl = "~/Activity/" + hdnActivityID.Value + "/" + actName; //lblPhone.Text = "Tel: " + lblPhone.Text; HtmlGenericControl divDescription = e.Item.FindControl("divDescription") as HtmlGenericControl; if (Regex.IsMatch(lblShortDescription.Text, @"([a-zA-Z]){20,}")) { divDescription.Attributes.Add("class", "breaking"); } TimeViewer ScheduleViewerUC1 = e.Item.FindControl("ScheduleViewerUC") as TimeViewer; ScheduleViewerUC1.ActivityID = Convert.ToInt32(hdnActivityID.Value); ScheduleViewerUC1.timetableFormat = (int)SystemConstants.TimetableFormat.Seasonal; if (string.IsNullOrEmpty(lblSub.Text)) { lblAddress.Visible = false; lblSub.Visible = false; lblState.Visible = false; lblPostCode.Visible = false; } lblSub.Text = lblSub.Text + ", "; //lblNo.Text = actNo.ToString() + "."; HiddenField hdnExpiryDate = e.Item.FindControl("hdnExpiryDate") as HiddenField; HiddenField hdnType = e.Item.FindControl("hdnType") as HiddenField; System.Web.UI.WebControls.Image imgStatus = e.Item.FindControl("imgStatus") as System.Web.UI.WebControls.Image; System.Web.UI.WebControls.Image imgCostIcon = e.Item.FindControl("imgCostIcon") as System.Web.UI.WebControls.Image; //Label lblType = e.Item.FindControl("lblType") as Label; //lblType.ForeColor = Color.Green; if (hdnType.Value == ((int)SystemConstants.ActivityFeeCategory.Private_Free).ToString() || hdnType.Value == ((int)SystemConstants.ActivityFeeCategory.Public_Free).ToString()) { //lblType.Text = "Free Activity"; //lblType.ForeColor = Color.Green; ; imgCostIcon.ImageUrl = "~/Content/StyleImages/free.png"; imgCostIcon.ToolTip = "This activity is free"; } else if (hdnType.Value == ((int)SystemConstants.ActivityFeeCategory.Private_Paid).ToString() || hdnType.Value == ((int)SystemConstants.ActivityFeeCategory.Public_Paid).ToString()) { imgCostIcon.ToolTip = "This activity has a fee"; imgCostIcon.ImageUrl = "~/Content/StyleImages/Paid.png"; } var dr = new CustomerDAC().RetrieveActivityPrimaryImage(Convert.ToInt32(hdnActivityID.Value)); if (dr != null && dr.ImageStream != null) { //imgPreview.ImageUrl = "data:image/jpeg;base64," + Convert.ToBase64String(dr.ImageStream); Convert byte directly, while its easier, its not suppose to be imgPreview.ImageUrl = "~/ImageHandler.ashx?" + SystemConstants.qs_ThumbImageID + "=" + dr.ID; } else { if (new CustomerDAC().IsUserImageExist(new Guid(hdnProviderID.Value))) { int ImageID = new CustomerBFC().getProviderPrimaryImage(new Guid(hdnProviderID.Value)); if (ImageID != 0) { imgPreview.ImageUrl = "~/ImageHandler.ashx?" + SystemConstants.qs_UserImageID + "=" + ImageID; } else { imgPreview.Visible = false; } } } if (WebSecurity.IsAuthenticated) { if (SavedList.Equals(string.Empty)) { hdnisSaved.Value = false.ToString(); lblSaved.Text = "Save Activity"; lnkSaved.Attributes.Add("Class", "btn-icon btn-white btn-radius btn-star"); } else { List <string> SavedactList = SavedList.Split('|').ToList(); if (SavedactList.Contains(hdnActivityID.Value)) { hdnisSaved.Value = true.ToString(); lblSaved.Text = "Saved"; lnkSaved.Attributes.Add("Class", "btn-icon btn-white btn-radius btn-starred"); } else { hdnisSaved.Value = false.ToString(); lblSaved.Text = "Save Activity"; lnkSaved.Attributes.Add("Class", "btn-icon btn-white btn-radius btn-star btn-star"); } } lnkSaved.Attributes.Add("OnClick", "ToggleSave(" + hdnActivityID.Value + "," + lnkSaved.ClientID + "," + hdnisSaved.Value + ");"); RetrieveSavedList(); } else { lnkSaved.Visible = false; } }
public void Refresh() { ddSort.SelectedValue = SortValue; lblKeyword.Visible = false; if (SearchKey != null) { String SearchPhrase = new CustomerBFC().RefineSearchKeyreward(SearchKey); SetDataSourcebySearchKey(SearchPhrase); lblAmount.Text = new CustomerDAC().RetrieveAdminRewardsbySearchPhraseCount(ProviderID, AgeFrom, AgeTo, RewardType, CategoryID, SearchPhrase).ToString(); if (Convert.ToInt32(lblAmount.Text) <= Convert.ToInt32(PageSize + StartRow)) { lblEndIndex.Text = lblAmount.Text; } else { lblEndIndex.Text = (StartRow + PageSize).ToString(); } lblStartIndex.Text = (StartRow + 1).ToString(); if (Convert.ToInt32(lblStartIndex.Text) >= Convert.ToInt32(lblEndIndex.Text)) { lblStartIndex.Text = lblEndIndex.Text; } lblEndIndex1.Text = lblEndIndex.Text; lblStartIndex1.Text = lblStartIndex.Text; lblAmount1.Text = lblAmount.Text; lblKeyword.Visible = true; if (lblAmount.Text == "0") { //lblKeyword.Text = "Search Found " + lblAmount.Text + " Record with keyword '" + SearchKey + "'"; //else //{ divPager.Visible = false; //lblKeyword.Text = "there are no records with keyword '" + SearchKey + "'"; } } else { SetDataSourcebyProviderCategory(); int amount = new CustomerDAC().RetrieveAdminRewardsCount(ProviderID, AgeFrom, AgeTo, RewardType, CategoryID); lblAmount.Text = amount.ToString(); if (Convert.ToInt32(lblAmount.Text) <= Convert.ToInt32(PageSize + StartRow)) { lblEndIndex.Text = lblAmount.Text; } else { lblEndIndex.Text = (StartRow + PageSize).ToString(); } lblStartIndex.Text = (StartRow + 1).ToString(); if (Convert.ToInt32(lblStartIndex.Text) >= Convert.ToInt32(lblEndIndex.Text)) { lblStartIndex.Text = lblEndIndex.Text; } lblEndIndex1.Text = lblEndIndex.Text; lblStartIndex1.Text = lblStartIndex.Text; lblAmount1.Text = lblAmount.Text; if (amount == 0) { ItemCountBottom.Visible = false; } else { if (amount <= PageSize) { divPager.Visible = false; ItemCountBottom.Visible = true; } else { divPager.Visible = ItemCountBottom.Visible = true; } } } }
internal void Refresh() { ddSort.SelectedValue = SortValue; lblKeyword.Visible = false; String query = ""; if (SearchKey != null) { List <String> parameters = new CustomerBFC().RefineSearchKey(SearchKey); foreach (var parameter in parameters) { if (!string.IsNullOrEmpty(parameter)) { if (parameter.StartsWith(SystemConstants.Query)) { query = parameter.Replace(SystemConstants.Query, string.Empty); } else if (parameter.StartsWith(SystemConstants.Location)) { String[] locs = parameter.Replace(SystemConstants.Location, string.Empty).ToUpper().Split(';'); var subDT = new CustomerDAC().RetrieveSuburbs(); var suburbs = subDT.Where(x => locs.Contains(x.Name.ToUpper())); foreach (var sub in suburbs) { if (String.IsNullOrEmpty(SuburbID)) { SuburbID = sub.ID.ToString(); } else { SuburbID += "|" + sub.ID.ToString(); } } } else if (parameter.StartsWith(SystemConstants.Day)) { MonFilter = TueFilter = WedFilter = ThursFilter = FriFilter = SatFilter = SunFilter = false; string[] days = parameter.Replace(SystemConstants.Day, string.Empty).Split(';'); foreach (var day in days) { if (day.ToUpper().Equals(DayOfWeek.Monday.ToString().ToUpper())) { MonFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Tuesday.ToString().ToUpper())) { TueFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Wednesday.ToString().ToUpper())) { WedFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Thursday.ToString().ToUpper())) { ThursFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Friday.ToString().ToUpper())) { FriFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Saturday.ToString().ToUpper())) { SatFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Sunday.ToString().ToUpper())) { SunFilter = true; } } } else if (parameter.StartsWith(SystemConstants.Time)) { string[] times = parameter.Replace(SystemConstants.Time, string.Empty).Split('-'); if (times.Length == 2) { dtFrom = Convert.ToDateTime(SystemConstants.nodate.ToShortDateString() + " " + Convert.ToDateTime(times[0]).ToShortTimeString()); dtTo = Convert.ToDateTime(SystemConstants.nodate.ToShortDateString() + " " + Convert.ToDateTime(times[1]).ToShortTimeString()); } else if (times.Length == 1) { dtFrom = Convert.ToDateTime(SystemConstants.nodate.ToShortDateString() + " " + Convert.ToDateTime(times[0]).ToShortTimeString()); } } } } } if (!string.IsNullOrEmpty(query)) { Stopwatch sw = Stopwatch.StartNew(); SetDataSourceFromSearchKey(query); lblAmount.Text = new CustomerDAC().RetrieveProviderActivitiesbySearchPhraseCount(ProviderID, dtFrom.ToString(), dtTo.ToString(), tmFrom.ToString(), tmTo.ToString(), AgeFrom, AgeTo, SuburbID, CategoryID, query, MonFilter.ToString(), TueFilter.ToString(), WedFilter.ToString(), ThursFilter.ToString(), FriFilter.ToString(), SatFilter.ToString(), SunFilter.ToString()).ToString(); if (Convert.ToInt32(lblAmount.Text) <= Convert.ToInt32(PageSize + StartRow)) { lblEndIndex.Text = lblAmount.Text; } else { lblEndIndex.Text = (StartRow + PageSize).ToString(); } lblStartIndex.Text = (StartRow + 1).ToString(); if (Convert.ToInt32(lblStartIndex.Text) >= Convert.ToInt32(lblEndIndex.Text)) { lblStartIndex.Text = lblEndIndex.Text; } lblEndIndex1.Text = lblEndIndex.Text; lblStartIndex1.Text = lblStartIndex.Text; lblAmount1.Text = lblAmount.Text; lblKeyword.Visible = true; if (lblAmount.Text != "0") { // lblKeyword.Text = "Search Found " + lblAmount.Text + " Record with keyword '" + SearchKey + "'"; // else //{ //lblKeyword.Text = "there are no records with keyword '" + SearchKey + "'"; } TimeSpan elapsed = sw.Elapsed; hdnTimespan.Value = elapsed.ToString(); } else { SetDataSourceFromCategoryProvider(); lblAmount.Text = new CustomerDAC().RetrieveProviderActivitiesCount(ProviderID, dtFrom.ToString(), dtTo.ToString(), tmFrom.ToString(), tmTo.ToString(), AgeFrom, AgeTo, SuburbID, CategoryID, MonFilter.ToString(), TueFilter.ToString(), WedFilter.ToString(), ThursFilter.ToString(), FriFilter.ToString(), SatFilter.ToString(), SunFilter.ToString()).ToString(); if (Convert.ToInt32(lblAmount.Text) <= Convert.ToInt32(PageSize + StartRow)) { lblEndIndex.Text = lblAmount.Text; } else { lblEndIndex.Text = (StartRow + PageSize).ToString(); } lblStartIndex.Text = (StartRow + 1).ToString(); if (Convert.ToInt32(lblStartIndex.Text) >= Convert.ToInt32(lblEndIndex.Text)) { lblStartIndex.Text = lblEndIndex.Text; } lblEndIndex1.Text = lblEndIndex.Text; lblStartIndex1.Text = lblStartIndex.Text; lblAmount1.Text = lblAmount.Text; } if (GridViewActivities.HeaderRow != null) { GridViewActivities.HeaderRow.TableSection = TableRowSection.TableHeader; } }
public void Refresh() { ddSort.SelectedValue = SortValue; lblKeyword.Visible = false; if (PageSize == 8 || PageSize == 16) { PageSize = 10; } /* if (SearchKey != null) * { * String SearchPhrases = new CustomerBFC().RefineSearchKeyreward(SearchKey); * string query = ""; * foreach (var phrase in SearchPhrases) * { * if (query.StartsWith(SystemConstants.Query)) * { * query = phrase; * query = query.Replace(SystemConstants.Query, string.Empty); * } * } * SetDataSourcebySearchKey(query);*/ if (SearchKey != null) { String SearchPhrase = new CustomerBFC().RefineSearchKeyreward(SearchKey); SetDataSourcebySearchKey(SearchPhrase); int amount = new CustomerDAC().RetrieveAdminRewardsbySearchPhraseCount(ProviderID, AgeFrom, AgeTo, RewardType, CategoryID, SearchPhrase); lblAmount.Text = amount.ToString(); if (Convert.ToInt32(lblAmount.Text) <= Convert.ToInt32(PageSize + StartRow)) { lblEndIndex.Text = lblAmount.Text; } else { lblEndIndex.Text = (StartRow + PageSize).ToString(); } lblStartIndex.Text = (StartRow + 1).ToString(); if (Convert.ToInt32(lblStartIndex.Text) >= Convert.ToInt32(lblEndIndex.Text)) { lblStartIndex.Text = lblEndIndex.Text; } lblEndIndex1.Text = lblEndIndex.Text; lblStartIndex1.Text = lblStartIndex.Text; lblAmount1.Text = lblAmount.Text; lblKeyword.Visible = true; if (lblAmount.Text == "0") { //lblKeyword.Text = "Search Found " + lblAmount.Text + " Record with keyword '" + SearchKey + "'"; //else //{ divPager.Visible = false; //lblKeyword.Text = "there are no records with keyword '" + SearchKey + "'"; } } else { SetDataSourcebyProviderCategory(); int amount = new CustomerDAC().RetrieveAdminRewardsCount(ProviderID, AgeFrom, AgeTo, RewardType, CategoryID); lblAmount.Text = amount.ToString(); if (Convert.ToInt32(lblAmount.Text) <= Convert.ToInt32(PageSize + StartRow)) { lblEndIndex.Text = lblAmount.Text; } else { lblEndIndex.Text = (StartRow + PageSize).ToString(); } lblStartIndex.Text = (StartRow + 1).ToString(); if (Convert.ToInt32(lblStartIndex.Text) >= Convert.ToInt32(lblEndIndex.Text)) { lblStartIndex.Text = lblEndIndex.Text; } lblEndIndex1.Text = lblEndIndex.Text; lblStartIndex1.Text = lblStartIndex.Text; lblAmount1.Text = lblAmount.Text; if (amount == 0) { ItemCountBottom.Visible = false; } else { if (amount <= PageSize) { divPager.Visible = false; ItemCountBottom.Visible = true; } else { divPager.Visible = ItemCountBottom.Visible = true; } } } }
public void Refresh() { if (WebSecurity.IsAuthenticated) { RetrieveSavedList(); } ddSort.SelectedValue = SortValue; lblKeyword.Visible = false; String query = ""; Stopwatch sw = new Stopwatch(); sw.Start(); if (!string.IsNullOrEmpty(SearchKey)) { List <String> parameters = new CustomerBFC().RefineSearchKey(SearchKey); foreach (var parameter in parameters) { if (!string.IsNullOrEmpty(parameter)) { if (parameter.StartsWith(SystemConstants.Query)) { query = parameter.Replace(SystemConstants.Query, string.Empty); } else if (parameter.StartsWith(SystemConstants.Location)) { String[] locs = parameter.Replace(SystemConstants.Location, string.Empty).ToUpper().Split(';'); var subDT = new CustomerDAC().RetrieveSuburbs(); var suburbs = subDT.Where(x => locs.Contains(x.Name.ToUpper())); foreach (var sub in suburbs) { if (String.IsNullOrEmpty(SuburbID)) { SuburbID = sub.ID.ToString(); } else { SuburbID += "|" + sub.ID.ToString(); } } } else if (parameter.StartsWith(SystemConstants.Day)) { MonFilter = TueFilter = WedFilter = ThursFilter = FriFilter = SatFilter = SunFilter = false; string[] days = parameter.Replace(SystemConstants.Day, string.Empty).Split(';'); foreach (var day in days) { if (day.ToUpper().Equals(DayOfWeek.Monday.ToString().ToUpper())) { MonFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Tuesday.ToString().ToUpper())) { TueFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Wednesday.ToString().ToUpper())) { WedFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Thursday.ToString().ToUpper())) { ThursFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Friday.ToString().ToUpper())) { FriFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Saturday.ToString().ToUpper())) { SatFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Sunday.ToString().ToUpper())) { SunFilter = true; } } } else if (parameter.StartsWith(SystemConstants.Time)) { string[] times = parameter.Replace(SystemConstants.Time, string.Empty).Split('-'); if (times.Length == 2) { dtFrom = Convert.ToDateTime(SystemConstants.nodate.ToShortDateString() + " " + Convert.ToDateTime(times[0]).ToShortTimeString()); dtTo = Convert.ToDateTime(SystemConstants.nodate.ToShortDateString() + " " + Convert.ToDateTime(times[1]).ToShortTimeString()); } else if (times.Length == 1) { dtFrom = Convert.ToDateTime(SystemConstants.nodate.ToShortDateString() + " " + Convert.ToDateTime(times[0]).ToShortTimeString()); } } } } } TimeSpan time = sw.Elapsed; sw.Restart(); lbltimerefine.Text = time.ToString(); if (!string.IsNullOrEmpty(query)) { SetDataSourcebySearchKey(query); int amount = new CustomerDAC().RetrieveProviderActivitiesbySearchPhraseCount(ProviderID, dtFrom.ToString(), dtTo.ToString(), tmFrom.ToString(), tmTo.ToString(), AgeFrom, AgeTo, SuburbID, CategoryID, query, MonFilter.ToString(), TueFilter.ToString(), WedFilter.ToString(), ThursFilter.ToString(), FriFilter.ToString(), SatFilter.ToString(), SunFilter.ToString()); lblAmount.Text = amount.ToString(); if (Convert.ToInt32(lblAmount.Text) <= Convert.ToInt32(PageSize + StartRow)) { lblEndIndex.Text = lblAmount.Text; } else { lblEndIndex.Text = (StartRow + PageSize).ToString(); } lblStartIndex.Text = (StartRow + 1).ToString(); if (Convert.ToInt32(lblStartIndex.Text) >= Convert.ToInt32(lblEndIndex.Text)) { lblStartIndex.Text = lblEndIndex.Text; } lblEndIndex1.Text = lblEndIndex.Text; lblStartIndex1.Text = lblStartIndex.Text; lblAmount1.Text = lblAmount.Text; lblKeyword.Visible = true; if (amount == 0) { ItemCountBottom.Visible = false; } else { if (amount <= PageSize) { divPager.Visible = false; ItemCountBottom.Visible = true; } else { divPager.Visible = ItemCountBottom.Visible = true; } } TimeSpan time1 = sw.Elapsed; lblshowres.Text = hdnTimespan.Value = "Set list by searchprovcat: " + time1.ToString(); } else { SetDataSourcebyProviderCategory(); int amount = new CustomerDAC().RetrieveProviderActivitiesCount(ProviderID, dtFrom.ToString(), dtTo.ToString(), tmFrom.ToString(), tmTo.ToString(), AgeFrom, AgeTo, SuburbID, CategoryID, MonFilter.ToString(), TueFilter.ToString(), WedFilter.ToString(), ThursFilter.ToString(), FriFilter.ToString() , SatFilter.ToString(), SunFilter.ToString()); lblAmount.Text = amount.ToString(); if (Convert.ToInt32(lblAmount.Text) <= Convert.ToInt32(PageSize + StartRow)) { lblEndIndex.Text = lblAmount.Text; } else { lblEndIndex.Text = (StartRow + PageSize).ToString(); } lblStartIndex.Text = (StartRow + 1).ToString(); if (Convert.ToInt32(lblStartIndex.Text) >= Convert.ToInt32(lblEndIndex.Text)) { lblStartIndex.Text = lblEndIndex.Text; } lblEndIndex1.Text = lblEndIndex.Text; lblStartIndex1.Text = lblStartIndex.Text; lblAmount1.Text = lblAmount.Text; if (amount == 0) { ItemCountBottom.Visible = false; } else { if (amount <= PageSize) { divPager.Visible = false; ItemCountBottom.Visible = true; } else { divPager.Visible = ItemCountBottom.Visible = true; } } TimeSpan time1 = sw.Elapsed; lblshowres.Text = hdnTimespan.Value = "Set list byprovcat: " + time1.ToString(); } }