Example #1
0
        public override global::System.Data.DataSet Clone()
        {
            DsClientesAgrupados cln = ((DsClientesAgrupados)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Example #2
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            DsClientesAgrupados ds = new DsClientesAgrupados();

            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);
        }
        public DsClientesAgrupados ConsultarClientes(IUsuarios usuario)
        {
            DsClientesAgrupados ds = new DsClientesAgrupados();

            if (this.AgrupacionID != 0)
            {
                SqlParameter pAgrupacionID = new SqlParameter("@AgrupacionID", this.AgrupacionID);
                SqlParameter pUsuarioID    = new SqlParameter("@UsuarioID", usuario.UsuarioID);
                Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "ClientesAsociadosByAgrupacionIDUsuarioID", pAgrupacionID, pUsuarioID);
            }
            return(ds);
        }
Example #4
0
        private bool Guardar()
        {
            //el encabezado->la agrupacion
            IAgrupacionClientes agrupacion = AgrupacionClienteFactory.GetAgrupacionClientes();

            agrupacion.AgrupacionNombre = txtNombreAgrup.Text;


            agrupacion.AgrupacionID = Utiles.Validaciones.obtieneEntero(txtAgrupacionID.Text);
            agrupacion.EsPublica    = chkEsPublica.Checked;
            //el detalle -> los clientes

            if ((agrupacionID != 0) && (txtAgrupacionID.Text == ""))//modo alta
            {
                agrupacion.AgrupacionID = agrupacionID;
            }


            DsClientesAgrupados ds = new DsClientesAgrupados();

            for (int i = 0; i <= ddlClientesAsociados.Items.Count - 1; i++)
            {//recorro la lista de clientes asociados
                ds.Datos.AddDatosRow(0, agrupacion.AgrupacionID, Utiles.Validaciones.obtieneEntero(ddlClientesAsociados.Items[i].Value), "");
                ds.AcceptChanges();
            }

            if (ds != null)
            {
                if (ds.Datos.Count > 0)
                {
                    if (agrupacion.Guardar(ds, usuario))
                    {
                        agrupacionID = agrupacion.AgrupacionID;
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    ((ErrorWeb)phErrores.Controls[0]).setMensaje("Debe asociar clientes");
                    return(false);
                }
            }
            else
            {
                ((ErrorWeb)phErrores.Controls[0]).setMensaje("Debe asociar clientes");
                return(false);
            }
        }
Example #5
0
        public DsClientesAgrupados GetClientesAgrupadosDataSet(IUsuarios usuario)
        {
            try
            {
                DsClientesAgrupados ds        = new DsClientesAgrupados();
                SqlParameter        id        = new SqlParameter("@AgrupacionID", Utiles.BaseDatos.IntToSql(this.AgrupacionID));
                SqlParameter        idusuario = new SqlParameter("@UsuarioID", Utiles.BaseDatos.IntToSql(usuario.UsuarioID));

                Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "ClientesAgrupadosSEL", id, idusuario);


                return(ds);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public bool Guardar(DsClientesAgrupados ds, IUsuarios usuario)
        {
            DsClientesAgrupados.DatosRow drAgAgrup;
            ClientesAgrupados            clientes;//detalle

            using (SqlConnection conexion = new SqlConnection())
            {
                SqlTransaction transaccion = null;
                conexion.ConnectionString = Config.ConnectionString;
                try
                {
                    conexion.Open();
                    //para trabajar con transaccion
                    transaccion = conexion.BeginTransaction();
                    //escribo el encabezado servicio de transporte
                    if (this.AgrupacionID != 0)
                    //si es modificar primero voy a borrar todos los detalles y volverlos crear
                    {
                        EliminarClientes(transaccion, usuario);
                    }


                    Guardar(transaccion, usuario);//guardo el encabezado
                    for (int i = 0; i <= (ds.Datos.Rows.Count) - 1; i++)
                    {
                        drAgAgrup = (DsClientesAgrupados.DatosRow)ds.Datos.Rows[i];

                        clientes = new ClientesAgrupados();
                        clientes.AgrupacionID = this.AgrupacionID;
                        clientes.ClienteID    = drAgAgrup.ClienteID;
                        clientes.Guardar(transaccion, usuario);
                    }
                    transaccion.Commit();
                    return(true);
                }
                catch (Exception ex)
                {
                    transaccion.Rollback();
                    throw ex;
                }
            }
        }
Example #7
0
        public void Editar()
        {
            DsClientesAgrupados ds = new DsClientesAgrupados();

            try
            {
                IAgrupacionClientes agrupacion = AgrupacionClienteFactory.GetAgrupacionClientes();
                agrupacion.AgrupacionID = Utiles.Validaciones.obtieneEntero(txtAgrupacionID.Text);
                agrupacion.Consultar();//trae el encabezado
                agrupacionID         = agrupacion.AgrupacionID;
                txtNombreAgrup.Text  = agrupacion.AgrupacionNombre;
                chkEsPublica.Checked = agrupacion.EsPublica;
                ds = (DsClientesAgrupados)agrupacion.ConsultarClientes(usuario);//trae el detalle, por si solo el encabezado no se usa
                ddlClientesAsociados.DataSource     = ds;
                ddlClientesAsociados.DataValueField = "ClienteID";
                ddlClientesAsociados.DataTextField  = "ClienteDescrip";
                ddlClientesAsociados.DataBind();
            }
            catch (Exception ex)
            {
                ((ErrorWeb)phErrores.Controls[0]).setMensaje(ex.Message);
            }
        }
Example #8
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();
                DsClientesAgrupados ds = new DsClientesAgrupados();

                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);
            }