예제 #1
0
        public int Insert(string nombre, string rfc, string direccion, string telefono, string correo, int idPlan)
        {
            try
            {
                using (var Conexion = new EntitiesERP())
                {
                    TBL_COMPANIA compania = new TBL_COMPANIA();

                    compania.NOMBRE         = nombre;
                    compania.RFC            = rfc;
                    compania.DIRECCION      = direccion;
                    compania.TELEFONO       = telefono;
                    compania.CORREO         = correo;
                    compania.FECHA_REGISTRO = DateTime.Now;
                    compania.ID_PLAN        = idPlan;

                    Conexion.TBL_COMPANIA.Add(compania);

                    Conexion.SaveChanges();

                    return(compania.ID_COMPANIA);
                }
            }
            catch (Exception)
            {
                return(0);
            }
        }
예제 #2
0
        public int UpdatePlan(int idCompania, int idPlan)
        {
            try
            {
                using (var Conexion = new EntitiesERP())
                {
                    TBL_COMPANIA tBL_COMPANIA = Conexion.TBL_COMPANIA.Where(x => x.ID_COMPANIA == idCompania).FirstOrDefault();

                    tBL_COMPANIA.ID_PLAN = idPlan;
                    //tBL_COMPANIA.FECHA_REGISTRO = DateTime.Now;

                    Conexion.Entry(tBL_COMPANIA).State = EntityState.Modified;

                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                return(0);
            }
        }