private void dtgDocumentosCobrados_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            this.dsDocumentosCA = (DsDocumentosCobradosAgencias)Session["dsDocumentos"];
            DsDocumentosCobradosAgencias.DatosRow dr = (DsDocumentosCobradosAgencias.DatosRow) this.dsDocumentosCA.Datos.Rows[e.Item.DataSetIndex];

            IDocumentoCobradoAgencia dca = DocumentoCobradoAgenciaFactory.GetDocumentoCobradoAgencia();

            dca.DocumentoCobradoAgenciaID = dr.DocumentoCobradoAgenciaID;
            try
            {
                dca.Eliminar();
                this.dtgDocumentosCobrados.EditItemIndex = -1;
                Session["dsDocumentos"] = null;
                this.BindGrilla();
            }
            catch (Exception ex)
            {
                string mensaje = ex.Message;
                try
                {
                    mensaje = this.TraducirTexto(ex.Message);
                    if (mensaje == "" || mensaje == null)
                    {
                        mensaje = ex.Message;
                    }
                }
                catch (Exception)
                {
                    mensaje = ex.Message;
                }
                ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(mensaje);
            }
        }
        private void butAgregar_Click(object sender, System.EventArgs e)
        {
            IraUltimaPagina();

            DsDocumentosCobradosAgencias ds = (DsDocumentosCobradosAgencias)Session["dsDocumentos"];

            DsDocumentosCobradosAgencias.DatosRow dr = ds.Datos.NewDatosRow();
            dr.DocumentoCobradoAgenciaID = 0;
            dr.AgenciaID    = this.AgenciaConectadaID;
            dr.DocumentoNro = "0";
            dr.Importe      = 0;
            dr.Fecha        = DateTime.Today;

            ds.Datos.AddDatosRow(dr);
            Session["dsDocumentos"] = ds;

            int iNewItemIndex = this.dtgDocumentosCobrados.Items.Count;

            if (iNewItemIndex >= this.dtgDocumentosCobrados.PageSize)
            {
                this.dtgDocumentosCobrados.CurrentPageIndex++;
                iNewItemIndex = 0;
            }

            this.dtgDocumentosCobrados.DataSource    = (DsDocumentosCobradosAgencias)Session["dsDocumentos"];
            this.dtgDocumentosCobrados.EditItemIndex = iNewItemIndex;
            this.dtgDocumentosCobrados.DataBind();
        }
        private void BindGrilla()
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgDocumentosCobrados, "DocumentoCobradoAgenciaID", this.CantidadOpciones);
            dtgDocumentosCobrados.AllowPaging = false;

            if (Session["dsDocumentos"] == null)
            {
                IDocumentoCobradoAgencia gastoCA = DocumentoCobradoAgenciaFactory.GetDocumentoCobradoAgencia();
                gastoCA.AgenciaID   = this.AgenciaConectadaID;
                this.dsDocumentosCA = gastoCA.GetDocumentosCobradosAgenciasDataSet();
            }
            else
            {
                this.dsDocumentosCA = (DsDocumentosCobradosAgencias)Session["dsDocumentos"];
                if (this.dtgDocumentosCobrados.EditItemIndex != -1)
                {
                    DataGridItem item = this.dtgDocumentosCobrados.Items[this.dtgDocumentosCobrados.EditItemIndex];
                    DsDocumentosCobradosAgencias.DatosRow dr = (DsDocumentosCobradosAgencias.DatosRow) this.dsDocumentosCA.Datos.Rows[item.DataSetIndex];

                    try
                    {
                        dr.DocumentoNro = ((TextBox)item.FindControl("txtDocumentoNro")).Text;
                        dr.Importe      = ((TextBox)item.FindControl("txtImporte")).Text == "" ? 0 : Convert.ToDouble(((TextBox)item.FindControl("txtImporte")).Text);
                    }
                    catch (Exception) {}
                    dr.Observaciones = ((TextBox)item.FindControl("txtObservaciones")).Text;
                }
            }

            Session["dsDocumentos"] = this.dsDocumentosCA;
            this.dtgDocumentosCobrados.DataSource       = this.dsDocumentosCA;
            this.dtgDocumentosCobrados.CurrentPageIndex = 0;
            this.dtgDocumentosCobrados.DataBind();
        }
示例#4
0
        public override global::System.Data.DataSet Clone()
        {
            DsDocumentosCobradosAgencias cln = ((DsDocumentosCobradosAgencias)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
        private void dtgDocumentosCobrados_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            if (((TextBox)e.Item.FindControl("txtImporte")).Text == "0")
            {
                ((TextBox)e.Item.FindControl("txtImporte")).Text = "";
            }

            RequiredFieldValidator req = (RequiredFieldValidator)((PlaceHolder)e.Item.FindControl("phValidImporte")).FindControl("ReqImporte");

            req.Enabled = true;
            req.Validate();
            if (!req.IsValid)
            {
                return;
            }

            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            this.dsDocumentosCA = (DsDocumentosCobradosAgencias)Session["dsDocumentos"];
            DsDocumentosCobradosAgencias.DatosRow dr = (DsDocumentosCobradosAgencias.DatosRow) this.dsDocumentosCA.Datos.Rows[e.Item.DataSetIndex];

            IDocumentoCobradoAgencia dca = DocumentoCobradoAgenciaFactory.GetDocumentoCobradoAgencia();

            dca.DocumentoCobradoAgenciaID = dr.DocumentoCobradoAgenciaID;
            dca.AgenciaID     = dr.AgenciaID;
            dca.DocumentoNro  = dr.DocumentoNro;
            dca.Importe       = dr.Importe;
            dca.Observaciones = dr.IsObservacionesNull() ? null : dr.Observaciones;

            try
            {
                dca.Guardar();
                this.dtgDocumentosCobrados.EditItemIndex = -1;
                Session["dsDocumentos"] = null;
                this.BindGrilla();
            }
            catch (Exception ex)
            {
                string mensaje = ex.Message;
                try
                {
                    mensaje = this.TraducirTexto(ex.Message);
                    if (mensaje == "" || mensaje == null)
                    {
                        mensaje = ex.Message;
                    }
                }
                catch (Exception)
                {
                    mensaje = ex.Message;
                }
                ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(mensaje);
            }
        }
示例#6
0
        /// <summary>
        /// Método para llenar el dataset de gastos registrados para
        /// la fecha del día por una agencia.
        /// Invoca al stored procedure DocumentoCobradoAgenciaByAgenciaID.
        /// </summary>
        /// <returns>Retorna el dataset de gastos diarios de la agencia</returns>
        public DsDocumentosCobradosAgencias GetDocumentosCobradosAgenciasDataSet()
        {
            DsDocumentosCobradosAgencias ds = new DsDocumentosCobradosAgencias();

            SqlParameter pAgenciaID = new SqlParameter("@AgenciaID", this.AgenciaID);

            Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "DocumentoCobradoAgenciaByAgenciaID", pAgenciaID);

            return(ds);
        }
示例#7
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            DsDocumentosCobradosAgencias ds = new DsDocumentosCobradosAgencias();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
示例#8
0
        /// <summary>
        /// Método para consultar los datos completos de un gasto diario de agencia.
        /// </summary>
        /// <returns>Retorna un booleando indicando si el gasto de agencia existe.</returns>
        public bool Consultar()
        {
            DsDocumentosCobradosAgencias ds = this.GetDocumentosCobradosAgenciasDataSet();

            if (ds == null)
            {
                return(false);
            }

            DsDocumentosCobradosAgencias.DatosRow dr = ds.Datos.FindByDocumentoCobradoAgenciaID(this.DocumentoCobradoAgenciaID);
            if (dr == null)
            {
                return(false);
            }

            this.fecha         = dr.Fecha;
            this.AgenciaID     = dr.AgenciaID;
            this.DocumentoNro  = dr.DocumentoNro;
            this.Importe       = dr.Importe;
            this.Observaciones = dr.IsObservacionesNull() ? null : dr.Observaciones;
            this.estado        = dr.IsEstadoNull() ? null : dr.Estado;

            return(true);
        }
示例#9
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                DsDocumentosCobradosAgencias ds = new DsDocumentosCobradosAgencias();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "DatosDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }