Exemple #1
0
        protected void btnAddMarks_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtRegisterNumber.Text))
            {
                bool stumarks = Validation_Marks();

                if (!stumarks)
                {
                    var student = entities.Students.FirstOrDefault(s => s.RegisterNumber == txtRegisterNumber.Text);


                    MarksCard mc = new MarksCard();
                    mc.AlphaSign          = "";
                    mc.CollegeCode        = student.College.Code;
                    mc.CollegeName        = student.College.Name;
                    mc.CourseCode         = student.Cours.Code;
                    mc.CreatedDate        = DateTime.Now;
                    mc.DegreeName         = student.Degree.Name;
                    mc.GroupName          = "Group-II : Optionals";
                    mc.GroupTotal         = "";
                    mc.IsSemesterPass     = "******";
                    mc.IsSubjectPass      = true;
                    mc.MarksCardOrder     = 0;
                    mc.MarksPercent       = 0;
                    mc.PracticalGrace     = "0";
                    mc.PracticalIAGrace   = "0";
                    mc.PracticalIAMarks   = txtPractialIAMarks.Text;
                    mc.PracticalIAMax     = txtPractialIAMax.Text;
                    mc.PracticalIAMin     = txtPractialIAMin.Text;
                    mc.PracticalIATotal   = txtPractialIAMarks.Text;
                    mc.PracticalMarks     = txtPractialMarks.Text;
                    mc.PracticalMax       = txtPractialMax.Text;
                    mc.PracticalMin       = txtPracticalMin.Text;
                    mc.PracticalNetTotal  = txtPractialNetTotal.Text;
                    mc.PracticalTotal     = txtPractialMarks.Text;
                    mc.RegisterNumber     = student.RegisterNumber;
                    mc.Remarks            = txtRemarks.Text;
                    mc.SemesterAlphaSign  = "";
                    mc.SemesterClass      = "";
                    mc.SemesterCredits    = "";
                    mc.SemesterGPA        = "";
                    mc.SemesterMax        = 0;
                    mc.SemesterMin        = 0;
                    mc.SemesterPercentage = "";
                    mc.SemesterTotal      = 0;
                    mc.StudentName        = student.FirstName + " " + student.LastName;
                    mc.SubGroupName       = "";
                    mc.SubGroupTotal      = "";
                    mc.SubjectCode        = txtSubjectCode.Text;
                    mc.SubjectCredits     = txtCredits.Text;
                    mc.SubjectGPA         = txtGPA.Text;
                    mc.SubjectGPW         = txtGPW.Text;
                    mc.SubjectMax         = int.Parse(txtSubjectMax.Text);
                    mc.SubjectMin         = int.Parse(txtSubjectMin.Text);
                    mc.SubjectName        = txtSubjectName.Text;
                    mc.SubjectTotal       = txtTotalMarks.Text;
                    mc.SubjectType        = txtSubjectType.Text;
                    mc.TheoryGrace        = "0";
                    mc.TheoryIAGrace      = "0";
                    mc.TheoryIAMarks      = txtTheoryIAMarks.Text;
                    mc.TheoryIAMax        = txtTheoryIAMax.Text;
                    mc.TheoryIAMin        = txtTheoryIAMin.Text;
                    mc.TheoryIATotal      = txtTheoryIAMarks.Text;
                    mc.TheoryMarks        = txtTheoryMarks.Text;
                    mc.TheoryMax          = txtTheoryMax.Text;
                    mc.TheoryMin          = txtTheoryMin.Text;
                    mc.TheoryNetTotal     = txtTheoryNetTotal.Text;
                    mc.TheoryTotal        = txtTheoryMarks.Text;
                    mc.TotalMarks         = txtTotalMarks.Text;
                    mc.TotalGP            = "0";
                    mc.TotalGPW           = "0";
                    mc.UniqueNumber       = student.Cours.Code + student.StudentId;
                    mc.VivaVoice          = txtVivaVoice.Text;
                    mc.VivaVoiceMax       = txtVivaVoiceMax.Text;
                    mc.VivaVoiceMin       = txtVivaVoiceMin.Text;
                    mc.WordText           = "";
                    mc.YearSem            = student.YearSem;
                    mc.YearText           = txtExaminationMonthYear.Text;

                    if (!markscard.Any(d => d.SubjectCode == mc.SubjectCode))
                    {
                        markscard.Add(mc);

                        Session["MC"] = markscard;

                        gridMarks.DataSource = markscard;
                        gridMarks.DataBind();
                    }
                    else
                    {
                        pnlMessagePanel.Visible = true;
                        lblMessageBox.Text      = "Subject Already Added";
                    }
                }
            }
        }
        public static void ImportData(string regno, int yearsem)
        {
            var exist = entities.MarksCards.Where(e => e.RegisterNumber == regno && e.YearSem == yearsem);

            foreach (var r in exist)
            {
                r.RegisterNumber += "_OLD";
            }
            entities.SaveChanges();

            var student = infinityentities.Students.FirstOrDefault(d => d.RegisterNumber == regno);
            var did     = infinityentities.Degrees.FirstOrDefault(i => i.DegreeId == student.DegreeId);

            if (student != null)
            {
                var UGres = entities.UGFinalResultTables.Where(r => r.RegisterNumber == regno && r.YearSem == yearsem).ToList();

                foreach (var r in UGres)
                {
                    var subject = entities.mdbSubjectPaperDetails.FirstOrDefault(d => d.SubjectPaperCode == r.SubjectCode);

                    var max = entities.DegreeMaxes.FirstOrDefault(x => x.DegreeName == did.Name && x.YearSem == yearsem);
                    var grp = entities.GroupNames.FirstOrDefault(g => g.SubjectName == r.SubjectName);

                    MarksCard m = new MarksCard();
                    m.RegisterNumber     = r.RegisterNumber;
                    m.StudentName        = student.FirstName;
                    m.CollegeName        = student.College.Name;
                    m.CollegeCode        = student.College.Code;
                    m.DegreeName         = r.DegreeName;
                    m.YearSem            = r.YearSem;
                    m.GroupName          = grp.GroupName1;
                    m.SubGroupName       = r.SubGroupName;
                    m.SubjectName        = r.SubjectName;
                    m.SubjectCode        = r.SubjectCode;
                    m.TheoryGrace        = r.TheoryGrace;
                    m.TheoryMarks        = r.TheoryMarks;
                    m.TheoryMin          = r.TheoryMin;
                    m.TheoryMax          = r.TheoryMax;
                    m.TheoryTotal        = r.TheoryTotal;
                    m.TheoryIAMarks      = r.TheoryIAMarks;
                    m.TheoryIAGrace      = r.TheoryIAGrace;
                    m.TheoryIAMin        = r.TheoryIAMin;
                    m.TheoryIAMax        = r.TheoryIAMax;
                    m.TheoryIATotal      = r.TheoryIATotal;
                    m.TheoryNetTotal     = r.TheoryNetTotal;
                    m.PracticalMarks     = r.PracticalMarks;
                    m.PracticalGrace     = r.PracticalGrace;
                    m.PracticalMin       = r.PracticalMin;
                    m.PracticalMax       = r.PracticalMax;
                    m.PracticalTotal     = r.PracticalTotal;
                    m.PracticalIAMarks   = r.PracticalIAMarks;
                    m.PracticalIAGrace   = r.PracticalIAGrace;
                    m.PracticalIAMin     = r.PracticalIAMin;
                    m.PracticalIAMax     = r.PracticalIAMax;
                    m.PracticalIATotal   = r.PracticalIATotal;
                    m.PracticalNetTotal  = r.PracticalNetTotal;
                    m.VivaVoice          = r.VivaVoice;
                    m.VivaVoiceMin       = r.VivaVoiceMin;
                    m.VivaVoiceMax       = r.VivaVoiceMax;
                    m.SubjectTotal       = r.SubjectTotal;
                    m.SubGroupTotal      = r.SubGroupTotal;
                    m.GroupTotal         = r.GroupTotal;
                    m.TotalMarks         = r.TotalMarks;
                    m.SubjectMin         = r.SubjectMin;
                    m.SubjectMax         = r.SubjectMax;
                    m.SubjectCredits     = r.SubjectCredits.ToString();
                    m.SubjectGPA         = r.SubjectGPA.ToString();
                    m.SubjectGPW         = r.SubjectGPW.ToString();
                    m.CreatedDate        = r.CreatedDate;
                    m.IsSubjectPass      = r.IsSubjectPass;
                    m.MarksPercent       = r.MarksPercent;
                    m.AlphaSign          = r.AlphaSign;
                    m.SemesterCredits    = r.SemesterCredits.ToString();
                    m.SemesterMax        = (int)max.SemesterMax;
                    m.SemesterMin        = r.SemesterMin;
                    m.SemesterTotal      = r.SemesterTotal;
                    m.SemesterPercentage = r.SemesterPercentage.ToString();
                    m.SemesterGPA        = r.SemesterGPA.ToString();
                    m.SemesterClass      = r.SemesterClass;
                    m.SemesterAlphaSign  = r.SemesterAlphaSign;
                    m.IsSemesterPass     = r.IsSemesterPass.ToString();
                    m.Remarks            = r.Remarks;
                    m.YearText           = r.YearText;
                    m.CourseCode         = student.Cours.Code;
                    m.SubjectType        = subject.SubjectPaperType;
                    m.MarksCardOrder     = (int)grp.MarksCardOrder;

                    entities.MarksCards.Add(m);
                    semesterTotal = (int)max.SemesterMax;
                    entities.SaveChanges();
                }
            }
        }