Ejemplo n.º 1
0
 public void CleanControls(RadAjaxPanel contenedor)
 {
     for (int i = 0; i <= contenedor.Controls.Count - 1; i++)
     {
         if (contenedor.Controls[i].GetType().Name == "TextBox")
         {
             ((TextBox)contenedor.Controls[i]).Text = string.Empty;
         }
         if (contenedor.Controls[i].GetType().Name == "RadTextBox")
         {
             ((RadTextBox)contenedor.Controls[i]).Text = string.Empty;
         }
         if (contenedor.Controls[i].GetType().Name == "RadMaskedTextBox")
         {
             ((RadMaskedTextBox)contenedor.Controls[i]).Text = string.Empty;
         }
         if (contenedor.Controls[i].GetType().Name == "RadComboBox")
         {
             ((RadComboBox)contenedor.Controls[i]).SelectedValue = null;
             ((RadComboBox)contenedor.Controls[i]).DataSourceID  = null;
             ((RadComboBox)contenedor.Controls[i]).DataSource    = null;
             ((RadComboBox)contenedor.Controls[i]).DataBind();
             //((RadComboBox)contenedor.Controls[i]).DataBind();
         }
     }
 }
Ejemplo n.º 2
0
 public static void SetEnable(RadGrid grid, bool Enabled, RadAjaxPanel AjaxPanel)
 {
     if (AjaxPanel.FindControl(grid.ID + "ShouldDisable") == null)
     {
         AjaxPanel.Controls.Add(new Literal()
         {
             Text = string.Format("<input type=\"hidden\" name=\"{0}\" id=\"{0}\" value=\"{1}\" />", grid.ID + "ShouldDisable", (!Enabled).ToString()), ID = grid.ID + "ShouldDisable"
         });
     }
     else
     {
         (AjaxPanel.FindControl(grid.ID + "ShouldDisable") as Literal).Text = string.Format("<input type=\"hidden\" name=\"{0}\" id=\"{0}\" value=\"{1}\" />", grid.ID + "ShouldDisable", (!Enabled).ToString());
     }
 }
Ejemplo n.º 3
0
        private void LoadAjaxPanel()
        {
            var loadingPanel = new RadAjaxLoadingPanel {
                ID = _control.ID + "_Prog", Skin = "Default"
            };

            Controls.Add(loadingPanel);

            var ajaxPanel = new RadAjaxPanel {
                ID             = _control.ID + "_UP",
                LoadingPanelID = loadingPanel.ID,
                RestoreOriginalRenderDelegate = false
            };

            InjectMessageControl(ajaxPanel);
            ajaxPanel.Controls.Add(_control);

            Controls.Add(ajaxPanel);
        }
        public void Setup_AddHandlers(
            WebControl Wc
            , RadAjaxPanel RadAjaxPanel_Target
            , ClsBindDefinition BindDefinition
            , bool IsMultipleSelect = false
            , string Window_Title = ""
            , double Window_Height = 450
            , double Window_Width = 500)
        {
            Control_Selection_DataSource So = new Control_Selection_DataSource();
            So.Source_ControlID = Wc.ID;
            So.RadAjaxPanel_TargetID = RadAjaxPanel_Target.ClientID;
            So.BindDefinition = BindDefinition;
            So.IsMultipleSelect = IsMultipleSelect;
            So.Window_Title = Window_Title == "" ? "Selection" : Window_Title;
            So.Window_Height = Window_Height < 450 ? 450 : Window_Height;
            So.Window_Width = Window_Width;

            this.mProperties.List_DataSource.Add(So);

            Wc.Attributes.Add(@"onclick", @"ShowSelection('" + Wc.ID + "','" + RadAjaxPanel_Target.ClientID + "', '" + So.Window_Title + "', " + So.Window_Height + ", " + So.Window_Width + "); return false;");
        }
Ejemplo n.º 5
0
        private void LoadAjaxPanel()
        {
            // Reference dnn.js to add attachEvent/detachEvent functions in IE11 to fix Telerik (see DNN-6167)
            JavaScript.RegisterClientReference(Page, ClientAPI.ClientNamespaceReferences.dnn);

            var loadingPanel = new RadAjaxLoadingPanel {
                ID = _control.ID + "_Prog", Skin = "Default"
            };

            Controls.Add(loadingPanel);

            var ajaxPanel = new RadAjaxPanel
            {
                ID             = _control.ID + "_UP",
                LoadingPanelID = loadingPanel.ID,
                RestoreOriginalRenderDelegate = false
            };

            InjectMessageControl(ajaxPanel);
            ajaxPanel.Controls.Add(_control);

            Controls.Add(ajaxPanel);
        }
Ejemplo n.º 6
0
 protected void Notify(RadAjaxPanel panel, string message, string type)
 {
     panel.ResponseScripts.Add(string.Format("notify(null, '{0}', '{1}');", message, type));
 }
Ejemplo n.º 7
0
 public void NotifyOK(RadAjaxPanel panel, string message)
 {
     Notify(panel, message, "success");
 }
Ejemplo n.º 8
0
 public void NotifyError(RadAjaxPanel panel, string message)
 {
     Notify(panel, message, "error");
 }
Ejemplo n.º 9
0
        private void LoadAjaxPanel()
        {
            var loadingPanel = new RadAjaxLoadingPanel { ID = _control.ID + "_Prog", Skin = "Default" };

            Controls.Add(loadingPanel);

            var ajaxPanel = new RadAjaxPanel {
                ID = _control.ID + "_UP",
                LoadingPanelID = loadingPanel.ID,
                RestoreOriginalRenderDelegate = false
            };
            InjectMessageControl(ajaxPanel); 
            ajaxPanel.Controls.Add(_control);

            Controls.Add(ajaxPanel);

        }
Ejemplo n.º 10
0
        /// <summary>
        /// OnPreRender handler.
        /// </summary>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            _lblFolder.Text = Utilities.GetLocalizedString("Folder");
            _lblFile.Text   = Utilities.GetLocalizedString("File");

            _lblFolder.CssClass = LabelCssClass;
            _lblFile.CssClass   = LabelCssClass;

            string fileName = null; string folderPath = null;

            if (!String.IsNullOrEmpty(FilePath))
            {
                fileName = FilePath.Substring(FilePath.LastIndexOf("/") + 1);
                {
                    folderPath = String.IsNullOrEmpty(fileName) ? FilePath : FilePath.Replace(fileName, String.Empty);
                }
            }
            else
            {
                fileName = FilePath; folderPath = String.Empty;
            }

            if (_cboFolders.Items.FindItemByValue(folderPath) != null)
            {
                _cboFolders.SelectedIndex = -1;
                {
                    _cboFolders.Items.FindItemByValue(folderPath).Selected = true;
                }
            }

            LoadFiles(); _pnlFolder.Visible = (_cboFolders.Items.Count > 1 && ShowFolders);

            if (_cboFiles.Items.FindItemByText(fileName) != null)
            {
                _cboFiles.Items.FindItemByText(fileName).Selected = true;
            }

            if (_cboFiles.SelectedItem == null || String.IsNullOrEmpty(_cboFiles.SelectedItem.Value))
            {
                FileId = -1;
            }
            else
            {
                FileId = Int32.Parse(_cboFiles.SelectedItem.Value);
            }

            _hfFileId.Value = FileId.ToString();

            switch (Mode)
            {
            case FileControlMode.Normal:
            {
                _pnlFile.Visible = true; _pnlUpload.Visible = false; _pnlRightDiv.Visible = true;
                {
                    ShowImage();         // show file selector preview
                }

                if ((FolderPermissionController.HasFolderPermission(PortalId, _cboFolders.SelectedItem.Value, "ADD")) && ShowUpload)
                {
                    ShowButton(_cmdUpload, "Upload");
                }

                break;
            }

            case FileControlMode.UploadFile:
            {
                ShowButton(_cmdSave, "Save"); ShowButton(_cmdCancel, "Cancel");
                {
                    _pnlFile.Visible = false; _pnlRightDiv.Visible = false; _pnlUpload.Visible = true;
                }

                RadAjaxPanel panel = (Parent as RadAjaxPanel);
                {
                    panel.ClientEvents.OnRequestStart = @"utils.postback";
                }

                break;
            }
            }
        }
        public void Setup(
            ClsSysCurrentUser CurrentUser
            , List<ClsBindGridColumn> BindDefinition
            , DataTable Dt_Source
            , RadAjaxPanel RadAjaxPanel_Target
            , string ModuleName = ""
            , bool IsPersistent = true)
        {
            this.mProperties = new Control_Filter_Properties();
            this.mProperties.BindDefinition = BindDefinition;
            this.mProperties.Dt_Filter = new DataTable();
            this.mProperties.RadAjaxPanel_Target_ClientID = RadAjaxPanel_Target.ClientID;
            this.mProperties.ModuleName = ModuleName != "" ? CnsState_Filter +  ModuleName : CnsState_Filter + this.Page.Request.Url.AbsolutePath;
            this.mProperties.IsPersistent = IsPersistent;
            this.ViewState[CnsProperties] = this.mProperties;

            //[-]

            this.mProperties.Dt_Filter.Columns.Add("Desc", typeof(string));
            this.mProperties.Dt_Filter.Columns.Add("Field", typeof(string));
            this.mProperties.Dt_Filter.Columns.Add("DataType", typeof(string));

            foreach (ClsBindGridColumn Gc in this.mProperties.BindDefinition)
            {
                if (Gc.mIsFilter && (Gc.mFieldName != ""))
                {
                    try
                    {
                        Do_Methods.AddDataRow(
                        ref this.mProperties.Dt_Filter
                        , new string[] { "Field", "Desc", "DataType" }
                        , new object[] { Gc.mFieldName, Gc.mFieldDesc, Dt_Source.Columns[Gc.mFieldName].DataType.ToString() });
                    }
                    catch { }
                }
            }

            Methods_Web.BindCombo(ref this.Cbo_Filter, this.mProperties.Dt_Filter, "Field", "Desc");

            //[-]

            if (this.mProperties.IsPersistent)
            {
                this.mState = (Control_Filter_State)this.Session[this.mProperties.ModuleName];
                if (this.mState == null)
                {
                    this.mState = new Control_Filter_State();
                    this.Session[this.mProperties.ModuleName] = this.mState;
                }
            }
            else
            {
                this.mState = new Control_Filter_State();
                this.ViewState[CnsState_Filter] = this.mState;
            }

            //[-]

            this.UpdateFilterLabel();
        }
Ejemplo n.º 12
0
        public static bool DoLogin(string User, string Password, Page Page, ref string Error, object AjaxPanel, bool ShouldRedirect)
        {
            User     = User.ToUpper();
            Password = Password.ToUpper();
            try
            {
                if (GMembershipProvider.Default.ValidateUser(User, Password))
                {
                    FormsAuthentication.SetAuthCookie(User, false);

                    // Cria uma identificação (temporária)
                    FormsIdentity id = new FormsIdentity(new FormsAuthenticationTicket(User, false, 20));

                    // Anexa a identidade ao HttpContext atual para,temporariamente, o user ficar setado como autenticado
                    HttpContext.Current.User = new GenericPrincipal(id, new string[] { });

                    string       RefreshControlsID = HttpContext.Current.Request.QueryString["RefreshControlID"];
                    string       Url         = HttpContext.Current.Request.QueryString["url"];
                    bool         CloseWindow = HttpContext.Current.Request.QueryString["CloseWindow"] == "true";
                    RadAjaxPanel Ajax        = null;
                    if (AjaxPanel != null && AjaxPanel is RadAjaxPanel)
                    {
                        Ajax = (RadAjaxPanel)AjaxPanel;
                    }
                    if ((RefreshControlsID == "" || RefreshControlsID == null) && Page.Request["RefreshControlsIDHidden"] != null)
                    {
                        RefreshControlsID = Page.Request["RefreshControlsIDHidden"];
                    }
                    if ((Url == "" || Url == null) && Page.Request["PageToRedirectHidden"] != null)
                    {
                        Url = Page.Request["PageToRedirectHidden"];
                    }
                    if (RefreshControlsID != "" && RefreshControlsID != null)
                    {
                        if (AjaxPanel == null)
                        {
                            Page.ClientScript.RegisterStartupScript(Page.GetType(), "Refresh", "<script>getParentPage().RefreshNavigationControl('" + RefreshControlsID + "','" + Url + "');</script>");
                        }
                        else
                        {
                            Ajax.ResponseScripts.Add("getParentPage().RefreshNavigationControl('" + RefreshControlsID + "','" + Url + "');");
                        }
                    }
                    else if (ShouldRedirect)
                    {
                        if (Url != "" && Url != null)
                        {
                            Url = Base64.Decode(Url);
                            if (AjaxPanel == null)
                            {
                                Page.ClientScript.RegisterStartupScript(Page.GetType(), "PageToRedirect", "<script>document.location.href = '" + Url + "';</script>");
                            }
                            else
                            {
                                Ajax.ResponseScripts.Add("document.location.href = '" + Url + "';");
                            }
                        }
                    }

                    if (AjaxPanel != null)
                    {
                        Ajax.ResponseScripts.Add("try{OnLoginSucceded();}catch(ex){}");
                        Ajax.ResponseScripts.Add("document.forms[0].RefreshControlsIDHidden.value = \"\";");
                        Ajax.ResponseScripts.Add("document.forms[0].PageToRedirectHidden.value = \"\";");
                        if (CloseWindow)
                        {
                            Ajax.ResponseScripts.Add("try{getParentPage().GetRadWindowManager().GetActiveWindow().Close();}catch(ex){}");
                        }
                    }
                    else
                    {
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "Succeded", "<script>OnLoginSucceded();</script>");
                        if (CloseWindow)
                        {
                            Page.ClientScript.RegisterStartupScript(Page.GetType(), "CloseWindow", "<script>try{getParentPage().GetRadWindowManager().GetActiveWindow().Close();}catch(ex){}</script>");
                        }
                    }
                    return(true);
                }
                else
                {
                    if (User != User.Trim() || Password != Password.Trim())
                    {
                        return(Utility.DoLogin(User.Trim(), Password.Trim(), Page, ref Error, AjaxPanel, ShouldRedirect));
                    }
                    Error = "Usuário ou senha inválido(s)!";
                }
            }
            catch (Exception ex)
            {
                Error = "Erro interno ao efetuar login! <a href = \"javascript:return false;\"  onclick = \"alert('" + ex.Message.ToString().Replace("'", "").Replace("\"", "") + "',0, 'Erro ao realizar login');\" > Ver mais </a>";
            }
            return(false);
        }