Inheritance: Ext.Net.BaseItem
Beispiel #1
0
        public MessageBox Alert(string title, string msg, JFunction fn, string scope)
        {
            MessageBoxConfig config = new MessageBoxConfig();

            config.Title   = title;
            config.Message = msg;
            config.Buttons = Button.OK;
            config.Fn      = fn;
            config.Scope   = scope;

            return(this.Configure(config));
        }
Beispiel #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="handler"></param>
 /// <returns>An instance of TBuilder</returns>
 public virtual TBuilder PrepareToolbar(string handler)
 {
     if (JFunction.IsFunctionName(handler))
     {
         this.ToComponent().PrepareToolbar.Fn = handler;
     }
     else
     {
         this.ToComponent().PrepareToolbar.Handler = handler;
     }
     return(this as TBuilder);
 }
            /// <summary>
            ///
            /// </summary>
            /// <param name="action">The action delegate</param>
            /// <returns>An instance of TBuilder</returns>
            public virtual TBuilder GetAdditionalData(string handler)
            {
                if (JFunction.IsFunctionName(handler))
                {
                    this.ToComponent().GetAdditionalData.Fn = handler;
                }
                else
                {
                    this.ToComponent().GetAdditionalData.Handler = handler;
                }

                return(this as TBuilder);
            }
            /// <summary>
            ///
            /// </summary>
            public virtual TBuilder SummaryRenderer(string handler)
            {
                if (JFunction.IsFunctionName(handler))
                {
                    this.ToComponent().SummaryRenderer.Fn = handler;
                }
                else
                {
                    this.ToComponent().SummaryRenderer.Handler = handler;
                }

                return(this as TBuilder);
            }
        public MessageBox Confirm(string title, string msg, JFunction fn, string scope)
        {
            MessageBoxConfig config = new MessageBoxConfig();

            config.Title   = title;
            config.Message = msg;
            config.Buttons = Button.YESNO;
            config.Fn      = fn;
            config.Scope   = scope;
            config.Icon    = Icon.QUESTION;

            return(this.Configure(config));
        }
Beispiel #6
0
        /// <summary>
        /// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
        /// </summary>
        /// <param name="title">The title bar text</param>
        /// <param name="msg">The message box body text</param>
        /// <param name="fn">(optional) The callback function invoked after the message box is closed</param>
        /// <param name="scope">(optional) The scope of the callback function</param>
        /// <param name="multiline">(optional) True to create a multiline textbox using the defaultTextHeight property, or the height in pixels to create the textbox (defaults to false / single-line)</param>
        /// <param name="value">(optional) Default value of the text input element (defaults to '')</param>
        public MessageBox Prompt(string title, string msg, JFunction fn, string scope, Unit multiline, string value)
        {
            MessageBoxConfig config = new MessageBoxConfig();

            config.Title           = title;
            config.Message         = msg;
            config.Buttons         = Button.OKCANCEL;
            config.Fn              = fn;
            config.MinWidth        = Unit.Pixel(250);
            config.Scope           = scope;
            config.Prompt          = true;
            config.MultilineHeight = multiline;
            config.Value           = value;

            return(this.Configure(config));
        }
        public JFunction(string handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }

            if (JFunction.IsFunctionName(handler))
            {
                this.Fn = handler;
            }
            else
            {
                this.Handler = handler;
            }
        }
 protected void getPreciarios()
 {
     string cliente = Cookies.GetCookie("cookieClienteID").Value;
     var success = new JFunction { Fn = "onBuscar_Sucursal" };
     if (cliente != null && !cliente.Trim().Equals(""))
     {
         List<Preciario> lPreciarios = PreciarioBusiness.ObtenerPreciariosActivosPorCliente(cliente);
         if (lPreciarios.Count() > 0)
         {
             sPreciarios.DataSource = lPreciarios;
             sPreciarios.DataBind();
         }
         else
         {
             X.Msg.Alert("ATENCIÓN", "<p align='center'>EL CLIENTE: "+cliente+" ES INDEFINIDO.</p>", success).Show();
         }
     }
 }
 /// <summary>
 /// Hides this Component, setting it to invisible using the configured hideMode.
 /// </summary>
 /// <param name="animateTarget">only valid for floating Components such as Windows or ToolTips, or regular Components which have been configured with floating: true.. The target to which the Component should animate while hiding (defaults to null with no animation)</param>
 /// <param name="callback">A callback function to call after the Component is hidden.</param>
 /// <param name="scope">The scope (this reference) in which the callback is executed. Defaults to this Component.</param>
 public virtual void Hide(string animateTarget, JFunction callback, string scope)
 {
     this.Call("hide", animateTarget, callback, new JRawValue(scope));
 }
Beispiel #10
0
 /// <summary>
 /// Expand the tree to the path of a particular node, then select it.
 /// </summary>
 /// <param name="path">The path to select. The path should include a leading separator.</param>
 /// <param name="field">The field to get the data from. Defaults to the model idProperty.</param>
 /// <param name="separator">A separator to use. Defaults to '/'.</param>
 /// <param name="callback">A function to execute when the select finishes. The callback will be called with (bSuccess, oLastNode) where bSuccess is if the select was successful and oLastNode is the last node that was expanded.</param>
 /// <param name="scope">The scope of the callback function</param>
 public virtual void SelectPath(string path, string field, string separator, JFunction callback, string scope)
 {
     this.Call("selectPath", path, field, separator, callback, new JRawValue(scope));
 }
 /// <summary>
 /// Hides this Component, setting it to invisible using the configured hideMode.
 /// </summary>
 /// <param name="animateTarget">only valid for floating Components such as Windows or ToolTips, or regular Components which have been configured with floating: true.. The target to which the Component should animate while hiding (defaults to null with no animation)</param>
 /// <param name="callback">A callback function to call after the Component is hidden.</param>
 public virtual void Hide(string animateTarget, JFunction callback)
 {
     this.Call("hide", animateTarget, callback);
 }
        /// <summary>
        /// Evento de clic del botón Guardar
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void imgbtnGuardar_Click(object sender, DirectEventArgs e)
        {
            //1. Obtener datos de la Forma y saber si es edición o nuevo
            string strRegistro = e.ExtraParams["registro"];
            string strEstatus = e.ExtraParams["estatus"];
            string strArchivo = e.ExtraParams["archivo"];
            string strSucursal = e.ExtraParams["sucursal"];

            string strcookieEditarPreciario = Cookies.GetCookie("cookieEditarPreciario").Value;
            Dictionary<string, string> dRegistro = JSON.Deserialize<Dictionary<string, string>>(strRegistro);
            string strPreciarioDetalle = e.ExtraParams["DetallePreciario"];

            //2. Se guarda en una lista el Store que contiene todos los campos para deserealizarlos y usarlos para el insert
            List<PreciarioConcepto> lDetallePreciario = JSON.Deserialize<List<PreciarioConcepto>>(strPreciarioDetalle);
            Preciario oPreciario = new Preciario();

            //3. Por cada elemento del submit de la Forma detectar el campo y asignarlo al objeto correspondiente
            foreach (KeyValuePair<string, string> sd in dRegistro)
            {
                switch (sd.Key)
                {
                    //4. Datos del preciario
                    case "txtfID":
                        oPreciario.ID = sd.Value;
                        break;
                    case "txtfDescripcion":
                        oPreciario.Descripcion = sd.Value;
                        break;
                    case "cmbEstatus":
                        oPreciario.Estatus = sd.Value;
                        break;
                    case "IdCliente":
                        oPreciario.Cliente = sd.Value;
                        break;
                }
            }

            //5. Se toma el nombre del archivo de Excel que se está cargando
            oPreciario.Archivo = fufArchivoExcel.FileName;

            //6. Validar si es nuevo o es uno existente
            if (strcookieEditarPreciario.Equals("Nuevo"))
            {
                //Checar ticket de autenticación
                UsuarioBusiness.checkValidSession(this);

                //7. Traemeos el objeto de sesion para llenr el objeto con los datos de usuario
                oPreciario.FechaAlta = DateTime.Now;
                Usuario oUsuario = (Usuario)Session["Usuario"];
                oPreciario.Usuario = oUsuario.ID;
                oPreciario.Estatus = strEstatus;
                oPreciario.Sucursal = strSucursal;

                //8. Insertar en la base de datos
                oPreciario.ID = PreciarioBusiness.Insertar(oPreciario);
                string categoria = "";
                string subcategoria = "";
                string subsubcategoria = "";

                foreach (PreciarioConcepto sd in lDetallePreciario)
                {
                    //9. Insertar Categoria
                    if (sd.Tipo.Equals("1"))
                    {
                        PreciarioCategoria c = new PreciarioCategoria();
                        c.Clave = sd.Clave;
                        c.Preciario = oPreciario.ID;
                        c.Descripcion = sd.Descripcion;
                        c.Usuario = oUsuario.ID;
                        c.Estatus = sd.Estatus;
                        c.FechaAlta =Convert.ToDateTime(sd.FechaAlta);
                        categoria =PreciarioCategoriaBuisness.Insertar(c);
                    }
                    //10. Insertar SubCategoria
                    if (sd.Tipo.Equals("2"))
                    {
                        PreciarioSubCategoria sc = new PreciarioSubCategoria();
                        sc.Clave = sd.Clave;
                        sc.Preciario = oPreciario.ID;
                        sc.Descripcion = sd.Descripcion;
                        sc.Categoria = categoria;
                        sc.Usuario = oUsuario.ID;
                        sc.Estatus = sd.Estatus;
                        sc.FechaAlta = Convert.ToDateTime(sd.FechaAlta);
                        subcategoria= PreciarioSubCategoriaBusiness.Insertar(sc);
                    }
                    //11. Insertar SubSubCategoria
                    if (sd.Tipo.Equals("3"))
                    {
                        PreciarioSubSubCategoria ssc = new PreciarioSubSubCategoria();
                        ssc.Clave = sd.Clave;
                        ssc.Preciario = oPreciario.ID;
                        ssc.Descripcion = sd.Descripcion;
                        ssc.Categoria = categoria;
                        ssc.SubCategoria = subcategoria;
                        ssc.Usuario = oUsuario.ID;
                        ssc.Estatus = sd.Estatus;
                        ssc.FechaAlta = Convert.ToDateTime(sd.FechaAlta);
                        subsubcategoria= PreciarioSubSubCategoriaBusiness.Insertar(ssc);
                    }
                    //12. Insertar Concepto
                    if (sd.Tipo.Equals(""))
                    {
                        PreciarioConcepto pc = new PreciarioConcepto();
                        pc.Clave = sd.Clave;
                        pc.Preciario = oPreciario.ID;
                        pc.Descripcion = sd.Descripcion;
                        pc.Unidad = sd.Unidad;
                        pc.Cantidad = sd.Cantidad;
                        pc.Utilizada = 0;
                        pc.Costo = sd.Costo;
                        pc.Importe = sd.Importe;
                        pc.Importefinal = 0;
                        pc.Categoria = categoria;
                        pc.SubCategoria = subcategoria;
                        pc.SubSubCategoria = subsubcategoria;
                        pc.Usuario = oUsuario.ID;
                        pc.Estatus = sd.Estatus;
                        pc.FechaAlta = sd.FechaAlta;
                        PreciarioConceptoBusiness.Insertar(pc);
                    }
                }

                //13. Mandar mensaje con el código del Preciario
                var success = new JFunction { Fn = "imgbtnGuardar_Click_Success" };
                X.Msg.Alert("Registro completo", "<p align='center'>Preciario registrada con ID: <br/>" + oPreciario.ID + ".</p>", success).Show();
            }
            else
            {
                //14. Valida que archivo guardar
                if (fufArchivoExcel.FileName.Equals(""))
                    oPreciario.Archivo = strArchivo;
                else
                    oPreciario.Archivo = fufArchivoExcel.FileName;

                //15. Tomamos la sucursal y estatus como parametro independiente por que ya esta desabilitada
                oPreciario.ID = strcookieEditarPreciario;
                oPreciario.Sucursal = strSucursal;
                oPreciario.Estatus = strEstatus;

                //16. Actualizar los datos del Preciario
                PreciarioBusiness.Actualizar(oPreciario);

                //17. Mandar mensaje con el código del preciario
                var success = new JFunction { Fn = "imgbtnGuardar_Click_Success" };
                X.Msg.Alert("Actualización completa", "<p align='center'>Se han actualizado los datos del preciario <br/>" + oPreciario.ID + ".</p>", success).Show();
            }
        }
Beispiel #13
0
 /// <summary>
 /// Expand all nodes
 /// </summary>
 /// <param name="callback">A function to execute when the expand finishes.</param>
 public virtual void ExpandAll(JFunction callback)
 {
     this.Call("expandAll", callback);
 }
 public virtual void Mon(Observable el, string eventName, JFunction fn, string scope)
 {
     this.Call("mon", new JRawValue(el.ClientID), eventName, fn, new JRawValue(scope));
 }
Beispiel #15
0
 public virtual void FilterBy(JFunction fn)
 {
     this.Call("filterBy", new JRawValue(fn.ToScript()));
 }
 /// <summary>
 ///
 /// </summary>
 public virtual TBuilder Update(string html, bool loadScripts, JFunction callback)
 {
     this.ToComponent().Update(html, loadScripts, callback);
     return(this as TBuilder);
 }
 /// <summary>
 ///
 /// </summary>
 public virtual TBuilder PreInit(JFunction preInit)
 {
     this.ToComponent().PreInit = preInit;
     return(this as TBuilder);
 }
        public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, JsonSerializer serializer)
        {
            if (value != null && value is ComponentDirectEvent)
            {
                ComponentDirectEvent directEvent = (ComponentDirectEvent)value;

                if (!directEvent.IsDefault)
                {
                    Control owner = null;
                    MessageBusDirectEvent busEvent = directEvent as MessageBusDirectEvent;

                    if (this.Owner is BaseItem)
                    {
                        owner = ((BaseItem)this.Owner).Owner;
                    }
                    else if (this.Owner is Control)
                    {
                        owner = (Control)this.Owner;
                    }

                    directEvent.Owner = owner;
                    directEvent.ExtraParams.Owner = owner;

                    foreach (Parameter param in directEvent.ExtraParams)
                    {
                        param.Owner = owner;
                    }

                    HandlerConfig cfg = directEvent.GetListenerConfig();
                    if (cfg.Delay == 0 && directEvent.HasOwnDelay)
                    {
                        cfg.Delay = -1;
                    }

                    string deScope = directEvent.Scope;
                    directEvent.ClearListenerConfig();
                    
                    string configObject = new ClientConfig().SerializeInternal(directEvent, directEvent.Owner);

                    StringBuilder cfgObj = new StringBuilder(configObject.Length + 64);

                    cfgObj.Append(configObject);
                    cfgObj.Remove(cfgObj.Length - 1, 1);
                    cfgObj.AppendFormat("{0}control:this", configObject.Length > 2 ? "," : "");

                    if (busEvent != null)
                    {
                        cfgObj.Append(",eventType:'bus'");
                    }

                    if (busEvent == null)
                    {
                        if (this.PropertyName != "Click")
                        {
                            cfgObj.AppendFormat(",action:'{0}'", this.PropertyName);
                        }
                    }
                    else
                    {
                        cfgObj.AppendFormat(",action:'{0}:'+name", busEvent.Name);
                    }
                    

                    cfgObj.Append("}");

                    if (this.PropertyName.IsNotEmpty())
                    {
                        directEvent.SetArgumentList(this.Owner.GetType().GetProperty(this.PropertyName));
                    }

                    JFunction jFunction = new JFunction("Ext.net.directRequest(".ConcatWith(cfgObj.ToString(), ");"), directEvent.ArgumentList.ToArray());

                    string scope = deScope.IsEmpty() || deScope == "this" ? "" : deScope;

                    StringBuilder sb = new StringBuilder();
                    
                    sb.Append("{");
                    sb.Append("fn:").Append(jFunction.ToScript()).Append(",");

                    if (scope.Length > 0)
                    {
                        sb.Append("scope:").Append(scope).Append(",");
                    }

                    if (busEvent != null)
                    {
                        if (busEvent.Bus.IsNotEmpty())
                        {
                            sb.Append("bus:'").Append(busEvent.Bus).Append("',");
                        }
                        if (busEvent.Name.IsNotEmpty())
                        {
                            sb.Append("name:'").Append(busEvent.Name).Append("',");
                        }                                                
                    }

                    string cfgStr = cfg.Serialize();

                    if (cfgStr != "{}")
                    {
                        sb.Append(cfgStr.Chop());
                    }

                    if (sb[sb.Length - 1] == ',')
                    {
                        sb.Remove(sb.Length - 1, 1);
                    }

                    sb.Append("}");

                    writer.WriteRawValue(sb.ToString());

                    return;
                }
            }

            writer.WriteRawValue("{}");
        }
Beispiel #19
0
 public MessageBox Alert(string title, string msg, JFunction fn)
 {
     return(this.Alert(title, msg, fn, ""));
 }
 /// <summary>
 /// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
 /// </summary>
 /// <param name="title">The title bar text</param>
 /// <param name="msg">The message box body text</param>
 /// <param name="fn">(optional) The callback function invoked after the message box is closed</param>
 public MessageBox Prompt(string title, string msg, JFunction fn)
 {
     return this.Prompt(title, msg, fn, "");
 }
        /// <summary>
        /// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
        /// </summary>
        /// <param name="title">The title bar text</param>
        /// <param name="msg">The message box body text</param>
        /// <param name="fn">(optional) The callback function invoked after the message box is closed</param>
        /// <param name="scope">(optional) The scope of the callback function</param>
        /// <param name="multiline">(optional) True to create a multiline textbox using the defaultTextHeight property, or the height in pixels to create the textbox (defaults to false / single-line)</param>
        /// <param name="value">(optional) Default value of the text input element (defaults to '')</param>
        public MessageBox Prompt(string title, string msg, JFunction fn, string scope, Unit multiline, string value)
        {
            MessageBoxConfig config = new MessageBoxConfig();
            config.Title = title;
            config.Message = msg;
            config.Buttons = Button.OKCANCEL;
            config.Fn = fn;
            config.MinWidth = Unit.Pixel(250);
            config.Scope = scope;
            config.Prompt = true;
            config.MultilineHeight = multiline;
            config.Value = value;

            return this.Configure(config);
        }
 /// <summary>
 /// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
 /// </summary>
 /// <param name="title">The title bar text</param>
 /// <param name="msg">The message box body text</param>
 /// <param name="fn">(optional) The callback function invoked after the message box is closed</param>
 /// <param name="scope">(optional) The scope of the callback function</param>
 public MessageBox Prompt(string title, string msg, JFunction fn, string scope)
 {
     return this.Prompt(title, msg, fn, scope, false, "");
 }
 /// <summary>
 /// Shows this AbstractComponent, rendering it first if Ext.AbstractComponent-autoRender is true.
 /// For a Window, it activates it and brings it to front if hidden.
 /// </summary>
 /// <param name="animTarget"> The target element or id from which the AbstractComponent should animate while opening (defaults to null with no animation)</param>
 /// <param name="callback">A callback function to call after the window is displayed. Only necessary if animation was specified.</param>
 /// <param name="scope">The scope (this reference) in which the callback is executed. Defaults to this AbstractComponent.</param>
 public virtual void Show(string animTarget, JFunction callback, string scope)
 {
     this.Call("show", animTarget, callback, new JRawValue(scope));
 }
Beispiel #24
0
 /// <summary>
 /// Hides this Component, setting it to invisible using the configured hideMode.
 /// </summary>
 /// <param name="animateTarget">only valid for floating Components such as Windows or ToolTips, or regular Components which have been configured with floating: true.. The target to which the Component should animate while hiding (defaults to null with no animation)</param>
 /// <param name="callback">A callback function to call after the Component is hidden.</param>
 public virtual void Hide(string animateTarget, JFunction callback)
 {
     this.Call("hide", animateTarget, callback);
 }
Beispiel #25
0
 public virtual void FilterBy(JFunction fn, string scope)
 {
     this.Call("filterBy", fn, new JRawValue(scope));
 }
Beispiel #26
0
 /// <summary>
 /// Hides this Component, setting it to invisible using the configured hideMode.
 /// </summary>
 /// <param name="animateTarget">only valid for floating Components such as Windows or ToolTips, or regular Components which have been configured with floating: true.. The target to which the Component should animate while hiding (defaults to null with no animation)</param>
 /// <param name="callback">A callback function to call after the Component is hidden.</param>
 /// <param name="scope">The scope (this reference) in which the callback is executed. Defaults to this Component.</param>
 public virtual void Hide(ComponentBase animateTarget, JFunction callback, string scope)
 {
     this.Call("hide", new JRawValue(animateTarget.ClientID), callback, new JRawValue(scope));
 }
Beispiel #27
0
 public virtual void Each(JFunction fn, string scope)
 {
     this.Call("each", new JRawValue(fn.ToScript()), new JRawValue(scope));
 }
Beispiel #28
0
 /// <summary>
 /// Hides this Component, setting it to invisible using the configured hideMode.
 /// </summary>
 /// <param name="animateTarget">only valid for floating Components such as Windows or ToolTips, or regular Components which have been configured with floating: true.. The target to which the Component should animate while hiding (defaults to null with no animation)</param>
 /// <param name="callback">A callback function to call after the Component is hidden.</param>
 /// <param name="scope">The scope (this reference) in which the callback is executed. Defaults to this Component.</param>
 public virtual void Hide(string animateTarget, JFunction callback, string scope)
 {
     this.Call("hide", animateTarget, callback, new JRawValue(scope));
 }
Beispiel #29
0
 public virtual void GuaranteeRange(int start, int end, JFunction callback)
 {
     this.Call("guaranteeRange", start, end, JRawValue.From(callback.ToScript()));
 }
Beispiel #30
0
 public virtual void Show(string animTarget, JFunction callback)
 {
     this.Call("show", animTarget, callback);
 }
Beispiel #31
0
 /// <summary>
 /// Expand all nodes
 /// </summary>
 /// <param name="callback">A function to execute when the expand finishes.</param>
 /// <param name="scope">The scope of the callback function</param>
 public virtual void ExpandAll(JFunction callback, string scope)
 {
     this.Call("expandAll", callback, new JRawValue(scope));
 }
 public MessageBox Confirm(string title, string msg, JFunction fn)
 {
     return(this.Confirm(title, msg, fn, ""));
 }
Beispiel #33
0
 /// <summary>
 /// Expand the tree to the path of a particular node.
 /// </summary>
 /// <param name="path">The path to expand. The path should include a leading separator.</param>
 /// <param name="field">The field to get the data from. Defaults to the model idProperty.</param>
 /// <param name="separator">A separator to use. Defaults to '/'.</param>
 /// <param name="callback">A function to execute when the expand finishes. The callback will be called with (success, lastNode) where success is if the expand was successful and lastNode is the last node that was expanded.</param>
 public virtual void ExpandPath(string path, string field, string separator, JFunction callback)
 {
     this.Call("expandPath", path, field, separator, callback);
 }
 /// <summary>
 /// Cascades down the component/container heirarchy from this component (passed in the first call), calling the specified function with each component.
 /// </summary>
 /// <param name="fn">The function to call</param>
 /// <param name="scope">The scope of the function (defaults to current component)</param>
 public virtual void Cascade(JFunction fn, string scope)
 {
     this.Call("cascade", JRawValue.From(fn.ToScript()), JRawValue.From(scope));
 }
Beispiel #35
0
 /// <summary>
 /// Expand the tree to the path of a particular node, then select it.
 /// </summary>
 /// <param name="path">The path to select. The path should include a leading separator.</param>
 /// <param name="field">The field to get the data from. Defaults to the model idProperty.</param>
 /// <param name="separator">A separator to use. Defaults to '/'.</param>
 /// <param name="callback">A function to execute when the select finishes. The callback will be called with (bSuccess, oLastNode) where bSuccess is if the select was successful and oLastNode is the last node that was expanded.</param>
 public virtual void SelectPath(string path, string field, string separator, JFunction callback)
 {
     this.Call("selectPath", path, field, separator, callback);
 }
Beispiel #36
0
        /*  Public Methods
            -----------------------------------------------------------------------------------------------*/

        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="fn"></param>
        public virtual void Subscribe(string name, JFunction fn)
        {
            this.Call("subscribe", name, new JRawValue(fn.ToScript()));
        }
 /// <summary>
 /// Hides this Component, setting it to invisible using the configured hideMode.
 /// </summary>
 /// <param name="animateTarget">only valid for floating Components such as Windows or ToolTips, or regular Components which have been configured with floating: true.. The target to which the Component should animate while hiding (defaults to null with no animation)</param>
 /// <param name="callback">A callback function to call after the Component is hidden.</param>
 /// <param name="scope">The scope (this reference) in which the callback is executed. Defaults to this Component.</param>
 public virtual void Hide(ComponentBase animateTarget, JFunction callback, string scope)
 {
     this.Call("hide", new JRawValue(animateTarget.ClientID), callback, new JRawValue(scope));
 }
 public virtual void AddListener(string eventName, JFunction fn)
 {
     this.AddListener(eventName, fn.ToScript());
 }
 public virtual void Show(string animTarget, JFunction callback)
 {
     this.Call("show", animTarget, callback);
 }
 public virtual void On(string eventName, JFunction fn, string scope, HandlerConfig options)
 {
     this.AddListener(eventName, "<raw>" + fn.ToScript(), scope, options);
 }
Beispiel #41
0
 /// <summary>
 /// Shows this AbstractComponent, rendering it first if Ext.AbstractComponent-autoRender is true.
 /// For a Window, it activates it and brings it to front if hidden.
 /// </summary>
 /// <param name="animTarget"> The target element or id from which the AbstractComponent should animate while opening (defaults to null with no animation)</param>
 /// <param name="callback">A callback function to call after the window is displayed. Only necessary if animation was specified.</param>
 /// <param name="scope">The scope (this reference) in which the callback is executed. Defaults to this AbstractComponent.</param>
 public virtual void Show(string animTarget, JFunction callback, string scope)
 {
     this.Call("show", animTarget, callback, new JRawValue(scope));
 }
        /// <summary>
        /// Evento de clic del botón Guardar
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void imgbtnGuardar_Click(object sender, DirectEventArgs e)
        {
            //1. Obtener datos de la Forma y saber si es edición o nuevo
            string strRegistro = e.ExtraParams["registro"];
            string strEstatus = e.ExtraParams["estatus"];
            string strFinObra = e.ExtraParams["FInObra"];
            string strSemanasObra = e.ExtraParams["semanasObra"];

            string strcookieEditarSucursal = Cookies.GetCookie("cookieEditarSucursal").Value;

            Dictionary<string, string> dRegistro = JSON.Deserialize<Dictionary<string, string>>(strRegistro);
            Sucursal oSucursal = new Sucursal();
            oSucursal.FechaAlta = DateTime.Now;

            string strcookieCP = "";
            string strcookieMunicipio = "";
            string strcookieEstado = "";
            string strcookieColonia = "";

            if (strcookieEditarSucursal.Equals("Nuevo"))
            {

                strcookieCP = Cookies.GetCookie("cookieCP").Value;
                strcookieMunicipio = Cookies.GetCookie("cookieMunicipio").Value;
                strcookieEstado = Cookies.GetCookie("cookieEstado").Value;
                strcookieColonia = Cookies.GetCookie("cookieColonia").Value;
                oSucursal.CodigoPostal = strcookieCP;
                oSucursal.Colonia = strcookieColonia;
                oSucursal.Estado = strcookieEstado;
                oSucursal.Municipio = strcookieMunicipio;
            }
            else {
                strcookieCP = Cookies.GetCookie("cookieCP").Value;
                strcookieMunicipio = Cookies.GetCookie("cookieMunicipio").Value;
                strcookieEstado = Cookies.GetCookie("cookieEstado").Value;
                strcookieColonia = Cookies.GetCookie("cookieColonia").Value;
                if (strcookieCP.Length > 0)
                {
                    oSucursal.CodigoPostal = strcookieCP;
                    oSucursal.Colonia = strcookieColonia;
                    oSucursal.Estado = strcookieEstado;
                    oSucursal.Municipio = strcookieMunicipio;
                } else {
                    Sucursal oSucursalForma = SucursalBusiness.ObtenerSucursalPorID(strcookieEditarSucursal);
                    if (oSucursal != null)
                    {
                        oSucursal.CodigoPostal = oSucursalForma.CodigoPostal;
                        oSucursal.Colonia = oSucursalForma.Colonia;
                        oSucursal.Estado = oSucursalForma.Estado;
                        oSucursal.Municipio = oSucursalForma.Municipio;
                    }
                }

            }

            //2. Por cada elemento del submit de la Forma detectar el campo y asignarlo al objeto correspondiente
            foreach (KeyValuePair<string, string> sd in dRegistro)
            {
                switch (sd.Key)
                {
                    //3. Datos del proveedor
                    case "nfCR":
                        oSucursal.CR = Convert.ToInt16(sd.Value);
                        break;
                    case "txtfNombre":
                        oSucursal.Nombre = sd.Value;
                        break;
                    case "txtfDireccionZona":
                        oSucursal.Direccionzona = sd.Value;
                        break;
                    case "txtfGerenteBBVANombre":
                        oSucursal.GerenteBBVANombre = sd.Value;
                        break;
                    case "txtfGerenteBBVAAPaterno":
                        oSucursal.GerenteBBVAAPaterno = sd.Value;
                        break;
                    case "txtfGerenteBBVAAMaterno":
                        oSucursal.GerenteBBVAAMaterno = sd.Value;
                        break;
                    case "txtfSupervisorNombre":
                        oSucursal.SupervisorNombre = sd.Value;
                        break;
                    case "txtfSupervisorAPaterno":
                        oSucursal.SupervisorAPaterno = sd.Value;
                        break;
                    case "txtfSupervisorAMaterno":
                        oSucursal.SupervisorAMaterno = sd.Value;
                        break;
                    case "txtfProveedorEnergia":
                        oSucursal.ProveedorEnergia = sd.Value;
                        break;
                    case "nfSuperficie":
                        oSucursal.Superficie = Convert.ToInt32(sd.Value);
                        break;
                    case "txtfCoordinadorNombre":
                        oSucursal.CoordinadorNombre = sd.Value;
                        break;
                    case "txtfCoordinadorAPaterno":
                        oSucursal.CoordinadorAPaterno = sd.Value;
                        break;
                    case "txtfCoordinadorAMaterno":
                        oSucursal.CoordinadorAMaterno = sd.Value;
                        break;
                    case "txtfCalle":
                        oSucursal.Calle = sd.Value;
                        break;
                    case "txtfEntreCalles":
                        oSucursal.EntreCalles = sd.Value;
                        break;
                    case "txtfNoExterior":
                        oSucursal.NoExterior = sd.Value;
                        break;
                    case "txtfNoInterior":
                        oSucursal.NoInterior = sd.Value;
                        break;
                    //case "txtfCodigoPostal":
                    //    oSucursal.CodigoPostal = Convert.ToInt32(sd.Value);
                    //    break;
                    //case "cmbColonia":
                    //    oSucursal.Colonia = sd.Value;
                    //    break;
                    //case "cmbEstado":
                    //    oSucursal.Estado = sd.Value;
                    //    break;
                    //case "cmbMunicipio":
                    //    oSucursal.Municipio = sd.Value;
                    //    break;
                    case "cmbProveedor":
                        oSucursal.Contratista = sd.Value;
                        break;
                    case "dfInicioObra":
                        oSucursal.InicioObra = Convert.ToDateTime(sd.Value);
                        break;
                    case "dfFechaAlta":
                        oSucursal.FechaAlta = Convert.ToDateTime(sd.Value);
                        break;
                    case "cmbEstatus":
                        oSucursal.Estatus = sd.Value;
                        break;
                    case "cmbEmpresaSupervisora":
                        oSucursal.EmpresaSupervisora = sd.Value == null || sd.Value.Equals("") ? "" : sd.Value;
                        break;
                    case "cmbTipoConcepto":
                        oSucursal.TipoConcepto = sd.Value == null || sd.Value.Equals("") ? "" : sd.Value;
                        break;
                    case "txtTipoObra":
                        oSucursal.TipoObra = sd.Value == null || sd.Value.Equals("") ? "" : sd.Value;
                        break;
                }
            }
            oSucursal.FinObra = Convert.ToDateTime(strFinObra);
            oSucursal.SemanasObra = Convert.ToInt16(strSemanasObra);
            string strcookieCliente = Cookies.GetCookie("cookieEditarCliente").Value != null || Cookies.GetCookie("cookieEditarCliente").Value.Length > 0 ? Cookies.GetCookie("cookieEditarCliente").Value : "";
            oSucursal.Cliente = strcookieCliente;

            if(strcookieCliente != null && !strcookieCliente.Equals("")){
                oSucursal.Cliente = strcookieCliente;
            }
            //4. Validar si es nuevo o es uno existente
            if (strcookieEditarSucursal.Equals("Nuevo"))
            {
                //5. Insertar en la base de datos
                oSucursal.FechaAlta = DateTime.Now;
                oSucursal.Estatus = "ALTA";

                if (SucursalBusiness.ObtenerCREnSucursales(oSucursal.CR, strcookieCliente))
                {
                    var success = new JFunction { Fn = "imgbtnGuardar_Click_SuccessCR" };
                    X.Msg.Alert("Alerta", "<p align='center'>El cliente ya posee esta sucursal registrada con CR: <br/>" + oSucursal.CR + ".</p>", success).Show();
                }else{
                    oSucursal.ID = SucursalBusiness.Insertar(oSucursal);
                    //6. Mandar mensaje con el código del proveedor
                    var success = new JFunction { Fn = "imgbtnGuardar_Click_Success" };
                    X.Msg.Alert("Registro completo", "<p align='center'>Sucursal registrada con ID: <br/>" + oSucursal.ID + ".</p>", success).Show();
                }
            }
            else
            {
                oSucursal.ID = strcookieEditarSucursal;
                oSucursal.Estatus = strEstatus;
                //7. Actualizar los datos del proveedor
                SucursalBusiness.Actualizar(oSucursal);
                //8. Mandar mensaje con el código del proveedor
                var success = new JFunction { Fn = "imgbtnGuardar_Click_Success" };
                X.Msg.Alert("Actualización completa", "<p align='center'>Se han actualizado los datos de la sucursal <br/>" + oSucursal.ID + ".</p>", success).Show();
            }
        }
 /// <summary>
 /// Cascades down the component/container heirarchy from this component (passed in the first call), calling the specified function with each component.
 /// </summary>
 /// <param name="fn">The function to call</param>
 public virtual void Cascade(JFunction fn)
 {
     this.Call("cascade", JRawValue.From(fn.ToScript()));
 }
Beispiel #44
0
 public virtual void AddListener(string eventName, JFunction fn)
 {
     this.AddListener(eventName, fn.ToScript());
 }
Beispiel #45
0
 /// <summary>
 /// Assigns this button's click handler
 /// </summary>
 /// <param name="function">The function to call when the arrow is clicked</param>
 public virtual void SetArrowHandler(JFunction function)
 {
     this.Call("setArrowHandler", new JRawValue(function.ToScript()));
 }
Beispiel #46
0
 public virtual void On(string eventName, JFunction fn, string scope)
 {
     this.AddListener(eventName, "<raw>" + fn.ToScript(), scope);
 }
Beispiel #47
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="name"></param>
 /// <param name="fn"></param>
 /// <param name="options"></param>
 public virtual void Subscribe(string name, JFunction fn, HandlerConfig options)
 {
     this.Call("subscribe", name, new JRawValue(fn.ToScript()), new JRawValue(options.Serialize()));
 }
Beispiel #48
0
 public virtual void On(string eventName, JFunction fn, string scope, HandlerConfig options)
 {
     this.AddListener(eventName, "<raw>" + fn.ToScript(), scope, options);
 }
 public virtual void On(string eventName, JFunction fn, string scope)
 {
     this.AddListener(eventName, "<raw>" + fn.ToScript(), scope);
 }
Beispiel #50
0
 public virtual void Mon(Element el, string eventName, JFunction fn, string scope)
 {
     this.Call("mon", new JRawValue(el.Descriptor), eventName, fn, new JRawValue(scope));
 }
 public virtual void Mon(Element el, string eventName, JFunction fn, string scope)
 {
     this.Call("mon", new JRawValue(el.Descriptor), eventName, fn, new JRawValue(scope));
 }
Beispiel #52
0
 public virtual void Mon(Observable el, string eventName, JFunction fn, string scope)
 {
     this.Call("mon", new JRawValue(el.ClientID), eventName, fn, new JRawValue(scope));
 }
Beispiel #53
0
 /// <summary>
 /// Find the index of the first matching Record in this Store by a function. If the function returns true it is considered a match.
 /// </summary>
 /// <param name="fn">The function to be called. It will be passed the following parameters:
 /// record : Ext.data.Model
 ///     The record to test for filtering. Access field values using Ext.data.Model.get.
 /// id : Object
 ///     The ID of the Record passed.
 /// </param>
 /// <returns></returns>
 public virtual ModelProxy FindBy(JFunction fn)
 {
     if (fn.Args == null || fn.Args.Length == 0)
     {
         fn.Args = new string[] { "record", "id" };
     }
     string pattern = string.Format("findBy({0})", fn);
     return new ModelProxy(this, pattern);
 }
Beispiel #54
0
 public MessageBox Confirm(string title, string msg, JFunction fn)
 {
     return this.Confirm(title, msg, fn, "");
 }
Beispiel #55
0
 public virtual void Each(JFunction fn)
 {
     this.Call("each", new JRawValue(fn.ToScript()));
 }
Beispiel #56
0
        public MessageBox Confirm(string title, string msg, JFunction fn, string scope)
        {
            MessageBoxConfig config = new MessageBoxConfig();
            config.Title = title;
            config.Message = msg;
            config.Buttons = Button.YESNO;
            config.Fn = fn;
            config.Scope = scope;
            config.Icon = Icon.QUESTION;

            return this.Configure(config);
        }
Beispiel #57
0
 public virtual void FilterBy(JFunction fn, string scope)
 {
     this.Call("filterBy", new JRawValue(fn.ToScript()), new JRawValue(scope));
 }
Beispiel #58
0
 /// <summary>
 /// Collapse all nodes
 /// </summary>
 /// <param name="callback">A function to execute when the collapse finishes.</param>
 /// <param name="scope">The scope of the callback function</param>
 public virtual void CollapseAll(JFunction callback, string scope)
 {
     this.Call("collpaseAll", callback, new JRawValue(scope));
 }
 /// <summary>
 /// Assigns this button's click handler
 /// </summary>
 /// <param name="function">The function to call when the arrow is clicked</param>
 public virtual void SetArrowHandler(JFunction function)
 {
     this.Call("setArrowHandler", new JRawValue(function.ToScript()));
 }
Beispiel #60
0
 /// <summary>
 /// Collapse all nodes
 /// </summary>
 /// <param name="callback">A function to execute when the collapse finishes.</param>
 public virtual void CollapseAll(JFunction callback)
 {
     this.Call("collpaseAll", callback);
 }