コード例 #1
0
        private bool IsStudentExist(StudentDetailsModel saveStudentDetails)
        {
            var stuData = AllStudentList.Where(rc => rc.Name.ToLower() == saveStudentDetails.Name.ToLower()).FirstOrDefault();

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

            return(false);
        }
コード例 #2
0
 public void SaveStudentData(StudentDetailsModel saveStudentDetails, bool IsAdmin)
 {
     try
     {
         _saveAndUpdatestudentDetails = saveStudentDetails;
         _validationStudentDetails.StudentDetailsValidation(_saveAndUpdatestudentDetails, IsAdmin, (int)EnumOperation.Insert);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
コード例 #3
0
 public void UploadDocument(StudentDetailsModel updatestudentDetails)
 {
     try
     {
         _studentDB.UpdateStudentData(updatestudentDetails);
         EventInvoke.Instance.SetViewModelEventArg(OpeartaionEvent, "Document uploded successfully!", (int)EnumOperation.Update, (int)EnumResult.success);
     }
     catch (Exception Ex)
     {
         Console.WriteLine(Ex.Message);
     }
 }
コード例 #4
0
ファイル: StudentDB.cs プロジェクト: Sanket27993/MySchoolApp
 /// <summary>
 /// Update Student Data
 /// </summary>
 /// <param name="studentDetailsModel"></param>
 public void UpdateStudentData(StudentDetailsModel studentDetailsModel)
 {
     try
     {
         if (studentDetailsModel != null)
         {
             _dataLayer.Update(new Update <StudentDetailsModel>(studentDetailsModel));
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.StackTrace);
     }
 }
コード例 #5
0
ファイル: StudentDB.cs プロジェクト: Sanket27993/MySchoolApp
 /// <summary>
 /// Save Student Data
 /// </summary>
 /// <param name="studentDetailsModel"></param>
 public void SaveStudentData(StudentDetailsModel studentDetailsModel)
 {
     try
     {
         if (studentDetailsModel != null)
         {
             _dataLayer.SaveWithoutReplace(new Save <StudentDetailsModel>(studentDetailsModel));
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.StackTrace);
     }
 }
コード例 #6
0
 public void DeleteStudentData(StudentDetailsModel deleteStudentDetails)
 {
     try
     {
         _studentDB.DeleteStudentData(deleteStudentDetails);
         var userdata = UserList.Where(rc => rc.StudentID == deleteStudentDetails.StudentID).FirstOrDefault();
         if (userdata != null)
         {
             _authenticationDB.DeleteStudentData(userdata);
         }
         EventInvoke.Instance.SetViewModelEventArg(OpeartaionEvent, "Student Details has been Deleted successfully !", (int)EnumOperation.Delete, (int)EnumResult.success);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
コード例 #7
0
 /// <summary>
 /// Get Student details
 /// </summary>
 /// <param name="StudentID"></param>
 public void GetStudentData(int StudentID)
 {
     try
     {
         var allStudents = _studentDB.AllStudentData;
         if (allStudents != null && allStudents.Count > 0)
         {
             var studentData = allStudents.Where(rc => rc.StudentID == StudentID).FirstOrDefault();
             if (studentData != null)
             {
                 studentDetails = studentData;
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
コード例 #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);
                }
            }
        }
コード例 #9
0
 public void StudentDetailsValidation(StudentDetailsModel studentDetails, bool IsAdmin, int Operation)
 {
     if (IsAdmin && string.IsNullOrEmpty(studentDetails.Name))
     {
         SetValidationEventArg(AppConstant.PLEASE_ENTER_STUDENT_NAME, (int)EnumResult.fail, Operation);
     }
     else if (IsAdmin && string.IsNullOrEmpty(studentDetails.Gender))
     {
         SetValidationEventArg(AppConstant.PLEASE_SELECT_GENDER, (int)EnumResult.fail, Operation);
     }
     else if (IsAdmin && string.IsNullOrEmpty(studentDetails.StudentClass))
     {
         SetValidationEventArg(AppConstant.PLEASE_ENTER_STUDENT_CLASS, (int)EnumResult.fail, Operation);
     }
     else if (string.IsNullOrEmpty(studentDetails.Address))
     {
         SetValidationEventArg(AppConstant.PLEASE_ENTER_ADDRESS, (int)EnumResult.fail, Operation);
     }
     else if (string.IsNullOrEmpty(studentDetails.Street))
     {
         SetValidationEventArg(AppConstant.PLEASE_ENTER_STREET, (int)EnumResult.fail, Operation);
     }
     else if (string.IsNullOrEmpty(studentDetails.City))
     {
         SetValidationEventArg(AppConstant.PLEASE_ENTER_CITY, (int)EnumResult.fail, Operation);
     }
     else if (string.IsNullOrEmpty(studentDetails.State))
     {
         SetValidationEventArg(AppConstant.PLEASE_ENTER_STATE, (int)EnumResult.fail, Operation);
     }
     else if (string.IsNullOrEmpty(studentDetails.Country))
     {
         SetValidationEventArg(AppConstant.PLEASE_ENTER_COUNTRY, (int)EnumResult.fail, Operation);
     }
     else if (string.IsNullOrEmpty(studentDetails.PostalCode))
     {
         SetValidationEventArg(AppConstant.PLEASE_ENTER_ZIPCODE, (int)EnumResult.fail, Operation);
     }
     else if (!string.IsNullOrEmpty(studentDetails.PostalCode) && studentDetails.PostalCode.Length != 6)
     {
         SetValidationEventArg(AppConstant.PLEASE_ENTER_VALID_ZIP_CODE, (int)EnumResult.fail, Operation);
     }
     else if (!string.IsNullOrEmpty(studentDetails.PostalCode) && Convert.ToInt32(studentDetails.PostalCode) == 0)
     {
         SetValidationEventArg(AppConstant.PLEASE_ENTER_VALID_ZIP_CODE, (int)EnumResult.fail, Operation);
     }
     else if (string.IsNullOrEmpty(studentDetails.EmailID))
     {
         SetValidationEventArg(AppConstant.EMAIL_EMPTY_MESSAGE, (int)EnumResult.fail, Operation);
     }
     else if (!Validation.IsEmailValid(studentDetails.EmailID))
     {
         SetValidationEventArg(AppConstant.VALID_EMAIL_MESSAGE, (int)EnumResult.fail, Operation);
     }
     else if (string.IsNullOrEmpty(studentDetails.ContactNo))
     {
         SetValidationEventArg(AppConstant.PLEASE_ENTER_CONTACTNO, (int)EnumResult.fail, Operation);
     }
     else if (!string.IsNullOrEmpty(studentDetails.ContactNo) && studentDetails.ContactNo.Length != 10)
     {
         SetValidationEventArg(AppConstant.PLEASE_ENTER_VALID_CONTACTNO, (int)EnumResult.fail, Operation);
     }
     else
     {
         SetValidationEventArg(String.Empty, (int)EnumResult.success, Operation);
     }
 }