コード例 #1
0
        public Boolean guardar(clsIngresoEgresoCAB ctm, ref string Mensaje)
        {
            try
            {
                using (INVENTARIOEntities te = new INVENTARIOEntities())
                {
                    IngresoEgresoCab tm = new IngresoEgresoCab();
                    tm.IdEmpresa        = Convert.ToInt32(ctm.empresa);
                    tm.NroMovimiento    = ctm.nroMovimiento;
                    tm.IdTipoMovimiento = ctm.tipoMovimiento;
                    tm.FechaMovimiento  = ctm.fechaMovimiento;
                    tm.IdOrdenCompra    = ctm.ordenCompra;
                    tm.IdMotivo         = ctm.motivo;
                    tm.IdBodega         = ctm.bodega;
                    tm.IdResponsable    = ctm.responsable;
                    tm.TotalPagar       = ctm.totalPagar;
                    tm.Observacion      = ctm.observacion;
                    tm.IdEstado         = ctm.estado;

                    te.AddToIngresoEgresoCab(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);
            }
        }
コード例 #2
0
 public Boolean modificar(clsIngresoEgresoCAB ctm)
 {
     using (INVENTARIOEntities te = new INVENTARIOEntities())
     {
         EntityKey ekey = new EntityKey("TECAEntitieS.IngresoEgresoCab", "IdnroMovimiento", ctm.nroMovimiento);
         object    OBJ  = null;
         if (te.TryGetObjectByKey(ekey, out OBJ))
         {
             IngresoEgresoCab IngEgCAB = (IngresoEgresoCab )OBJ;
             IngEgCAB.IdTipoMovimiento = ctm.tipoMovimiento;
             IngEgCAB.FechaMovimiento  = ctm.fechaMovimiento;
             IngEgCAB.IdOrdenCompra    = ctm.ordenCompra;
             IngEgCAB.IdMotivo         = ctm.motivo;
             IngEgCAB.IdBodega         = ctm.bodega;
             IngEgCAB.IdResponsable    = ctm.responsable;
             IngEgCAB.TotalPagar       = ctm.totalPagar;
             IngEgCAB.Observacion      = ctm.observacion;
             IngEgCAB.IdEstado         = Convert.ToInt32(ctm.estado);
         }
         te.SaveChanges(System.Data.Objects.SaveOptions.DetectChangesBeforeSave);
     }
     return(true);
 }