Ejemplo n.º 1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                GuestbookCSController     objGuestbookCSs = new GuestbookCSController();
                List <GuestbookEntryInfo> colGuestbookCSs;

                // get the content from the GuestbookCS table
                colGuestbookCSs = objGuestbookCSs.GetAllEntries(ModuleId);

                if (colGuestbookCSs.Count == 0)
                {
                    // add the content to the GuestbookCS table
                    GuestbookEntryInfo objGuestbookCS = new GuestbookEntryInfo();
                    objGuestbookCS.ModuleId         = ModuleId;
                    objGuestbookCS.SubmitterComment = Localization.GetString("DefaultContent", LocalResourceFile);
                    objGuestbookCS.SubmitterName    = this.UserId.ToString();
                    objGuestbookCSs.InsertGuestbookEntry(objGuestbookCS);
                    // get the content from the GuestbookCS table
                    //colGuestbookCSs = objGuestbookCSs.GetGuestbookCSs(ModuleId);
                }

                // bind the content to the repeater
                lstContent.DataSource = colGuestbookCSs;
                lstContent.DataBind();
            }

            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 2
0
        /// ----------------------------------------------------------------------------- 
        /// <summary> 
        /// Page_Load runs when the control is loaded 
        /// </summary> 
        /// ----------------------------------------------------------------------------- 
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                GuestbookCSController objGuestbookCSs = new GuestbookCSController();
                List<GuestbookEntryInfo> colGuestbookCSs;

                // get the content from the GuestbookCS table 
                colGuestbookCSs = objGuestbookCSs.GetAllEntries(ModuleId);

                if (colGuestbookCSs.Count == 0)
                {
                    // add the content to the GuestbookCS table 
                    GuestbookEntryInfo objGuestbookCS = new GuestbookEntryInfo();
                    objGuestbookCS.ModuleId = ModuleId;
                    objGuestbookCS.SubmitterComment = Localization.GetString("DefaultContent", LocalResourceFile);
                    objGuestbookCS.SubmitterName  = this.UserId.ToString();
                    objGuestbookCSs.InsertGuestbookEntry(objGuestbookCS);
                    // get the content from the GuestbookCS table 
                    //colGuestbookCSs = objGuestbookCSs.GetGuestbookCSs(ModuleId);
                }

                // bind the content to the repeater 
                lstContent.DataSource = colGuestbookCSs;
                lstContent.DataBind();
            }

            catch (Exception exc)
            {
                //Module failed to load 
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdUpdate_Click runs when the update button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                GuestbookCSController objGuestbookCSs = new GuestbookCSController();

                GuestbookEntryInfo objGuestbookCS = new GuestbookEntryInfo();

                objGuestbookCS.ModuleId = ModuleId;
                //objGuestbookCS.ItemId = ItemId;
                //objGuestbookCS.Content = txtContent.Text;
                //objGuestbookCS.CreatedByUser = this.UserId;

                if (Null.IsNull(ItemId))
                {
                    // add the content within the GuestbookCS table
                    objGuestbookCSs.InsertGuestbookEntry(objGuestbookCS);
                }
                else
                {
                    // update the content within the GuestbookCS table
                    //objGuestbookCSs.ApproveGuestbookEntry(objGuestbookCS);
                }

                // Redirect back to the portal home page
                Response.Redirect(Globals.NavigateURL(), true);
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 4
0
        /// ----------------------------------------------------------------------------- 
        /// <summary> 
        /// Page_Load runs when the control is loaded 
        /// </summary> 
        /// <remarks> 
        /// </remarks> 
        /// <history> 
        /// </history> 
        /// ----------------------------------------------------------------------------- 
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {

                // Determine ItemId of GuestbookCS to Update 
                if ((Request.QueryString["ItemId"] != null))
                {
                    ItemId = Int32.Parse(Request.QueryString["ItemId"]);
                }

                // If this is the first visit to the page, bind the role data to the datalist 
                if (Page.IsPostBack == false)
                {

                    cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");

                    if (!Null.IsNull(ItemId))
                    {
                        // get content 
                        GuestbookCSController objGuestbookCSs = new GuestbookCSController();
                        GuestbookEntryInfo objGuestbookCS = objGuestbookCSs.GetGuestbookCS(ModuleId, ItemId);
                        if ((objGuestbookCS != null))
                        {
                            txtContent.Text = objGuestbookCS.Content;
                            ctlAudit.CreatedByUser = objGuestbookCS.CreatedByUserName;
                            ctlAudit.CreatedDate = objGuestbookCS.CreatedDate.ToString();
                        }
                        else
                        {
                            // security violation attempt to access item not related to this Module 
                            Response.Redirect(Globals.NavigateURL(), true);
                        }
                    }
                    else
                    {
                        cmdDelete.Visible = false;
                        ctlAudit.Visible = false;
                    }
                }
            }

            catch (Exception exc)
            {
                //Module failed to load 
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 5
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                // Determine ItemId of GuestbookCS to Update
                if ((Request.QueryString["ItemId"] != null))
                {
                    ItemId = Int32.Parse(Request.QueryString["ItemId"]);
                }

                // If this is the first visit to the page, bind the role data to the datalist
                if (Page.IsPostBack == false)
                {
                    cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");

                    if (!Null.IsNull(ItemId))
                    {
                        // get content
                        GuestbookCSController objGuestbookCSs = new GuestbookCSController();
                        GuestbookEntryInfo    objGuestbookCS  = objGuestbookCSs.GetGuestbookCS(ModuleId, ItemId);
                        if ((objGuestbookCS != null))
                        {
                            txtContent.Text        = objGuestbookCS.Content;
                            ctlAudit.CreatedByUser = objGuestbookCS.CreatedByUserName;
                            ctlAudit.CreatedDate   = objGuestbookCS.CreatedDate.ToString();
                        }
                        else
                        {
                            // security violation attempt to access item not related to this Module
                            Response.Redirect(Globals.NavigateURL(), true);
                        }
                    }
                    else
                    {
                        cmdDelete.Visible = false;
                        ctlAudit.Visible  = false;
                    }
                }
            }

            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 6
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdDelete_Click runs when the delete button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                // Only attempt to delete the item if it exists already
                if (!Null.IsNull(ItemId))
                {
                    GuestbookCSController objGuestbookCSs = new GuestbookCSController();
                    objGuestbookCSs.DeleteGuestbookEntry(ModuleId, ItemId);
                }

                // Redirect back to the portal home page
                Response.Redirect(Globals.NavigateURL(), true);
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 7
0
        /// ----------------------------------------------------------------------------- 
        /// <summary> 
        /// cmdDelete_Click runs when the delete button is clicked 
        /// </summary> 
        /// <remarks> 
        /// </remarks> 
        /// <history> 
        /// </history> 
        /// ----------------------------------------------------------------------------- 
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                // Only attempt to delete the item if it exists already 
                if (!Null.IsNull(ItemId))
                {

                    GuestbookCSController objGuestbookCSs = new GuestbookCSController();
                    objGuestbookCSs.DeleteGuestbookEntry(ModuleId, ItemId);

                }

                // Redirect back to the portal home page 
                Response.Redirect(Globals.NavigateURL(), true);
            }
            catch (Exception exc)
            {
                //Module failed to load 
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 8
0
        /// ----------------------------------------------------------------------------- 
        /// <summary> 
        /// cmdUpdate_Click runs when the update button is clicked 
        /// </summary> 
        /// <remarks> 
        /// </remarks> 
        /// <history> 
        /// </history> 
        /// ----------------------------------------------------------------------------- 
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                GuestbookCSController objGuestbookCSs = new GuestbookCSController();

                GuestbookEntryInfo objGuestbookCS = new GuestbookEntryInfo();

                objGuestbookCS.ModuleId = ModuleId;
                //objGuestbookCS.ItemId = ItemId;
                //objGuestbookCS.Content = txtContent.Text;
                //objGuestbookCS.CreatedByUser = this.UserId;

                if (Null.IsNull(ItemId))
                {
                    // add the content within the GuestbookCS table 
                    objGuestbookCSs.InsertGuestbookEntry(objGuestbookCS);
                }
                else
                {
                    // update the content within the GuestbookCS table 
                    //objGuestbookCSs.ApproveGuestbookEntry(objGuestbookCS);
                }

                // Redirect back to the portal home page 
                Response.Redirect(Globals.NavigateURL(), true);
            }
            catch (Exception exc)
            {
                //Module failed to load 
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }