public Page(Status status) { this.status = status; this.pageStatus = PageStatus.NoChanges; this.isMouseDown = false; this.fileName = string.Empty; this.memory = new Memory(); this.workSpaceDefSize = new Size(300, 400); this.workSpace = new MyPictureBox(); this.workSpace.BackColor = System.Drawing.Color.White; this.workSpace.Location = new System.Drawing.Point(2, 1); this.workSpace.Margin = new System.Windows.Forms.Padding(1); this.workSpace.Name = "WorkSpace"; this.workSpace.Size = workSpaceDefSize; this.workSpace.TabIndex = 0; this.workSpace.TabStop = false; this.workSpace.Cursor = System.Windows.Forms.Cursors.Cross; // events this.workSpace.MouseDown += new MouseEventHandler(this.Page_MouseDown); this.workSpace.MouseMove += new MouseEventHandler(this.Page_MouseMove); this.workSpace.MouseUp += new MouseEventHandler(this.Page_MouseUp); this.workSpace.Paint += new PaintEventHandler(this.Page_Paint); }
public void Open(string path) { memory.Clear(); // openign file fileName = path; Bitmap bm; try { bm = (Bitmap)System.Drawing.Image.FromFile(path, true); } catch (Exception e) { MessageBox.Show(e.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } workSpace.Size = new Size(bm.Width, bm.Height); workSpace.Refresh(); Graphics grPhoto = workSpace.CreateGraphics(); grPhoto.DrawImage(bm, new Rectangle(0, 0, bm.Width, bm.Height), 0, 0, bm.Width, bm.Height, GraphicsUnit.Pixel); grPhoto.Dispose(); memory.Add(new ImageMemoryItem(bm, new Point(0, 0))); pageStatus = PageStatus.NoChanges; }
public BlogPost UpdateBlogPostStatus(int blogPostId, PageStatus updatedStatus) { BlogPost blogPost = new BlogPost(); using (SqlConnection cn = new SqlConnection(Settings.ConnectionString)) { var cmd = new SqlCommand(); cmd.CommandText = "UpdateStatus"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@BlogPostID", blogPostId); cmd.Parameters.AddWithValue("@Status", (int)updatedStatus); cmd.Connection = cn; cn.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { blogPost = PopulateBlogPostFromReader(dr); } } } blogPost.Hashtags = GetHashtagByBlogPostId(blogPost.BlogPostId); return(blogPost); }
public StaticPage UpdateStaticPageStatus(int staticPageId, PageStatus updateStaticPageStatus) { StaticPage staticPage = new StaticPage(); using (SqlConnection cn = new SqlConnection(Settings.ConnectionString)) { var cmd = new SqlCommand(); cmd.CommandText = "UpdateStaticPageStatus"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@StaticPageID", staticPageId); cmd.Parameters.AddWithValue("@Status", (int)updateStaticPageStatus); cmd.Connection = cn; cn.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { staticPage = PopulateStaticPageFromReader(dr); } } } return(staticPage); }
public PageStatus GetByID(int _pageStatusId) { PageStatusDAC _pageStatusComponent = new PageStatusDAC(); IDataReader reader = _pageStatusComponent.GetByIDPageStatus(_pageStatusId); PageStatus _pageStatus = null; while (reader.Read()) { _pageStatus = new PageStatus(); if (reader["PageStatusId"] != DBNull.Value) { _pageStatus.PageStatusId = Convert.ToInt32(reader["PageStatusId"]); } if (reader["Name"] != DBNull.Value) { _pageStatus.Name = Convert.ToString(reader["Name"]); } if (reader["RowGuid"] != DBNull.Value) { _pageStatus.RowGuid = new Guid(reader["RowGuid"].ToString()); } if (reader["ModifiedDate"] != DBNull.Value) { _pageStatus.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]); } _pageStatus.NewRecord = false; } reader.Close(); return(_pageStatus); }
public bool IsSelected(PageStatus pageStatus) { var item = PivotControl.SelectedItem as PivotItem; if (item == UnReadedViewer) { return(pageStatus == PageStatus.UNREAD); } else if (item == ReadedViewer) { return(pageStatus == PageStatus.READ); } else if (item == RecentViewer) { return(pageStatus == PageStatus.RECENT); } else if (item == StarViewer) { return(pageStatus == PageStatus.STAR); } else { return(false); } }
public void New() { memory.Clear(); workSpace.CreateGraphics().Clear(workSpace.BackColor); pageStatus = PageStatus.NoChanges; }
public List <PageStatus> GetAll() { PageStatusDAC _pageStatusComponent = new PageStatusDAC(); IDataReader reader = _pageStatusComponent.GetAllPageStatus().CreateDataReader(); List <PageStatus> _pageStatusList = new List <PageStatus>(); while (reader.Read()) { if (_pageStatusList == null) { _pageStatusList = new List <PageStatus>(); } PageStatus _pageStatus = new PageStatus(); if (reader["PageStatusId"] != DBNull.Value) { _pageStatus.PageStatusId = Convert.ToInt32(reader["PageStatusId"]); } if (reader["Name"] != DBNull.Value) { _pageStatus.Name = Convert.ToString(reader["Name"]); } if (reader["RowGuid"] != DBNull.Value) { _pageStatus.RowGuid = new Guid(reader["RowGuid"].ToString()); } if (reader["ModifiedDate"] != DBNull.Value) { _pageStatus.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]); } _pageStatus.NewRecord = false; _pageStatusList.Add(_pageStatus); } reader.Close(); return(_pageStatusList); }
private async Task OnSelectedPage(PageStatus link) { if (link.Page == PageParam.CurrentPage || !link.Enabled) { return; } PageParam.CurrentPage = link.Page; await SelectedPage.InvokeAsync(link.Page); }
public void ActivatePage(PageStatus status) { if (status == CurrentPageStatus) { return; } FightSabersViewController controller; switch (status) { case PageStatus.Home: controller = BeatSaberUI.CreateViewController <HomePageController>(); ReplaceTopViewController(controller, null, false, ViewController.SlideAnimationDirection.Left); SetLeftScreenViewController(null); SetRightScreenViewController(null); ProvideInitialViewControllers(controller, null, null, bottomController); break; case PageStatus.Skills: controller = BeatSaberUI.CreateViewController <SkillTreePageController>(); ReplaceTopViewController(controller, null, false, ViewController.SlideAnimationDirection.Left); SetLeftScreenViewController(null); SetRightScreenViewController(null); ProvideInitialViewControllers(controller, null, null, bottomController); break; case PageStatus.Profile: controller = BeatSaberUI.CreateViewController <ProfilePageController>(); ReplaceTopViewController(controller, null, false, ViewController.SlideAnimationDirection.Left); SetLeftScreenViewController(null); SetRightScreenViewController(null); ProvideInitialViewControllers(controller, null, null, bottomController); break; case PageStatus.Quests: controller = BeatSaberUI.CreateViewController <QuestPickerPageController>(); ReplaceTopViewController(controller, null, false, ViewController.SlideAnimationDirection.Left); SetRightScreenViewController(null); ProvideInitialViewControllers(controller, null, null, bottomController); SetLeftScreenViewController(BeatSaberUI.CreateViewController <CurrentQuestPageController>(), false); break; case PageStatus.Statistics: controller = BeatSaberUI.CreateViewController <CharacterStatsPageController>(); ReplaceTopViewController(controller, null, false, ViewController.SlideAnimationDirection.Left); ProvideInitialViewControllers(controller, null, null, bottomController); SetLeftScreenViewController(BeatSaberUI.CreateViewController <MonsterInfoPageController>(), false); SetRightScreenViewController(BeatSaberUI.CreateViewController <ModifierStatsPageController>(), false); break; default: throw new ArgumentOutOfRangeException(nameof(status), status, null); } controller.flowCoordinatorOwner = this; CurrentPageStatus = status; }
private void btnHistory_Click(object sender, RoutedEventArgs e) { if (currentPageStatus == PageStatus.HistoryPage) { return; } currentPageStatus = PageStatus.HistoryPage; pageMainTransitionControl.ShowPage(historyPage); }
private void btnSettings_Click(object sender, RoutedEventArgs e) { if (currentPageStatus == PageStatus.SettingPage) { return; } currentPageStatus = PageStatus.SettingPage; pageMainTransitionControl.ShowPage(settingsPage); }
private void btnSmartContract_Click(object sender, RoutedEventArgs e) { if (currentPageStatus == PageStatus.SmartContractPage) { return; } currentPageStatus = PageStatus.SmartContractPage; pageMainTransitionControl.ShowPage(smartContractPage); }
public void GetBeamSMPStatusTest() { try { PageStatus.GetBeamSMPStatus(Machine.Beam.Beam1); } catch (Exception ex) { Assert.Fail("Expected no exception, but got: " + ex.Message); } }
public void GetSMPStatusTest() { try { PageStatus.GetSMPStatus(Machine.Beam.Beam1, Machine.Page1.SMPFlags.Beam_Presence); } catch (Exception ex) { Assert.Fail("Expected no exception, but got: " + ex.Message); } }
public void GetSMPStatusIndividualTest() { try { PageStatus.GetSMPStatusIndividual(Machine.Beam.Beam1, Machine.Page1.SMPFlags.Link_Status_of_Beam_Permits); } catch (Exception ex) { Assert.Fail("Expected no exception, but got: " + ex.Message); } }
private void SceneInit() { _currentOutline = 0; _currentXRay = 0; _pageStatus = PageStatus.PageOne; foreach (Image image in _outlines) { image.color = Color.white; image.DOColor(Color.yellow, .7f).SetLoops(-1); } }
public IEnumerable<Page> Get(PageStatus status) { switch (status) { case PageStatus.All: return _contentManager.Query(PageDriver.ContentType.Name).Join<RoutableRecord>().ForVersion(VersionOptions.Latest).List().AsPart<Page>(); case PageStatus.Published: return _contentManager.Query(PageDriver.ContentType.Name).Join<RoutableRecord>().ForVersion(VersionOptions.Published).List().AsPart<Page>(); case PageStatus.Offline: return _contentManager.Query(PageDriver.ContentType.Name).Join<RoutableRecord>().ForVersion(VersionOptions.Latest).Where<ContentPartVersionRecord>(ci => !ci.ContentItemVersionRecord.Published).List().AsPart<Page>(); default: return Enumerable.Empty<Page>(); } }
public bool Insert(PageStatus pagestatus) { int autonumber = 0; PageStatusDAC pagestatusComponent = new PageStatusDAC(); bool endedSuccessfuly = pagestatusComponent.InsertNewPageStatus(ref autonumber, pagestatus.Name, pagestatus.RowGuid, pagestatus.ModifiedDate); if (endedSuccessfuly) { pagestatus.PageStatusId = autonumber; } return(endedSuccessfuly); }
public void Analyze(float sure, float doubt, ref PageStatus status) { // If the image has been analyzed earlier it has to be reloaded if (ProcessedImage) { LoadImage(); status.Reset(); } // Resizing can only happen as part of RotateAndCrop int resize = (int)((Math.Max(Program.Test.Paper.Dimensions.Pixel.Width, Program.Test.Paper.Dimensions.Pixel.Height) * 150) / Math.Max(ScannedImage.GetLength(0), ScannedImage.GetLength(1))); // Half searchsize must be bigger than calibrationpoint, but not too big (border / other points) => Difficult, depends on how it is scanned (rotation) // After resize the picture is at a standard size ==> fixed searchsize int searchSize = 40; // Midpoints of itemalts ItemAltsLocation = Calibration.RotateAndCrop(Program.Test, ref ScannedImage, ref BarCodeBytes, resize, searchSize); if (ItemAltsLocation[0, 0].X != 0 && ItemAltsLocation[0, 0].Y != 0) { ItemAltsCheckedState = new ItemCheckedState[Program.Test.Paper.Blocks.X, Program.Test.Paper.Blocks.Y]; ObservedBlockSize = new SizeF( (float)ScannedImage.GetLength(0) / Program.Test.Paper.Blocks.X, (float)ScannedImage.GetLength(1) / Program.Test.Paper.Blocks.Y); ColorDistribution = new ColorDistribution(); if (!BarError(BarCodeBytes)) { // BarCodeBytes[0] is page number (0 based) ==> has to be smaller than count // Only BarMatch for first three bytes (first is page number, second and third are hash, rest doesn't matter) if (BarCodeBytes[0] < Program.Test.Pages.Count && BarMatch(BarCodeBytes, Program.Test.Pages[BarCodeBytes[0]].Hash(), 3)) { CalculateInitialItemAltsCheckedState(BarCodeBytes[0], sure, doubt); // Other way to reach this is after manually setting page number } else { status.PageNumberOrHashError = true; // Fail: invalid page number according to barcode or page hash not correct } } else { status.BarCodeError = true; // Fail: could not read barcode, or not correctly (parity check fail) } } else { status.CalibrationError = true; // Fail: probably couldn't calibrate } ProcessedImage = true; status.Analyzed = true; }
private void Page_MouseDown(object sender, MouseEventArgs e) { pageStatus = PageStatus.ChangesWereMade; IDrawUsable tool = status.ActiveTool as IDrawUsable; if (tool != null) { memory.Add(tool.StartDrawing(sender, e)); isMouseDown = true; workSpace.Invalidate(); } }
protected override void DidActivate(bool firstActivation, ActivationType activationType) { if (activationType != ActivationType.AddedToHierarchy) { return; } CurrentPageStatus = PageStatus.Home; var homeController = BeatSaberUI.CreateViewController <HomePageController>(); bottomController = BeatSaberUI.CreateViewController <BottomPageController>(); bottomController.flowCoordinatorOwner = homeController.flowCoordinatorOwner = this; ProvideInitialViewControllers(homeController, null, null, bottomController); }
public async Task Start() { Status = PageStatus.Processing; this.StateHasChanged(); var checkpoints = await BorderCrossingServiceWebWrapper.ParseLocationHistoryAsync(RequestId, QueryRequest, (sender, e) => { PercentageProc = e.ProgressPercentage; InvokeAsync(StateHasChanged); }); await BorderCrossingServiceWebWrapper.UpdateResultAsync(RequestId, checkpoints); NavigationManager.NavigateTo($"result/{RequestId}"); }
private static async Task <IEnumerable <PageStatus> > HitPages() { var listPageStatus = new List <PageStatus>(); try { using (var repoPages = new PagesRepository()) { using (var repoPageStatus = new PageStatusRepository()) { //Get page with Monitor bit on. var pages = repoPages.GetAllMonitor(); //var pages = repoPages.GetAllProdMonitor(); //var pages = repoPages.GetAllStgMonitor(); var pageGetter = new PageGetter(); foreach (var page in pages) { var pageStats = new PageStats { Url = page.Url }; var stats = await pageGetter.HTTP_GET(pageStats); var pageStatus = new PageStatus { Url = stats.Url, ResponseTime = stats.ResponseTime, ContentLength = stats.ContentLength, ExceptionMessage = stats.ExceptionMessage, Status = stats.Status.ToString(), Created = DateTime.Now }; repoPageStatus.Add(pageStatus); repoPageStatus.SaveChanges(); listPageStatus.Add(pageStatus); } } } } catch (Exception ex) { // ReSharper disable once UnusedVariable var msg = ex.Message; } return(listPageStatus); }
public Response UpdateStaticPageStatus(int staticPageId, PageStatus updatedStaticPageStatus) { _response = new Response(); var staticPage = _repo.UpdateStaticPageStatus(staticPageId, updatedStaticPageStatus); if (staticPage != null) { _response.Success = true; _response.StaticPage = staticPage; _response.Message = "Static page status was successfully updated"; } _response.Message = "Your static page status could not be updated"; return(_response); }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] == null) { Response.Write("<script>alert('尚未登陆或超时,请重新登录!');window.location='Login.aspx'</script>"); } if (!IsPostBack) { ViewState["SortOrder"] = "pid"; ViewState["OrderDire"] = "ASC"; BindGridViewData(); BindDropDownList(); pageStatus = PageStatus.Add; } SetGridViewStyle(); }
public Response UpdateBlogPostStatus(int blogPostId, PageStatus updatedStatus) { _response = new Response(); var blogPost = _repo.UpdateBlogPostStatus(blogPostId, updatedStatus); if (blogPost != null) { _response.Success = true; _response.BlogPost = blogPost; _response.Message = "Blog post status was successfully updated"; } _response.Message = "Your blog post status could not be updated"; return(_response); }
private static void DirectAccess() { var repoPages = new PagesRepository(); //var pages = repoPages.GetAllProdMonitor(); var pages = repoPages.GetAllStgMonitor(); var repoPageStatus = new PageStatusRepository(); var pageGetter = new PageGetter(); var counter = 1000; while (counter > 0) { foreach (var page in pages) { Console.WriteLine($"Page: {page.Url}"); var pageStats = new PageStats { Url = page.Url }; var result = pageGetter.HTTP_GET(pageStats); var stats = result.Result; var pageStatus = new PageStatus { Url = stats.Url, ResponseTime = stats.ResponseTime, ContentLength = stats.ContentLength, ExceptionMessage = stats.ExceptionMessage, Status = stats.Status.ToString(), Created = DateTime.Now }; repoPageStatus.Add(pageStatus); repoPageStatus.SaveChanges(); Console.WriteLine($"seconds: {stats.ResponseTime} length: {stats.ContentLength} time: {DateTime.Now}"); Console.WriteLine(); } Thread.Sleep(10000); counter--; } }
private void OnLoaded(object sender, RoutedEventArgs args) { BookPage bp0 = GetTemplateChild("sheet0") as BookPage; BookPage bp1 = GetTemplateChild("sheet1") as BookPage; if ((bp0 == null) || (bp1 == null)) return; defaultDataTemplate = (DataTemplate) Resources["defaultDataTemplate"]; Read<PageStatus> GetStatus = delegate() { return _status; }; Action<PageStatus> SetStatus = delegate(PageStatus ps) { _status = ps; }; bp0.GetStatus += GetStatus; bp0.SetStatus += SetStatus; bp1.GetStatus += GetStatus; bp1.SetStatus += SetStatus; RefreshSheetsContent(); }
public void Update() { if (m_MenuSeq == null) { return; } if (!m_MenuSeq.m_MainMenuSeqStartOK) { return; } switch(m_PageStatus) { case PageStatus.PageSwitchEnableBefore: { if(!m_MenuSeq.PageSwitchEventEnableBefore()) { m_PageStatus = PageStatus.PageSwitchEnable; } } break; case PageStatus.PageSwitchEnable: { m_MenuSeq.PageSwitchTriger(); m_PageStatus = PageStatus.PageSwitchEnableAfter; } break; case PageStatus.PageSwitchEnableAfter: { if( !m_MenuSeq.PageSwitchEventEnableAfter() ) { m_PageStatus = PageStatus.PageSwitchWait; } } break; case PageStatus.PageSwitchWait: break; } }
public void StateEngineTest() { { // Setup page state var pageState = new StateDefinition <Page, PageStatus>( x => x.Status, new StateTransitionDefinition <Page, PageStatus>(PageStatus.Unpublished, PageStatusExtended.ForTranslation), new StateTransitionDefinition <Page, PageStatus>(PageStatusExtended.ForTranslation, PageStatusExtended.ReadToPublish), new StateTransitionDefinition <Page, PageStatus>(PageStatusExtended.ReadToPublish, PageStatus.Published), new StateTransitionDefinition <Page, PageStatus>(PageStatusExtended.ReadToPublish, PageStatus.DeleyPublished) { ExpectParameterType = typeof(DeleydPublishArgs), Expect = (page, o) => o.Date > DateTime.Now, PreAction = (container, page, arg3) => page.TimePublishDate = arg3.Date } ); StateEngine.Add(pageState); } { // the actual test var page = new Page(); using (var uow = new DummyUnitOfWorkContainer()) { Assert.Throws <StateTransitionNotAllowedException>(() => uow.StateEngine.Execute(page, PageStatus.Published)); Assert.Throws <StateTransitionNotAllowedException>(() => uow.StateEngine.Execute(page, PageStatusExtended.ReadToPublish)); uow.StateEngine.Execute(page, PageStatusExtended.ForTranslation); Assert.Throws <StateTransitionNotAllowedException>(() => uow.StateEngine.Execute(page, PageStatus.Unpublished)); Assert.Throws <StateTransitionNotAllowedException>(() => uow.StateEngine.Execute(page, PageStatus.Published)); uow.StateEngine.Execute(page, PageStatusExtended.ReadToPublish); Assert.Throws <StateTransitionNotAllowedException>(() => uow.StateEngine.Execute(page, PageStatus.Unpublished)); Assert.Throws <StateTransitionNotAllowedException>(() => uow.StateEngine.Execute(page, PageStatusExtended.ForTranslation)); Assert.Throws <StateTransitionNotAllowedException>(() => uow.StateEngine.Execute(page, PageStatusExtended.ReadToPublish)); uow.StateEngine.Execute(page, PageStatus.Published); } } Assert.Equal(PageStatus.Get("test"), PageStatus.Get("test")); Assert.Equal(PageStatus.Get("test"), PageStatus.Get("test")); Assert.Equal(PageStatus.Get("test"), PageStatus.Get("test")); }
public void SwipeGestureDetect(string direct) { switch (direct) { case "eRight": RightSelect(); break; case "eLeft": LeftSelect(); break; case "eOutwards": if (_pageStatus == PageStatus.PageOne && _currentOutline == 2) { _panel2.SetActive(true); _pageStatus = PageStatus.PageTwo; } else if (_pageStatus == PageStatus.PageOne && _currentOutline == 0) { _panel3.SetActive(true); _pageStatus = PageStatus.PageThree; } break; case "eInWards": if (_pageStatus == PageStatus.PageTwo) { _panel2.SetActive(false); _pageStatus = PageStatus.PageOne; } else if (_pageStatus == PageStatus.PageThree) { _panel3.SetActive(false); _pageStatus = PageStatus.PageOne; } break; default: break; } }
public bool Save(string path) { if (path == string.Empty) { if (fileName == string.Empty) { return(false); } else { path = fileName; } } CrateWorkSpaceBitmap().Save(path); fileName = path; pageStatus = PageStatus.NoChanges; return(true); }
public void UpdateBlogPostStatusTest(int blogPostId, PageStatus status) { var actual = _repo.UpdateBlogPostStatus(blogPostId, status); Assert.AreEqual(status, actual.Status); }
private void ReSetControlsStatus() { labelID.Text = ""; textBoxMorder.Text = "0"; textBoxPid.Text = ""; textBoxContainer.Text = ""; textBoxWidgetname.Text = "Grid"; textBoxWidgetsettings.Text = "{}"; dropdownlistCategories.SelectedIndex = 0; checkBoxIsVisible.Checked = true; pageStatus = PageStatus.Add; }
public void UpdateStaticPageStatusTest(int staticPageId, PageStatus status) { var actual = _repo.UpdateStaticPageStatus(staticPageId, status); Assert.AreEqual(status, actual.Status); }
protected void btnCancel_Click(object sender, EventArgs e) { ReSetControlsStatus(); pageStatus = PageStatus.Add; }
protected void PcMappingGridView_RowCommand(object sender, GridViewCommandEventArgs e) { switch (e.CommandName) { case "HiddenPostButtonCommand": Control cmdControl = e.CommandSource as Control; GridViewRow row = cmdControl.NamingContainer as GridViewRow; string lblPcmID = (row.FindControl("lblPcmID") as Label).Text; if (!string.IsNullOrEmpty(lblPcmID)) { labelID.Text = lblPcmID; dropdownlistCategories.SelectedValue = (row.FindControl("hiddentCatagoryId") as HiddenField).Value; textBoxMorder.Text = (row.FindControl("lblmorder") as Label).Text; textBoxPid.Text = (row.FindControl("lblpid") as Label).Text; textBoxContainer.Text = (row.FindControl("lblcontainer") as Label).Text; textBoxWidgetname.Text = (row.FindControl("lblwidgetname") as Label).Text; textBoxWidgetsettings.Text = (row.FindControl("lblwidgetsettings") as Label).Text; checkBoxIsVisible.Checked = (row.FindControl("chkVisible") as CheckBox).Checked; pageStatus = PageStatus.Modify; } else { //throw sth } break; } }
public Response UpdateBlogPostStatus(int blogPostId, PageStatus updatedStatus) { _response = new Response(); var blogPost = _repo.UpdateBlogPostStatus(blogPostId, updatedStatus); if (blogPost != null) { _response.Success = true; _response.BlogPost = blogPost; _response.Message = "Blog post status was successfully updated"; } _response.Message = "Your blog post status could not be updated"; return _response; }
public Response UpdateStaticPageStatus(int staticPageId, PageStatus updatedStaticPageStatus) { _response = new Response(); var staticPage = _repo.UpdateStaticPageStatus(staticPageId, updatedStaticPageStatus); if (staticPage != null) { _response.Success = true; _response.StaticPage = staticPage; _response.Message = "Static page status was successfully updated"; } _response.Message = "Your static page status could not be updated"; return _response; }
public StaticPage UpdateStaticPageStatus(int staticPageId, PageStatus updateStaticPageStatus) { StaticPage staticPage = new StaticPage(); using (SqlConnection cn = new SqlConnection(Settings.ConnectionString)) { var cmd = new SqlCommand(); cmd.CommandText = "UpdateStaticPageStatus"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@StaticPageID", staticPageId); cmd.Parameters.AddWithValue("@Status", (int)updateStaticPageStatus); cmd.Connection = cn; cn.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { staticPage = PopulateStaticPageFromReader(dr); } } } return staticPage; }
public BlogPost UpdateBlogPostStatus(int blogPostId, PageStatus updatedStatus) { BlogPost blogPost = new BlogPost(); using (SqlConnection cn = new SqlConnection(Settings.ConnectionString)) { var cmd = new SqlCommand(); cmd.CommandText = "UpdateStatus"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@BlogPostID", blogPostId); cmd.Parameters.AddWithValue("@Status", (int)updatedStatus); cmd.Connection = cn; cn.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { blogPost = PopulateBlogPostFromReader(dr); } } } blogPost.Hashtags = GetHashtagByBlogPostId(blogPost.BlogPostId); return blogPost; }