Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //load verse
                Readings read1 = new Readings();
                read1.Where.ViewDate.Value = DateTime.Now.ToShortDateString();
                read1.Where.ReadingsType.Value = 1;
                read1.Query.Load();
                if (read1.RowCount == 0)
                {
                    read1.Where.WhereClauseReset();
                    read1.Query.AddOrderBy(Ermia_BLL.Readings.ColumnNames.ViewDate, MyGeneration.dOOdads.WhereParameter.Dir.DESC);
                    read1.Where.ReadingsType.Value = 1;
                    read1.Query.Top = 1;
                    read1.Query.Load();
                }
                uiLiteralverse.Text = Server.HtmlDecode(read1.ArContent);

                //load sayings
                Readings read2 = new Readings();
                read2.Where.ViewDate.Value = DateTime.Now.ToShortDateString();
                read2.Where.ReadingsType.Value = 3;
                read2.Query.Load();
                if (read2.RowCount == 0)
                {
                    read2.Where.WhereClauseReset();
                    read2.Query.AddOrderBy(Ermia_BLL.Readings.ColumnNames.ViewDate, MyGeneration.dOOdads.WhereParameter.Dir.DESC);
                    read2.Where.ReadingsType.Value = 3;
                    read2.Query.Top = 1;
                    read2.Query.Load();
                }
                uiLiteralsaying.Text = Server.HtmlDecode(read2.ArContent);

                // load quotes
                Quotes read3 = new Quotes();
                read3.Where.WhereClauseReset();
                read3.Query.AddOrderBy(Ermia_BLL.Quotes.ColumnNames.PostedDate, MyGeneration.dOOdads.WhereParameter.Dir.DESC);
                read3.Query.Top = 1;
                read3.Query.Load();
                uiLiteralquotes.Text = Server.HtmlDecode(read3.ArContent);

                //load reading
                Readings read4 = new Readings();
                read4.Where.ViewDate.Value = DateTime.Now.ToShortDateString();
                read4.Where.ReadingsType.Value = 2;
                read4.Query.Load();
                if (read4.RowCount == 0)
                {
                    read4.Where.WhereClauseReset();
                    read4.Query.AddOrderBy(Ermia_BLL.Readings.ColumnNames.ViewDate, MyGeneration.dOOdads.WhereParameter.Dir.DESC);
                    read4.Where.ReadingsType.Value = 2;
                    read4.Query.Top = 1;
                    read4.Query.Load();
                }
                uiLiteralreading.Text = Server.HtmlDecode(read4.ArContent);

            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Quotes read = new Quotes();
         read.Where.WhereClauseReset();
         read.Query.AddOrderBy(Ermia_BLL.Quotes.ColumnNames.PostedDate, MyGeneration.dOOdads.WhereParameter.Dir.DESC);
         read.Query.Top = 4;
         read.Query.Load();
         uiRepeaterQuotes.DataSource = read.DefaultView;
         uiRepeaterQuotes.DataBind();
     }
 }
 protected void uiGridViewQuotes_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditQuotes")
     {
         Quotes objData = new Quotes();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         uiRadEditorPageContent.Content = Server.HtmlDecode(objData.ArContent);
         uiTextBoxDate.Text = objData.PostedDate.ToString("dd/MM/yyyy");
         uiPanelViewQuotes.Visible = false;
         uiPanelEdit.Visible = true;
         CurrentQuote = objData;
     }
     else if (e.CommandName == "DeleteQuotes")
     {
         Quotes objData = new Quotes();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         objData.MarkAsDeleted();
         objData.Save();
         LoadQuotes();
     }
 }
 protected void uiLinkButtonUpdateReadings_Click(object sender, EventArgs e)
 {
     if (CurrentQuote != null)
     {
         CurrentQuote.ArContent = Server.HtmlEncode(uiRadEditorPageContent.Content);
         CurrentQuote.PostedDate = DateTime.ParseExact(uiTextBoxDate.Text, "dd/MM/yyyy", null);
         if (uiFileUploadMainPicturePath.HasFile)
         {
             uiFileUploadMainPicturePath.SaveAs(Server.MapPath("~/UploadedFiles/Images/" + uiFileUploadMainPicturePath.FileName));
             CurrentQuote.ImageURL = "/UploadedFiles/Images/" + uiFileUploadMainPicturePath.FileName;
         }
         CurrentQuote.Save();
     }
     else
     {
         Quotes objData = new Quotes();
         objData.AddNew();
         objData.ArContent = Server.HtmlEncode(uiRadEditorPageContent.Content);
         objData.PostedDate = DateTime.ParseExact(uiTextBoxDate.Text, "dd/MM/yyyy", null);
         if (uiFileUploadMainPicturePath.HasFile)
         {
             uiFileUploadMainPicturePath.SaveAs(Server.MapPath("~/UploadedFiles/Images/" + uiFileUploadMainPicturePath.FileName));
             objData.ImageURL = "/UploadedFiles/Images/" + uiFileUploadMainPicturePath.FileName;
         }
         objData.Save();
     }
     uiPanelEdit.Visible = false;
     uiPanelViewQuotes.Visible = true;
     uiRadEditorPageContent.Content = "";
     uiTextBoxDate.Text = "";
     LoadQuotes();
 }
 protected void uiLinkButtonCancelReadings_Click(object sender, EventArgs e)
 {
     uiPanelEdit.Visible = false;
     uiPanelViewQuotes.Visible = true;
     uiRadEditorPageContent.Content = "";
     uiTextBoxDate.Text = "";
     CurrentQuote = null;
 }
 private void LoadQuotes()
 {
     Quotes read = new Quotes();
     read.Query.AddOrderBy(Ermia_BLL.Quotes.ColumnNames.PostedDate, MyGeneration.dOOdads.WhereParameter.Dir.DESC);
     read.Query.Load();
     uiGridViewQuotes.DataSource = read.DefaultView;
     uiGridViewQuotes.DataBind();
 }