public void SendLogin() { try { LoginGetDTO loginGetDTO = loginDAO.Login(LoginSendDTO); //Añadir Perfil obtenido del Servidor en la base de datos local Profile p = new Profile(loginGetDTO.Profile.Username, loginGetDTO.Profile.Name, loginGetDTO.Profile.Email, loginGetDTO.Profile.Phone, loginGetDTO.Profile.TOKEN); profileDAO.Insert(p); //Añadir Contactos obtenidos del Servidor en la base de datos local foreach (ContactSERVER contactSERVER in loginGetDTO.Contacts) { Contact c = new Contact(contactSERVER.ContactID, contactSERVER.Username, contactSERVER.Name); contactDAO.Insert(c); } //Añadir Chats obtenidos del Servidor en la base de datos local foreach (ChatSERVER chatSERVER in loginGetDTO.Chats) { Chat c = new Chat(chatSERVER.ChatID, chatSERVER.ContactID, chatSERVER.Username, chatSERVER.Name); chatDAO.Insert(c); } } catch (MyException e) { throw e; } }
public void Add( string PhoneNumber, string Name) { BillingSystemContext context = new BillingSystemContext(); Profile profile = new Profile() { PhoneNumber = PhoneNumber, Name = Name }; ProfileDAO dao = new ProfileDAO(); dao.Insert(profile); }
public ActionResult Save(Profile obj, int?[] ids) { ConnectionFactory conex = null; try { List <Restriction> lst = new List <Restriction>(); foreach (var item in ids) { lst.Add(new Restriction { IdRestriction = (byte)item }); } obj.Restrictions = lst; conex = new ConnectionFactory(); ProfileDAO dao = new ProfileDAO(conex); conex.BeginTran(); if (obj.IdProfile == 0) { dao.Insert(obj); TempData["SuccessMsg"] = "Perfil salva com sucesso!"; } else { dao.Update(obj); TempData["SuccessMsg"] = "Perfil Editada com sucesso!"; } conex.Commit(); } catch (Exception ex) { conex.Rollback(); TempData["SuccessMsg"] = ""; TempData["ErrorMsg"] = String.Format("Falha ao salvar o perfil. {0}", ex.Message); return(View("Create", obj)); } return(RedirectToAction("Index")); }
public int AddProfile() { ProfileDAO DAO = new ProfileDAO(); return(DAO.Insert(this)); }