Exemple #1
0
        /// <summary>
        /// User login
        /// </summary>
        /// <param name="UserName"></param>
        /// <param name="Password"></param>
        public void UserLogin(UserOAuthenticationModel userOAuthentication)
        {
            bool IsValid = _validationLogin.Validate(userOAuthentication);

            if (IsValid)
            {
                GetUserData(userOAuthentication);
            }
            else
            {
                EventInvoke.Instance.SetViewModelEventArg(OpeartaionEvent, _validationLogin.Message, (int)EnumOperation.Get, (int)EnumResult.fail);
            }
        }
Exemple #2
0
 /// <summary>
 /// Delete User Data
 /// </summary>
 /// <param name="studentDetailsModel"></param>
 public void DeleteStudentData(UserOAuthenticationModel userOAuthentication)
 {
     try
     {
         if (userOAuthentication != null)
         {
             _dataLayer.Delete(new Delete <UserOAuthenticationModel>(userOAuthentication));
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.StackTrace);
     }
 }
Exemple #3
0
 /// <summary>
 /// Save user data
 /// </summary>
 /// <param name="userOAuthentication"></param>
 public void SaveUserData(UserOAuthenticationModel userOAuthentication)
 {
     try
     {
         if (userOAuthentication != null)
         {
             _dataLayer.SaveWithoutReplace(new Save <UserOAuthenticationModel>(userOAuthentication));
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.StackTrace);
     }
 }
Exemple #4
0
 private void SavetStudentData()
 {
     if (_saveAndUpdatestudentDetails != null)
     {
         _studentDB.SaveStudentData(_saveAndUpdatestudentDetails);
         UserOAuthenticationModel userOAuthentication = new UserOAuthenticationModel
         {
             IsAdmin   = false,
             StudentID = _saveAndUpdatestudentDetails.StudentID,
             UserName  = "******" + _saveAndUpdatestudentDetails.StudentID,
             Password  = "******"
         };
         _authenticationDB.SaveUserData(userOAuthentication);
     }
 }
Exemple #5
0
 /// <summary>
 /// Set sign in validation
 /// </summary>
 /// <param name="loginModel"></param>
 /// <returns></returns>
 public bool Validate(UserOAuthenticationModel userOAuthentication)
 {
     if (string.IsNullOrEmpty(userOAuthentication.UserName))
     {
         Message = AppConstant.USERNAME_EMPTY_MESSAGE;
         isValid = false;
     }
     else if (string.IsNullOrEmpty(userOAuthentication.Password))
     {
         Message = AppConstant.PASSWORD_EMPTY_MESSAGE;
         isValid = false;
     }
     else
     {
         Message = string.Empty;
         isValid = true;
     }
     return(isValid);
 }
Exemple #6
0
        private void SaveUserData()
        {
            List <UserOAuthenticationModel> users = new List <UserOAuthenticationModel>();
            UserOAuthenticationModel        userOAuthenticationModel = new UserOAuthenticationModel();

            userOAuthenticationModel.IsAdmin  = true;
            userOAuthenticationModel.UserName = "******";
            userOAuthenticationModel.Password = "******";
            userOAuthenticationModel.UserID   = 1;

            users.Add(userOAuthenticationModel);

            // userOAuthenticationModel = new UserOAuthenticationModel();
            //userOAuthenticationModel.IsAdmin = false;
            //userOAuthenticationModel.UserName = "******";
            //userOAuthenticationModel.Password = "******";
            //userOAuthenticationModel.UserID = 2;
            //users.Add(userOAuthenticationModel);

            foreach (var data in users)
            {
                _authenticationDB.SaveUserData(data);
            }
        }
Exemple #7
0
 /// <summary>
 /// Get user Data
 /// </summary>
 /// <param name="userData"></param>
 private void GetUserData(UserOAuthenticationModel userData)
 {
     try
     {
         var allusers = _authenticationDB.AllUserData;
         if (allusers != null && allusers.Count > 0)
         {
             var user = _authenticationDB.AllUserData.FirstOrDefault(rc => rc.UserName == userData.UserName && rc.Password == userData.Password);
             if (user != null)
             {
                 UserOAuthenticationData = user;
                 EventInvoke.Instance.SetViewModelEventArg(OpeartaionEvent, "Success", (int)EnumOperation.Get, (int)EnumResult.success);
             }
             else
             {
                 EventInvoke.Instance.SetViewModelEventArg(OpeartaionEvent, "Invalid User", (int)EnumOperation.Get, (int)EnumResult.fail);
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Exemple #8
0
        private void StudentDummyData()
        {
            List <StudentDetailsModel> studentDetailsModels = new List <StudentDetailsModel>();

            StudentDetailsModel studentDetails = new StudentDetailsModel
            {
                StudentID    = 1,
                Name         = "Divya Prajapati",
                Gender       = "Female",
                StudentClass = "9th B",
                Birthdate    = "02/02/1990",
                EmailID      = "*****@*****.**",
                Address      = "Prajapatiwadi Chhipvad Valsad",
                City         = "valsad",
                Street       = "chipwad",
                State        = "Gujarat",
                PostalCode   = "396001",
                IsAudited    = false,
                Country      = "India",
                ContactNo    = "1234567890"
            };
            UserOAuthenticationModel userOAuthentication = new UserOAuthenticationModel
            {
                IsAdmin   = true,
                StudentID = 1,
                UserName  = "******",
                Password  = "******",
                UserID    = 1
            };

            studentDetails.userOAuthenticationModel = userOAuthentication;
            studentDetailsModels.Add(studentDetails);

            studentDetails = new StudentDetailsModel
            {
                StudentID    = 2,
                Name         = "Devang Prajapati",
                Gender       = "Male",
                StudentClass = "10th B",
                Birthdate    = "02/02/1990",
                EmailID      = "*****@*****.**",
                Address      = "Prajapatiwadi Chhipvad Valsad",
                City         = "valsad",
                Street       = "chipwad",
                State        = "Gujarat",
                PostalCode   = "396001",
                IsAudited    = false,
                Country      = "India",
                ContactNo    = "1234567890"
            };
            userOAuthentication = new UserOAuthenticationModel
            {
                IsAdmin   = false,
                StudentID = 2,
                UserName  = "******",
                Password  = "******",
                UserID    = 2
            };
            studentDetails.userOAuthenticationModel = userOAuthentication;
            studentDetailsModels.Add(studentDetails);
            studentDetails = new StudentDetailsModel
            {
                StudentID    = 3,
                Name         = "Smit Prajapati",
                Gender       = "Male",
                StudentClass = "10th B",
                Birthdate    = "02/02/1990",
                EmailID      = "*****@*****.**",
                Address      = "Prajapatiwadi Chhipvad Valsad",
                City         = "valsad",
                Street       = "chipwad",
                State        = "Gujarat",
                PostalCode   = "396001",
                IsAudited    = false,
                Country      = "India",
                ContactNo    = "1234567890"
            };
            userOAuthentication = new UserOAuthenticationModel
            {
                IsAdmin   = false,
                StudentID = 2,
                UserName  = "******",
                Password  = "******",
                UserID    = 2
            };
            studentDetails.userOAuthenticationModel = userOAuthentication;
            studentDetailsModels.Add(studentDetails);
            //userOAuthentication = new UserOAuthenticationModel
            //{
            //    IsAdmin = true,
            //    StudentID = 0,
            //    UserName = "******",
            //    Password = "******",
            //    UserID = 4
            //};

            //studentDetails = new StudentDetailsModel();
            //studentDetails.userOAuthenticationModel = userOAuthentication;
            //studentDetailsModels.Add(studentDetails);

            foreach (var data in studentDetailsModels)
            {
                if (data != null)
                {
                    _studentDB.SaveStudentData(data);
                    _authenticationDB.SaveUserData(data.userOAuthenticationModel);
                }
            }
        }