protected void btnSavePost_Click(object sender, EventArgs e) { try { int iFileID = 0; int.TryParse(Request["FileID"], out iFileID); BSPost bsPost = BSPost.GetPost(iFileID); bsPost.Content = tmceContent.Content; bsPost.State = (PostStates)Convert.ToInt16(ddState.SelectedValue); bsPost.AddComment = cblAddComment.Checked; bsPost.UpdateDate = DateTime.Now; Categories1.SaveData(bsPost.PostID); Tags1.SaveTags(bsPost.PostID); if (bsPost.Save()) { Response.Redirect("Library.aspx?FileID=" + bsPost.PostID + "&Message=1"); } else { MessageBox1.Message = "Error"; MessageBox1.Type = MessageBox.ShowType.Error; } } catch (Exception ex) { MessageBox1.Message = ex.Message; MessageBox1.Type = MessageBox.ShowType.Error; } }
protected void Page_Load(object sender, EventArgs e) { btnDelete.OnClientClick = "return confirm('" + Language.Admin["CategoryDeleteConfirm"] + "');"; HideAll(); int iFileID = 0; int.TryParse(Request["FileID"], out iFileID); if (!string.IsNullOrEmpty(Request["p"]) && Request["p"].Equals("new")) { divAddMedia.Visible = true; } else if (iFileID != 0) { divEditMedia.Visible = true; divEditMediaSide.Visible = true; divEditMedia.Visible = true; divEditMediaSide.Visible = true; if (!IsPostBack) { BSPost bsPost = BSPost.GetPost(iFileID); if (bsPost != null) { tmceContent.Content = bsPost.Content; txtTitle.Text = bsPost.Title; cblAddComment.Checked = bsPost.AddComment; ddState.SelectedValue = bsPost.State.ToString(); Categories1.TermType = TermTypes.Category; Categories1.LoadData(bsPost.PostID); Tags1.LoadTags(bsPost.PostID); ddState.Items[0].Text = Language.Admin["HiddenFile"]; ddState.Items[1].Text = Language.Admin["PublicFile"]; cblAddComment.Text = Language.Admin["CommentAdd"]; string strFolder = bsPost.Show == PostVisibleTypes.Hidden ? "Files/" : bsPost.Show == PostVisibleTypes.Public ? "Images/" : "Files/"; ltOpenAddress.Text = "Upload/" + strFolder + bsPost.Title; ltShowAddress.Text = "?FileID=" + bsPost.PostID; ltDownloadAdress.Text = "FileHandler.ashx?FileID=" + bsPost.PostID; } else { Response.Redirect("Library.aspx"); } } } else { if (!IsPostBack) { gvPosts.DataBind(); } divLibrary.Visible = true; } }
private void FixupTags1(Tag previousValue) { // This is the principal end in an association that performs cascade deletes. // Update the event listener to refer to the new dependent. if (previousValue != null) { ChangeTracker.ObjectStateChanging -= previousValue.HandleCascadeDelete; } if (Tags1 != null) { ChangeTracker.ObjectStateChanging += Tags1.HandleCascadeDelete; } if (IsDeserializing) { return; } if (previousValue != null && ReferenceEquals(previousValue.Tag1, this)) { previousValue.Tag1 = null; } if (Tags1 != null) { Tags1.Tag1 = this; } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("Tags1") && (ChangeTracker.OriginalValues["Tags1"] == Tags1)) { ChangeTracker.OriginalValues.Remove("Tags1"); } else { ChangeTracker.RecordOriginalValue("Tags1", previousValue); // This is the principal end of an identifying association, so the dependent must be deleted when the relationship is removed. // If the current state of the dependent is Added, the relationship can be changed without causing the dependent to be deleted. if (previousValue != null && previousValue.ChangeTracker.State != ObjectState.Added) { previousValue.MarkAsDeleted(); } } if (Tags1 != null && !Tags1.ChangeTracker.ChangeTrackingEnabled) { Tags1.StartTracking(); } } }
/// <summary> /// Page Load /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { gvhDefault.SearchButton.Click += new EventHandler(lbSearch_Click); GenerateHeaderButtons(); if (!Page.IsPostBack) { HideAll(); string PostID = Request.QueryString["PostID"]; int iPostID = 0; int.TryParse(PostID, out iPostID); if (iPostID > 0) { BSPost bsPost = BSPost.GetPost(iPostID); divAddPost.Visible = true; divAddPostSide.Visible = true; if (bsPost != null) { tmceContent.Content = bsPost.Content; txtTitle.Text = bsPost.Title; cblAddComment.Checked = bsPost.AddComment; ddState.SelectedValue = bsPost.State.ToString(); Categories1.TermType = TermTypes.Category; Categories1.LoadData(bsPost.PostID); Tags1.LoadTags(bsPost.PostID); rblDate.Items[0].Text = Language.Admin["NowPublish"]; rblDate.Items[1].Text = Language.Admin["ChangeDateTime"]; dtsDateTime.SelectedDateTime = bsPost.Date; } else { Response.Redirect("Posts.aspx"); } } else { divPosts.Visible = true; gvPosts.DataBind(); } } }
/// <summary> /// Save Post(s) click action. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSavePost_Click(object sender, EventArgs e) { try { string PostID = Request.QueryString["PostID"]; int iPostID = 0; int.TryParse(PostID, out iPostID); BSPost bsPost = BSPost.GetPost(iPostID); bsPost.Title = txtTitle.Text; bsPost.Code = BSHelper.CreateCode(txtTitle.Text); bsPost.Content = tmceContent.Content; bsPost.State = (PostStates)Convert.ToInt16(ddState.SelectedValue); bsPost.AddComment = cblAddComment.Checked; bsPost.UpdateDate = DateTime.Now; if (rblDate.SelectedValue == "1") { bsPost.Date = dtsDateTime.SelectedDateTime; } Categories1.SaveData(bsPost.PostID); Tags1.SaveTags(bsPost.PostID); if (bsPost.Save()) { Response.Redirect("Posts.aspx?PostID=" + PostID + "&Message=1"); } else { MessageBox1.Message = Language.Admin["PostError"]; MessageBox1.Type = MessageBox.ShowType.Error; } } catch (Exception ex) { MessageBox1.Message = ex.Message; MessageBox1.Type = MessageBox.ShowType.Error; } }
public override string ToString() { string strUserID = "XX"; if (UserIDLogedIn.HasValue && UserIDLogedIn.Value != Constants.ANONYMOUS_USERID.ToGuid()) { strUserID = string.Concat("X", UserIDLogedIn); } System.Text.StringBuilder sb = new System.Text.StringBuilder(string.Format("OT{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}", (int)ObjectType, strUserID, (int)SortBy, CommunityID, UserID, TagID, (int)Direction, (int)QuerySourceType)); if (SortBySecond != QuickSort.NotSorted) { sb.AppendFormat("-SS{0}_{1}", (int)SortBySecond, (int)DirectionSecond); } if (Featured != null) { sb.AppendFormat("-B{0}", Featured.Value); } if (WithCopy != null) { sb.AppendFormat("-C{0}", WithCopy.Value ? "1" : "0"); } if (ObjectStatus != null) { sb.AppendFormat("-D1{0}", (int)ObjectStatus.Value); } if (ShowState != null) { sb.AppendFormat("-D2{0}", (int)ShowState.Value); } if (FromInserted != null) { sb.AppendFormat("-E{0}", FromInserted.Value.Date.Ticks); } if (ToInserted != null) { sb.AppendFormat("-F{0}", ToInserted.Value.Date.Ticks); } if (FromStartDate != null) { sb.AppendFormat("-G1{0}", FromStartDate.Value.Date.Ticks); } if (ToStartDate != null) { sb.AppendFormat("-G2{0}", ToStartDate.Value.Date.Ticks); } if (FromEndDate != null) { sb.AppendFormat("-H1{0}", FromEndDate.Value.Date.Ticks); } if (ToEndDate != null) { sb.AppendFormat("-H2{0}", ToEndDate.Value.Date.Ticks); } if (DateQueryMethode != null) { sb.AppendFormat("-I{0}", (int)DateQueryMethode.Value); } if (!string.IsNullOrEmpty(Country)) { sb.AppendFormat("-J{0}", Country.ToLower()); } if (!string.IsNullOrEmpty(Zip)) { sb.AppendFormat("-K{0}", Zip.ToLower()); } if (!string.IsNullOrEmpty(City)) { sb.AppendFormat("-L{0}", City.ToLower()); } if (DistanceKm != null && GeoLat != null && GeoLong != null) { sb.AppendFormat("-M{0}({1}{2})", DistanceKm.Value, GeoLat.Value, GeoLong.Value); } if (!string.IsNullOrEmpty(ParentObjectID)) { sb.AppendFormat("-N{0}", ParentObjectID); } if (CheckUserRoleRight) { sb.AppendFormat("-O{0}", UserRole.ToLower()); } if (PageSize > 0 || Amount > 0) { sb.AppendFormat("-P{0}", string.Format("{0}.{1}.{2}", PageNumber, PageSize, Amount)); } if (!string.IsNullOrEmpty(Communities)) { sb.AppendFormat("-R{0}", Communities.ToLower()); } if (!string.IsNullOrEmpty(Tags1)) { sb.AppendFormat("-S1{0}", Tags1.ToLower()); } if (!string.IsNullOrEmpty(RawTags1)) { sb.AppendFormat("-SR1{0}", RawTags1.ToLower()); } if (!string.IsNullOrEmpty(Tags2)) { sb.AppendFormat("-S2{0}", Tags2.ToLower()); } if (!string.IsNullOrEmpty(RawTags2)) { sb.AppendFormat("-SR2{0}", RawTags2.ToLower()); } if (!string.IsNullOrEmpty(Tags3)) { sb.AppendFormat("-S3{0}", Tags3.ToLower()); } if (!string.IsNullOrEmpty(RawTags3)) { sb.AppendFormat("-SR3{0}", RawTags3.ToLower()); } if (!string.IsNullOrEmpty(ObjectTypes)) { sb.AppendFormat("-T{0}", ObjectTypes.ToLower()); } if (GroupID.HasValue) { sb.AppendFormat("-X1{0}", GroupID.Value); } if (CatalogSearchType != DBCatalogSearchType.None) { sb.AppendFormat("-X2{0}", (int)CatalogSearchType); } if (DisablePaging.HasValue) { sb.AppendFormat("-X3{0}", DisablePaging.Value ? "1" : "0"); } if (CurrentObjectID.HasValue) { sb.AppendFormat("-XC4{0}", CurrentObjectID.Value); } if (ObjectID.HasValue) { sb.AppendFormat("-XO4{0}", ObjectID.Value); } if (OnlyConverted.HasValue) { sb.AppendFormat("-X5{0}", OnlyConverted.Value ? "1" : "0"); } if (OnlyWithImage.HasValue) { sb.AppendFormat("-X6{0}", OnlyWithImage.Value ? "1" : "0"); } if (IncludeGroups.HasValue) { sb.AppendFormat("-X7{0}", IncludeGroups.Value ? "1" : "0"); } if (OnlyGeoTagged.HasValue) { sb.AppendFormat("-X8{0}", OnlyGeoTagged.Value ? "1" : "0"); } if (!string.IsNullOrEmpty(nickname)) { sb.AppendFormat("-X9{0}", nickname.ToLower()); } if (!string.IsNullOrEmpty(title)) { sb.AppendFormat("-X10{0}", title.ToLower()); } if (!string.IsNullOrEmpty(description)) { sb.AppendFormat("-X11{0}", description.ToLower()); } if (!string.IsNullOrEmpty(userSearch)) { sb.AppendFormat("-X12{0}", userSearch.ToLower()); } if (!string.IsNullOrEmpty(generalSearch)) { sb.AppendFormat("-X13{0}", generalSearch.ToLower()); } if (!string.IsNullOrEmpty(oTypes)) { sb.AppendFormat("-X14{0}", oTypes.ToLower()); } if (!string.IsNullOrEmpty(cties)) { sb.AppendFormat("-X15{0}", cties.ToLower()); } if (!string.IsNullOrEmpty(titleLeftChar)) { sb.AppendFormat("-X16{0}", titleLeftChar.ToLower()); } if (!string.IsNullOrEmpty(excludeObjectIds)) { sb.AppendFormat("-X17{0}", excludeObjectIds); } if (RelationParams != null) { sb.AppendFormat("-RP{0}", RelationParams.ToString()); } if (MembershipParams != null) { sb.AppendFormat("-MP{0}", MembershipParams.ToString()); } if (ViewLogParams != null) { sb.AppendFormat("-LP{0}", ViewLogParams.ToString()); } //public ViewLogParams ViewLogParams { get; set; } return(sb.ToString()); }
public void Save(int postId) { Categories1.SaveData(postId); Tags1.SaveTags(postId); }
public void ListingSteps() { //click add new // IWebElement ShareSkills = Common.Driver.FindElement(By.CssSelector("div.ui:nth-child(1) section.nav-secondary:nth-child(2) div.ui.eight.item.menu div.right.item:nth-child(5) > a.ui.basic.green.button")); Thread.Sleep(7000); ShareSkills.Click(); Thread.Sleep(8000); Title.SendKeys("Automation Testing"); Description.SendKeys("Tools used in testing and methods followed in handling tools"); Category1.SendKeys("Programming & Tech"); Category2.SendKeys("QA"); Tags1.SendKeys("Selenium"); Tags1.SendKeys(Keys.Enter); Console.WriteLine("Enter pressed for tag1"); ServiceType.Click(); LocationType.Click(); StartDate.SendKeys("17/10/2019"); EndDate.SendKeys("17/4/2020"); ChooseMon.Click(); StartTimeMon.SendKeys("8.30AM"); EndTimeMon.SendKeys("4.30PM"); SkillTrade.Click(); Credit.SendKeys("5"); Active.Click(); Save.Click(); Thread.Sleep(6000); //verification ManagelistingsMenu.Click(); Thread.Sleep(8000); try { Assert.AreEqual("Automation Testing", ActualResult1.Text); Console.WriteLine("Test case 1 PASS: record added succesfully"); } catch (Exception e) { Console.WriteLine(e); } }
public void ListingSteps() { //populate excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "AddSkill"); //click add new // IWebElement ShareSkills = Common.Driver.FindElement(By.CssSelector("div.ui:nth-child(1) section.nav-secondary:nth-child(2) div.ui.eight.item.menu div.right.item:nth-child(5) > a.ui.basic.green.button")); Thread.Sleep(7000); ShareSkills.Click(); Thread.Sleep(8000); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); Category1.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Category1")); Category2.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Category2")); Tags1.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags1")); Tags1.SendKeys(Keys.Enter); Console.WriteLine("Enter pressed for tag1"); ServiceType.Click(); LocationType.Click(); StartDate.SendKeys("17/10/2019"); EndDate.SendKeys("17/04/2020"); ChooseMon.Click(); StartTimeMon.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartTimeMon")); EndTimeMon.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndTimeMon")); SkillTrade.Click(); Credit.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, " Credit")); PlusIcon.Click(); Thread.Sleep(7000); AutoItX3 autoIt = new AutoItX3(); autoIt.WinActivate("Open"); //activate the window, so that next set of action actives n this window Thread.Sleep(5000); autoIt.Send(@"C:\Users\Bhushan\Desktop\Updated - Mars(QA)-CompetitionTask.pdf"); Thread.Sleep(7000); autoIt.Send("{ENTER}"); Active.Click(); Save.Click(); //verify Thread.Sleep(9000); ManagelistingsMenu.Click(); Thread.Sleep(9000); try { Console.WriteLine("Entered try"); Assert.IsTrue(ActualResult1.Text.Contains("Automation testing")); { Console.WriteLine("Test case 1 PASS : Added Record successfully"); Base.test.Log(LogStatus.Info, "Record added"); } ////Screenshot //String img = Global.GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Report"); ////AddScreenCapture(@"E:\Dropbox\VisualStudio\Projects\Beehive\TestReports\ScreenShots\"); //Base.test.Log(LogStatus.Info, "Image example: " + img); //// end test. (Reports) //Base.extent.EndTest(Base.test); //// calling Flush writes everything to the log file (Reports) //Base.extent.Flush(); } catch (Exception e) { Console.WriteLine(e); } }