protected void contentUpdateButton_Click(object sender, EventArgs e) { if (!this.ValidateFields(2)) { return; } ContentP p = (ContentP)this.Master._CoachingDal.Get("content", this.contentRemoveUpdateSelector.SelectedValue.Remove(0, 1)); if (p == null) { this.Master._Logger.Error(new AdminException(". p == null"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(23, "Red", "")); return; } if (p.IsLinkPage == 1) { this.UpdatePageLinkInit(); } else { this.UpdatePageInit(); } }
private void UpdatePageLinkInit() { if (!this.ValidateFields(2)) { this.ClearFields(2); this.contentLinkHiddenUp.Value = ""; return; } ContentP p = (ContentP)this.Master._CoachingDal.Get("content", this.contentRemoveUpdateSelector.SelectedValue.Remove(0, 1)); if (p == null) { this.Master._Logger.Error(new AdminException(". p == null"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(23, "Red", "")); return; } this.contentLinkUpdateTime.Text = p.spLastUpdate; this.contentLinkButtonTitle.Text = p.ContentButtonTitle; this.contentLinkUrl.Text = p.ContentLink; this.contentLinkPlace.Text = p.ContentMenuPlace.ToString(); this.contentLinkHiddenUp.Value = p.ContentID; this.ContentDivSelector("2"); }
public bool CheckIfContentPlaceAvailableExcept(int existContentPlace, int newContentPlace) { if (existContentPlace < 0 || newContentPlace < 0) { return(false); } ContentP p = this.coachingDal.ContentPs.SingleOrDefault (g => g.ContentMenuPlace != existContentPlace && g.ContentMenuPlace == newContentPlace); return(p == null); }
public bool CheckIfContentPlaceAvailable(int contentPlace) { if (contentPlace < 0) { return(false); } ContentP p = this.coachingDal.ContentPs.SingleOrDefault (g => g.ContentMenuPlace == contentPlace); return(p == null); }
public bool CheckAvailableButtonTitle(string contentButtonTitle) { if (contentButtonTitle == "" || contentButtonTitle == null) { return(false); } ContentP p = this.coachingDal.ContentPs.SingleOrDefault (g => g.ContentButtonTitle == contentButtonTitle); if (p != null) { return(false); } return(true); }
public bool CheckAvailableButtonTitleExcept(string existingContentButtonTitle, string newContentButtonTitle) { if (existingContentButtonTitle == "" || existingContentButtonTitle == null || newContentButtonTitle == "" || newContentButtonTitle == null) { return(false); } ContentP p = this.coachingDal.ContentPs.SingleOrDefault (g => g.ContentButtonTitle != existingContentButtonTitle && g.ContentButtonTitle == newContentButtonTitle); if (p != null) { return(false); } return(true); }
public ContentP Update(ref ContentP m, DateTime time) { this.ContentID = m.ContentID; this.CreationTime = m.CreationTime; this.ContentContent = m.ContentContent; this.ContentButtonTitle = m.ContentButtonTitle; this.ContentDescription = m.ContentDescription; this.ContentKeyWords = m.ContentKeyWords; this.ContentLanguageID = m.ContentLanguageID; this.ContentTitle = m.ContentTitle; this.ContentMenuPlace = m.ContentMenuPlace; this.IsLinkPage = m.IsLinkPage; this.ContentLink = m.ContentLink; this.spLastUpdate = time.ToString(); this.LastUpdate = time; return(this); }
protected void Page_Load(object sender, EventArgs e) { ContentP p = null; foreach (ContentP page in (IEnumerable <ContentP>) this.Master._CoachingDal.GetAll("content")) { if (page.ContentPageType == "Graduates") { p = page; if (page.ContentLanguageID.Trim() == "1") { this.intro.Attributes["class"] = "hebrew"; } if (page.ContentLanguageID.Trim() == "2") { this.intro.Attributes["class"] = "english"; } break; } } if (p == null) { this.SetError("You Don't Have Graduates Page, Please Create One In Admin.aspx And Try Again"); return; } try { this.intro.InnerHtml = p.ContentContent; this.Master._GlobalFunctions.SetPageSEO(p.ContentTitle, p.ContentDescription, p.ContentKeyWords, this.Page); } catch (Exception t) { this.Master._Logger.Error(t, MethodBase.GetCurrentMethod().Name); this.SetError("Oops! Something Wrong Has Happened, Please Try Again Or/And contact The Administrator"); } if (!Page.IsPostBack) { this.graduatesRepeater.DataSource = this.Master._CoachingDal.GetAll("session"); } this.Session["tab"] = "c" + p.ContentID; }
public bool GetContentByType(string pageType) { if (pageType == "" || pageType == null) { return(false); } if (pageType == "Content") { return(true); } ContentP p = this.coachingDal.ContentPs.SingleOrDefault(g => g.ContentPageType == pageType); if (p == null) { return(true); } return(false); }
private void RemovePage() { if (this.contentHiddenRe.Value == "") { this.Master._Logger.Error(new AdminException (". this.contentHiddenRe.Value == \"\""), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(23, "Red", "")); this.ClearFields(1); this.contentHiddenRe.Value = ""; return; } try { ContentP p = (ContentP)(this.Master._CoachingDal.Get("content", this.contentHiddenRe.Value)); if (p == null) { this.Master._Logger.Error(new AdminException (". p == null"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(11, "Red", "")); return; } this.Master._CoachingDal.Delete("content", p.ContentID); this.Master._Logger.Log(new AdminException(string.Format(". Page content {0} Was Successfully Removed", p.ContentID)), MethodBase.GetCurrentMethod().Name); this.contentRemoveUpdateSelector.Items.Remove(this.contentRemoveUpdateSelector.Items.FindByValue("s" + p.ContentID)); this.Notify(this.Master._Notifier.Notify(2, "White", p.ContentButtonTitle)); } catch (Exception e) { this.Master._Logger.Error(e, MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(23, "Red", "")); } finally { this.ClearFields(1); this.contentHiddenRe.Value = ""; } }
private void LoadPage() { if (Request["pageID"] == null) { this.Master._Logger.Error(new AdminException (". Request[\"pageID\"] == null"), MethodBase.GetCurrentMethod().Name); Response.Redirect("Default.aspx?error=true"); } try { ContentP page = (ContentP)this.Master._CoachingDal.Get("content", (string)Request["pageID"]); if (page == null) { throw new AdminException(". page == null"); } if (page.ContentLanguageID.Trim() == "1") { this.contact.Attributes["class"] = "hebrew"; } if (page.ContentLanguageID.Trim() == "2") { this.contact.Attributes["class"] = "english"; } this.Master._GlobalFunctions.SetPageSEO (page.ContentTitle, page.ContentDescription, page.ContentKeyWords, this.Page); this.contact.InnerHtml = page.ContentContent; this.Session["tab"] = "c" + page.ContentID; } catch (Exception e) { this.Master._Logger.Error(e, MethodBase.GetCurrentMethod().Name); Response.Redirect("Default.aspx?error=true"); } }
public bool GetContentByTypeExcept(string existingType, string newType) { if (existingType == "Content" || newType == "Content") { return(true); } if (existingType == "" || existingType == null || newType == "" || newType == null) { return(false); } ContentP p = this.coachingDal.ContentPs.SingleOrDefault (g => g.ContentPageType != existingType && g.ContentPageType == newType); if (p == null) { return(true); } return(false); }
private void UpdatePageInit() { if (!this.ValidateFields(2)) { this.ClearFields(1); this.contentHiddenUp.Value = ""; return; } ContentP p = (ContentP)this.Master._CoachingDal.Get("content", this.contentRemoveUpdateSelector.SelectedValue.Remove(0, 1)); if (p == null) { this.Master._Logger.Error(new AdminException(". p == null"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(23, "Red", "")); return; } this.ClearFields(1); this.contentUpdateTime.Text = p.spLastUpdate; this.contentDescription.Text = p.ContentDescription; this.contentTitle.Text = p.ContentTitle; this.contentLanguageSelector.SelectedIndex = int.Parse(p.ContentLanguageID.Trim()); this.contentKeyWords.Text = p.ContentKeyWords; this.contentEditor.Value = p.ContentContent; this.contentButtonTitle.Text = p.ContentButtonTitle; this.contentPageTypeSelector.Items.FindByValue(p.ContentPageType.Trim()).Selected = true; this.contentPlace.Text = p.ContentMenuPlace.ToString(); this.contentLink.Text = p.ContentLink; this.contentFullPageLink.Text = p.ContentFullPageLink; this.contentHiddenUp.Value = p.ContentID; this.ContentDivSelector("1"); }
protected void Page_Load(object sender, EventArgs e) { if (Request["type"] == null) { this._logger.Error(new AdminException (". Request[\"type\"] == null"), MethodBase.GetCurrentMethod().Name); Response.Redirect("Default.aspx?error=true"); } if (Request["pageID"] == null) { this._logger.Error(new AdminException (". Request[\"pageID\"] == null"), MethodBase.GetCurrentMethod().Name); Response.Redirect("Default.aspx?error=true"); } if (Request["type"] == "content") { try { ContentP page = (ContentP)this._coachingDal.Get("content", (string)Request["pageID"]); if (page == null) { throw new AdminException(". page == null"); } if (page.ContentLanguageID.Trim() == "1") { this.content.Attributes["class"] = "hebrew"; } if (page.ContentLanguageID.Trim() == "2") { this.content.Attributes["class"] = "english"; } this._globalFunctions.SetPageSEO (page.ContentTitle, page.ContentDescription, page.ContentKeyWords, this.Page); this.content.InnerHtml = this._globalFunctions.FixBackUrl(page.ContentContent); this.Session["tab"] = "c" + page.ContentID; } catch (Exception y) { this._logger.Error(y, MethodBase.GetCurrentMethod().Name); Response.Redirect("Default.aspx?error=true"); } } if (Request["type"] == "article") { try { Article page = (Article)this._coachingDal.Get("article", (string)Request["pageID"]); if (page == null) { throw new AdminException(". page == null"); } if (page.ArticleLanguageID.Trim() == "1") { this.content.Attributes["class"] = "hebrew"; } if (page.ArticleLanguageID.Trim() == "2") { this.content.Attributes["class"] = "english"; } this._globalFunctions.SetPageSEO (page.ArticleTitle, page.ArticleDescription, page.ArticleKeyWords, this.Page); this.content.InnerHtml = this._globalFunctions.FixBackUrl(page.ArticleContent); } catch (Exception u) { this._logger.Error(u, MethodBase.GetCurrentMethod().Name); Response.Redirect("Default.aspx?error=true"); } } if (Request["type"] == "graduates") { if (Request["sessionID"] == null) { this._logger.Error(new AdminException (". Request[\"sessionID\"] == null"), MethodBase.GetCurrentMethod().Name); Response.Redirect("Default.aspx?error=true"); } GraduateSession session = (GraduateSession)this._coachingDal.Get("session", Request["sessionID"]); if (session == null) { this._logger.Error(new AdminException (". session == null"), MethodBase.GetCurrentMethod().Name); Response.Redirect("Default.aspx?error=true"); } this.content.Attributes["class"] = "graduate"; StringBuilder build = new StringBuilder(@"<div class=""space3""></div>"); foreach (Graduate g in this._coachingDal.GetAllGraduatesBySession(Request["sessionID"])) { build.Append(g.GraduateName + "<br />"); } this.content.InnerHtml = build.ToString(); } }
private void AddPage() { if (!ValidateFields(1)) { this.ClearFields(1); this.ClearLanguageSelector(); return; } if (!this.Master._CoachingDal.GetContentByType(this.contentPageTypeSelector.SelectedValue)) { this.Master._Logger.Error(new AdminException (". !this.Master._CoachingDal.GetContentByType(this.contentPageTypeSelector.SelectedValue)") , MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(70, "Red", this.contentPageTypeSelector.SelectedValue)); this.ClearFields(1); this.ClearLanguageSelector(); return; } if (!this.Master._CoachingDal.CheckAvailableButtonTitle(this.contentButtonTitle.Text)) { this.Master._Logger.Warn(new AdminException(". !this.Master._CoachingDal.CheckAvailableButtonTitle(this.contentButtonTitle.Text)"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(31, "Red", this.contentButtonTitle.Text)); this.ClearFields(1); this.ClearLanguageSelector(); return; } if (!this.Master._CoachingDal.CheckIfContentPlaceAvailable(int.Parse(this.contentPlace.Text))) { this.Master._Logger.Warn(new AdminException(". (!this.Master._CoachingDal.CheckIfContentPlaceAvailable(int.Parse(this.contentPlace.Text)))"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(66, "Red", "")); this.ClearFields(1); this.ClearLanguageSelector(); return; } string title = ""; try { title = this.contentTitle.Text; string id = this.Master._CoachingDal.GetNextAvailableID("content"); ContentP p = new ContentP { ContentID = id, ContentContent = this.contentEditor.Value, ContentMenuPlace = int.Parse(this.contentPlace.Text), ContentButtonTitle = contentButtonTitle.Text, ContentDescription = this.contentDescription.Text, ContentKeyWords = this.contentKeyWords.Text, ContentLanguageID = this.contentLanguageSelector.SelectedIndex.ToString(), ContentTitle = this.contentTitle.Text, CreationTime = TimeNow.TheTimeNow, ContentPageType = this.contentPageTypeSelector.SelectedValue, ContentLink = "http://www.malliere.com/ContactPage.aspx?pageID=" + id, ContentFullPageLink = "http://www.malliere.com/FullPage.aspx?pageID=" + id + "&type=content", IsLinkPage = 2, LastUpdate = TimeNow.TheTimeNow, spLastUpdate = TimeNow.TheTimeNow.ToShortDateString() }; this.Master._CoachingDal.Add("content", p, TimeNow.TheTimeNow); this.Master._Logger.Log(new Exception("Page" + p.ContentTitle + " Was Successfully Added"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(4, "White", p.ContentButtonTitle + "," + p.ContentID)); ListItem m = new ListItem(p.ContentButtonTitle, "s" + p.ContentID); this.contentRemoveUpdateSelector.Items.Add(m); } catch (Exception e) { this.Master._Logger.Error(e, MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(12, "Red", this.contentButtonTitle.Text)); } finally { this.ClearFields(1); this.ClearLanguageSelector(); } }
private void UpdatePage() { if (this.contentHiddenUp.Value == "") { this.Master._Logger.Error(new AdminException (". this.contentHiddenUp.Value == \"\""), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(23, "Red", "")); this.ClearFields(1); this.ClearLanguageSelector(); this.contentHiddenUp.Value = ""; return; } if (!this.ValidateFields(1)) { this.ClearFields(1); this.ClearLanguageSelector(); this.contentHiddenUp.Value = ""; return; } try { ContentP p = (ContentP)(this.Master._CoachingDal.Get("content", this.contentHiddenUp.Value)); if (p == null) { this.Master._Logger.Error(new AdminException (". p == null"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(11, "Red", "")); this.ClearFields(1); this.ClearLanguageSelector(); this.contentHiddenUp.Value = ""; return; } if (!this.Master._CoachingDal.GetContentByTypeExcept(p.ContentPageType, this.contentPageTypeSelector.SelectedValue)) { this.Master._Logger.Error(new AdminException (". !this.Master._CoachingDal.GetContentByTypeExcept(p.ContentPageType, this.contentPageTypeSelector.SelectedValue)") , MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(70, "Red", this.contentPageTypeSelector.SelectedValue)); this.ClearFields(1); this.ClearLanguageSelector(); this.contentHiddenUp.Value = ""; return; } if (!this.Master._CoachingDal.CheckAvailableButtonTitleExcept(p.ContentButtonTitle, this.contentButtonTitle.Text)) { this.Master._Logger.Warn(new AdminException(". !this.Master._CoachingDal.CheckAvailableButtonTitleExcept(p.ContentButtonTitle, this.contentButtonTitle.Text)"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(31, "Red", this.contentButtonTitle.Text)); this.ClearFields(1); this.ClearLanguageSelector(); this.contentHiddenUp.Value = ""; return; } if (!this.Master._CoachingDal.CheckIfContentPlaceAvailableExcept(p.ContentMenuPlace, int.Parse(this.contentPlace.Text))) { this.Master._Logger.Warn(new AdminException(". !this.Master._CoachingDal.CheckIfContentPlaceAvailable(i)"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(66, "Red", "")); this.ClearFields(1); this.ClearLanguageSelector(); this.contentHiddenUp.Value = ""; return; } ListItem m = this.contentRemoveUpdateSelector.Items.FindByValue("s" + p.ContentID); this.contentRemoveUpdateSelector.Items.Remove(m); p.ContentID = p.ContentID; p.ContentContent = this.contentEditor.Value; p.ContentButtonTitle = this.contentButtonTitle.Text; p.ContentDescription = this.contentDescription.Text; p.ContentKeyWords = this.contentKeyWords.Text; p.ContentLanguageID = this.contentLanguageSelector.SelectedIndex.ToString(); p.ContentTitle = this.contentTitle.Text; p.LastUpdate = TimeNow.TheTimeNow; p.ContentPageType = this.contentPageTypeSelector.SelectedValue; p.spLastUpdate = TimeNow.TheTimeNow.ToString(); p.IsLinkPage = 2; p.ContentMenuPlace = int.Parse(this.contentPlace.Text); this.Master._CoachingDal.Update("content", p, TimeNow.TheTimeNow); this.Master._Logger.Log(new Exception(". " + p.ContentID + " " + p.ContentTitle + " Was Successfully Updated"), MethodBase.GetCurrentMethod().Name); m = new ListItem(p.ContentButtonTitle, "s" + p.ContentID); this.contentRemoveUpdateSelector.Items.Add(m); this.Notify(this.Master._Notifier.Notify(29, "White", p.ContentButtonTitle)); } catch (Exception e) { this.Master._Logger.Error(e, MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(13, "Red", this.contentButtonTitle.Text)); } finally { this.ClearFields(1); this.ClearLanguageSelector(); this.contentHiddenUp.Value = ""; } }
private void UpdateLinkContent() { if (this.contentLinkHiddenUp.Value == "") { this.Master._Logger.Error(new AdminException(". this.contentLinkHiddenUp.Value == \"\""), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(23, "Red", "")); this.ClearFields(2); this.contentLinkHiddenUp.Value = ""; return; } ContentP p = (ContentP)this.Master._CoachingDal.Get("content", this.contentLinkHiddenUp.Value); if (p == null) { this.Master._Logger.Error(new AdminException(". p == null"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(23, "Red", "")); this.ClearFields(2); this.contentLinkHiddenUp.Value = ""; return; } if (!this.Master._CoachingDal.CheckIfContentPlaceAvailableExcept (p.ContentMenuPlace, int.Parse(this.contentLinkPlace.Text))) { this.Master._Logger.Warn(new AdminException(@". !this.Master._CoachingDal.CheckIfContentPlaceAvailableExcept (p.ContentMenuPlace, int.Parse(this.contentLinkPlace.Text))"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(66, "Red", "")); this.ClearFields(2); this.contentLinkHiddenUp.Value = ""; return; } if (!this.Master._CoachingDal.CheckAvailableButtonTitleExcept(p.ContentButtonTitle, this.contentLinkButtonTitle.Text)) { this.Master._Logger.Warn(new AdminException(". !this.Master._CoachingDal.CheckAvailableButtonTitleExcept(p.ContentButtonTitle, this.contentLinkButtonTitle.Text)"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(31, "Red", this.contentButtonTitle.Text)); this.ClearFields(2); this.contentLinkHiddenUp.Value = ""; return; } try { ListItem m = this.contentRemoveUpdateSelector.Items.FindByValue("s" + p.ContentID); this.contentRemoveUpdateSelector.Items.Remove(m); string url = this.Master._GlobalFunctions.FixUrl(this.contentLinkUrl.Text); p.ContentMenuPlace = int.Parse(this.contentLinkPlace.Text); p.ContentLink = url; p.ContentButtonTitle = this.contentLinkButtonTitle.Text; p.spLastUpdate = TimeNow.TheTimeNow.ToShortDateString(); p.LastUpdate = TimeNow.TheTimeNow; this.Master._CoachingDal.Update("content", p, TimeNow.TheTimeNow); this.Master._Logger.Log(new Exception(". " + p.ContentID + " " + p.ContentTitle + " Was Successfully Updated"), MethodBase.GetCurrentMethod().Name); m = new ListItem(p.ContentButtonTitle, "s" + p.ContentID); this.contentRemoveUpdateSelector.Items.Add(m); this.Notify(this.Master._Notifier.Notify(29, "White", p.ContentButtonTitle)); } catch (Exception e) { this.Master._Logger.Error(e, MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(13, "Red", this.contentLinkButtonTitle.Text)); } finally { this.ClearFields(2); this.contentLinkHiddenUp.Value = ""; } }
private void AddLinkContent() { if (!this.Master._CoachingDal.CheckIfContentPlaceAvailable(int.Parse(this.contentLinkPlace.Text))) { this.Master._Logger.Warn(new AdminException(". (!this.Master._CoachingDal.CheckIfContentPlaceAvailable(int.Parse(this.contentLinkPlace.Text)))"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(66, "Red", "")); this.ClearFields(2); return; } if (!this.Master._CoachingDal.CheckAvailableButtonTitle(this.contentLinkButtonTitle.Text)) { this.Master._Logger.Warn(new AdminException(". !this.Master._CoachingDal.CheckAvailableButtonTitle(this.contentButtonTitle.Text)"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(31, "Red", this.contentButtonTitle.Text)); this.ClearFields(2); return; } try { string url = this.Master._GlobalFunctions.FixUrl(this.contentLinkUrl.Text); ContentP content = new ContentP() { ContentButtonTitle = this.contentLinkButtonTitle.Text, ContentContent = "", ContentDescription = "", ContentID = this.Master._CoachingDal.GetNextAvailableID("content"), ContentKeyWords = "", ContentLanguageID = "1", ContentLink = url, ContentFullPageLink = "", ContentMenuPlace = int.Parse(this.contentLinkPlace.Text), ContentTitle = "", ContentPageType = "Content", CreationTime = TimeNow.TheTimeNow, IsLinkPage = 1, LastUpdate = TimeNow.TheTimeNow, spLastUpdate = TimeNow.TheTimeNow.ToShortDateString() }; this.Master._CoachingDal.Add("content", content, TimeNow.TheTimeNow); this.Master._Logger.Log(new AdminException(". Page" + content.ContentButtonTitle + " Was Successfully Added"), MethodBase.GetCurrentMethod().Name); ListItem m = new ListItem(content.ContentButtonTitle, "s" + content.ContentID); this.contentRemoveUpdateSelector.Items.Add(m); this.Notify(this.Master._Notifier.Notify(9, "White", content.ContentButtonTitle + "," + content.ContentID)); } catch (Exception p) { this.Master._Logger.Error(p, MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(12, "Red", this.contentLinkButtonTitle.Text)); } finally { this.ClearFields(2); } }
public void Add(string type, object item, DateTime time) { if (type == "" || type == null || item == null || time == default(DateTime) || time == default(DateTime)) { return; } switch (type) { case "admin": AdminUser ad = (AdminUser)item; if (this.Get(type, ad.AdminUserID) == null) { ad.CreationTime = time; ad.spCreationTime = time.ToShortDateString(); this.coachingDal.AdminUsers.InsertOnSubmit(ad); } break; case "article": Article ar = (Article)item; if (this.Get(type, ar.ArticleID) == null) { ar.CreationTime = time; this.coachingDal.Articles.InsertOnSubmit(ar); } break; case "content": ContentP co = (ContentP)item; if (this.Get(type, co.ContentID) == null) { co.CreationTime = time; this.coachingDal.ContentPs.InsertOnSubmit(co); } break; case "mailList": MailList ma = (MailList)item; if (this.Get(type, ma.MailListID) == null) { ma.MailListJoinTime = time; ma.spMailListLastUpdate = time.ToShortDateString(); this.coachingDal.MailLists.InsertOnSubmit(ma); } break; case "log": Log lo = (Log)item; if (this.Get(type, lo.LogID.ToString()) == null) { lo.LogDate = time; lo.spLogDate = time.ToShortDateString(); this.coachingDal.Logs.InsertOnSubmit(lo); } break; case "graduate": Graduate gr = (Graduate)item; if (this.Get(type, gr.GraduateID.ToString()) == null) { gr.CreationTime = time; gr.spCreationTime = time.ToShortDateString(); this.coachingDal.Graduates.InsertOnSubmit(gr); } break; case "session": GraduateSession se = (GraduateSession)item; if (this.Get(type, se.GraduateSessionID.ToString()) == null) { se.CreationTime = time; se.spCreationTime = time.ToShortDateString(); this.coachingDal.GraduateSessions.InsertOnSubmit(se); } break; case "lead": Lead le = (Lead)item; if (this.Get(type, le.LeadID.ToString()) == null) { le.LeadDate = time; le.spLeadDate = time.ToString(); this.coachingDal.Leads.InsertOnSubmit(le); } break; case "news": New ne = (New)item; if (this.Get(type, ne.NewsID) == null) { ne.NewsCreationDate = time; ne.spNewsCreationDate = time.ToShortDateString(); this.coachingDal.News.InsertOnSubmit(ne); } break; default: break; } this.coachingDal.SubmitChanges(); }
protected void Page_Load(object sender, EventArgs e) { if (this.Request["error"] != null) { { this.SetError("Oops! Something Wrong Has Happened, Please Try Again Or/And contact The Administrator"); return; } } ContentP p = null; foreach (ContentP page in (IEnumerable <ContentP>) this.Master._CoachingDal.GetAll("content")) { { if (page.ContentPageType == "Home") { { p = page; if (page.ContentLanguageID.Trim() == "1") { { this.home.Attributes["class"] = "hebrew"; } } if (page.ContentLanguageID.Trim() == "2") { { this.home.Attributes["class"] = "english"; } } break; } } } } if (p == null) { { this.SetError("You Don't Have Home Page, Please Create One In Admin.aspx And Try Again"); return; } } try { HtmlGenericControl css; css = new HtmlGenericControl(); css.TagName = "link"; css.Attributes.Add("rel", "stylesheet"); if (p.ContentPageType == "Home") { { css.Attributes.Add("href", "style1.css"); } } else { { css.Attributes.Add("href", "style.css"); } } this.Master.Header.Controls.Add(css); this.home.InnerHtml = p.ContentContent; this.Master._GlobalFunctions.SetPageSEO(p.ContentTitle, p.ContentDescription, p.ContentKeyWords, this.Page); this.Session["tab"] = "c" + p.ContentID; } catch (Exception t) { this.Master._Logger.Error(t, MethodBase.GetCurrentMethod().Name); this.SetError("Oops! Something Wrong Has Happened, Please Try Again Or/And contact The Administrator"); } }
public void Delete(string type, string itemID) { if (type == "" || type == null || itemID == null || itemID == "") { return; } switch (type) { case "admin": AdminUser m = null; if ((m = (AdminUser)this.Get(type, itemID)) != null) { this.coachingDal.AdminUsers.DeleteOnSubmit(m); } break; case "article": Article ar = null; if ((ar = (Article)this.Get(type, itemID)) != null) { this.coachingDal.Articles.DeleteOnSubmit(ar); } break; case "content": ContentP co = null; if ((co = (ContentP)this.Get(type, itemID)) != null) { this.coachingDal.ContentPs.DeleteOnSubmit(co); } break; case "mailList": MailList ma = null; if ((ma = (MailList)this.Get(type, itemID)) != null) { this.coachingDal.MailLists.DeleteOnSubmit(ma); } break; case "log": Log lo = null; if ((lo = (Log)this.Get(type, itemID)) != null) { this.coachingDal.Logs.DeleteOnSubmit(lo); } break; case "graduate": Graduate gr = null; if ((gr = (Graduate)this.Get(type, itemID)) != null) { this.coachingDal.Graduates.DeleteOnSubmit(gr); } break; case "session": GraduateSession se = null; if ((se = (GraduateSession)this.Get(type, itemID)) != null) { this.coachingDal.GraduateSessions.DeleteOnSubmit(se); } break; case "lead": Lead le = null; if ((le = (Lead)this.Get(type, itemID)) != null) { this.coachingDal.Leads.DeleteOnSubmit(le); } break; case "news": New ne = null; if ((ne = (New)this.Get(type, itemID)) != null) { this.coachingDal.News.DeleteOnSubmit(ne); } break; default: break; } this.coachingDal.SubmitChanges(); }
public string GetNextAvailableID(string type) { if (type == "" || type == null) { return(type); } int result = 0; switch (type) { case "admin": AdminUser ad = null; while ((ad = (AdminUser)this.Get(type, result.ToString())) != null) { result += 1; } break; case "article": Article ar = null; while ((ar = (Article)this.Get(type, result.ToString())) != null) { result += 1; } break; case "content": ContentP co = null; while ((co = (ContentP)this.Get(type, result.ToString())) != null) { result += 1; } break; case "mailList": MailList ma = null; while ((ma = (MailList)this.Get(type, result.ToString())) != null) { result += 1; } break; case "log": Log lo = null; while ((lo = (Log)this.Get(type, result.ToString())) != null) { result += 1; } break; case "graduate": Graduate gr = null; while ((gr = (Graduate)this.Get(type, result.ToString())) != null) { result += 1; } break; case "session": GraduateSession ss = null; while ((ss = (GraduateSession)this.Get(type, result.ToString())) != null) { result += 1; } break; case "lead": Lead le = null; while ((le = (Lead)this.Get(type, result.ToString())) != null) { result += 1; } break; case "news": New ne = null; while ((ne = (New)this.Get(type, result.ToString())) != null) { result += 1; } break; default: break; } return(result.ToString()); }
public void Update(string type, object item, DateTime time) { if (type == "" || type == null || time == default(DateTime)) { return; } switch (type) { case "admin": AdminUser ad1 = (AdminUser)item; AdminUser ad2 = null; if ((ad2 = (AdminUser)this.Get(type, ad1.AdminUserID)) != null) { ad2.Update(ref ad1, time); ad2.LastUpdate = time; ad2.spLastUpdate = time.ToString(); } break; case "article": Article ar1 = (Article)item; Article ar2 = null; if ((ar2 = (Article)this.Get(type, ar1.ArticleID)) != null) { ar2.Update(ref ar1, time); ar2.LastUpdate = time; ar2.spLastUpdate = time.ToString(); } break; case "content": ContentP co1 = (ContentP)item; ContentP co2 = null; if ((co2 = (ContentP)this.Get(type, co1.ContentID)) != null) { co2.Update(ref co1, time); co2.LastUpdate = time; co2.spLastUpdate = time.ToString(); } break; case "log": Log lo1 = (Log)item; Log lo2 = null; if ((lo2 = (Log)this.Get(type, lo1.LogID.ToString())) != null) { lo2.Update(ref lo1, time); } break; case "graduate": Graduate gr1 = (Graduate)item; Graduate gr2 = null; if ((gr2 = (Graduate)this.Get(type, gr1.GraduateID)) != null) { gr2.Update(ref gr1, time); } break; case "session": GraduateSession ss1 = (GraduateSession)item; GraduateSession ss2 = null; if ((ss2 = (GraduateSession)this.Get(type, ss1.GraduateSessionID)) != null) { ss2.Update(ref ss1, time); } break; case "lead": Lead le1 = (Lead)item; Lead le2 = null; if ((le2 = (Lead)this.Get(type, le1.LeadID.ToString())) != null) { le2.Update(ref le1, time); } break; case "news": New ne1 = (New)item; New ne2 = null; if ((ne2 = (New)this.Get(type, ne1.NewsID.ToString())) != null) { ne2.Update(ref ne1, time); } break; default: break; } this.coachingDal.SubmitChanges(); }