private void BindData()
 {
     try
     {
         SystemStartupController ctl = new SystemStartupController();
         grdList.DataSource = ctl.GetSystemEventStartUpList(GetPortalID);
         grdList.DataBind();
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Registers startup events
        /// </summary>
        /// <param name="EventLocation"> Event locations</param>
        /// <param name="PortalID">portalID</param>
        /// <param name="phdContainer">Placeholder name</param>  
        /// <param name="IsAdmin">Set true for admin part</param>
        public void IncludeStartupEvents(SystemEventLocation EventLocation, int PortalID, PlaceHolder phdContainer, bool IsAdmin)
        {
            SystemStartupController obj = new SystemStartupController();
            ArrayList arrColl = new ArrayList();
            switch (EventLocation)
            {
                case SystemEventLocation.Top:
                    arrColl = obj.GetStartUpControls("Top", PortalID, IsAdmin);
                    for (int i = 0; i < arrColl.Count; i++)
                    {
                        try
                        {
                            UserControl ctl = this.Page.LoadControl("~/" + arrColl[i].ToString()) as SageFrameStartUpControl;
                            if (ctl != null)
                            {
                                this.Page.Controls.AddAt(0, ctl);
                            }
                        }
                        catch
                        {
                        }

                    }
                    break;
                case SystemEventLocation.Middle:
                    arrColl = obj.GetStartUpControls("Middle", PortalID, IsAdmin);
                    UserControl uc = phdContainer.FindControl("lytA") as UserControl;
                    for (int i = 0; i < arrColl.Count; i++)
                    {
                        try
                        {
                            UserControl ctl = this.Page.LoadControl("~/" + arrColl[i].ToString()) as SageFrameStartUpControl;
                            PlaceHolder phdPlaceHolderMiddle = uc.FindControl("pch_middlemaincurrent") as PlaceHolder;
                            if (phdPlaceHolderMiddle != null && ctl != null)
                            {
                                phdPlaceHolderMiddle.Controls.Add(ctl);
                            }
                        }
                        catch
                        {
                        }
                    }
                    break;
                case SystemEventLocation.Bottom:
                    arrColl = obj.GetStartUpControls("Bottom", PortalID, IsAdmin);
                    for (int i = 0; i < arrColl.Count; i++)
                    {
                        try
                        {
                            UserControl ctl = this.Page.LoadControl("~/" + arrColl[i].ToString()) as SageFrameStartUpControl;
                            if (ctl != null)
                            {
                                this.Page.Controls.AddAt(this.Page.Controls.Count, ctl);
                            }
                        }
                        catch
                        {
                        }
                    }
                    break;
            }
        }
 protected void grdList_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         SystemStartupController ctl = new SystemStartupController();
         Int32 PortalStartUpID = Int32.Parse(e.CommandArgument.ToString());         
         switch (e.CommandName.ToString())
         {
             case "EditEvent":
                 EditSystemEventStartUp(PortalStartUpID);
                 break;
             case "DeleteEvent":
                 ctl.DeleteSystemEventStartUp(PortalStartUpID,GetUsername);
                 ClearForm();
                 BindData();
                 break;
         }
         HttpRuntime.Cache.Remove(CacheKeys.StartupSageSetting);
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
    public void EditSystemEventStartUp(Int32 PortalStartUpID)
    {
        try
        {
            SystemStartupController ctl = new SystemStartupController();           
            SystemEventStartUpInfo objInfo = ctl.GetSystemEventStartUpDetails(PortalStartUpID);           
            if (objInfo != null)
            {              
                 ClearForm();
                 pnlSystemEventStartUpList.Style.Add("display", "none");
                 pnlEventStartUp.Style.Add("display", "block");
                 LoadSources(Server.MapPath("~/Modules"));                
                 LoadEventLocation();
                 hdnPortalStartUpID.Value =PortalStartUpID.ToString();
                 ddlControlUrl.SelectedIndex = ddlControlUrl.Items.IndexOf(ddlControlUrl.Items.FindByValue(objInfo.ControlUrl));                
                 ddlEventLocation.SelectedIndex = ddlEventLocation.Items.IndexOf(ddlEventLocation.Items.FindByValue(objInfo.EventLocationName));
                 chkIsAdmin.Checked = objInfo.IsAdmin;
                 chkIsControlUrl.Checked = objInfo.IsControlUrl;
                 chkIsActive.Checked = objInfo.IsActive;

            }
            
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
    private void Save()
    {
        try
        {           
            SystemStartupController ctl = new SystemStartupController();
            Int32 PortalStartUpID = Int32.Parse(hdnPortalStartUpID.Value);
            ctl.UpdateSystemEventStartUp(PortalStartUpID, GetPortalID, ddlControlUrl.SelectedValue, ddlEventLocation.SelectedValue,chkIsAdmin.Checked,chkIsControlUrl.Checked,chkIsActive.Checked, GetUsername);
            ClearForm();
            BindData();
            HttpRuntime.Cache.Remove(CacheKeys.StartupSageSetting);
        }

        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
 private void LoadEventLocation()
 {
     try
     {
         SystemStartupController ctl = new SystemStartupController();
         List<SystemEventLocationInfo> obj = ctl.GetEventLocationList();            
         ddlEventLocation.DataSource = obj;
         ddlEventLocation.DataTextField = "EventLocationName";
         ddlEventLocation.DataValueField = "EventLocationName";
         ddlEventLocation.DataBind(); 
        
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }