Ejemplo n.º 1
0
        protected void btnSaveAssessment_Click(object sender, EventArgs e)
        {
            bool is_version_update = false;

            if (!Validate_Data())
            {
                return;
            }
            DataAccess.Assessment objAssessment;
            if (gPageMode == Constants.enPageMode.NEW_DATA)
            {
                objAssessment = new DataAccess.Assessment();
            }
            else
            {
                objAssessment = gAssessment_br.GetAssessmentByIDFromCache(gAssessmentID);
                string[] arr_version = objAssessment.Version.Split(".".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (arr_version.Length == 3)
                {
                    if (!txtMajorVersion.Text.Equals(arr_version[0]) || txtMinorVersion.Text.Equals(arr_version[1]))
                    {
                        is_version_update = true;
                    }
                }
            }

            objAssessment.Name         = txtName.Text;
            objAssessment.Introduction = txtIntroduction.Text;
            objAssessment.Version      = txtMajorVersion.Text + "." + txtMinorVersion.Text + "." + txtBuildNumber.Text;
            objAssessment.Author       = txtAuthor.Text;
            objAssessment.TypeID       = Convert.ToInt32(cmbType.Value);
            objAssessment.ProgramID    = Convert.ToInt32(cmbProgram.Value);
            if (gPageMode == Constants.enPageMode.NEW_DATA)
            {
                objAssessment.AssessmentTreeID = gAssessment_br.GetNextAssessmentTreeID();
            }

            bool res = gAssessment_br.Save_Assessment(objAssessment, is_version_update);

            if (res)
            {
                Set_Message_On_Another_Page("Assessment saved successfully", "AssessmentList.aspx", false);
            }
            else
            {
                Set_Error_Message("An error occured during save process");
            }
        }