コード例 #1
0
        private void BindGrid()
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgResponsables, "ResponsableID", this.CantidadOpciones);
            try
            {
                IResponsable   responsable = ResponsableFactory.GetResponsable();
                DsResponsables ds          = responsable.GetResponsablesDataSet();

                string docNro = this.txtDocumentoNro.Text;
                string apeNom = this.txtApellidoNombre.Text;
                string filtro = null;
                if (docNro != "")
                {
                    filtro = "NroDocumento = '" + docNro + "' AND (Apellido LIKE '" + apeNom + "%' OR Nombre LIKE '" + apeNom + "%')";
                }
                else
                {
                    filtro = "Apellido LIKE '" + apeNom + "%' OR Nombre LIKE '" + apeNom + "%'";
                }

                DsResponsables.DatosRow[] drLista = (DsResponsables.DatosRow[])ds.Datos.Select(filtro, "Apellido, Nombre DESC");

                this.dtgResponsables.DataSource = drLista;
                this.dtgResponsables.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
                //this.txtErrorMsg.Text = "Error al consultar datos de responsables: " + ex.Message;
            }
        }
コード例 #2
0
        private void Editar()
        {
            IResponsable responsable = ResponsableFactory.GetResponsable();

            responsable.ResponsableID = Convert.ToInt32(this.txtResponsableID.Text);
            responsable.Consultar();

            this.txtNombre.Text   = responsable.Nombre;
            this.txtApellido.Text = responsable.Apellido;

            //this.txtFechaAlta.Text = responsable.FechaAlta.ToString("dd/MM/yyyy");
            this.ddlTipoDoc.SelectedValue = ((int)responsable.TipoDocumento).ToString();
            this.txtNroDoc.Text           = Convert.ToString(responsable.NroDocumento);
            this.txtEstadoID.Text         = ((int)responsable.EstadoResponsable).ToString();


            IDatosDomicilio domicilio = (IDatosDomicilio)phDomicilio.FindControl("domicilio");

            domicilio.Calle       = responsable.Domicilio.Calle;
            domicilio.CalleNro    = responsable.Domicilio.CalleNro;
            domicilio.Telefono    = responsable.Domicilio.Telefono;
            domicilio.ProvinciaID = responsable.Domicilio.Localidad.Provincia.ProvinciaID;
            domicilio.LocalidadID = responsable.Domicilio.Localidad.LocalidadID;
            domicilio.Fax         = responsable.Domicilio.Fax;
        }
コード例 #3
0
        private void Buscar()
        {
            int total = 0;

            try
            {
                IResponsable   responsable = ResponsableFactory.GetResponsable();
                DsResponsables ds          = responsable.GetResponsablesDataSet();
//ESTA que sigue
                string filtroEspecial = "docNro LIKE '" + this.documentoNro + "%' AND ApeNom LIKE '" + this.apellidoNombre + "%'";

                if (this.documentoNro != "")
                {
                    filtro = "NroDocumento = '" + this.documentoNro + "' AND (Apellido LIKE '" + this.apellidoNombre + "%' OR Nombre LIKE '" + this.apellidoNombre + "%')";
                }
                else
                {
                    filtro = "Apellido LIKE '" + this.apellidoNombre + "%' OR Nombre LIKE '" + this.apellidoNombre + "%'";
                }

                DsResponsables.DatosRow[] drLista = (DsResponsables.DatosRow[])ds.Datos.Select(filtro);
                total = drLista.Length;

                if (total > 0)
                {
                    if (total == 1)
                    {
                        DsResponsables.DatosRow dr = drLista[0];
                        this.txtResponsableID.Text  = dr.ResponsableID.ToString();
                        this.txtDocumentoNro.Text   = dr.NroDocumento.ToString();
                        this.txtApellidoNombre.Text = dr.Apellido + " " + dr.Nombre;
                        this.txtErrorMsg.Text       = "";
                        this.txtOpen.Text           = "";
                    }
                    else
                    {
                        this.txtDocumentoNro.Text   = this.documentoNro;
                        this.txtApellidoNombre.Text = this.apellidoNombre;
                        this.txtOpen.Text           = "S";
                    }
                }
                else
                {
                    this.txtResponsableID.Text = "";
                    this.txtErrorMsg.Text      = "No se encontraron datos.";
                    this.txtOpen.Text          = "";
                }
            }
            catch (Exception ex)
            {
                this.txtErrorMsg.Text = "Error al consultar datos de responsables: " + ex.Message;
            }
        }
コード例 #4
0
        private void dtgResponsables_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            IResponsable responsable = ResponsableFactory.GetResponsable();

            responsable.ResponsableID = Convert.ToInt32(this.dtgResponsables.DataKeys[e.Item.ItemIndex]);
            responsable.Consultar();

            try
            {
                responsable.Eliminar(usuario);
                this.dtgResponsables.EditItemIndex = -1;
                //this.BindGrid();
                try
                {
                    this.BindGrid();
                }
                catch (Exception)
                {
                    this.dtgResponsables.CurrentPageIndex = 0;
                    this.BindGrid();
                }
            }
            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);
            }
        }
コード例 #5
0
        private void butGuardarResponsable_Click(object sender, System.EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            IResponsable responsable = ResponsableFactory.GetResponsable();

            responsable.ResponsableID = this.txtResponsableID.Text == "" ? 0 : Convert.ToInt32(this.txtResponsableID.Text);
            responsable.Nombre        = this.txtNombre.Text;
            responsable.Apellido      = this.txtApellido.Text;


            //responsable.FechaAlta = this.txtFechaAlta.Text != "" ? Fechas.FormatFechaDDMMYYYY(this.txtFechaAlta.Text) : Utiles.Fechas.FormatFechaYYYYMMDD("19000101");
            responsable.NroDocumento  = this.txtNroDoc.Text;
            responsable.TipoDocumento = (NegociosSisPackInterface.SisPack.TipoDocumento)Convert.ToInt32(this.ddlTipoDoc.SelectedValue);
            if (this.txtResponsableID.Text == "")
            {
                responsable.EstadoResponsable = NegociosSisPackInterface.SisPack.EstadoResponsable.Habilitado;
            }
            else
            {
                responsable.EstadoResponsable = (NegociosSisPackInterface.SisPack.EstadoResponsable)Convert.ToInt32(this.txtEstadoID.Text);
            }

            //Carga de domicilio
            IDatosDomicilio domicilio = (IDatosDomicilio)this.phDomicilio.FindControl("domicilio");

            responsable.Domicilio.DomicilioID           = domicilio.DomicilioID;
            responsable.Domicilio.Calle                 = domicilio.Calle;
            responsable.Domicilio.CalleNro              = domicilio.CalleNro;
            responsable.Domicilio.Localidad.LocalidadID = domicilio.LocalidadID;
            responsable.Domicilio.Telefono              = domicilio.Telefono;

            try
            {
                if (responsable.Guardar(usuario))
                {
                    string script = "<script language='javascript'>\n";
                    script += "alert('Los datos se guardaron correctamente.');\n";
                    //script += "window.location.href = 'ResponsablesConsul.aspx';\n";
                    script += "</script>";
                    Page.RegisterStartupScript("scriptOk", script);

                    int    responsableID = responsable.ResponsableID;
                    string docNro        = responsable.NroDocumento.ToString();
                    string apeNom        = responsable.Apellido + " " + responsable.Nombre;

                    StringBuilder scriptString = new StringBuilder();
                    scriptString.Append("<script language='javascript'>\n");
                    scriptString.Append("window.dialogArguments.responsableID = '" + responsableID.ToString() + "';\n");
                    scriptString.Append("window.dialogArguments.docNro = '" + docNro + "';\n");
                    scriptString.Append("window.dialogArguments.apeNom = '" + apeNom + "';\n");
                    scriptString.Append("window.returnValue = true;\n");
                    scriptString.Append("window.close();\n");
                    scriptString.Append("</script>");

                    Page.RegisterClientScriptBlock("scriptModalResponsable", scriptString.ToString());
                }
                else
                {
                    string script = "<script language='javascript'>\n";
                    script += "alert('Los datos no se guardaron debido a errores.');\n";
                    script += "</script>";

                    Page.RegisterStartupScript("scriptError", script);
                }
            }
            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>
        /// Guardar datos del Responsable
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>


        private void butGuardarResponsable_Click(object sender, System.EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            IResponsable responsable = ResponsableFactory.GetResponsable();

            responsable.ResponsableID = this.txtResponsableID.Text == "" ? 0 : Convert.ToInt32(this.txtResponsableID.Text);
            responsable.Nombre        = this.txtNombre.Text;
            responsable.Apellido      = this.txtApellido.Text;
            responsable.NroDocumento  = this.txtNroDoc.Text;
            responsable.TipoDocumento = (NegociosSisPackInterface.SisPack.TipoDocumento)Convert.ToInt32(this.ddlTipoDoc.SelectedValue);
            if (this.txtResponsableID.Text == "")
            {
                responsable.EstadoResponsable = NegociosSisPackInterface.SisPack.EstadoResponsable.Habilitado;
            }
            else
            {
                responsable.EstadoResponsable = (NegociosSisPackInterface.SisPack.EstadoResponsable)Convert.ToInt32(this.txtEstadoID.Text);
            }

            //Carga de domicilio
            IDatosDomicilio domicilio = (IDatosDomicilio)this.phDomicilio.FindControl("domicilio");

            responsable.Domicilio.DomicilioID           = domicilio.DomicilioID;
            responsable.Domicilio.Calle                 = domicilio.Calle;
            responsable.Domicilio.CalleNro              = domicilio.CalleNro;
            responsable.Domicilio.Localidad.LocalidadID = domicilio.LocalidadID;
            responsable.Domicilio.Telefono              = domicilio.Telefono;
            responsable.Domicilio.Fax   = domicilio.Fax;
            responsable.Domicilio.Depto = domicilio.Depto;

            try
            {
                if (responsable.Guardar(usuario))
                {
                    string script = "<script language='javascript'>\n";
                    script += "alert('Los datos se guardaron correctamente.');\n";
                    script += "window.location.href = 'ResponsablesConsul.aspx';\n";
                    script += "</script>";
                    Page.RegisterStartupScript("scriptOk", script);
                }
                else
                {
                    string script = "<script language='javascript'>\n";
                    script += "alert('Los datos no se guardaron debido a errores.');\n";
                    script += "</script>";

                    Page.RegisterStartupScript("scriptError", script);
                }
            }
            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);
            }
        }