예제 #1
0
        public remotas GetRemota(int id)
        {
            remotas query = null;

            using (var db = new Data())
            {
                query = (from x in db.Remotas where x.remotaid == id select x).First();
            }

            return(query);
        }
예제 #2
0
 public void Delete(int IdClase)
 {
     using (var db = new Data())
     {
         remotas query = (from x in db.Remotas
                          where x.remotaid == IdClase
                          select x).FirstOrDefault <remotas>();
         if (query != null)
         {
             db.Remotas.Remove(query);
             db.SaveChanges();
         }
     }
 }
예제 #3
0
        public bool Existeremota(string remotastr)
        {
            bool resp = false;

            using (var db = new Data())
            {
                remotas Edo = (from x in db.Remotas where x.remota.ToLower() == remotastr.ToLower() select x).FirstOrDefault();
                if (Edo != null)
                {
                    resp = true;
                }
            }
            return(resp);
        }
예제 #4
0
        private string validarRegistro(remotas newpart)
        {
            bool   aux         = remotaManager.Existeremota(newpart.remota);
            string msgValidate = "";

            if (aux && (newpart.remotaid != currentRemota.remotaid))
            {
                msgValidate = msgValidate + "Impresora ya Existente.\n";
            }
            if (newpart.remota == "")
            {
                msgValidate = msgValidate + "Nombre no puede ser dejado en Blanco\n";
            }


            return(msgValidate);
        }
예제 #5
0
        public remotasDTO GetRemotaDTO(int id)
        {
            remotasDTO B     = new remotasDTO();
            remotas    query = null;

            using (var db = new Data())
            {
                query = (from x in db.Remotas where x.remotaid == id select x).FirstOrDefault();
            }
            if (query != null)
            {
                B = new remotasDTO {
                    remotaid = query.remotaid, remota = query.remota, nombre = query.nombre
                }
            }
            ;
            return(B);
        }
예제 #6
0
        public void SeleccionoBarra()
        {
            this.textoBoxp2.Focus();
            if (comandBar1.Status == RecordAction.Search)
            {
                Carga_Busqueda();
            }
            if (comandBar1.Status == RecordAction.None)
            {
                this.panel1.Enabled = false;
            }
            if (comandBar1.Status == RecordAction.Insert || (comandBar1.Status == RecordAction.Update))
            {
                this.panel1.Enabled = true;
                this.panel1.Select();
                if (comandBar1.Status == RecordAction.Insert)
                {
                    initField();
                }
                textoBoxp2.Focus();
            }

            if (comandBar1.Status == RecordAction.Delete && comandBar1.confirma)
            {
                remotaManager.Delete(currentRemota.remotaid);
                this.comandBar1.confirma = false;
                initField();
                panel1.Enabled = false;
                Utilities.Mensaje(errorBar1, "El registro fue Borrado", errorType.Error);
            }
            if (comandBar1.Status == RecordAction.Save)
            {
                var aux = validaforma();
                if (aux != "")
                {
                    errorBar1.Mensaje = aux;
                    errorBar1.Status  = errorType.Error;
                    this.comandBar1.Novalido();
                    return;
                }
                if (comandBar1.Status == RecordAction.Save && comandBar1.previo == RecordAction.Insert && aux == "")
                {
                    var remota = new remotas {
                        remota = textoBoxp3.Text, remotaid = 0, nombre = textoBoxp2.Text
                    };
                    var remotaDTO = new remotasDTO {
                        remota = textoBoxp3.Text, remotaid = 0, nombre = textoBoxp2.Text
                    };
                    var aux1 = validarRegistro(remota);
                    if (aux1.Length > 0)
                    {
                        Utilities.Mensaje(errorBar1, aux1, errorType.Error);
                        return;
                    }
                    remotaManager.InsertClase(remotaDTO);
                    this.comandBar1.previo = RecordAction.None;
                    Utilities.Controles(this, "Reset");
                    panel1.Enabled = false;
                }

                if (comandBar1.Status == RecordAction.Save && comandBar1.previo == RecordAction.Update && aux == "")
                {
                    var remota = new remotas {
                        remota = textoBoxp3.Text, remotaid = Convert.ToInt16(labelindex.Text), nombre = textoBoxp2.Text
                    };
                    var remotaDTO = new remotasDTO {
                        remota = textoBoxp3.Text, remotaid = Convert.ToInt16(labelindex.Text), nombre = textoBoxp2.Text
                    };
                    var aux1 = validarRegistro(remota);
                    if (aux1.Length > 0)
                    {
                        Utilities.Mensaje(errorBar1, aux1, errorType.Error);
                        return;
                    }
                    remotaManager.Edit(remotaDTO);
                    this.comandBar1.previo = RecordAction.None;
                    Utilities.Controles(this, "Reset");
                    panel1.Enabled = false;
                }
            }
        }