public ScheduleRepository(MIDASGBXEntities context)
     : base(context)
 {
     _dbSet = context.Set <Schedule>();
     _dbSetScheduleDetail = context.Set <ScheduleDetail>();
     context.Configuration.ProxyCreationEnabled = false;
 }
        /// <summary>
        /// Returns the user based on authentication context
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        public Model.User GetUser(string userName, string password)
        {
            _context = new MIDASGBXEntities();
            User user = _context.Users.Where(u => u.UserName == userName).FirstOrDefault();

            if (user != null)
            {
                try
                {
                    if (Common.PasswordHash.ValidatePassword(password, user.Password))
                    {
                        Model.User midasuser = new Model.User();
                        midasuser.Subject     = Convert.ToString(user.id);
                        midasuser.Id          = user.id;
                        midasuser.Username    = user.UserName;
                        midasuser.FirstName   = user.FirstName;
                        midasuser.MiddleName  = user.MiddleName;
                        midasuser.LastName    = user.LastName;
                        midasuser.DisplayName = user.FirstName + ' ' + user.LastName;
                        midasuser.TwoFactorEmailAuthEnabled = (user.C2FactAuthEmailEnabled == null || user.C2FactAuthEmailEnabled == false ? false : true);
                        midasuser.TwoFactorSMSAuthEnabled   = (user.C2FactAuthSMSEnabled == null || user.C2FactAuthSMSEnabled == false ? false : true);
                        midasuser.Roles = GetUserRoles(user.id);

                        return(midasuser);
                    }
                }
                catch (Exception)
                {
                    //Log exception
                }
            }

            return(null);
        }
        public InvitationRepository(MIDASGBXEntities context)
            : base(context)
        {
            _dbInvitation = context.Set <Invitation>();

            context.Configuration.ProxyCreationEnabled = false;
        }
 public AttorneyMasterRepository(MIDASGBXEntities context) : base(context)
 {
     _dbAttorney            = context.Set <Attorney>();
     _dbAttorneyAddressInfo = context.Set <AddressInfo>();
     _dbAttorneyContactInfo = context.Set <ContactInfo>();
     context.Configuration.ProxyCreationEnabled = false;
 }
示例#5
0
 public DoctorRepository(MIDASGBXEntities context)
     : base(context)
 {
     _dbSetDocSpecility       = context.Set <DoctorSpeciality>();
     _dbSet                   = context.Set <Doctor>();
     _dbSetDocRoomTestMapping = context.Set <DoctorRoomTestMapping>();
     context.Configuration.ProxyCreationEnabled = false;
 }
示例#6
0
 public CompanyRepository(MIDASGBXEntities context) : base(context)
 {
     _dbSet             = context.Set <Company>();
     _dbuser            = context.Set <User>();
     _dbUserCompany     = context.Set <UserCompany>();
     _dbUserCompanyRole = context.Set <UserCompanyRole>();
     _dbInvitation      = context.Set <Invitation>();
     context.Configuration.ProxyCreationEnabled = false;
 }
        //private int UTCAdjustment_Minutes = 0;

        public CalendarEventRepository(MIDASGBXEntities context) : base(context)
        {
            _dbCalendarEvent = context.Set <CalendarEvent>();
            context.Configuration.ProxyCreationEnabled = false;

            //if (ConfigurationManager.AppSettings["UTCAdjustment_Minutes"] != null)
            //{
            //    int.TryParse(ConfigurationManager.AppSettings["UTCAdjustment_Minutes"], out UTCAdjustment_Minutes);
            //}
        }
示例#8
0
        public MIDASGBXEntities GetGbDBContext()
        {
            MIDASGBXEntities context      = null;
            string           serverName   = ConfigReader.GetSettingsValue <string>("GbDatabaseServer", "codearray.dlinkddns.com");
            string           databaseName = ConfigReader.GetSettingsValue <string>("GbDatabase", "GreenBillsDb");
            string           modelName    = ConfigReader.GetSettingsValue <string>("ModelName", "GreenBillsDb");

            string entityConnection = ConnectionStringProvider.GetEntityConnection(serverName, databaseName, modelName);

            context = new MIDASGBXEntities();


            // ((IObjectContextAdapter)context).ObjectContext.CommandTimeout = ConfigReader.GetSettingsValue<int>("CommandTimeout", 300);

            return(context);
        }
        public bool GenerateAndSendOTP(int userID)
        {
            _context = new MIDASGBXEntities();
            Repository.User user = _context.Users.Where(u => u.id == userID).FirstOrDefault();
            int             defaultAdminUserID = Convert.ToInt32(Common.Utility.GetConfigValue("DefaultAdminUserID"));
            bool            result             = false;

            try
            {
                if (user != null)
                {
                    var existingOTP = _context.OTPs.Where(p => p.UserID == userID).ToList();
                    existingOTP.ForEach(a => { a.IsDeleted = true; a.UpdateDate = DateTime.UtcNow; a.UpdateByUserID = defaultAdminUserID; });
                }

                OTP otp = new OTP();
                otp.OTPCode        = Common.Utility.GenerateRandomNumber(6);
                otp.Pin            = Common.Utility.GenerateRandomNo();
                otp.UserID         = user.id;
                otp.CreateDate     = DateTime.UtcNow;
                otp.CreateByUserID = Convert.ToInt32(defaultAdminUserID);
                otp.IsDeleted      = false;

                _context.OTPs.Add(otp);
                _context.SaveChanges();

                string Message = "Dear " + user.FirstName
                                 + ",<br><br>As per your request, a One Time Password (OTP) has been generated and the same is <i><b>" + otp.OTPCode.ToString()
                                 + "</b></i><br><br>Please use this OTP to complete the Login. Reference number is " + otp.Pin.ToString()
                                 + " <br><br>*** This is an auto-generated email. Please do not reply to this email.*** <br><br>Thanks"
                                 + " <br><br>MIDAS Administrator";

                Common.Email mail = new Common.Email();
                mail.ToEmail = user.UserName;
                mail.Subject = "OTP Alert Message From GBX MIDAS";
                mail.Body    = Message;

                mail.SendMail();
                result = true;
            }
            catch
            {
                result = false;
            }
            return(result);
        }
        public bool VerifyOTP(int userId, int otpCode)
        {
            _context = new MIDASGBXEntities();
            bool result = false;

            var otp = _context.OTPs
                      .Where(u => u.UserID == userId && u.OTPCode == otpCode && u.IsDeleted == false).FirstOrDefault();

            if (otp != null)
            {
                otp.IsDeleted      = true;
                otp.UpdateByUserID = userId;
                otp.UpdateDate     = DateTime.UtcNow;
                _context.SaveChanges();

                result = true;
            }
            return(result);
        }
        /// <summary>
        /// Returns user by user id
        /// </summary>
        /// <param name="userID"></param>
        public Model.User GetUserProfileData(int userID)
        {
            _context = new MIDASGBXEntities();
            Model.User      midasuser = new Model.User();
            Repository.User user      = _context.Users.Where(u => u.id == userID).FirstOrDefault();

            if (user != null)
            {
                midasuser.Subject     = Convert.ToString(user.id);
                midasuser.Id          = user.id;
                midasuser.Username    = user.UserName;
                midasuser.FirstName   = user.FirstName;
                midasuser.MiddleName  = user.MiddleName;
                midasuser.LastName    = user.LastName;
                midasuser.DisplayName = user.FirstName + ' ' + user.LastName;
                midasuser.TwoFactorEmailAuthEnabled = (user.C2FactAuthEmailEnabled == null ? false : true);
                midasuser.TwoFactorSMSAuthEnabled   = (user.C2FactAuthSMSEnabled == null ? false : true);
                midasuser.Roles = GetUserRoles(user.id);
            }

            return(user != null ? midasuser : null);
        }
示例#12
0
 public RefferingOfficeRepository(MIDASGBXEntities context)
     : base(context)
 {
     _dbSet = context.Set <RefferingOffice>();
     context.Configuration.ProxyCreationEnabled = false;
 }
 public SpecialityDetailsRepository(MIDASGBXEntities context)
     : base(context)
 {
     _dbSet = context.Set <SpecialtyDetail>();
     context.Configuration.ProxyCreationEnabled = false;
 }
 public PlaintiffVehicleRepository(MIDASGBXEntities context) : base(context)
 {
     _dbAccidentInfo = context.Set <PlaintiffVehicle>();
     context.Configuration.ProxyCreationEnabled = false;
 }
示例#15
0
 public CompanyCaseConsentApprovalRepository(MIDASGBXEntities context) : base(context)
 {
     _dbCompanyCaseConsentApproval = context.Set <CompanyCaseConsentApproval>();
     context.Configuration.ProxyCreationEnabled = false;
 }
示例#16
0
 public AttorneyVisitRepository(MIDASGBXEntities context) : base(context)
 {
     _dbpatientVisit = context.Set <AttorneyVisit>();
     context.Configuration.ProxyCreationEnabled = false;
 }
示例#17
0
 public OTPCompanyMappingRepository(MIDASGBXEntities context) : base(context)
 {
     _dbSet = context.Set <OTPCompanyMapping>();
     context.Configuration.ProxyCreationEnabled = false;
 }
示例#18
0
 public DocumentNodeObjectMappingRepository(MIDASGBXEntities context)
     : base(context)
 {
     _dbSet = context.Set <DocumentNodeObjectMapping>();
     context.Configuration.ProxyCreationEnabled = false;
 }
 public CaseInsuranceMappingRepository(MIDASGBXEntities context) : base(context)
 {
     _dbCaseInsuranceMapping = context.Set <CaseInsuranceMapping>();
     context.Configuration.ProxyCreationEnabled = false;
 }
 public SocialMediaRepository(MIDASGBXEntities context)
     : base(context)
 {
     _dbSet = context.Set <CaseStatu>();
     context.Configuration.ProxyCreationEnabled = false;
 }
 public PatientEmpInfoRepository(MIDASGBXEntities context) : base(context)
 {
     _dbEmpInfo = context.Set <PatientEmpInfo>();
     context.Configuration.ProxyCreationEnabled = false;
 }
示例#22
0
 public ReportsRepository(MIDASGBXEntities context) : base(context)
 {
 }
示例#23
0
 public CityRepository(MIDASGBXEntities context) : base(context)
 {
     _dbCity = context.Set <City>();
 }
示例#24
0
 public UserCompanyRepository(MIDASGBXEntities context)
     : base(context)
 {
     _dbSet = context.Set <UserCompany>();
     context.Configuration.ProxyCreationEnabled = false;
 }
 public AdjusterMasterRepository(MIDASGBXEntities context) : base(context)
 {
     _dbAdjusterMaster = context.Set <AdjusterMaster>();
     context.Configuration.ProxyCreationEnabled = false;
 }
 public DoctorLocationScheduleRepository(MIDASGBXEntities context)
     : base(context)
 {
     _dbSet = context.Set <DoctorLocationSchedule>();
     context.Configuration.ProxyCreationEnabled = false;
 }
 public InsuranceMasterRepository(MIDASGBXEntities context)
     : base(context)
 {
     _dbSet = context.Set <InsuranceMaster>();
     context.Configuration.ProxyCreationEnabled = false;
 }
示例#28
0
 public PreferredAttorneyProviderRepository(MIDASGBXEntities context) : base(context)
 {
     _dbSet = context.Set <PreferredAttorneyProvider>();
 }
示例#29
0
 public RoomTestRepository(MIDASGBXEntities context)
     : base(context)
 {
     _dbSet = context.Set <RoomTest>();
     context.Configuration.ProxyCreationEnabled = false;
 }
 public SchoolInformationRepository(MIDASGBXEntities context) : base(context)
 {
     _dbSchoolInformation = context.Set<SchoolInformation>();
     context.Configuration.ProxyCreationEnabled = false;
 }