Пример #1
0
 public int addresults(Results_tbl result)
 {
     db = new CollegeERPDBEntities();
     db.Results_tbl.Add(result);
     db.SaveChanges();
     return result.ID;
 }
Пример #2
0
    protected void uplaodfile_Click(object sender, EventArgs e)
    {
        if(Resultfile.FileName==null)
        {

        }
        else
        {
            string filename = Path.GetFileName(Resultfile.PostedFile.FileName);
            string Extension = Path.GetExtension(Resultfile.PostedFile.FileName);

            long milliseconds = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) / 1000;
            string orgPath = string.Empty;
            orgPath = Server.MapPath("~/Admin/Temp_UploadedFiles/" + filename);
            Resultfile.SaveAs(orgPath);

            System.Data.DataTable dt = Import_To_Grid(orgPath, Extension, "Yes");
            DBFunctions db = new DBFunctions();
            int grade = 1008; //None Grade For Mid Result
            foreach (System.Data.DataRow row in dt.Rows)
            {
                if (row[4].ToString().ToLower() != "mid")
                {
                    if (int.Parse(row[2].ToString()) >= 90)
                        grade = 1;//A Grade
                    else if (int.Parse(row[2].ToString()) >= 85 && int.Parse(row[2].ToString()) < 90)
                        grade = 2;//A- Grade
                    else if (int.Parse(row[2].ToString()) >= 80 && int.Parse(row[2].ToString()) < 85)
                        grade = 3;//B+ Grade
                    else if (int.Parse(row[2].ToString()) >= 70 && int.Parse(row[2].ToString()) < 80)
                        grade = 4;//B Grade
                    else if (int.Parse(row[2].ToString()) >= 60 && int.Parse(row[2].ToString()) < 70)
                        grade = 5;//B- Grade
                    else if (int.Parse(row[2].ToString()) >= 55 && int.Parse(row[2].ToString()) < 60)
                        grade = 6;//C+ Grade
                    else if (int.Parse(row[2].ToString()) >= 50 && int.Parse(row[2].ToString()) < 55)
                        grade = 7;//C Grade
                    else if (int.Parse(row[2].ToString()) >= 45 && int.Parse(row[2].ToString()) < 50)
                        grade = 8;
                    else if (int.Parse(row[2].ToString()) < 45)
                        grade = 9; //F Grade
                }
                Results_tbl result = new Results_tbl { CourseID = int.Parse(DropDownCourse.SelectedValue), MetricNo = row[0].ToString(), TotalMarks = int.Parse(row[1].ToString()), ObtainedMarks = int.Parse(row[2].ToString()), Year = row[3].ToString(), ExamType = row[4].ToString(), Semester = int.Parse(row[5].ToString()),GradeID=grade};
                //string marks = row[0].ToString();

                    db.addresults(result);
                    LabelUpload.Text = "Result Uploaded.";
                    LabelUpload.Visible = true;
                   AddmissionList_tbl student= db.getstudentinfoFromMetrcino(result.MetricNo);
                    
                if(grade!=9)
                {
                    db.updateenrollment(student.UserID.Value, result.CourseID.Value,2); //Pass
                }
                else
                {
                    db.updateenrollment(student.UserID.Value, result.CourseID.Value, 3); //Fail

                }
               
            }
            

        }
    }
Пример #3
0
    protected void uplaodfile_Click(object sender, EventArgs e)
    {
        if (Resultfile.FileName == null)
        {
        }
        else
        {
            string filename  = Path.GetFileName(Resultfile.PostedFile.FileName);
            string Extension = Path.GetExtension(Resultfile.PostedFile.FileName);

            long   milliseconds = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) / 1000;
            string orgPath      = string.Empty;
            orgPath = Server.MapPath("~/Admin/Temp_UploadedFiles/" + filename);
            Resultfile.SaveAs(orgPath);

            System.Data.DataTable dt = Import_To_Grid(orgPath, Extension, "Yes");
            DBFunctions           db = new DBFunctions();
            int grade = 1008; //None Grade For Mid Result
            foreach (System.Data.DataRow row in dt.Rows)
            {
                if (row[4].ToString().ToLower() != "mid")
                {
                    if (int.Parse(row[2].ToString()) >= 90)
                    {
                        grade = 1;//A Grade
                    }
                    else if (int.Parse(row[2].ToString()) >= 85 && int.Parse(row[2].ToString()) < 90)
                    {
                        grade = 2;//A- Grade
                    }
                    else if (int.Parse(row[2].ToString()) >= 80 && int.Parse(row[2].ToString()) < 85)
                    {
                        grade = 3;//B+ Grade
                    }
                    else if (int.Parse(row[2].ToString()) >= 70 && int.Parse(row[2].ToString()) < 80)
                    {
                        grade = 4;//B Grade
                    }
                    else if (int.Parse(row[2].ToString()) >= 60 && int.Parse(row[2].ToString()) < 70)
                    {
                        grade = 5;//B- Grade
                    }
                    else if (int.Parse(row[2].ToString()) >= 55 && int.Parse(row[2].ToString()) < 60)
                    {
                        grade = 6;//C+ Grade
                    }
                    else if (int.Parse(row[2].ToString()) >= 50 && int.Parse(row[2].ToString()) < 55)
                    {
                        grade = 7;//C Grade
                    }
                    else if (int.Parse(row[2].ToString()) >= 45 && int.Parse(row[2].ToString()) < 50)
                    {
                        grade = 8;
                    }
                    else if (int.Parse(row[2].ToString()) < 45)
                    {
                        grade = 9; //F Grade
                    }
                }
                Results_tbl result = new Results_tbl {
                    CourseID = int.Parse(DropDownCourse.SelectedValue), MetricNo = row[0].ToString(), TotalMarks = int.Parse(row[1].ToString()), ObtainedMarks = int.Parse(row[2].ToString()), Year = row[3].ToString(), ExamType = row[4].ToString(), Semester = int.Parse(row[5].ToString()), GradeID = grade
                };
                //string marks = row[0].ToString();

                db.addresults(result);
                LabelUpload.Text    = "Result Uploaded.";
                LabelUpload.Visible = true;
                AddmissionList_tbl student = db.getstudentinfoFromMetrcino(result.MetricNo);

                if (grade != 9)
                {
                    db.updateenrollment(student.UserID.Value, result.CourseID.Value, 2); //Pass
                }
                else
                {
                    db.updateenrollment(student.UserID.Value, result.CourseID.Value, 3); //Fail
                }
            }
        }
    }