public Expediente2(PostgresDataAccess.Expediente exp)
        {
            Ubicacion = "";
            // rellenar :(
            InitializeComponent();
            Datos = new PostgresDataAccess.DataAccess();
            // rellenar combo
            ComunasCuerpo = Datos.ObtenerComunasCuerpo();
            Comunas       = Datos.ObtenerComunas();
            comboComuna.Items.AddRange(Comunas.ToArray());
            checkRM.Checked = true;

            //!!!!!!!!!!!!!!!!!comboServicio.SelectedItem = exp.Servicio;
            textClave.Text             = Datos.ObtenerTipoLlamado(exp.Codigo_llamado);
            textClave.Tag              = exp.Codigo_llamado;
            textHora.Text              = exp.Hora.ToShortTimeString();
            dtFecha.Value              = exp.Fecha;
            textDireccion.Text         = exp.Seis2;
            comboComuna.SelectedItem   = exp.Comuna;
            textEsquina.Text           = exp.Cero5;
            textPoblacion.Text         = exp.Poblacion_villa;
            textBlock.Text             = exp.Block;
            textCasa.Text              = exp.Casa;
            textTelefono.Text          = exp.Telefono;
            textQuienLlama.Text        = exp.Quien_llama;
            comboCompañia.SelectedItem = exp.Compania;
            textDescripcion.Text       = exp.Descripcion;
            edicion          = true;
            EditExp          = exp;
            btnIngresar.Text = "Actualizar";
        }
Exemple #2
0
        public Agenda()
        {
            InitializeComponent();
            Regex r = new Regex(@"(\(.*\)|Exp)");

            Datos = new PostgresDataAccess.DataAccess();

            // llenar combobox
            List <PostgresDataAccess.Expediente> l = new List <PostgresDataAccess.Expediente>();
            DataTable dt = Datos.ObtenerExpedientesActivos();

            foreach (DataRow dr in dt.Rows)
            {
                PostgresDataAccess.Expediente exp = new PostgresDataAccess.Expediente();
                exp.Id_expediente = (int)dr["id_expediente"];
                exp.Seis2         = (string)dr["seis2"];
                exp.Cero5         = (string)dr["cero5"];
                exp.Ubicacion     = new PointD((double)dr["puntoX"], (double)dr["puntoY"]);
                comboExpedientes.Items.Add(Datos.ObtenerClaveLlamado((int)dr["codigo_llamado"]) + " >> " + exp.Seis2 + " / " + exp.Cero5);
                l.Add(exp);
            }

            exps = l.ToArray();

            FillCombos();
        }
Exemple #3
0
 private void dgExpedientes_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgExpedientes.Columns[e.ColumnIndex] == bEditar)
     {
         //editar
         PostgresDataAccess.Expediente exp = Datos.ObtenerExpediente((int)dgExpedientes["id_expediente", e.RowIndex].Value);
         Expediente Editar = new Expediente(exp);
         if (Editar.ShowDialog() == DialogResult.OK)
         {
             ListadoExpedientes_Load(this, new EventArgs());
         }
     }
     if (dgExpedientes.Columns[e.ColumnIndex] == bEliminar)
     {
         // eliminar
         if (MessageBox.Show(this, "¿Desea realmente borrar este expediente?", "Borrar Expediente", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             if (Datos.EliminarExpediente((int)dgExpedientes["id_expediente", e.RowIndex].Value) == true)
             {
                 dgExpedientes.Rows.RemoveAt(e.RowIndex);
             }
             else
             {
                 MessageBox.Show("No se puede eliminar el expediente. Compruebe que\nno hayan recursos asignados a este expediente y reitere la operación", "Mensaje de ZEUS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
     }
 }
        private bool Ingresar()
        {
            PostgresDataAccess.Expediente exp = new PostgresDataAccess.Expediente();
            bool res;

            // agregar datos
            exp.Activo          = true;
            exp.Block           = textBlock.Text;
            exp.Casa            = textCasa.Text;
            exp.Cero5           = /*textDireccion.Text + " / " + */ TextoFormateado(textEsquina.Text);
            exp.Compania        = comboCompañia.SelectedItem == null ? "" : comboCompañia.SelectedItem.ToString();
            exp.Comuna          = comboComuna.SelectedItem == null ? "" : comboComuna.SelectedItem.ToString();
            exp.Descripcion     = textDescripcion.Text;
            exp.Fecha           = dtFecha.Value;
            exp.Hora            = DateTime.Parse(textHora.Text);
            exp.Poblacion_villa = textPoblacion.Text;
            exp.Quien_llama     = textQuienLlama.Text;
            exp.Seis2           = TextoFormateado(textDireccion.Text);
            //exp.Servicio = comboServicio.SelectedItem == null ? "" : comboServicio.SelectedItem.ToString();
            exp.Codigo_llamado   = (int)textClave.Tag;
            exp.Codigo_principal = exp.Codigo_llamado < 100 ? exp.Codigo_llamado : (exp.Codigo_llamado - (exp.Codigo_llamado % 100)) / 100;
            exp.Telefono         = textTelefono.Text;
            if (edicion)
            {
                exp.Ubicacion = EditExp.Ubicacion;
                exp.Geoz      = EditExp.Geoz;
                exp.Id_area   = EditExp.Id_area;
            }
            else
            {
                exp.Ubicacion = PlugData.Direccion.Ubicacion.Value;
                exp.Geoz      = Datos.ObtenerGeoz(exp.Ubicacion.ToString());
                exp.Id_area   = Datos.ObtenerArea(exp.Ubicacion.ToString());
            }

            this.UseWaitCursor = true;
            if (edicion)
            {
                exp.Id_expediente = EditExp.Id_expediente;
                res = Datos.ActualizarExpediente(exp);
            }
            else
            {
                res = Datos.InsertarExpediente(exp);
            }
            this.UseWaitCursor = false;

            return(res);

            /*else
             * {
             *  this.Close();
             * }*/
        }