Esempio n. 1
0
        //Get Student Statictic Scores and Data
        private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            //try
            //{
            var dc = new ClassSRMDataContext(Config.connection);

            if (gridView1.RowCount > 0)
            {
                byte[] data = null;
                data = ((System.Data.Linq.Binary)(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "StuImage"))).ToArray();
                using (MemoryStream memory = new MemoryStream(data))
                {
                    imgStudent.Image = Image.FromStream(memory);
                }

                id = (int)gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Id");

                var qActivity = dc.SelectQActivity(id).First().Score;     //دریافت مجموع امتیاز فعالیت ها
                lblActivity.Text     = qActivity.ToString();
                prgActiveClass.Value = qActivity;

                var Exist = dc.SelectExistCheck(id).First().Count;      //دریافت حضور فعال
                lblActive.Text  = Exist.ToString();
                prgActive.Value = Exist;

                var NotExist = dc.SelectNOTExistCheck(id).First().Count;       //دریافت حضور غیرفعال
                lblDeAct.Text     = NotExist.ToString();
                prgDeActive.Value = NotExist;

                var qEvaPoint = dc.SelectSumEvaPoint(id).First().SUMEVA;     //دریافت مجموع امتیاز درس ها

                lblEvaPoint.Text    = qEvaPoint.ToString();
                prgTotalScore.Value = qEvaPoint;

                var queryWin = dc.SelectQueryWin().First();
                if (qActivity != 0 && queryWin.HighScore != 0)
                {
                    var diffrence = (100 - (qActivity * 100) / (queryWin.HighScore));
                    lblDifference.Text = diffrence.ToString();
                    if (lblDifference.Text == "0")
                    {
                        lblDifference.Text = "برتر";
                    }
                    prgDifference.Value = diffrence;
                }
                else
                {
                    lblDifference.Text = "0";
                    if (lblDifference.Text == "0")
                    {
                        lblDifference.Text = "برتر";
                    }
                    prgDifference.Value = 0;
                }

                var qFarsi = dc.SelectSumBook(id, "بخوانیم و بنویسیم").First();
                prgFarsi.Value = qFarsi.HighScoreUser;
                lblFarsi.Text  = qFarsi.HighScoreUser.ToString();

                var qWork = dc.SelectSumBook(id, "کار و فناوری").First();
                prgWorkLife.Value = qWork.HighScoreUser;
                lblWorkLife.Text  = qWork.HighScoreUser.ToString();

                var qQuran = dc.SelectSumBook(id, "قرآن").First();
                prgQuran.Value = qQuran.HighScoreUser;
                lblQuran.Text  = qQuran.HighScoreUser.ToString();

                var qLife = dc.SelectSumBook(id, "مهارت های زندگی و تربیتی").First();
                prgLife.Value = qLife.HighScoreUser;
                lblLife.Text  = qLife.HighScoreUser.ToString();

                var qTafakor = dc.SelectSumBook(id, "تفکر").First();
                prgTafakor.Value = qTafakor.HighScoreUser;
                lblTafakor.Text  = qTafakor.HighScoreUser.ToString();

                var qHedye = dc.SelectSumBook(id, "هدیه های آسمانی").First();
                prgHedye.Value = qHedye.HighScoreUser;
                lblHedye.Text  = qHedye.HighScoreUser.ToString();

                var qEmla = dc.SelectSumBook(id, "املا/انشا").First();
                prgEmla.Value = qEmla.HighScoreUser;
                lblEmla.Text  = qEmla.HighScoreUser.ToString();

                var qEjtemayi = dc.SelectSumBook(id, "اجتماعی").First();
                prgEjtemayi.Value = qEjtemayi.HighScoreUser;
                lblEjtemayi.Text  = qEjtemayi.HighScoreUser.ToString();

                var qOlom = dc.SelectSumBook(id, "علوم").First();
                prgOlom.Value = qOlom.HighScoreUser;
                lblOlom.Text  = qOlom.HighScoreUser.ToString();

                var qRiazi = dc.SelectSumBook(id, "ریاضی").First();
                prgRiazi.Value = qRiazi.HighScoreUser;
                lblRiazi.Text  = qRiazi.HighScoreUser.ToString();

                drawChart(id);
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
            //}
            //catch (InvalidOperationException ex) { XtraMessageBox.Show(ex.Message); }
            ////catch (TaskCanceledException ex) { XtraMessageBox.Show(ex.Message); }
            //catch (Exception ex) { XtraMessageBox.Show(ex.Message); }
        }