コード例 #1
0
 public bool IsThereAPetition() //Devuelve true si ya existe una petición donde se quiere ingresar, false si no.
 {
     try
     {
         Data.petition res = Connection.AutomateDB.petition.First(re => re.dayoftheweek == Day && re.block == Block && re.infrastructure == Facilty);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #2
0
 public bool Delete()
 {
     try
     {
         Data.petition res = Connection.AutomateDB.petition.First(re => re.dayoftheweek == Day && re.block == Block && re.infrastructure == Facilty && re.account == Username);
         Connection.AutomateDB.petition.Remove(res);
         Connection.AutomateDB.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #3
0
 public bool Update()
 {
     try
     {
         Data.petition res = Connection.AutomateDB.petition.First(re => re.idpetition == Id);
         res.dayoftheweek   = Day;
         res.block          = Block;
         res.account        = Username;
         res.infrastructure = Facilty;
         Connection.AutomateDB.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #4
0
 public bool Read()
 {
     try
     {
         Data.petition res = Connection.AutomateDB.petition.First(re => re.idpetition == Id);
         Id       = res.idpetition;
         Day      = res.dayoftheweek;
         Block    = res.block;
         Username = res.account;
         Facilty  = res.infrastructure;
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #5
0
 public bool Create()
 {
     try
     {
         Data.petition res = new Data.petition();
         res.idpetition     = LastId() + 1;
         res.dayoftheweek   = Day;
         res.block          = Block;
         res.account        = Username;
         res.infrastructure = Facilty;
         Connection.AutomateDB.petition.Add(res);
         Connection.AutomateDB.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }