Exemplo n.º 1
0
        public Boolean guardar(clsMotivo ctm, ref string Mensaje)
        {
            try
            {
                using (INVENTARIOEntities te = new INVENTARIOEntities())
                {
                    Motivo tm = new Motivo();

                    tm.IdEmpresa   = Convert.ToInt32(ctm.empresa);
                    tm.IdMotivo    = Convert.ToInt32(ctm.codigo);
                    tm.Descripcion = Convert.ToString(ctm.descripcion);
                    tm.IdEstado    = Convert.ToInt32(ctm.estado);

                    te.AddToMotivo(tm);
                    te.SaveChanges();
                }
                return(true);
            }
            catch (Exception e)
            {
                Mensaje = "ERROR" + e.InnerException + e.Message;
                //System.Windows.Forms.MessageBox.Show("error al guardar" + e);
                return(false);
            }
        }
Exemplo n.º 2
0
        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            clsMotivo Motivo = (clsMotivo)gridView1.GetFocusedRow();

            Event_frmConsultaMotivo_FormClosing(Motivo, e);
            //  Close();
        }
Exemplo n.º 3
0
 public void eliminar(clsMotivo ctm)
 {
     using (INVENTARIOEntities te = new INVENTARIOEntities())
     {
         var t = (from q in te.Motivo where q.IdMotivo == ctm.codigo select q).First();
         te.DeleteObject(t);
         te.SaveChanges();
     }
 }
Exemplo n.º 4
0
 private void btnBuscarCodigo_Click_1(object sender, EventArgs e)
 {
     consulta = new frmConsultaMotivo();
     consulta.ShowDialog();
     cMotivo             = consulta.clastm;
     txtCodigo.Text      = cMotivo.codigo.ToString();
     txtDescripcion.Text = cMotivo.descripcion;
     cbxEstado.EditValue = Convert.ToString(cMotivo.estado);
 }
Exemplo n.º 5
0
        void consulta_Event_frmConsultaMotivo_FormClosing(object sender, EventArgs e)
        {
            clsMotivo motivo = (clsMotivo)sender;

            txtCodigo.Text      = motivo.codigo.ToString();
            txtDescripcion.Text = motivo.descripcion;
            cbxEstado.Text      = motivo.estado;
            consulta.Visible    = false;
        }
Exemplo n.º 6
0
 public Boolean modificar(clsMotivo ctm)
 {
     using (INVENTARIOEntities te = new INVENTARIOEntities())
     {
         EntityKey ekey = new EntityKey("INVENTARIOEntities.Motivo", "IdMotivo", ctm.codigo);
         object    OBJ  = null;
         if (te.TryGetObjectByKey(ekey, out OBJ))
         {
             Motivo Motivo = (Motivo)OBJ;
             Motivo.Descripcion = ctm.descripcion;
             Motivo.IdEstado    = Convert.ToInt32(ctm.estado);
         }
         te.SaveChanges(System.Data.Objects.SaveOptions.DetectChangesBeforeSave);
     }
     return(true);
 }
Exemplo n.º 7
0
 public List <clsMotivo> consulta()
 {
     try
     {
         List <clsMotivo>   lista = new List <clsMotivo>();
         INVENTARIOEntities ent   = new INVENTARIOEntities();
         var con = from w in ent.Motivo select w;
         foreach (var item in con)
         {
             clsMotivo clas = new clsMotivo();
             clas.empresa     = Convert.ToInt32(item.IdEmpresa);
             clas.codigo      = Convert.ToInt32(item.IdMotivo);
             clas.descripcion = item.Descripcion;
             clas.estado      = Convert.ToString(item.IdEstado);
             lista.Add(clas);
         }
         return(lista);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 8
0
 private void gridView1_Click(object sender, EventArgs e)
 {
     clastm = getRow((DevExpress.XtraGrid.Views.Grid.GridView)sender);
     Close();
 }