Message IManterTRANSACTIONS.DeleteByIdTotalTransaction(int ids) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { var registros = (from a in contexto.Transactions where ids == a.ID_Total_Transactions select a).ToList(); if (registros.Count > 0) { foreach (var item in registros) { contexto.Transactions.Remove(item); } contexto.SaveChanges(); } } } catch (Exception ex) { msg.Exception = ex; } return(msg); }
Message IManterTRANSACTIONS.SaveList(params Dominio.Entidades.Transaction[] transaction) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { foreach (var item in transaction) { if (item.ID != 0) { contexto.Entry(transaction).State = EntityState.Modified; } else { contexto.Transactions.Add(item); } } contexto.SaveChanges(); } } catch (Exception ex) { msg.Exception = ex; } return(msg); }
Message IManterDOCUMENT.DeleteByID(int id) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { var registros = (from a in contexto.DOCUMENTs where id == a.ID select a).ToList(); if (registros.Count == 0) { foreach (var item in registros) { contexto.DOCUMENTs.Remove(item); } contexto.SaveChanges(); } } } catch (Exception ex) { msg.Exception = ex; } return(msg); }
Message IManterTRANSACTIONS.Salvar(Transaction transactions) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { if (transactions.ID != 0) { contexto.Entry(transactions).State = EntityState.Modified; } else { contexto.Transactions.Add(transactions); } contexto.SaveChanges(); } } catch (Exception ex) { msg.Exception = ex; } return(msg); }
Message IManterSTOCK.Save(Dominio.Entidades.Stock stk) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { if (stk.ID != 0) { contexto.Entry(stk).State = EntityState.Modified; } else { contexto.Stocks.Add(stk); } contexto.SaveChanges(); } } catch (Exception ex) { msg.Exception = ex; } return(msg); }
Message IManterDOCUMENT.Save(Dominio.Entidades.DOCUMENT doc) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { if (doc.ID != 0) { contexto.Entry(doc).State = EntityState.Modified; } else { contexto.DOCUMENTs.Add(doc); } contexto.SaveChanges(); } } catch (Exception ex) { msg.Exception = ex; } return(msg); }
Message IManterLIST.Save(Dominio.Entidades.LIST list) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { if (list.ID != 0) { contexto.Entry(list).State = EntityState.Modified; } else { contexto.LISTs.Add(list); } contexto.SaveChanges(); } } catch (Exception ex) { msg.Exception = ex; } return(msg); }
Message IManterLIST.DeleteLISTByID(int id) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { var registros = (from a in contexto.LISTs where id == a.ID select a).ToList(); if (registros.Count == 0) { throw new BusinessException("Não foi localizado registro para o ID informado"); } foreach (var item in registros) { contexto.LISTs.Remove(item); } contexto.SaveChanges(); } } catch (Exception ex) { msg.Exception = ex; } return(msg); }
Message IManterMONEY_COUNT.Salvar(Money_Count moneyCount) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { if (moneyCount.ID != 0) { contexto.Entry(moneyCount).State = EntityState.Modified; } else { contexto.Money_Count.Add(moneyCount); } contexto.SaveChanges(); } } catch (Exception ex) { msg.Exception = ex; } return(msg); }
Message IManterUSER.Salvar(User user) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { if (user.ID != 0) { contexto.Entry(user).State = EntityState.Modified; } else { contexto.Users.Add(user); } contexto.SaveChanges(); } } catch (Exception ex) { msg.Exception = ex; } return(msg); }
Message IManterCALC.Salvar(Dominio.Entidades.Calc CALC) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { if (CALC.ID != 0) { contexto.Entry(CALC).State = EntityState.Modified; } else { contexto.Calcs.Add(CALC); } contexto.SaveChanges(); } } catch (Exception ex) { msg.Exception = ex; } return(msg); }
Message IManterHOUSE_KEEPING.DeleteByDtNow(DateTime dtNow) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { //var registros = (from a in contexto.Transactions // where ids == a.ID_Total_Transactions // select a).ToList(); //if (registros.Count == 0) // throw new BusinessException("Não foi localizado registro para o ID informado"); //foreach (var item in registros) // contexto.Transactions.Remove(item); contexto.SaveChanges(); } } catch (Exception ex) { msg.Exception = ex; } return(msg); }
Message IManterHOUSE_KEEPING.Save(List <House_Keeping> house_keeping) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { foreach (var item in house_keeping) { if (item.ID != 0) { contexto.Entry(house_keeping).State = EntityState.Modified; } else { contexto.House_Keeping.Add(item); } } contexto.SaveChanges(); } } catch (Exception ex) { msg.Exception = ex; } return(msg); }
Message IManterEGALI_PASSWORDS.Save(Dominio.Entidades.EGALI_PASSWORDS eP) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { if (eP.ID != 0) { contexto.Entry(eP).State = EntityState.Modified; } else { contexto.EGALI_PASSWORDS.Add(eP); } contexto.SaveChanges(); } } catch (Exception ex) { msg.Exception = ex; } return(msg); }
Message IManterEGALI_PASSWORDS_HISTORY.DeleteByIdEgaliPasswords(int id) { Message msg = new Message(); try { using (var contexto = new Dominio.Entidades.HostelEntities()) { var registros = (from a in contexto.EGALI_PASSWORDS_HISTORY where id == a.ID_EGALI_PASSWORDS select a).ToList(); if (registros.Count == 0) { foreach (var item in registros) { contexto.EGALI_PASSWORDS_HISTORY.Remove(item); } contexto.SaveChanges(); } } } catch (Exception ex) { msg.Exception = ex; } return(msg); }