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)
     {
         Readings read = new Readings();
         read.Where.ViewDate.Value = DateTime.Now.ToShortDateString();
         read.Where.ReadingsType.Value = 3;
         read.Query.Load();
         if (read.RowCount == 0)
         {
             read.Where.WhereClauseReset();
             read.Query.AddOrderBy(Ermia_BLL.Readings.ColumnNames.ViewDate, MyGeneration.dOOdads.WhereParameter.Dir.DESC);
             read.Where.ReadingsType.Value = 3;
             read.Query.Top = 1;
             read.Query.Load();
         }
         uiLiteralContent.Text = Server.HtmlDecode(read.ArContent);
     }
 }
 protected void uiGridViewReadings_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditRead")
     {
         Readings objData = new Readings();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         uiRadEditorPageContent.Content = Server.HtmlDecode(objData.ArContent);
         uiTextBoxDate.Text = objData.ViewDate.ToString("dd/MM/yyyy");
         uiPanelAllReadings.Visible = false;
         uiPanelCurrent.Visible = true;
         CurrentRead = objData;
     }
     else if (e.CommandName == "DeleteRead")
     {
         Readings objData = new Readings();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         objData.MarkAsDeleted();
         objData.Save();
         LoadReadings();
     }
 }
 protected void uiLinkButtonUpdateReadings_Click(object sender, EventArgs e)
 {
     if (CurrentRead != null)
     {
         CurrentRead.ArContent = Server.HtmlEncode(uiRadEditorPageContent.Content);
         CurrentRead.ViewDate = DateTime.ParseExact(uiTextBoxDate.Text, "dd/MM/yyyy", null);
         CurrentRead.ReadingsType = 2;
         CurrentRead.Save();
     }
     else
     {
         Readings objData = new Readings();
         objData.AddNew();
         objData.ArContent = Server.HtmlEncode(uiRadEditorPageContent.Content);
         objData.ViewDate = DateTime.ParseExact(uiTextBoxDate.Text, "dd/MM/yyyy", null);
         objData.ReadingsType = 2;
         objData.Save();
     }
     uiPanelCurrent.Visible = false;
     uiPanelAllReadings.Visible = true;
     uiRadEditorPageContent.Content = "";
     uiTextBoxDate.Text = "";
     LoadReadings();
 }
 protected void uiLinkButtonCancelReadings_Click(object sender, EventArgs e)
 {
     uiPanelCurrent.Visible = false;
     uiPanelAllReadings.Visible = true;
     uiRadEditorPageContent.Content = "";
     uiTextBoxDate.Text = "";
     CurrentRead = null;
 }
 private void LoadReadings()
 {
     Readings read = new Readings();
     read.GetReadingsByTypeID(2);
     uiGridViewReadings.DataSource = read.DefaultView;
     uiGridViewReadings.DataBind();
 }