Exemplo n.º 1
0
        public override global::System.Data.DataSet Clone()
        {
            DsGuiasClienteDetalle cln = ((DsGuiasClienteDetalle)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Exemplo n.º 2
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            DsGuiasClienteDetalle ds = new DsGuiasClienteDetalle();

            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);
        }
        private void BindGrid(int currentPage)
        {
            try
            {
                if (this.usuario.ClienteID == 0)
                {
                    throw new Exception("El usuario conectado no corresponde a un cliente.");
                }

                DataSet ds = new DataSet();
                SisPackController.AdministrarGrillas.Configurar(hgGuias, "GuiaID", this.CantidadOpciones);

                string tGuia    = "";
                string tipoGuia = "";

                if (this.rbtCodigoBarras.Checked && this.txtCodigoBarras.Text.Length > 0)
                {
                    tGuia = this.txtCodigoBarras.Text.Substring(0, 1);

//					if (tGuia != "3" && tGuia != "4")
//						throw new Exception("El código de barras ingresado no es válido.");

                    tipoGuia = NegociosSisPackInterface.SisPack.TipoGuia(tGuia);
                    if (tipoGuia.Equals(""))
                    {
                        throw new Exception("El código de barras ingresado no es válido.");
                    }

                    this.ddlTipoGuia.SelectedValue = tipoGuia;
                    this.txtNroSucursal.Text       = this.txtCodigoBarras.Text.Substring(1, 4);
                    this.txtNroGuia.Text           = this.txtCodigoBarras.Text.Substring(5);
                }
                else if (this.rbtNroGuia.Checked)
                {
                    tipoGuia = this.ddlTipoGuia.SelectedValue;
                }

                DateTime fechaDesde = Utiles.Fechas.FormatFechaDDMMYYYY(this.txtFechaDesde.Text.Length > 0 ? this.txtFechaDesde.Text : "01/01/1900");
                DateTime fechaHasta = Utiles.Fechas.FormatFechaDDMMYYYY(this.txtFechaHasta.Text.Length > 0 ? this.txtFechaHasta.Text : "31/12/2050");

//				if (tGuia == "3")
//					tipoGuia = "A";
//				else if (tGuia == "4")
//					tipoGuia = "B";

                int nroGuia         = Utiles.Validaciones.obtieneEntero(this.txtNroGuia.Text);
                int nroSucursalGuia = Utiles.Validaciones.obtieneEntero(this.txtNroSucursal.Text);

                ICliente       cliente        = ClienteFactory.GetCliente();
                DsGuiasCliente dsGuiasCliente = cliente.GetGuias(fechaDesde, fechaHasta, tipoGuia, nroGuia, nroSucursalGuia, this.usuario.ClienteID);

                ds.Tables.Add(dsGuiasCliente.Datos.Clone());
                ds.Tables[0].TableName = "GuiasCliente";

                foreach (System.Data.DataRow row in dsGuiasCliente.Datos.Rows)
                {
                    ds.Tables["GuiasCliente"].ImportRow(row);
                }

                DsGuiasClienteDetalle dsDetalle = cliente.GetGuiasDetalle(fechaDesde, fechaHasta, tipoGuia, nroGuia, nroSucursalGuia, this.usuario.ClienteID);

                ds.Tables.Add(dsDetalle.Datos.Clone());
                ds.Tables[1].TableName = "Detalle";

                foreach (System.Data.DataRow row in dsDetalle.Datos.Rows)
                {
                    ds.Tables["Detalle"].ImportRow(row);
                }

                DataColumn dc1 = ds.Tables[0].Columns["GuiaID"];

                DataColumn dc2 = ds.Tables[1].Columns["GuiaID"];

                DataRelation dr = new DataRelation("GuiaID_Detalle", dc1, dc2, false);
                ds.Relations.Add(dr);

                //hgGuias.DataSource = ds;
                hgGuias.DataSource       = ds;
                hgGuias.DataMember       = "GuiasCliente";
                hgGuias.CurrentPageIndex = currentPage;
                hgGuias.DataBind();
            }
            catch (Exception ex)
            {
                ManejaErrores(ex);
            }
        }
Exemplo n.º 4
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();
                DsGuiasClienteDetalle ds = new DsGuiasClienteDetalle();

                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);
            }
Exemplo n.º 5
0
        private void BindGrid(int currentPage)
        {
            try
            {
                if (this.rbtCodigoBarras.Checked && this.txtCodigoBarras.Text.Length == 0)
                {
                    throw new Exception("Debe ingresar el código de barras que desea consultar.");
                }
                else if (this.rbtNroGuia.Checked && this.txtNroGuia.Text.Length == 0)
                {
                    throw new Exception("Debe ingresar el número de guía que desea consultar.");
                }

                if (this.txtNroGuia.Text.Length < 5)
                {
                    throw new Exception("El número de guía ingresado no es válido.");
                }

                DataSet ds = new DataSet();
                SisPackController.AdministrarGrillas.Configurar(hgGuias, "GuiaID", 10);

                /*string tGuia = "";
                 * string tipoGuia = "";
                 * if (this.rbtCodigoBarras.Checked && this.txtCodigoBarras.Text.Length > 0)
                 * {
                 *      tGuia = this.txtCodigoBarras.Text.Substring(0,1);
                 *      if (tGuia != "3" && tGuia != "4")
                 *              throw new Exception("El código de barras ingresado no es válido.");
                 *
                 *      this.ddlTipoGuia.SelectedValue = tGuia == "3" ? "A" : "B";
                 *      this.txtNroSucursal.Text = this.txtCodigoBarras.Text.Substring(1,4);
                 *      this.txtNroGuia.Text = this.txtCodigoBarras.Text.Substring(5);
                 * }
                 * else if (this.rbtNroGuia.Checked)
                 * {
                 *      tipoGuia = this.ddlTipoGuia.SelectedValue;
                 * }
                 *
                 *
                 * if (tGuia == "3")
                 *      tipoGuia = "A";
                 * else if (tGuia == "4")
                 *      tipoGuia = "B";
                 *
                 * int nroGuia = Utiles.Validaciones.obtieneEntero(this.txtNroGuia.Text);
                 * int nroSucursalGuia = Utiles.Validaciones.obtieneEntero(this.txtNroSucursal.Text);
                 */

                string codigoGuia   = this.txtNroGuia.Text;
                string codigoBarras = this.txtCodigoBarras.Text;

                ICliente       cliente        = ClienteFactory.GetCliente();
                DsGuiasCliente dsGuiasCliente = cliente.GetGuiasEventual(codigoGuia, codigoBarras, string.Empty, string.Empty, string.Empty);

                ds.Tables.Add(dsGuiasCliente.Datos.Clone());
                ds.Tables[0].TableName = "GuiasCliente";

                foreach (System.Data.DataRow row in dsGuiasCliente.Datos.Rows)
                {
                    ds.Tables["GuiasCliente"].ImportRow(row);
                }

                DsGuiasClienteDetalle dsDetalle = cliente.GetGuiasDetalleEventual(dsGuiasCliente);

                ds.Tables.Add(dsDetalle.Datos.Clone());
                ds.Tables[1].TableName = "Detalle";

                foreach (System.Data.DataRow row in dsDetalle.Datos.Rows)
                {
                    ds.Tables["Detalle"].ImportRow(row);
                }

                DataColumn dc1 = ds.Tables[0].Columns["GuiaID"];

                DataColumn dc2 = ds.Tables[1].Columns["GuiaID"];

                DataRelation dr = new DataRelation("GuiaID_Detalle", dc1, dc2, false);
                ds.Relations.Add(dr);

                /*
                 * XmlDataDocument xml = new XmlDataDocument(ds);
                 * Response.Write(xml);
                 * Response.Flush();
                 */
                //hgGuias.DataSource = ds;
                hgGuias.RowExpanded[0]   = true;
                hgGuias.DataSource       = ds;
                hgGuias.DataMember       = "GuiasCliente";
                hgGuias.CurrentPageIndex = currentPage;
                hgGuias.DataBind();
            }
            catch (Exception ex)
            {
                ManejaErrores(ex);
            }
        }