Exemplo n.º 1
0
 public MasterServiceCode AddMasterServiceCode(MasterServiceCode masterServiceCode)
 {
     try
     {
         _context.MasterServiceCode.Add(masterServiceCode);
         _context.SaveChanges();
     }
     catch (Exception)
     {
         throw;
     }
     return(masterServiceCode);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Saves the changes to the database.
        /// </summary>
        /// <returns>Number of rows affected.</returns>
        public int SaveChanges()
        {
            int recordsAffected = context.SaveChanges();

            //this.Dispose();  // uncommented by kundan for memeory release
            return(recordsAffected);
        }
        public MasterServiceType AddMasterServiceType(MasterServiceType masterServiceType)
        {
            _context.MasterServiceType.Add(masterServiceType);
            _context.SaveChanges();


            return(masterServiceType);
        }
        public MasterServices AddMasterService(MasterServices masterService)
        {
            _context.MasterServices.Add(masterService);
            _context.SaveChanges();


            return(masterService);
        }
        public void SaveChangesWithAuditLogs(string screenName, string action, int?patientId, int?userId, string parentInfo, TokenModel token)
        {
            List <AuditLogs> auditLogs = GetChanges(screenName, action, patientId, userId, parentInfo, token);

            //assign IpAddress OrganizationId and LocationID
            auditLogs.ForEach(a => { a.OrganizationID = token.OrganizationID; a.LocationID = token.LocationID; a.IPAddress = token.IPAddress; });
            _context.AuditLogs.AddRange(auditLogs);
            _context.SaveChanges();
        }
        public Patients UpdatePatientData(int id, Patients patientInfo)
        {
            try
            {
                if (id > 0)
                {
                    var patient = _context.Patients.Find(id);
                    if (patient != null)
                    {
                        patient.MRN                          = patientInfo.MRN;
                        patient.FirstName                    = patientInfo.FirstName;
                        patient.MiddleName                   = patientInfo.MiddleName;
                        patient.LastName                     = patientInfo.LastName;
                        patient.Gender                       = patientInfo.Gender;
                        patient.DOB                          = patientInfo.DOB;
                        patient.SSN                          = patientInfo.SSN;
                        patient.Email                        = patientInfo.Email;
                        patient.MaritalStatus                = patientInfo.MaritalStatus;
                        patient.Race                         = patientInfo.Race;
                        patient.SecondaryRaceID              = patientInfo.SecondaryRaceID;
                        patient.Ethnicity                    = patientInfo.Ethnicity;
                        patient.PrimaryProvider              = patientInfo.PrimaryProvider;
                        patient.EmergencyContactFirstName    = patientInfo.EmergencyContactFirstName;
                        patient.EmergencyContactLastName     = patientInfo.EmergencyContactLastName;
                        patient.EmergencyContactPhone        = patientInfo.EmergencyContactPhone;
                        patient.EmergencyContactRelationship = patientInfo.EmergencyContactRelationship;
                        if (!string.IsNullOrEmpty(patientInfo.PhotoBase64))
                        {
                            patient.PhotoPath          = patientInfo.PhotoPath;
                            patient.PhotoThumbnailPath = patientInfo.PhotoThumbnailPath;
                        }
                        patient.Citizenship = patientInfo.Citizenship;

                        _context.SaveChanges();
                    }
                    return(patient);
                }
                return(null);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 7
0
        public CheckListCategory AddUpdateChecklistCategory(CheckListCategory checkListCategory)
        {
            try
            {
                if (checkListCategory.CheckListCategoryID > 0)
                {
                    _context.CheckListCategory.Update(checkListCategory);
                }
                else
                {
                    _context.CheckListCategory.Add(checkListCategory);
                }
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw;
            }

            return(checkListCategory);
        }
Exemplo n.º 8
0
 public Entity.Message AddMessage(Entity.Message message)
 {
     try
     {
         _context.Message.Add(message);
         _context.SaveChanges();
     }
     catch (Exception)
     {
     }
     return(message);
 }
        public bool SaveOtp(int userId, string otp)
        {
            bool          isUpdated = false;
            PatientInvite user      = _context.Set <PatientInvite>().Where(x => x.Id == userId).FirstOrDefault();

            if (user != null)
            {
                user.Otp = otp;
                _context.SaveChanges();
                isUpdated = true;
            }
            return(isUpdated);
        }
 public JsonModel SavePatientInsurance(PatientInsuranceDetails patientInsuranceDetails, bool Updated)
 {
     try
     {
         if (Updated)
         {
             _context.PatientInsuranceDetails.Update(patientInsuranceDetails);
             _context.SaveChanges();
             response = new JsonModel(patientInsuranceDetails, StatusMessage.ClientInsuranceUpdated, (int)HttpStatusCodes.OK);
         }
         else
         {
             _context.PatientInsuranceDetails.Add(patientInsuranceDetails);
             _context.SaveChanges();
             response = new JsonModel(patientInsuranceDetails, StatusMessage.ClientInsuranceCreated, (int)HttpStatusCodes.OK);
         }
     }
     catch (Exception e)
     {
         response = new JsonModel(new object(), StatusMessage.ServerError, (int)HttpStatusCodes.InternalServerError, e.Message);
     }
     return(response);
 }
Exemplo n.º 11
0
        public string AddUpdateCheckList(CheckList checkListobj, TokenModel tokenModel)
        {
            string isSuccess = "";

            try
            {
                if (checkListobj.CheckListID > 0)
                {
                    checkListobj.OrganizationID = tokenModel.OrganizationID;
                    checkListobj.UpdatedBy      = tokenModel.UserID;
                    checkListobj.UpdatedDate    = DateTime.Now;
                    _context.CheckList.Update(checkListobj);
                    isSuccess = "Updated Successfully";
                }
                else
                {
                    checkListobj.CreatedBy      = 2;
                    checkListobj.CreatedDate    = DateTime.Now;
                    checkListobj.OrganizationID = tokenModel.OrganizationID;
                    checkListobj.IsActive       = true;
                    checkListobj.IsDeleted      = false;
                    checkListobj.DeletedDate    = null;
                    checkListobj.UpdatedDate    = null;
                    _context.CheckList.Add(checkListobj);
                    isSuccess = "Inserted Successfull";
                }
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                isSuccess = "Something went wrong. Try again later";
                throw;
            }

            return(isSuccess);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Saves the changes to the database.
        /// </summary>
        /// <returns>Number of rows affected.</returns>
        public int SaveChanges()
        {
            try
            {
                int recordsAffected = context.SaveChanges();
                return(recordsAffected);
            }
            //int recordsAffected = context.SaveChanges();
            //return recordsAffected;

            catch (Exception ex)
            {
                throw ex;
            }

            //this.Dispose();  // uncommented by kundan for memeory release
        }
Exemplo n.º 13
0
 public JsonModel SavePhoneAddress(Patients patients, bool updated)
 {
     try
     {
         _context.Update(patients);
         _context.SaveChanges();
         if (updated)
         {
             response = new JsonModel(new object(), StatusMessage.ClientAddressUpdated, (int)HttpStatusCodes.OK);
         }
         else
         {
             response = new JsonModel(new object(), StatusMessage.ClientAddressCreated, (int)HttpStatusCodes.OK);
         }
     }
     catch (Exception e) { response = new JsonModel(new object(), StatusMessage.ServerError, (int)HttpStatusCodes.InternalServerError, e.Message); }
     return(response);
 }
Exemplo n.º 14
0
 public void UploadDocument(List <UserDocument> userDocument)
 {
     _context.UserDocuments.AddRange(userDocument);
     _context.SaveChanges();
 }