Example #1
0
        /// <summary>
        /// Create RegistrationService client proxy.
        /// </summary>
        /// <returns>New RegistrationService client proxy.</returns>
        public static RegistrationServiceClient CreateRegistrationService()
        {
            var proxy = new RegistrationServiceClient();

            SetupServiceUri(proxy.Endpoint);
            return(proxy);
        }
        public void RunRegistration()
        {
            while (true)
            {
                ClientInputProcessor inputProc = new ClientInputProcessor();
                var regInput = inputProc.ReadRegistrationInput();
                if (regInput == null)
                {
                    continue;
                }

                try
                {
                    using (var client = new RegistrationServiceClient(m_ChatServiceNode))
                    {
                        if (!client.Register(regInput))
                        {
                            Console.WriteLine(UIMessages.REG_FAILURE);
                            return;
                        }
                        else
                        {
                            Console.WriteLine(UIMessages.REG_SUCCESS);
                            return;
                        }
                    }
                }
                catch (Exception error)
                {
                    Console.Write("\nServer error: ");
                    Console.WriteLine(error.Message + "\n");
                    continue;
                }
            }
        }
Example #3
0
        private void loadList()
        {
            RegistrationServiceClient regService = new RegistrationServiceClient();
            stEnrolled = new List<StudentEnrollment>(regService.GetCurrentStudents(sY));

            gridView.DataSource = stEnrolled;

            switch (groupedBy)
            {
                case "Religion":
                    GroupDescriptor descriptor2 = new GroupDescriptor();
                    descriptor2.GroupNames.Add("Religion", ListSortDirection.Ascending);
                    this.gridView.GroupDescriptors.Add(descriptor2);
                    break;
                case "Grade Level":
                    GroupDescriptor descriptor4 = new GroupDescriptor();
                    descriptor4.GroupNames.Add("GradeLevel", ListSortDirection.Ascending);
                    this.gridView.GroupDescriptors.Add(descriptor4);
                    break;
                case "Section":
                    GroupDescriptor descriptor5 = new GroupDescriptor();
                    descriptor5.GroupNames.Add("GradeLevel", ListSortDirection.Ascending);
                    GroupDescriptor descriptor6 = new GroupDescriptor();
                    descriptor6.GroupNames.Add("Section", ListSortDirection.Ascending);
                    this.gridView.GroupDescriptors.Add(descriptor5);
                    this.gridView.GroupDescriptors.Add(descriptor6);
                    break;
                case "Gender":
                    GroupDescriptor descriptor3 = new GroupDescriptor();
                    descriptor3.GroupNames.Add("Gender", ListSortDirection.Ascending);
                    this.gridView.GroupDescriptors.Add(descriptor3);
                    break;
            }
        }
Example #4
0
        public DoctorRegisterWindow()
        {
            InitializeComponent();

            _commonService       = new CommonServiceClient();
            _registrationService = new RegistrationServiceClient();

            InitializeSpecializations();

            SpecializationsComboBox.ItemsSource = _specializations;
        }
Example #5
0
        public bool DoesEmailExist(string email)
        {
            bool result = false;

            RegistrationServiceClient registrationClient =
                new RegistrationServiceClient();

            result = registrationClient.DoesEmailExistForAccount(email);

            return(result);
        }
Example #6
0
    public void DeleteNamespace(
        string projectId   = "projectId",
        string locationId  = "us-east1",
        string namespaceId = "test-namespace")
    {
        // Create client
        RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create();
        // Initialize request argument(s)
        var namespaceName = NamespaceName.FromProjectLocationNamespace(projectId, locationId, namespaceId);

        registrationServiceClient.DeleteNamespace(namespaceName);
    }
    public Endpoint CreateEndpoint(
        string projectId   = "my-project",
        string locationId  = "us-east1",
        string namespaceId = "test-namespace",
        string serviceId   = "test-service",
        string endpointId  = "test-endpoint")
    {
        RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create();
        var serviceName = ServiceName.FromProjectLocationNamespaceService(projectId, locationId, namespaceId, serviceId);

        return(registrationServiceClient.CreateEndpoint(serviceName, new Endpoint(), endpointId));
    }
Example #8
0
    public Namespace CreateNamespace(
        string projectId   = "my-project",
        string locationId  = "us-east1",
        string namespaceId = "test-namespace")
    {
        // Create client
        RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create();
        // Initialize request argument(s)
        var locationName = LocationName.FromProjectLocation(projectId, locationId);

        return(registrationServiceClient.CreateNamespace(locationName, new Namespace(), namespaceId));
    }
Example #9
0
        public UserValidation ValidateUser(User user)
        {
            UserDTO dto = new UserDTO
            {
                FirstName = user.FirstName,
                LastName  = user.LastName,
                Email     = user.Email,
                UserName  = user.UserName
            };
            RegistrationServiceClient registration = new RegistrationServiceClient();

            return(Mapper.Map <UserValidation>(registration.ValidateUser(dto)));
        }
Example #10
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            RegistrationServiceClient registrationService = new RegistrationServiceClient();

            EnrolMe.StudentSY = RegisterStudent.StudentId + SY;
            EnrolMe.StudentId = RegisterStudent.StudentId;
            EnrolMe.SY = SY;
            EnrolMe.GradeLevel = this.GradeLevel;
            EnrolMe.Dismissed = false;
            EnrolMe.DiscountId = Int32.Parse(cmbScholarship.SelectedValue.ToString());
            EnrolMe.Rank = (int)RegisterStudent.ranking;
            //EnrolMe.GradeSectionCode=
            if (EnrolMe.Stat.Equals("b") || EnrolMe.Stat.Equals("c"))
            {
                if (registrationService.EnrolStudent(EnrolMe))
                {
                    Log("C", "StudentEnrolments", EnrolMe);
                    Log("U", "Students", EnrolMe);
                    Log("C", "StudentTraits", EnrolMe);

                    MessageBox.Show(this, "Student Successfully Registered.");
                    frmControlSubjects fmControlSubjects = new frmControlSubjects();
                    fmControlSubjects.controlStudentId = RegisterStudent.StudentId;
                    fmControlSubjects.ShowDialog(this);

                }
                else
                {
                    MessageBox.Show(this, "Student Registration Failed.");
                }
            }
            else
            {
                if (registrationService.EnrolStudent(EnrolMe))
                {
                    Log("C", "StudentEnrolments", EnrolMe);
                    Log("U", "Students", EnrolMe);
                    Log("C", "StudentTraits", EnrolMe);

                    MessageBox.Show(this, "Student Successfully Registered.");

                    frmControlSubjects fmControlSubjects = new frmControlSubjects();
                    fmControlSubjects.controlStudentId = RegisterStudent.StudentId;
                    fmControlSubjects.ShowDialog(this);

                }
                else
                    MessageBox.Show(this, "Student Registration Failed.");
            }
            this.Close();
        }
Example #11
0
        public void CreateUser(User user)
        {
            UserDTO dto = new UserDTO
            {
                FirstName = user.FirstName,
                LastName  = user.LastName,
                Email     = user.Email,
                UserName  = user.UserName,
                Password  = user.Password
            };
            RegistrationServiceClient registration = new RegistrationServiceClient();

            registration.Register(dto);
        }
Example #12
0
    public void DeleteEndpoint(
        string projectId   = "my-project",
        string locationId  = "us-east1",
        string namespaceId = "test-namespace",
        string serviceId   = "test-service",
        string endpointId  = "test-endpoint")
    {
        // Create client
        RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create();
        // Initialize request argument(s)
        var endpointName = EndpointName.FromProjectLocationNamespaceServiceEndpoint(projectId, locationId, namespaceId, serviceId, endpointId);

        registrationServiceClient.DeleteEndpoint(endpointName);
    }
    public void CreatesNamespace()
    {
        var namespaceId = _fixture.RandomResourceId;

        _fixture.TempNamespaceIds.Add(namespaceId);
        // Run the sample code.
        var createNamespaceSample = new CreateNamespaceSample();
        var result = createNamespaceSample.CreateNamespace(_fixture.ProjectId, _fixture.LocationId, namespaceId);

        // Get the namespace.
        var namespaceName = NamespaceName.FromProjectLocationNamespace(_fixture.ProjectId, _fixture.LocationId, namespaceId);
        RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create();
        var namespaceVal = registrationServiceClient.GetNamespace(namespaceName);

        Assert.Contains(namespaceVal.Name, result.Name);
    }
Example #14
0
    public void Dispose()
    {
        var registrationServiceClient = RegistrationServiceClient.Create();

        foreach (var namespaceId in TempNamespaceIds)
        {
            try
            {
                var namespaceName = NamespaceName.FromProjectLocationNamespace(ProjectId, LocationId, namespaceId);
                registrationServiceClient.DeleteNamespace(namespaceName);
            }
            catch (Exception)
            {
                // Do nothing, we delete on a best effort basis.
            }
        }
    }
    public void DeletesNamespace()
    {
        // Setup namespace for the test.
        var namespaceId = _fixture.RandomResourceId;

        _fixture.CreateNamespace(namespaceId);
        // Run the sample code.
        var deleteNamespaceSample = new DeleteNamespaceSample();

        deleteNamespaceSample.DeleteNamespace(_fixture.ProjectId, _fixture.LocationId, namespaceId);

        // Try to get the namespace.
        RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create();
        var namespaceName = NamespaceName.FromProjectLocationNamespace(_fixture.ProjectId, _fixture.LocationId, namespaceId);
        var exception     = Assert.Throws <RpcException>(() => registrationServiceClient.GetNamespace(namespaceName));

        Assert.Equal(StatusCode.NotFound, exception.StatusCode);
    }
    public void CreatesService()
    {
        // Setup namespace for the test.
        var namespaceId = _fixture.RandomResourceId;

        _fixture.CreateNamespace(namespaceId);

        var serviceId = _fixture.RandomResourceId;
        // Run the sample code.
        var createServiceSample = new CreateServiceSample();
        var result = createServiceSample.CreateService(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId);

        // Get the service.
        var serviceName = ServiceName.FromProjectLocationNamespaceService(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId);
        RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create();
        var service = registrationServiceClient.GetService(serviceName);

        Assert.Contains(serviceId, service.Name);
    }
    public void CreatesEndpoint()
    {
        // Setup namespace and service for test
        var namespaceId = _fixture.RandomResourceId;
        var serviceId   = _fixture.RandomResourceId;

        _fixture.CreateNamespace(namespaceId);
        _fixture.CreateService(namespaceId, serviceId);

        var endpointId           = _fixture.RandomResourceId;
        var createEndpointSample = new CreateEndpointSample();

        var result = createEndpointSample.CreateEndpoint(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId, endpointId);

        var endpointName = EndpointName.FromProjectLocationNamespaceServiceEndpoint(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId, endpointId);
        RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create();
        var endpoint = registrationServiceClient.GetEndpoint(endpointName);

        Assert.Equal(endpoint.Name, result.Name);
    }
Example #18
0
        public void LoadStudents()
        {
            RegistrationServiceClient registrationService = new RegistrationServiceClient();
            RegisteredStudents= new List<string>(registrationService.GetEnrolledStudents(GlobalClass.currentsy));
            StudentServiceClient studentService = new StudentServiceClient();
            string message = String.Empty;
            try
            {
                var students = studentService.GetAllStudents();
                studentList = new List<StudentServiceRef.Student>(students);
                gvStudent.DataSource = students;
                gvStudent.Refresh();

                if (gvStudent.RowCount != 0)
                    gvStudent.Rows[0].IsSelected = true;
            }
            catch (Exception ex)
            {
                message = "Error Loading Student List";
                MessageBox.Show(ex.ToString());
            }
        }
Example #19
0
 private void ScheduleSelector_Load(object sender, EventArgs e)
 {
     Sy = GlobalClass.currentsy;
     RegistrationServiceClient regService = new RegistrationServiceClient();
     Schedules=new List<StudentSchedule>(regService.GetSubjectSchedules(Sy));
     gvSchedule.DataSource = Schedules;
 }
Example #20
0
        public bool Register(string username, string password, string firstName, string middleInits, string lastName,
                             string streetAddress, string zipCode, string country, string city, string homePhone, string mobilePhone,
                             string email, ProfileType profileType)
        {
            bool result = false;

            RegistrationServiceClient registrationClient =
                new RegistrationServiceClient();

            Account account =
                new Account()
            {
                AccountID       = Guid.NewGuid(),
                AccountUsername = username,
                AccountPassword = password,
                AccountCode     = "INTERNET-REGISTRATION"
            };

            Person person =
                new Person()
            {
                PersonID             = Guid.NewGuid(),
                PersonFirstName      = firstName,
                PersonMiddleInitials = middleInits,
                PersonLastName       = lastName
            };

            Address address =
                new Address()
            {
                AddressID      = Guid.NewGuid(),
                AddressStreet  = streetAddress,
                AddressCity    = city,
                AddressZipCode = zipCode,
                AddressCountry = country,
                //TODO:  hard coding this for now instead of having user choose the type of address
                AddressTypeID = new Guid("74EE21B4-29F0-4EA9-B1C0-40CCD2D5BE00")
            };

            //TODO:  this is a problem but just store mobile for now
            PhoneNumber phoneNumber =
                new PhoneNumber()
            {
                PhoneNumberTypeID    = new Guid("B7CC6F6C-F435-4EF1-BFD8-92BCAFB2C4C3"),
                PhoneNumber_Property = mobilePhone
            };

            EmailAddress emailAddress =
                new EmailAddress()
            {
                EmailAddressID        = Guid.NewGuid(),
                EmailAddress_Property = email
            };



            result = registrationClient.Register(account,
                                                 person,
                                                 address,
                                                 phoneNumber,
                                                 emailAddress,
                                                 profileType);
            return(result);
        }
Example #21
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            RegistrationServiceClient registrationService = new RegistrationServiceClient();
            LogServiceClient logService = new LogServiceClient();
            if (ExistingSchedRemove.Count > 0)
            {
                if (registrationService.DeleteLoadedSubjects(controlStudentId, SY, ExistingSchedRemove.ToArray()))
                {

                    foreach (StudentSubject ss in ExistingSchedRemove)
                    {
                        string json = JsonConvert.SerializeObject(ss);
                        Log log = new Log
                        {
                            CLUD = "D",
                            LogDate = DateTime.Now,
                            TableName = "StudentSubject",
                            UserId = GlobalClass.user.UserId,
                            UserName = GlobalClass.user.UserName,
                            PassedData = json
                        };
                        logService.AddLogs(log);
                    }
                    MessageBox.Show(this, "Adding Student Subjects Successful .");
                    Close();
                }
                else
                {
                    MessageBox.Show(this, "Student Subjects Adding Failed.");
                    Close();
                }
            }
            if (subjects.Count > 0)
            {
                if (registrationService.ControlSubjects(controlStudentId, SY, subjects.ToArray()))
                {
                    foreach (StudentSubject ss in subjects)
                    {
                        string json = JsonConvert.SerializeObject(ss);
                        Log log = new Log
                        {
                            CLUD = "C",
                            LogDate = DateTime.Now,
                            TableName = "StudentSubject",
                            UserId = GlobalClass.user.UserId,
                            UserName = GlobalClass.user.UserName,
                            PassedData = json
                        };
                        logService.AddLogs(log);
                    }
                    MessageBox.Show(this, "Adding Student Subjects Successful .");
                    Close();
                }
                else
                {
                    MessageBox.Show(this, "Student Subjects Adding Failed.");
                    Close();
                }
            }
        }
Example #22
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            calculate.Visible = false;
            RegistrationServiceClient registrationService = new RegistrationServiceClient();
            LogServiceClient logService = new LogServiceClient();
            var assessments = registrationService.AssessMe(StudentAssessed);
            if (assessments.Length> 0)
            {
                string json = JsonConvert.SerializeObject(StudentAssessed);
                Log log = new Log
                {
                    CLUD = "C",
                    LogDate = DateTime.Now,
                    TableName = "StudentAssessment",
                    UserId = GlobalClass.user.UserId,
                    UserName = GlobalClass.user.UserName,
                    PassedData = json
                };
                logService.AddLogs(log);

                PrintPane();
                calculate.Visible = true;
            }
        }
Example #23
0
        private void frmStudentRegister_Load(object sender, EventArgs e)
        {
            RegistrationServiceClient registrationService = new RegistrationServiceClient();

            RegisterStudent =registrationService.StudentInfoWithRank(StudentId,GradeLevel,Gender);
            SY = GlobalClass.currentsy;

            Discounts = new List<ScholarshipDiscount>(registrationService.GetScholarshipDiscounts());
            txtSY.Text = SY;
            txtPrevGradeLevel.Text = RegisterStudent.GradeLevel;
            txtStudentId.Text = RegisterStudent.StudentId;
            txtName.Text = RegisterStudent.LastName + "," + RegisterStudent.FirstName + " " + RegisterStudent.MiddleName;
            txtGpa.Text = RegisterStudent.Average.ToString();
            txtFailed.Text = RegisterStudent.UnitsFailedLastYear.ToString();
            txtranking.Text = RegisterStudent.ranking.ToString();
            decimal cri = 3.50M;

              if (RegisterStudent.UnitsFailedLastYear.CompareTo(0.0M) == 0)
            {
                chkRetain.Checked = false;
                chkPromote.Checked = true;
                chkIrreg.Checked = false;
                Promote();
                EnrolMe.Stat = "a";
            }
               else if (RegisterStudent.UnitsFailedLastYear.CompareTo(cri) > 0)
            {
                chkRetain.Checked = true;
                chkPromote.Checked = false;
                chkIrreg.Checked = false;
                EnrolMe.Stat = "c";
                GradeLevel = RegisterStudent.GradeLevel;
            }
            else if (RegisterStudent.UnitsFailedLastYear.CompareTo(cri) <= 0) {
                chkRetain.Checked = false ;
                chkPromote.Checked = false;
                chkIrreg.Checked = true;
                Promote();
                EnrolMe.Stat = "b";
            }

            cmbScholarship.DataSource = Discounts;
            cmbScholarship.ValueMember = "ScholarshipDiscountId";
            cmbScholarship.DisplayMember = "Scholarship";
            cmbScholarship.SelectedValue = RegisterStudent.ScholarshipDiscountId;
        }
Example #24
0
        private void AssessStudent_Load(object sender, EventArgs e)
        {
            RegistrationServiceClient registrationService = new RegistrationServiceClient();
            List<Fee> fees = new List<Fee>();
            ScholarshipServiceClient scholarshipService = new ScholarshipServiceClient();
            List<RegistrationServiceRef.ScholarshipDiscount> scholarships = new List<RegistrationServiceRef.ScholarshipDiscount>();

            currentSY = registrationService.GetCurrentSY();

            StudentAssessed = registrationService.GetStudentEnrolled(StudentId, currentSY.SY);
            txtGradeLevel.Text = StudentAssessed.GradeLevel;
            txtIDnum.Text = StudentAssessed.StudentId;
            txtName.Text = StudentAssessed.StudentName;
            txtSY.Text = currentSY.SY;

            //scholarshipDiscount = scholarshipService.GetAllScholarshipDiscount(StudentAssessed.DiscountId);
            //scholarshipDiscount = scholarshipService.GetAllScholarships();

            fees = new List<Fee>(registrationService.GetStudentFees(StudentAssessed));
            gvAssessment.DataSource = fees;
            fees.ToArray();

            scholarships = new List<RegistrationServiceRef.ScholarshipDiscount>(registrationService.GetScholarshipDiscounts());

            int scholarshipDiscountId = StudentAssessed.DiscountId;

            RegistrationServiceRef.ScholarshipDiscount sd = new RegistrationServiceRef.ScholarshipDiscount();

            sd = scholarships.Find(v => v.ScholarshipDiscountId == scholarshipDiscountId);

            amountTuition = (double)fees[0].Amount;
            enrollment = (double)fees[1].Amount;

            // Read Only TextBox
            tuitionFee.ReadOnly = true;
            discountPercent.ReadOnly = true;
            totalTuitionFee.ReadOnly = true;
            enrollmentFee.ReadOnly = true;
            enrTotalTuitionFee.ReadOnly = true;
            subTotal.ReadOnly = true;
            discountbyAmountSubTotal.ReadOnly = true;
            Total.ReadOnly = true;

            // Total Tuition Fee
            tuitionFee.Text = amountTuition.ToString("0.###");

            // Percent Discount
            double perc = 0;
            double percRound = 0;
            double percInitial = 0;

            perc = (double)sd.Discount;
            if (sd.Discount == null)
            {
                discountPercent.Enabled = false;
            }
            else
            {
                discountPercent.Text = perc.ToString("0.##");
                percRound = perc / 100;
                if (percRound == 1)
                {
                    percValue = amountTuition;
                    fullPaymentDisc.ReadOnly = true;
                } else {
                    percInitial = amountTuition * percRound;
                    percValue = amountTuition - percInitial;
                }
            }

               /* Operations */
            // Operation for Percent Discount if not null

            if (fullPaymentDisc != null)
            {
                finalPercentDisc = amountTuition - percValue - fullPaymentDiscount;
            }
            else
            {
                finalPercentDisc = amountTuition - percValue;
            }

            // Total Tuition Fee
            totalTuitionFee.Text = finalPercentDisc.ToString("0.##");

            // Enrollment Fee
            enrollmentFee.Text = enrollment.ToString();

            // Total Tuition Fee
            enrTotalTuitionFee.Text = finalPercentDisc.ToString("0.##");

            // Sub Total

            subTotalValue = enrollment + finalPercentDisc;
            subTotal.Text = subTotalValue.ToString("0.##");

            // Sub Total
            discountbyAmountSubTotal.Text = subTotalValue.ToString("0.##");

            // Discount by Amount
            double discByAmout = 0;
            //discByAmout = discountByAmount

            // Para ma assess og ma save sa db
            //var assessments = registrationService.AssessMe(StudentAssessed);

            //gvAssessment.DataSource = assessments;
        }
Example #25
0
        private void frmControlSubjects_Load(object sender, EventArgs e)
        {
            RegistrationServiceClient registrationService = new RegistrationServiceClient();
            string message = String.Empty;

            ControlStudent = registrationService.GetStudent(controlStudentId,ref message);
            StudentEnrollment enrStudent = new StudentEnrollment();

            SY = GlobalClass.currentsy;
            enrStudent = registrationService.GetStudentEnrolled(controlStudentId,SY);

            EnrolMe.StudentSY = controlStudentId + SY;
            int prev =Int32.Parse(SY.Substring(0,4));
            prev--;
            int sy = Int32.Parse(SY.Substring(5, 4));
            sy--;
            string prevSY = prev.ToString() + "-" + sy.ToString();

            string prevRecord = controlStudentId + prevSY;
            FailedSubjects = new List<StudentSubject>(registrationService.GetFailedSubjects(prevRecord));
            StudentSubs = new List<StudentSubject>(registrationService.GetStudentSubjects(EnrolMe.StudentSY));
            Schedules = new List<StudentSchedule>(registrationService.GetSubjectSchedules(SY));

            if (StudentSubs.Count > 0)
            {
                ExistingSchedule = new List<StudentSchedule>(registrationService.GetStudentExistingSchedule(StudentSubs.ToArray(), SY));

            }

            if (ExistingSchedule.Count > 0) {
                foreach (StudentSchedule ss in ExistingSchedule) {
                    int index = Schedules.FindIndex(item => item.SubjectAssignments == ss.SubjectAssignments);
                    Schedules.RemoveAt(index);
                    //StudentSubject s = new StudentSubject()
                    //{
                    //    StudentSY = controlStudentId + SY,
                    //    SubjectCode = ss.SubjectCode,
                    //    SubjectAssignments = ss.SubjectAssignments,
                    //    StudentEnrSubCode = controlStudentId + SY + ss.SubjectCode,
                    //    LockFirst = false,
                    //    LockSecond = false,
                    //    LockThird = false,
                    //    LockFourth = false,
                    //    FirstPeriodicRating = 0.00,
                    //    SecondPeriodicRating = 0.00,
                    //    ThirdPeriodicRating = 0.00,
                    //    FourthPeriodicRating = 0.00
                    //};
                    //subjects.Add(s);
                }
            }

            gvAllSchedules.DataSource = Schedules;
            gvFail.DataSource = FailedSubjects;

            if (ControlStudent.UnitsFailedLastYear == 0 && StudentSubs.Count == 0)
            {
                int sectionCode = (int)enrStudent.GradeSectionCode;
                Schedule = new List<StudentSchedule>(registrationService.GetSubjectsOfSection(sectionCode, SY));
                foreach (StudentSchedule sch in Schedule) {
                    StudentSubject ss = new StudentSubject()
                    {
                        StudentSY = controlStudentId + SY,
                        SubjectCode = sch.SubjectCode,
                        SubjectAssignments = sch.SubjectAssignments,
                        StudentEnrSubCode = controlStudentId + SY + sch.SubjectCode,
                        LockFirst = false,
                        LockSecond = false,
                        LockThird = false,
                        LockFourth = false,
                        FirstPeriodicRating = 0.00,
                        SecondPeriodicRating = 0.00,
                        ThirdPeriodicRating = 0.00,
                        FourthPeriodicRating = 0.00
                    };
                    subjects.Add(ss);
                }

                ControlSchedule = Schedule;
                GlobalClass.gvDatasource = 1;
                gvSchedule.DataSource = ControlSchedule;
                gvSchedule.ReadOnly = false;
            }
            else if (StudentSubs.Count > 0)
            {
                GlobalClass.gvDatasource = 2;
                ControlSchedule = ExistingSchedule;
                gvAllSchedules.ReadOnly = false;
                gvSchedule.ReadOnly = false;
                //   btnSelect.Enabled = true;
                gvSchedule.DataSource = ControlSchedule;
            }
             else if (ControlStudent.UnitsFailedLastYear > 0)
             {
                GlobalClass.gvDatasource = 3;
                gvAllSchedules.ReadOnly = false;
                gvSchedule.ReadOnly = false;
            }
            txtSection.Text = ControlStudent.Section;
            txtSY.Text = SY;
            txtGradeLevel.Text = ControlStudent.GradeLevel;
            txtStudentId.Text = ControlStudent.StudentId;
            txtStudentName.Text = ControlStudent.LastName + "," + ControlStudent.FirstName + " " + ControlStudent.MiddleName;
            txtPrevGPA.Text = ControlStudent.Average.ToString();
            txtUnitsFailed.Text = ControlStudent.UnitsFailedLastYear.ToString();
        }