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

            IKmsLocalidad kmsLocalidad = KmsLocalidadFactory.GetKmsLocalidad();

            kmsLocalidad.LocalidadOrigenID  = dr.LocalidadOrigenID;
            kmsLocalidad.LocalidadDestinoID = dr.LocalidadDestinoID;

            try
            {
                kmsLocalidad.Eliminar();
                this.dtgLocalidades.EditItemIndex = -1;
                Session["dsKmsLocalidad"]         = null;
                this.BindGrilla(0);
            }
            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 dtgLocalidades_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            if (error)
            {
                ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(this.TraducirTexto("Errores.Invalidos.LocalidadYaVinculada"));
                return;
            }

            /*Page.Validate();
             * if (!Page.IsValid)
             *      return;*/

            this.dsKmsLocalidad = (DsKmsLocalidad)Session["dsKmsLocalidad"];
            DsKmsLocalidad.DatosRow dr = (DsKmsLocalidad.DatosRow) this.dsKmsLocalidad.Datos.Rows[e.Item.DataSetIndex];

            IKmsLocalidad kmsLocalidad = KmsLocalidadFactory.GetKmsLocalidad();

            //LocalidadOrigenID
            kmsLocalidad.LocalidadOrigenID = dr.LocalidadOrigenID;
            //LocalidadDestinoID
            kmsLocalidad.LocalidadDestinoID = dr.LocalidadDestinoID;
            //Kms
            kmsLocalidad.Kms = dr.Kms;
            //Baja, inicalmente en falso
            kmsLocalidad.Baja = false;
            //LocalidadDestinoID en text oculto

            /*TextBox txt = (TextBox) e.Item.FindControl("txtLocalidadDestinoID");
             * txt.Text = dr.LocalidadDestinoID.ToString();*/


            try
            {
                kmsLocalidad.Guardar(this.nuevo);
                this.dtgLocalidades.EditItemIndex = -1;
                Session["dsKmsLocalidad"]         = null;
                this.BindGrilla(0);
            }
            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);
                Session["dsKmsLocalidad"]         = null;
                this.dtgLocalidades.EditItemIndex = -1;
                this.BindGrilla(0);
            }
        }
Пример #3
0
        public override global::System.Data.DataSet Clone()
        {
            DsKmsLocalidad cln = ((DsKmsLocalidad)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Пример #4
0
        public DsKmsLocalidad GetCruceLocalidadesbyLocalidadOrigenID()
        {
            DsKmsLocalidad ds = new DsKmsLocalidad();
            SqlParameter   pLocalidadOrigenID = new SqlParameter("@LocalidadOrigenID", this.LocalidadOrigenID);

            Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "KmsLocalidadSELbyLocalidadOrigenID", pLocalidadOrigenID);
            return(ds);
        }
Пример #5
0
        public DsKmsLocalidad GuardarCruceLocalidadesbyLocalidadReferencia()
        {
            DsKmsLocalidad ds = new DsKmsLocalidad();
            SqlParameter   pLocalidadOrigenID     = new SqlParameter("@LocalidadOrigenID", this.LocalidadOrigenID);
            SqlParameter   pLocalidadReferenciaID = new SqlParameter("@LocalidadReferenciaID", this.LocalidadOrigenRefID);
            SqlParameter   pKmsRef       = new SqlParameter("@Kms", this.KmsRef);
            SqlParameter   pFactorAjuste = new SqlParameter("@FactorAjuste", this.FactorAjuste);

            Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "KmsLocalidadPorReferenciaINS", pLocalidadOrigenID, pLocalidadReferenciaID, pKmsRef, pFactorAjuste);
            return(ds);
        }
Пример #6
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            DsKmsLocalidad ds = new DsKmsLocalidad();

            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 BindGrilla(int currentPage)
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgLocalidades, "LocalidadOrigenID", this.CantidadOpciones);
            this.dtgLocalidades.AllowPaging = false;

            if (Session["dsKmsLocalidad"] == null)
            {
                IKmsLocalidad kmsLocalidad = KmsLocalidadFactory.GetKmsLocalidad();
                kmsLocalidad.LocalidadOrigenID = (this.txtLocalidadSelec.Text == "" ? 0 : Convert.ToInt32(this.txtLocalidadSelec.Text));
                this.dsKmsLocalidad            = kmsLocalidad.GetCruceLocalidadesbyLocalidadOrigenID();
            }
            else
            {
                this.dsKmsLocalidad = (DsKmsLocalidad)Session["dsKmsLocalidad"];
                if (this.dtgLocalidades.EditItemIndex != -1)
                {
                    DataGridItem            item = this.dtgLocalidades.Items[this.dtgLocalidades.EditItemIndex];
                    DsKmsLocalidad.DatosRow dr   = (DsKmsLocalidad.DatosRow) this.dsKmsLocalidad.Datos.Rows[item.DataSetIndex];

                    /*try
                     * {*/
                    dr.ProvinciaDestinoDescrip = ((DropDownList)item.FindControl("ddlProvinciaTabla")).SelectedValue == "" ? "0" : Convert.ToString(((DropDownList)item.FindControl("ddlProvinciaTabla")).SelectedValue);
                    dr.LocalidadDestinoDescrip = ((DropDownList)item.FindControl("ddlLocalidadTabla")).SelectedValue == "" ? "0" : Convert.ToString(((DropDownList)item.FindControl("ddlLocalidadTabla")).SelectedValue);
                    dr.LocalidadDestinoID      = (this.txtLocalidadSelecGrilla.Text == "") ? 0 : Convert.ToInt32(this.txtLocalidadSelecGrilla.Text);
                    dr.Kms         = ((TextBox)item.FindControl("txtKmsDestino")).Text == "" ? 0 : Convert.ToDouble(((TextBox)item.FindControl("txtKmsDestino")).Text);
                    dr.ZonaDescrip = ((Label)item.FindControl("lblZonaDestino")).Text == "" ? "0" : Convert.ToString(((Label)item.FindControl("lblZonaDestino")).Text);

                    /*}
                     * catch(Exception)
                     * {
                     *      ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(this.TraducirTexto("Errores.Invalidos.LocalidadYaVinculada"));
                     *      return;
                     * }*/
                }
            }

            Session["dsKmsLocalidad"]            = this.dsKmsLocalidad;
            this.dtgLocalidades.DataSource       = this.dsKmsLocalidad;
            this.dtgLocalidades.CurrentPageIndex = currentPage;
            this.dtgLocalidades.DataBind();
        }
Пример #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();
                DsKmsLocalidad ds = new DsKmsLocalidad();

                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);
            }
        private void butAgregar_Click(object sender, System.EventArgs e)
        {
            if (error)
            {
                ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(this.TraducirTexto("Errores.Invalidos.LocalidadYaVinculada"));
                return;
            }

            RequiredFieldValidator reqProvincia = (RequiredFieldValidator)this.phValidProvinciaOrigen.FindControl("reqProvincia");

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

            /*RequiredFieldValidator reqLocalidad = (RequiredFieldValidator)this.phValidLocalidadOrigen.FindControl("reqLocalidad");
             * reqLocalidad.Enabled = true;
             * reqLocalidad.Validate();
             * if(!reqLocalidad.IsValid)
             *      return;*/

            if (this.ckTomarLocalidadReferencia.Checked == false)
            {
                if (dtgLocalidades.EditItemIndex == -1)
                {
                    IraUltimaPagina();

                    DsKmsLocalidad          ds = (DsKmsLocalidad)Session["dsKmsLocalidad"];
                    DsKmsLocalidad.DatosRow dr = ds.Datos.NewDatosRow();
                    dr.LocalidadOrigenID       = (this.txtLocalidadSelec.Text == "" ? 0 : Convert.ToInt32(this.txtLocalidadSelec.Text));
                    dr.LocalidadDestinoID      = 0;
                    dr.ProvinciaDestinoDescrip = "";
                    dr.LocalidadDestinoDescrip = "";
                    dr.Baja               = false;
                    dr.Kms                = 0;
                    dr.ZonaDescrip        = "";
                    dr.ProvinciaDestinoID = 0;

                    /*try
                     * {*/
                    ds.Datos.AddDatosRow(dr);

                    /*}
                     * catch(Exception){}*/
                    Session["dsKmsLocalidad"] = ds;

                    int iNewItemIndex = this.dtgLocalidades.Items.Count;

                    /*if (iNewItemIndex >= this.dtgLocalidades.PageSize)
                     * {
                     *      this.dtgLocalidades.CurrentPageIndex++;
                     *      iNewItemIndex = 0;
                     * }*/
                    this.dtgLocalidades.DataSource    = (DsKmsLocalidad)Session["dsKmsLocalidad"];
                    this.dtgLocalidades.EditItemIndex = iNewItemIndex;
                    this.dtgLocalidades.DataBind();
                }
            }
            else if (this.ckTomarLocalidadReferencia.Checked == true)
            {
                RequiredFieldValidator reqProvinciaReferencia = (RequiredFieldValidator)this.phValidProvinciaReferencia.FindControl("reqProvinciaReferencia");
                reqProvinciaReferencia.Enabled = true;
                reqProvinciaReferencia.Validate();
                if (!reqProvinciaReferencia.IsValid)
                {
                    return;
                }

                /*RequiredFieldValidator reqLocalidadReferencia = (RequiredFieldValidator)this.phValidLocalidadReferencia.FindControl("reqLocalidadReferencia");
                 * reqLocalidadReferencia.Enabled = true;
                 * reqLocalidadReferencia.Validate();
                 * if(!reqLocalidadReferencia.IsValid)
                 *      return;*/

                RequiredFieldValidator reqKmsReferencia = (RequiredFieldValidator)this.phValidKmsReferencia.FindControl("reqKmsReferencia");
                reqKmsReferencia.Enabled = true;
                reqKmsReferencia.Validate();
                if (!reqKmsReferencia.IsValid)
                {
                    return;
                }

                RegularExpressionValidator valKmsReferencia = (RegularExpressionValidator)this.phValidKmsReferencia.FindControl("valKmsReferencia");
                valKmsReferencia.Enabled = true;
                valKmsReferencia.Validate();
                if (!valKmsReferencia.IsValid)
                {
                    return;
                }


                IKmsLocalidad kmsLocalidad = KmsLocalidadFactory.GetKmsLocalidad();
                kmsLocalidad.LocalidadOrigenID    = Convert.ToInt32(this.txtLocalidadSelec.Text);
                kmsLocalidad.LocalidadOrigenRefID = Convert.ToInt32(this.txtLocalidadSelecReferencia.Text);
                kmsLocalidad.KmsRef       = Convert.ToInt32(this.txtKmsReferencia.Text);
                kmsLocalidad.FactorAjuste = this.rbFactorAjusteNegativo.Checked ? false : true;
                Session["dsKmsLocalidad"] = (DsKmsLocalidad)kmsLocalidad.GuardarCruceLocalidadesbyLocalidadReferencia();
                this.BindGrilla(0);
            }
        }