Пример #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                Page.SmartNavigation     = false;
                Response.Buffer          = true;
                Response.Expires         = -1000;
                Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
                Response.AddHeader("pragma", "no-cache");
                Response.AddHeader("cache-control", "private");
                Response.CacheControl     = "no-cache";
                Session["DsCodigoBarras"] = null;
                this.tblUVenta.Visible    = false;
                Page.RegisterStartupScript("init", SisPackController.GenerarJavaScripts.SetearFocoControl(this.txtCodigoBarras.ClientID));
            }
            this.txtAgenciaID.Text = Request.QueryString["AgenciaID"];
            this.txtClienteID.Text = Session["ClienteCorp.ClienteID"] == null ? "" : Session["ClienteCorp.ClienteID"].ToString();

            if (Session["DsCodigoBarras"] != null)
            {
                dsCodigoBarras = (DsCodigoBarrasGuia)Session["DsCodigoBarras"];
            }
            else
            {
                dsCodigoBarras = new DsCodigoBarrasGuia();
            }

            this.butAceptar.Attributes.Add("onclick", "window.document.getElementById('txtButAceptar').value = '1';\n");
            this.butCerrar.Attributes.Add("onclick", "window.close();");
            //this.SetearValidadores();
        }
        public override global::System.Data.DataSet Clone()
        {
            DsCodigoBarrasGuia cln = ((DsCodigoBarrasGuia)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Пример #3
0
        private void dtgCodigos_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            DsCodigoBarrasGuia ds = (DsCodigoBarrasGuia)Session["DsCodigoBarras"];

            DsCodigoBarrasGuia.DatosRow drSelec = (DsCodigoBarrasGuia.DatosRow)ds.Datos.Rows[e.Item.DataSetIndex];

            DsCodigoBarrasGuia dsNuevo = new DsCodigoBarrasGuia();

            foreach (DsCodigoBarrasGuia.DatosRow dr in ds.Datos.Rows)
            {
                if (dr.CodigoBarras != drSelec.CodigoBarras)
                {
                    dsNuevo.Datos.ImportRow(dr);
                }
                else if (dr.ServicioID != 0)
                {
                    int cantServicios = Utiles.Validaciones.obtieneEntero(this.txtCantServicios.Text);
                    cantServicios--;
                    this.txtCantServicios.Text = cantServicios.ToString();
                }
                else if (dr.UnidadVentaID != 0)
                {
                    this.txtPrevendido.Text = "";
                }
            }

            // voy acumulando los ServicioID de todos los codigos asociados a servicios que se
            // vayan ingresando
            string servicioTemp = "";
            int    i            = 0;

            foreach (DsCodigoBarrasGuia.DatosRow dr in dsNuevo.Datos.Rows)
            {
                if (dr.ServicioID != 0)
                {
                    servicioTemp += dr.ServicioID.ToString();
                    if (i < dsNuevo.Datos.Count - 1)
                    {
                        servicioTemp += ",";
                    }
                    i++;
                }
            }
            if (servicioTemp.EndsWith(","))
            {
                servicioTemp = servicioTemp.Remove(servicioTemp.Length - 1, 1);
            }
            this.txtServicioIDSel.Text = servicioTemp;

            Session["DsCodigoBarras"]   = dsNuevo;
            dtgCodigos.DataSource       = dsNuevo;
            dtgCodigos.CurrentPageIndex = 0;
            dtgCodigos.DataBind();
            MuestraOcultaBotonAceptar();
            this.txtCodigoBarras.Text = "";
        }
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            DsCodigoBarrasGuia ds = new DsCodigoBarrasGuia();

            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);
        }
Пример #5
0
        private void MuestraOcultaBotonAceptar()
        {
            DsCodigoBarrasGuia ds = (DsCodigoBarrasGuia)Session["DsCodigoBarras"];

            if (ds.Datos.Count > 0)
            {
                this.butAceptar.Visible = true;
            }
            else
            {
                this.butAceptar.Visible = false;
            }
        }
            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();
                DsCodigoBarrasGuia ds = new DsCodigoBarrasGuia();

                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);
            }
Пример #7
0
        private void butAceptar_Click(object sender, System.EventArgs e)
        {
            try
            {
                DsCodigoBarrasGuia ds = (DsCodigoBarrasGuia)Session["DsCodigoBarras"];

                //concateno los codigos de barras
                string codigos            = "";
                string servicios          = "";
                int    i                  = 0;
                string unidadVentaID      = "";
                string tiempoEntregaID    = "";
                string productoID         = "";
                string modalidadEntregaID = "";

                foreach (DsCodigoBarrasGuia.DatosRow dr in ds.Datos.Rows)
                {
                    if (dr.ServicioID != 0)
                    {
                        servicios += dr.ServicioID.ToString();
                    }
                    else
                    {
                        servicios += "0";
                    }

                    codigos += dr.CodigoBarras;
                    if (i < ds.Datos.Rows.Count - 1)
                    {
                        codigos += ",";
                    }

                    if (i < ds.Datos.Rows.Count - 1 && dr.ServicioID != 0)
                    {
                        servicios += ",";
                    }
                    if (dr.UnidadVentaID.ToString() != "0")
                    {
                        unidadVentaID = dr.UnidadVentaID.ToString();
                    }
                    if (dr.TiempoEntregaID.ToString() != "0")
                    {
                        tiempoEntregaID = dr.TiempoEntregaID.ToString();
                    }
                    if (dr.ProductoID.ToString() != "0")
                    {
                        productoID = dr.ProductoID.ToString();
                    }
                    if (dr.ModalidadEntregaID.ToString() != "0")
                    {
                        modalidadEntregaID = dr.ModalidadEntregaID.ToString();
                    }

                    i++;
                }

                //verifico que todos los codigos de barras tengan el mismo estado (asignado o prevendido)
                ICodigoBarras codigoBarras = CodigoBarrasFactory.GetCodigoBarras();
                codigoBarras.VerificaEstadoCodigoBarras(codigos);                 //si falla, arroja una excepcion, sino, sigue sin problemas


                this.txtUVentaSelec.Text     = unidadVentaID == "" ? "0" : unidadVentaID;
                this.txtTiempoEntregaID.Text = tiempoEntregaID == "" ? "0" : tiempoEntregaID;
                this.txtProductoID.Text      = productoID == "" ? "0" : productoID;
                //this.txtServicioIDSel.Text = servicios == "" ? "0" : servicios; //dr.ServicioID.ToString();
                this.txtModalidadEntregaID.Text = modalidadEntregaID == "" ? "0" : modalidadEntregaID;


                // solo se elije un codigo de barra, que está asociado a una unidad de venta
                if (this.txtUVentaSelec.Text != "0" && Utiles.Validaciones.obtieneEntero(this.txtCantServicios.Text) == 0)
                {
                    BindProducto();
                    BindTiempoEntregaUV(Utiles.Validaciones.obtieneEntero(this.txtUVentaSelec.Text));                     //dr.UnidadVentaID
                    BindServicioUV();

                    if (this.txtPrevendido.Text == "1")
                    {
                        BindModalidadEntregaByID(Utiles.Validaciones.obtieneEntero(this.txtModalidadEntregaID.Text));
                    }
                    else
                    {
                        BindModalidadEntregaByUnidadVentaID(Convert.ToInt32(unidadVentaID));
                    }
                }
                // solo se elije un codigo de barras, que está asociado a uno o mas servicio
                else if (this.txtUVentaSelec.Text == "0" && Utiles.Validaciones.obtieneEntero(this.txtCantServicios.Text) != 0)
                {
                    BindProductoByCodigo(codigos);
                    BindTiempoEntrega();
                    BindServicio();
                    BindModalidadEntrega();
                }
                // se elije un codigo de barras asociado a una UV, y uno o mas codigos de barras asociados a un servicio
                else if (this.txtUVentaSelec.Text != "0" && Utiles.Validaciones.obtieneEntero(this.txtCantServicios.Text) != 0)
                {
                    BindProductoByCodigoCombinado(codigos);
                    BindTiempoEntregaUV(Utiles.Validaciones.obtieneEntero(this.txtUVentaSelec.Text));
                    BindServicioAmbos();
                    if (this.txtPrevendido.Text == "1")
                    {
                        BindModalidadEntregaByID(Utiles.Validaciones.obtieneEntero(this.txtModalidadEntregaID.Text));
                    }
                    else
                    {
                        BindModalidadEntrega();
                    }
                }

                this.tblUVenta.Visible         = true;
                this.txtCodigoBarrasTotal.Text = codigos;

                this.txtCodigoBarras.Enabled = false;
                this.butAgregar.Enabled      = false;
                this.butAceptar.Enabled      = false;
                this.txtButAceptar.Text      = "1";

                SisPackController.AdministrarGrillas.ConfigurarChica(dtgCodigos, "CodigoBarras");
                Session["DsCodigoBarras"]        = (DsCodigoBarrasGuia)dsCodigoBarras;
                this.dtgCodigos.DataSource       = dsCodigoBarras;
                this.dtgCodigos.CurrentPageIndex = 0;
                this.dtgCodigos.DataBind();
                this.butConfirmar.Enabled = true;
            }
            catch (Exception ex)
            {
                this.txtButAceptar.Text = "0";
                ManejaErrores(ex);
            }
        }