예제 #1
0
        protected void BtnSaveExam_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    BECourseAdmin objBEExamProvider = new BECourseAdmin();
                    BCourseAdmin  objBExamProvider  = new BCourseAdmin();
                    objBEExamProvider.strCourseName    = ddlCourse.SelectedItem.Text;
                    objBEExamProvider.IntCourseID      = Convert.ToInt32(ddlCourse.SelectedItem.Value.ToString());
                    objBEExamProvider.strSecurityLevel = ddlExamSecurity.SelectedItem.Value.ToString();

                    objBEExamProvider.strSecurityLevel1 = ddlExamSecurity.SelectedItem.Text;
                    objBEExamProvider.strExamName       = txtExam.Text.Trim();
                    objBEExamProvider.ddlHours          = Convert.ToDecimal(ddlHours.SelectedValue);
                    objBEExamProvider.ddlMinutes        = Convert.ToDecimal(ddlMinutes.SelectedValue);
                    objBEExamProvider.ddlHM             = objBEExamProvider.ddlHours.ToString() + '.' + objBEExamProvider.ddlMinutes.ToString();
                    objBEExamProvider.IntBufferTime     = Convert.ToInt32(ddlBufferTime.SelectedValue);
                    objBEExamProvider.strLinkAccessExam = txtAccessExam.InnerText;
                    objBEExamProvider.strExamStartDate  = Convert.ToDateTime(CalendarExtender1.SelectedDate.ToString());
                    objBEExamProvider.strExamEndDate    = Convert.ToDateTime(CalendarExtender2.SelectedDate.ToString());
                    objBEExamProvider.strOpenBook       = 1;
                    objBEExamProvider.IntUserID         = Convert.ToInt32(Session[BaseClass.EnumPageSessions.USERID].ToString());
                    objBExamProvider.BValidateExam(objBEExamProvider);
                    if (upFile.HasFile)
                    {
                        string strpath             = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["ProviderUploads"]);
                        string strOriginalFileName = upFile.FileName;
                        string strUploadFileName   = CommonFunctions.generateUploadFileName(upFile.FileName);
                        string strTotalPath        = strpath + '\\' + strUploadFileName;
                        objBEExamProvider.strOriginalFileName = strOriginalFileName;
                        objBEExamProvider.strUploadPath       = strUploadFileName;
                        upFile.SaveAs(strTotalPath);
                    }

                    else
                    {
                        objBEExamProvider.strOriginalFileName = null;
                        objBEExamProvider.strUploadPath       = null;
                    }
                    if (Session["DT_Notes"] != null)
                    {
                        objBEExamProvider.DtResult = (DataTable)Session["DT_Notes"];
                    }
                    if (Session["DT_Rules"] != null)
                    {
                        objBEExamProvider.DtResult1 = (DataTable)Session["DT_Rules"];
                    }

                    DataTable  dt = new DataTable();
                    DataColumn dc;
                    dc = new DataColumn("ToolID");
                    dt.Columns.Add(dc);
                    dc = new DataColumn("ToolName");
                    dt.Columns.Add(dc);
                    if (RadListBoxDestination.Items.Count > 0)
                    {
                        for (int i = 0; i < RadListBoxDestination.Items.Count; i++)
                        {
                            DataRow dr = dt.NewRow();
                            dr[0] = RadListBoxDestination.Items[i].Value.ToString();
                            dr[1] = RadListBoxDestination.Items[i].Text;
                            dt.Rows.Add(dr);
                        }
                        objBEExamProvider.DtTools = dt;
                    }
                    else
                    {
                        objBEExamProvider.DtTools = dt;
                    }
                    //if (chkCalc.Checked == true)
                    //    objBEExamProvider.intCalc = 1;
                    //else
                    //    objBEExamProvider.intCalc = 0;
                    //if (chkStickynotes.Checked == true)
                    //    objBEExamProvider.intStickyNotes = 1;
                    //else
                    //    objBEExamProvider.intStickyNotes = 0;
                    if (objBEExamProvider.IntResult == 1)
                    {
                        //lblSuccess.Text = "Exam Name Already Exists";
                        lblSuccess.Text = Resources.ResMessages.Provider_ExamExists;
                    }
                    if (objBEExamProvider.IntResult == 0)
                    {
                        Session["EP_Exam"] = objBEExamProvider;
                        Response.Redirect("ExamConfirmationPage.aspx", false);
                    }
                    objBEExamProvider = null;
                    objBExamProvider  = null;
                }
            }
            catch (Exception)
            {
            }
        }