public ReshimgathiMatrimony.Login GetUserDetails(string UserName, string Password)
        {
            using (ReshimgathiMatrimonyEntities db = new ReshimgathiMatrimonyEntities())
            {
                var userDetails = db.Logins.Where(x => x.UserName == UserName && x.Password == Password).FirstOrDefault();

                return(userDetails);
            }
        }
예제 #2
0
        public bool CheckUserNameAvailability(string userName)
        {
            using (ReshimgathiMatrimonyEntities db = new ReshimgathiMatrimonyEntities())
            {
                var userDetails = db.Logins.Where(x => x.UserName == userName).FirstOrDefault();

                if (userDetails != null)
                {
                    return(true);
                }
            }

            return(false);
        }
        public bool IsLogInUserVerified(string UserName, string Password)
        {
            using (ReshimgathiMatrimonyEntities db = new ReshimgathiMatrimonyEntities())
            {
                var userDetails = db.Logins.Where(x => x.UserName == UserName && x.Password == Password).FirstOrDefault();

                if ((bool)userDetails.IsVerified)
                {
                    return(true);
                }
            }

            return(false);
        }
        public UserType LoggedUserType(string UserName, string Password)
        {
            using (ReshimgathiMatrimonyEntities db = new ReshimgathiMatrimonyEntities())
            {
                var  userDetails = db.Logins.Where(x => x.UserName == UserName && x.Password == Password).FirstOrDefault();
                bool userType    = Convert.ToBoolean((int)Enum.Parse(UserType.User.GetType(), UserType.User.ToString()));

                if (userDetails.UserType == userType)
                {
                    return(UserType.User);
                }
                else
                {
                    return(UserType.Admin);
                }
            }
        }
예제 #5
0
        public bool Add(Registration model)
        {
            Login data = new Login();

            data.UserName = model.UserName;
            data.Password = model.Password;

            using (ReshimgathiMatrimonyEntities db = new ReshimgathiMatrimonyEntities())
            {
                //Create Login record first and return LoginId
                LoginOperations log     = new LoginOperations();
                Guid            LoginId = log.Add(data);

                if (LoginId == Guid.Empty)
                {
                    throw new Exception("Login record is not created due to server error. Please try again.");
                }

                RegistrationPhase1 record = new RegistrationPhase1();
                record.Id              = Guid.NewGuid();
                record.LoginId         = LoginId;
                record.ReshimgathiId   = Reshimgathi.Instance.GenerateReshimgathiId();
                record.FirstName       = model.FirstName;
                record.LastName        = model.LastName;
                record.EmailId         = model.EmailId;
                record.PhoneNumber     = model.PhoneNumber;
                record.IsEmailVerified = false;
                record.IsPhoneVerified = false;
                record.CreateDate      = DateTime.Now;
                record.UpdatedDate     = DateTime.Now;

                var response = db.RegistrationPhase1.Add(record);

                db.SaveChanges();

                if (response != null)
                {
                    return(true);
                }
            }

            return(false);
        }
        public bool IsLoggedUserPresent(string UserName, string Password)
        {
            //throw new Exception("Manual exception thrown.");
            using (ReshimgathiMatrimonyEntities db = new ReshimgathiMatrimonyEntities())
            {
                //calling a function from database using entity framework
                //IQueryable loginResult = db.GetLoginDetails();

                //calling a stored procedure from databas using entity framework
                //var procResult = db.GetLoginDetailsProc(string.Empty);

                var IsUSerPresent = db.Logins.Where(x => x.UserName == UserName && x.Password == Password).FirstOrDefault();

                if (IsUSerPresent != null)
                {
                    return(true);
                }
            }

            return(false);
        }
        public Guid Add(ReshimgathiMatrimony.Models.Login data)
        {
            ReshimgathiMatrimony.Login record = new ReshimgathiMatrimony.Login();
            record.Id          = Guid.NewGuid();
            record.UserName    = data.UserName;
            record.Password    = data.Password;
            record.UserType    = false;
            record.IsVerified  = false;
            record.CreateDate  = DateTime.Now;
            record.UpdatedDate = DateTime.Now;

            using (ReshimgathiMatrimonyEntities db = new ReshimgathiMatrimonyEntities())
            {
                var response = db.Logins.Add(record);
                db.SaveChanges();
                if (response != null)
                {
                    return(record.Id);
                }
            }

            return(Guid.Empty);
        }