コード例 #1
0
 ///<summary>Inserts one GradingScale into the database.  Returns the new priKey.</summary>
 public static long Insert(GradingScale gradingScale)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         gradingScale.GradingScaleNum = DbHelper.GetNextOracleKey("gradingscale", "GradingScaleNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(gradingScale, true));
             }
             catch (Oracle.ManagedDataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     gradingScale.GradingScaleNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(gradingScale, false));
     }
 }
コード例 #2
0
        ///<summary>Inserts one GradingScale into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(GradingScale gradingScale, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                gradingScale.GradingScaleNum = ReplicationServers.GetKey("gradingscale", "GradingScaleNum");
            }
            string command = "INSERT INTO gradingscale (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "GradingScaleNum,";
            }
            command += "ScaleType,Description) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(gradingScale.GradingScaleNum) + ",";
            }
            command +=
                POut.Int((int)gradingScale.ScaleType) + ","
                + "'" + POut.String(gradingScale.Description) + "')";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                gradingScale.GradingScaleNum = Db.NonQ(command, true, "GradingScaleNum", "gradingScale");
            }
            return(gradingScale.GradingScaleNum);
        }
コード例 #3
0
        ///<summary>Updates one GradingScale in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
        public static bool Update(GradingScale gradingScale, GradingScale oldGradingScale)
        {
            string command = "";

            if (gradingScale.ScaleType != oldGradingScale.ScaleType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ScaleType = " + POut.Int((int)gradingScale.ScaleType) + "";
            }
            if (gradingScale.Description != oldGradingScale.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(gradingScale.Description) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE gradingscale SET " + command
                      + " WHERE GradingScaleNum = " + POut.Long(gradingScale.GradingScaleNum);
            Db.NonQ(command);
            return(true);
        }
コード例 #4
0
        ///<summary>Inserts one GradingScale into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(GradingScale gradingScale, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO gradingscale (";

            if (!useExistingPK && isRandomKeys)
            {
                gradingScale.GradingScaleNum = ReplicationServers.GetKeyNoCache("gradingscale", "GradingScaleNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "GradingScaleNum,";
            }
            command += "ScaleType,Description) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(gradingScale.GradingScaleNum) + ",";
            }
            command +=
                POut.Int((int)gradingScale.ScaleType) + ","
                + "'" + POut.String(gradingScale.Description) + "')";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                gradingScale.GradingScaleNum = Db.NonQ(command, true, "GradingScaleNum", "gradingScale");
            }
            return(gradingScale.GradingScaleNum);
        }
コード例 #5
0
 private void FormEvaluationCriterionEdit_Load(object sender, EventArgs e)
 {
     //There is always going to be an EvaluationCriterion when coming into this window.
     _gradingScale = GradingScales.GetOne(_evalCritCur.GradingScaleNum);
     textCriterionDescript.Text = _evalCritCur.CriterionDescript;
     textGradingScale.Text      = _gradingScale.Description;
     textNote.Text   = _evalCritCur.Notes;
     _listGradeItems = GradingScaleItems.Refresh(_evalCritCur.GradingScaleNum);
     //if(!_gradingScale.IsPercentage) {
     //	textGradeNumber.ReadOnly=true;
     //	textGradeShowingPercent.Visible=false;
     //	for(int i=0;i<_listGradeItems.Count;i++) {
     //		comboGradeShowing.Items.Add(_listGradeItems[i].GradeShowing);
     //		if(_listGradeItems[i].GradeShowing==_evalCritCur.GradeShowing) {
     //			comboGradeShowing.SelectedIndex=i;
     //			textGradeNumber.Text=_evalCritCur.GradeNumber.ToString();
     //		}
     //	}
     //}
     //else {
     //	comboGradeShowing.Visible=false;
     //	textGradeNumber.Text=_evalCritCur.GradeNumber.ToString();
     //	textGradeShowingPercent.Text=_evalCritCur.GradeShowing;
     //}
 }
コード例 #6
0
        private void butGradingScale_Click(object sender, EventArgs e)
        {
            //Although there can be multiple grading scales on the same evaluation, it is highly discouraged.
            //The grades must be manually calculated since the only calculated grades are scales that match the evaluation.
            //This could be changed later by forcing all scales to have point values and giving each EvaluationCriterion a "rubrick" gradingscale.
            //This change would require that Evaluations be given a different kind of grading scale that allowed for percentage ranges.
            //This would then be calculated into a grade for the reports that could use a similar grading scale.
            //These changes may not be necessary if the customers prefers the current method.
            FormGradingScales FormGS = new FormGradingScales();

            FormGS.IsSelectionMode = true;
            FormGS.ShowDialog();
            if (FormGS.DialogResult == DialogResult.OK)
            {
                textGradeScaleName.Text      = FormGS.SelectedGradingScale.Description;
                _gradeScale                  = FormGS.SelectedGradingScale;
                _evalCritDef.GradingScaleNum = _gradeScale.GradingScaleNum;
                if (FormGS.SelectedGradingScale.ScaleType == EnumScaleType.Weighted)
                {
                    textPoints.Visible  = true;
                    labelPoints.Visible = true;
                    textPoints.Text     = _evalCritDef.MaxPointsPoss.ToString();
                }
                else
                {
                    textPoints.Visible  = false;
                    labelPoints.Visible = false;
                    textPoints.Text     = "";
                }
            }
        }
コード例 #7
0
        ///<summary>Updates one GradingScale in the database.</summary>
        public static void Update(GradingScale gradingScale)
        {
            string command = "UPDATE gradingscale SET "
                             + "ScaleType      =  " + POut.Int((int)gradingScale.ScaleType) + ", "
                             + "Description    = '" + POut.String(gradingScale.Description) + "' "
                             + "WHERE GradingScaleNum = " + POut.Long(gradingScale.GradingScaleNum);

            Db.NonQ(command);
        }
コード例 #8
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (gridMain.GetSelectedIndex() == -1)
     {
         MsgBox.Show(this, "Select a grading scale first.");
         return;
     }
     SelectedGradingScale = _listGradingScales[gridMain.GetSelectedIndex()];
     DialogResult         = DialogResult.OK;
 }
コード例 #9
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            GradingScale gradingScaleNew = new GradingScale();

            gradingScaleNew.GradingScaleNum = GradingScales.Insert(gradingScaleNew);
            gradingScaleNew.IsNew           = true;
            FormGradingScaleEdit FormGSE = new FormGradingScaleEdit(gradingScaleNew);

            FormGSE.ShowDialog();
            FillGrid();
        }
コード例 #10
0
ファイル: GradingScaleCrud.cs プロジェクト: mnisl/OD
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<GradingScale> TableToList(DataTable table){
			List<GradingScale> retVal=new List<GradingScale>();
			GradingScale gradingScale;
			for(int i=0;i<table.Rows.Count;i++) {
				gradingScale=new GradingScale();
				gradingScale.GradingScaleNum= PIn.Long  (table.Rows[i]["GradingScaleNum"].ToString());
				gradingScale.ScaleType      = (OpenDentBusiness.EnumScaleType)PIn.Int(table.Rows[i]["ScaleType"].ToString());
				gradingScale.Description    = PIn.String(table.Rows[i]["Description"].ToString());
				retVal.Add(gradingScale);
			}
			return retVal;
		}
コード例 #11
0
 ///<summary>Returns true if Update(GradingScale,GradingScale) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(GradingScale gradingScale, GradingScale oldGradingScale)
 {
     if (gradingScale.ScaleType != oldGradingScale.ScaleType)
     {
         return(true);
     }
     if (gradingScale.Description != oldGradingScale.Description)
     {
         return(true);
     }
     return(false);
 }
コード例 #12
0
 private void FormEvaluationCriterionDefEdit_Load(object sender, EventArgs e)
 {
     textDescript.Text           = _evalCritDef.CriterionDescript;
     _gradeScale                 = GradingScales.GetOne(_evalCritDef.GradingScaleNum);
     textGradeScaleName.Text     = _gradeScale.Description;
     checkIsCategoryName.Checked = _evalCritDef.IsCategoryName;
     if (_gradeScale.ScaleType == EnumScaleType.Weighted)
     {
         textPoints.Visible  = true;
         labelPoints.Visible = true;
         textPoints.Text     = _evalCritDef.MaxPointsPoss.ToString();
     }
 }
コード例 #13
0
        private void gridMain_DoubleClick(object sender, EventArgs e)
        {
            if (IsSelectionMode)
            {
                SelectedGradingScale = _listGradingScales[gridMain.GetSelectedIndex()];
                DialogResult         = DialogResult.OK;
                return;
            }
            FormGradingScaleEdit FormGSE = new FormGradingScaleEdit(_listGradingScales[gridMain.GetSelectedIndex()]);

            FormGSE.ShowDialog();
            FillGrid();
        }
コード例 #14
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <GradingScale> TableToList(DataTable table)
        {
            List <GradingScale> retVal = new List <GradingScale>();
            GradingScale        gradingScale;

            foreach (DataRow row in table.Rows)
            {
                gradingScale = new GradingScale();
                gradingScale.GradingScaleNum = PIn.Long(row["GradingScaleNum"].ToString());
                gradingScale.ScaleType       = (OpenDentBusiness.EnumScaleType)PIn.Int(row["ScaleType"].ToString());
                gradingScale.Description     = PIn.String(row["Description"].ToString());
                retVal.Add(gradingScale);
            }
            return(retVal);
        }
コード例 #15
0
 ///<summary>Inserts one GradingScale into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(GradingScale gradingScale)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(gradingScale, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             gradingScale.GradingScaleNum = DbHelper.GetNextOracleKey("gradingscale", "GradingScaleNum");                  //Cacheless method
         }
         return(InsertNoCache(gradingScale, true));
     }
 }
コード例 #16
0
 private void FormEvaluationEdit_Load(object sender, EventArgs e)
 {
     //This window fills all necessary data on load. This eliminates the need for multiple calls to the database.
     textDate.Text           = _evalCur.DateEval.ToShortDateString();
     textTitle.Text          = _evalCur.EvalTitle;
     _evalGradeScale         = GradingScales.GetOne(_evalCur.GradingScaleNum);
     _listEvalGradeItems     = GradingScaleItems.Refresh(_evalCur.GradingScaleNum);
     textGradeScaleName.Text = _evalGradeScale.Description;
     _provInstructor         = Providers.GetProv(_evalCur.InstructNum);
     textInstructor.Text     = _provInstructor.GetLongDesc();
     _provStudent            = Providers.GetProv(_evalCur.StudentNum);
     if (_provStudent != null)
     {
         textStudent.Text = _provStudent.GetLongDesc();
     }
     textCourse.Text = SchoolCourses.GetDescript(_evalCur.SchoolCourseNum);
     textGradeNumberOverride.Text  = _evalCur.OverallGradeNumber.ToString();
     textGradeShowingOverride.Text = _evalCur.OverallGradeShowing;
     _listEvalCrits = EvaluationCriterions.Refresh(_evalCur.EvaluationNum);
     for (int i = 0; i < _listEvalCrits.Count; i++)
     {
         GradingScale critGradeScale = GradingScales.GetOne(_listEvalCrits[i].GradingScaleNum);
         if (!_dictCritGradeScales.ContainsKey(critGradeScale.GradingScaleNum))
         {
             _dictCritGradeScales.Add(critGradeScale.GradingScaleNum, critGradeScale);
         }
         if (!_dictCritGradeItems.ContainsKey(critGradeScale.GradingScaleNum))
         {
             _dictCritGradeItems.Add(critGradeScale.GradingScaleNum, GradingScaleItems.Refresh(critGradeScale.GradingScaleNum));
         }
     }
     FillGridCriterion();
     RecalculateGrades();
     //Since there is no override column in the database, we check for equality of the calculated grade and the grade on the evaluation.
     //If they are different then the grade was overwritten at some point.
     if (textGradeNumber.Text == textGradeNumberOverride.Text)
     {
         textGradeNumberOverride.Text = "";
     }
     if (textGradeShowing.Text == textGradeShowingOverride.Text)
     {
         textGradeShowingOverride.Text = "";
     }
 }
コード例 #17
0
        public GradingScaleGradeDim GetGradingScaleGrade(GradingScale gradingScale, StudentGradeDim studentGrade)
        {
            if (!gradingScale.IsNumericGradingScale && !gradingScale.IsLetterGradingScale)
            {
                return(null);
            }

            if (gradingScale.IsNumericGradingScale && studentGrade.NumericGradeEarned != null)
            {
                var highestGradingScale = gradingScale.GradingScaleGradeDims.Last();
                if (highestGradingScale.UpperNumericGrade <= studentGrade.NumericGradeEarned)
                {
                    return(highestGradingScale);
                }

                return(gradingScale.GradingScaleGradeDims.FirstOrDefault(x => x.UpperNumericGrade >= studentGrade.NumericGradeEarned));
            }

            return(gradingScale.GradingScaleGradeDims.FirstOrDefault(x => string.Equals(x.LetterGrade, studentGrade.LetterGradeEarned, StringComparison.OrdinalIgnoreCase)));
        }
コード例 #18
0
ファイル: GradingScaleCrud.cs プロジェクト: mnisl/OD
		///<summary>Inserts one GradingScale into the database.  Provides option to use the existing priKey.</summary>
		public static long Insert(GradingScale gradingScale,bool useExistingPK){
			if(!useExistingPK && PrefC.RandomKeys) {
				gradingScale.GradingScaleNum=ReplicationServers.GetKey("gradingscale","GradingScaleNum");
			}
			string command="INSERT INTO gradingscale (";
			if(useExistingPK || PrefC.RandomKeys) {
				command+="GradingScaleNum,";
			}
			command+="ScaleType,Description) VALUES(";
			if(useExistingPK || PrefC.RandomKeys) {
				command+=POut.Long(gradingScale.GradingScaleNum)+",";
			}
			command+=
				     POut.Int   ((int)gradingScale.ScaleType)+","
				+"'"+POut.String(gradingScale.Description)+"')";
			if(useExistingPK || PrefC.RandomKeys) {
				Db.NonQ(command);
			}
			else {
				gradingScale.GradingScaleNum=Db.NonQ(command,true);
			}
			return gradingScale.GradingScaleNum;
		}
コード例 #19
0
ファイル: GradingScaleCrud.cs プロジェクト: mnisl/OD
		///<summary>Inserts one GradingScale into the database.  Returns the new priKey.</summary>
		public static long Insert(GradingScale gradingScale){
			if(DataConnection.DBtype==DatabaseType.Oracle) {
				gradingScale.GradingScaleNum=DbHelper.GetNextOracleKey("gradingscale","GradingScaleNum");
				int loopcount=0;
				while(loopcount<100){
					try {
						return Insert(gradingScale,true);
					}
					catch(Oracle.DataAccess.Client.OracleException ex){
						if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
							gradingScale.GradingScaleNum++;
							loopcount++;
						}
						else{
							throw ex;
						}
					}
				}
				throw new ApplicationException("Insert failed.  Could not generate primary key.");
			}
			else {
				return Insert(gradingScale,false);
			}
		}
コード例 #20
0
 public static StandardsGradingScaleRangeExportModel Create(GradingScaleRange range, GradingScale gradingScale)
 {
     return(new StandardsGradingScaleRangeExportModel
     {
         Name = range.AlphaGrade,
         Description = gradingScale.Description + " " + range.AlphaGrade
     });
 }
コード例 #21
0
 public static TraditionalGradingScaleRangeExportModel Create(GradingScaleRange range, GradingScale gradingScale)
 {
     return(new TraditionalGradingScaleRangeExportModel
     {
         MaxValue = range.HighValue,
         MinValue = range.LowValue,
         Name = range.AlphaGrade
     });
 }
コード例 #22
0
 public FormGradingScaleEdit(GradingScale gradingScaleCur)
 {
     InitializeComponent();
     Lan.F(this);
     _gradingScaleCur = gradingScaleCur;
 }
コード例 #23
0
 ///<summary>Inserts one GradingScale into the database.  Returns the new priKey.</summary>
 public static long Insert(GradingScale gradingScale)
 {
     return(Insert(gradingScale, false));
 }
コード例 #24
0
ファイル: GradingScaleCrud.cs プロジェクト: mnisl/OD
		///<summary>Updates one GradingScale in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
		public static bool Update(GradingScale gradingScale,GradingScale oldGradingScale){
			string command="";
			if(gradingScale.ScaleType != oldGradingScale.ScaleType) {
				if(command!=""){ command+=",";}
				command+="ScaleType = "+POut.Int   ((int)gradingScale.ScaleType)+"";
			}
			if(gradingScale.Description != oldGradingScale.Description) {
				if(command!=""){ command+=",";}
				command+="Description = '"+POut.String(gradingScale.Description)+"'";
			}
			if(command==""){
				return false;
			}
			command="UPDATE gradingscale SET "+command
				+" WHERE GradingScaleNum = "+POut.Long(gradingScale.GradingScaleNum);
			Db.NonQ(command);
			return true;
		}
コード例 #25
0
ファイル: GradingScaleCrud.cs プロジェクト: mnisl/OD
		///<summary>Updates one GradingScale in the database.</summary>
		public static void Update(GradingScale gradingScale){
			string command="UPDATE gradingscale SET "
				+"ScaleType      =  "+POut.Int   ((int)gradingScale.ScaleType)+", "
				+"Description    = '"+POut.String(gradingScale.Description)+"' "
				+"WHERE GradingScaleNum = "+POut.Long(gradingScale.GradingScaleNum);
			Db.NonQ(command);
		}