public bool AddPacient(Pacients pacient, int systemUserId) { PersonBL oPersonBL = new PersonBL(); try { var oPersonBE = new PersonDto { v_FirstName = pacient.FirstName, v_FirstLastName = pacient.FirstLastName, v_SecondLastName = pacient.SecondLastName, i_DocTypeId = pacient.DocTypeId, v_DocNumber = pacient.DocNumber, v_TelephoneNumber = pacient.TelephoneNumber }; var personId = oPersonBL.AddPerson(oPersonBE, systemUserId); //aaa if (personId != "") { var oPacient = new PacientBE { v_PersonId = personId, i_IsDeleted = (int)Enumeratores.SiNo.No, d_InsertDate = DateTime.UtcNow, i_InsertUserId = systemUserId }; ctx.Pacient.Add(oPacient); int rows = ctx.SaveChanges(); if (rows > 0) { return(true); } return(false); } else { return(false); } } catch (Exception ex) { return(false); throw; } }
public void CreatePacient(string personId, int userId, int nodeId) { try { DatabaseContext cnx = new DatabaseContext(); var oPacient = new PacientBE { v_PersonId = personId, i_IsDeleted = (int)Enumeratores.SiNo.No, d_InsertDate = DateTime.UtcNow, i_InsertUserId = userId }; cnx.Pacient.Add(oPacient); cnx.SaveChanges(); } catch (Exception ex) { throw; } }