Exemple #1
0
    /// <summary>
    /// เพิ่มข้อมูลลงตาราง PREREQUISITE
    /// </summary>
    /// <param name="dataInsert">PreRequisite Object</param>
    /// <returns>Success</returns>
    public string insertPreRequisite(PreRequisite dataInsert)
    {
        string response = "";

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        string sql = "Insert into PREREQUISITE (CURRCODE, YEARVERSION, CURRFORMATCODE, CURRTYPECODE, MAJORCODE, COURSEGROUPCODE, CATEGORYCODE, COURSETYPECODE, COURSECODE, PREREQUISITECOURSECODE, PREREQUISITERULE, PREREQUISITEFORMAT) values ('" + dataInsert.CurrCode + "','" + dataInsert.YearVersion + "','" + dataInsert.CurrFormatCode + "','" + dataInsert.CurrTypeCode + "','" + dataInsert.MajorCode + "','" + dataInsert.CourseGroupCode + "','" + dataInsert.CategoryCode + "','" + dataInsert.CourseTypeCode + "','" + dataInsert.CourseCode + "','" + dataInsert.PreRequisiteCourseCode + "','" + dataInsert.PreRequisiteRule + "','" + dataInsert.PreRequisiteFormat + "')";

        oracleObj.InsertCommand = sql;

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response = "Success";
            }
        }
        catch (Exception e)
        {
            string exception = e.Message;
            HttpContext.Current.Session["response"] = "insertPreRequisite: " + exception;
            HttpContext.Current.Response.Redirect("../err_response.aspx");
        }

        return(response);
    }
    protected void btnADD_Click(object sender, EventArgs e)
    {
        string sql = "Select * From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + CourseCode + "' And PREREQUISITECOURSECODE='" + txtCOURSECODE.Text + "' And PREREQUISITERULE='" + ddlRuleOrder.SelectedValue + "'";

        List <PreRequisite> chkPreRequisite = new PreRequisite().getPreRequisiteManual(sql);

        if (chkPreRequisite.Count > 0)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('ข้อมูลซ้ำ!');", true);
        }
        else
        {
            PreRequisite preRequisiteData = new PreRequisite();
            preRequisiteData.CurrCode               = CurrCode;
            preRequisiteData.YearVersion            = YearVersion;
            preRequisiteData.CurrFormatCode         = CurrFormatCode;
            preRequisiteData.CurrTypeCode           = CurrTypeCode;
            preRequisiteData.MajorCode              = MajorCode;
            preRequisiteData.CourseGroupCode        = CourseGroupCode;
            preRequisiteData.CategoryCode           = CategoryCode;
            preRequisiteData.CourseTypeCode         = CourseTypeCode;
            preRequisiteData.CourseCode             = CourseCode;
            preRequisiteData.PreRequisiteCourseCode = txtCOURSECODE.Text;
            preRequisiteData.PreRequisiteRule       = ddlRuleOrder.SelectedValue;
            preRequisiteData.PreRequisiteFormat     = ddlRuleFormat.SelectedValue;

            string insertPreRequisite = new PreRequisite().insertPreRequisite(preRequisiteData);

            if (insertPreRequisite == "Success")
            {
                Response.Redirect("addCOURSE_to_PREREQ.aspx?CurrCode=" + CurrCode + "&YearVersion=" + YearVersion + "&CurrFormatCode=" + CurrFormatCode + "&CurrTypeCode=" + CurrTypeCode + "&MajorCode=" + MajorCode + "&CategoryCode=" + CategoryCode + "&CourseGroupCode=" + CourseGroupCode + "&CourseTypeCode=" + CourseTypeCode + "&CourseCode=" + CourseCode + "");
            }
        }
    }
Exemple #3
0
    /// <summary>
    /// แก้ไขข้อมูลจากตาราง PREREQUISITE
    /// </summary>
    /// <param name="updateData">PreRequisite Object</param>
    /// <returns>Success</returns>
    public string updatePreRequisite(PreRequisite updateData)
    {
        string        response  = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        string sql = "Update PREREQUISITE Set PREREQUISITEFORMAT = '" + updateData.PreRequisiteFormat + "'Where CURRCODE = '" + updateData.CurrCode + "' And YEARVERSION = '" + updateData.YearVersion + "' And CURRFORMATCODE = '" + updateData.CurrFormatCode + "' And CURRTYPECODE = '" + updateData.CurrTypeCode + "' And MAJORCODE = '" + updateData.MajorCode + "' And COURSEGROUPCODE = '" + updateData.CourseGroupCode + "' And CATEGORYCODE = '" + updateData.CourseTypeCode + "' And COURSECODE = '" + updateData.CourseCode + "' And PREREQUISITECOURSECODE = '" + updateData.PreRequisiteCourseCode + "' And PREREQUISITERULE = '" + updateData.PreRequisiteRule + "'";

        oracleObj.UpdateCommand = sql;

        try
        {
            if (oracleObj.Update() == 1)
            {
                response = "Success";
            }
        }
        catch (Exception e)
        {
            string exception = e.Message;
            HttpContext.Current.Session["response"] = "updatePreRequisite: " + exception;
            HttpContext.Current.Response.Redirect("../err_response.aspx");
        }

        return(response);
    }
Exemple #4
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง PREREQUISITE
    /// </summary>
    /// <param name="CurrCode">รหัสหลักสูตร(Curriculum)</param>
    /// <returns>ข้อมูลจากตาราง PREREQUISITE</returns>
    public PreRequisite getPreRequisite(string CurrCode)
    {
        PreRequisite PreRequisiteData = new PreRequisite();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = "Select * From PREREQUISITE Where CURRCODE='" + CurrCode + "'";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            PreRequisiteData.CurrCode               = rowData["CURRCODE"].ToString();
            PreRequisiteData.YearVersion            = rowData["YEARVERSION"].ToString();
            PreRequisiteData.CurrFormatCode         = rowData["CURRFORMATCODE"].ToString();
            PreRequisiteData.CurrTypeCode           = rowData["CURRTYPECODE"].ToString();
            PreRequisiteData.MajorCode              = rowData["MAJORCODE"].ToString();
            PreRequisiteData.CourseGroupCode        = rowData["COURSEGROUPCODE"].ToString();
            PreRequisiteData.CategoryCode           = rowData["CATEGORYCODE"].ToString();
            PreRequisiteData.CourseTypeCode         = rowData["COURSETYPECODE"].ToString();
            PreRequisiteData.CourseCode             = rowData["COURSECODE"].ToString();
            PreRequisiteData.PreRequisiteCourseCode = rowData["PREREQUISITECOURSECODE"].ToString();
            PreRequisiteData.PreRequisiteRule       = rowData["PREREQUISITERULE"].ToString();
            PreRequisiteData.PreRequisiteFormat     = rowData["PREREQUISITEFORMAT"].ToString();
        }

        return(PreRequisiteData);
    }
Exemple #5
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง PREREQUISITE
    /// </summary>
    /// <param name="sql">SQL Command</param>
    /// <returns>ข้อมูลจากตาราง PREREQUISITE</returns>
    public List <PreRequisite> getPreRequisiteManual(string sql)
    {
        List <PreRequisite> PreRequisiteData = new List <PreRequisite>();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = sql;

        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            PreRequisite PreRequisiteRow = new PreRequisite();

            PreRequisiteRow.CurrCode               = rowData["CURRCODE"].ToString();
            PreRequisiteRow.YearVersion            = rowData["YEARVERSION"].ToString();
            PreRequisiteRow.CurrFormatCode         = rowData["CURRFORMATCODE"].ToString();
            PreRequisiteRow.CurrTypeCode           = rowData["CURRTYPECODE"].ToString();
            PreRequisiteRow.MajorCode              = rowData["MAJORCODE"].ToString();
            PreRequisiteRow.CourseGroupCode        = rowData["COURSEGROUPCODE"].ToString();
            PreRequisiteRow.CategoryCode           = rowData["CATEGORYCODE"].ToString();
            PreRequisiteRow.CourseTypeCode         = rowData["COURSETYPECODE"].ToString();
            PreRequisiteRow.CourseCode             = rowData["COURSECODE"].ToString();
            PreRequisiteRow.PreRequisiteCourseCode = rowData["PREREQUISITECOURSECODE"].ToString();
            PreRequisiteRow.PreRequisiteRule       = rowData["PREREQUISITERULE"].ToString();
            PreRequisiteRow.PreRequisiteFormat     = rowData["PREREQUISITEFORMAT"].ToString();

            PreRequisiteData.Add(PreRequisiteRow);
        }

        return(PreRequisiteData);
    }
        public ActionResult FinishStep(int id)
        {
            PreRequisite step = ContextProcess.Object.PreRequisites.Find(id);
            MainProcess  p    = ContextProcess.Object.MainProceses.Find(step.ProcessID);

            if (p.CurrentStateName == ProcState.Running && p.CurrentStep.ID == id)
            {
                History history = p.Current_State.FirstOrDefault(h => h.EventID == id);
                if (history != null)
                {
                    string path_to_file;
                    string err;

                    history.Success = step.Check(out err, out path_to_file);

                    if (history.Success.Value)
                    {
                        history.TimeFinish   = DateTime.Now;
                        history.ErrorMessage = string.Empty;
                    }
                    else
                    {
                        history.TimeFinish   = null;
                        history.ErrorMessage = err;
                    }
                    ContextProcess.Object.SaveChanges();
                    p.Refresh();
                }
            }
            return(View("Index", ContextProcess.Object.MainProceses.ToArray()));
        }
Exemple #7
0
        static DemoCollecitonManager()
        {
            PreRequisite.NotNullOrWhiteSpace(DemoCollectionId);

            _clinet         = new Lazy <DdbClinet>(DdbClinetFactory.GetInstance);
            _demoCollection = new Lazy <DocumentCollection>(() => Client.GetCollectionIfNotExistsCreate(DemoCollectionId));
        }
Exemple #8
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        //เช็คว่ามีข้อมูลอยู่จริงหรือไม่
        string sql = "Select * From TQF2SEC3PLANDETAIL Where T2S3NO='" + T2S3No + "' And CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + CourseCode + "'";

        List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql);

        if (tqf2Sec3PlanDetail.Count > 0)
        {
            //ลบข้อมูลในตาราง TQF2SEC3PLANDETAIL
            string sql2 = "Delete From TQF2SEC3PLANDETAIL Where T2S3NO='" + T2S3No + "' And CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + CourseCode + "'";

            string deleteTQF2Sec3PlanDetail = new TQF2Sec3PlanDetail().deleteTQF2Sec3PlanDetailManual(sql2);

            if (deleteTQF2Sec3PlanDetail == "Success")
            {
                //เช็คว่ามีข้อมูลอยู่จริงหรือไม่
                string sql3 = "Select * From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + CourseCode + "'";

                List <PreRequisite> preRequisite = new PreRequisite().getPreRequisiteManual(sql3);

                if (preRequisite.Count > 0)
                {
                    //ลบข้อมูลในตาราง PREREQUISITE
                    string sql4 = "Delete From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + CourseCode + "'";

                    string deletePreRequisite = new PreRequisite().deletePreRequisiteManual(sql4);

                    if (deletePreRequisite == "Success")
                    {
                        //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR6.aspx
                        Session["CurrCode"]    = CurrCode;
                        Session["YearVersion"] = YearVersion;
                        //Session["MajorCode"] = MajorCode;

                        Response.Redirect("Faculty_add_CURR6.aspx");
                    }
                }
                else
                {
                    //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR6.aspx
                    Session["CurrCode"]    = CurrCode;
                    Session["YearVersion"] = YearVersion;
                    //Session["MajorCode"] = MajorCode;

                    Response.Redirect("Faculty_add_CURR6.aspx");
                }
            }
        }
        else
        {
            //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR6.aspx
            Session["CurrCode"]    = CurrCode;
            Session["YearVersion"] = YearVersion;
            //Session["MajorCode"] = MajorCode;

            Response.Redirect("Faculty_add_CURR6.aspx");
        }
    }
Exemple #9
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string sql = "Select * From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "'";
        List <TQF2Sec3StructureGroup> tqf2Sec3StructureGroup;

        tqf2Sec3StructureGroup = new TQF2Sec3StructureGroup().getTQF2Sec3StructureGroupManual(sql);

        if (tqf2Sec3StructureGroup.Count > 0)
        {
            //[Step 8] ลบข้อมูลในตาราง TQF2SEC3SEMESTERPLAN
            string sql8 = "Delete From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'";
            string deleteTQF2SemesterPlan = new TQF2Sec3SemesterPlan().deleteTQF2Sec3SemesterPlanManual(sql8);

            //[Step 7] ลบข้อมูลในตาราง TQF2SEC4CURRICULUMMAPPING
            string sql7 = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'";
            List <TQF2Sec3PlanDetail> TQF2Sec3PlanDetailData = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql7);
            foreach (TQF2Sec3PlanDetail row in TQF2Sec3PlanDetailData)
            {
                string sql7_1 = "Delete From TQF2SEC4CURRICULUMMAPPING Where CURRCODE ='" + row.CurrCode + "'";
                string deleteTQF2Sec4CurriculumMapping = new TQF2Sec4CurriculumMapping().deleteTQF2Sec4CurriculumMappingManual(sql7_1);
            }

            //[Step 6-1] ลบข้อมูลในตาราง PREREQUISITE
            string sql6 = "Delete From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "'";
            string deletePreRequisite = new PreRequisite().deletePreRequisiteManual(sql6);

            //[Step 6] ลบข้อมูลในตาราง TQF2SEC3PLANDETAIL
            string sql5 = "Delete From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "'";
            string deleteTQF2Sec3PlanDetail = new TQF2Sec3PlanDetail().deleteTQF2Sec3PlanDetailManual(sql5);

            //[Step 5_1] ลบข้อมูลในตาราง TQF2SEC3STRUCTURETYPE
            string sql4 = "Delete From TQF2SEC3STRUCTURETYPE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "'";
            string deleteTqf2Sec3StructureType = new Tqf2Sec3StructureType().deleteTqf2Sec3StructureTypeManual(sql4);

            //[Step 5] ลบข้อมูลในตาราง TQF2SEC3STRUCTUREGROUP
            string sql3 = "Delete From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "'";
            string deleteTQF2Sec3StructureGroup = new TQF2Sec3StructureGroup().deleteTQF2Sec3StructureGroupManual(sql3);

            //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR5.aspx
            Session["CurrCode"]    = CurrCode;
            Session["YearVersion"] = YearVersion;
            //Session["MajorCode"] = MajorCode;

            Response.Redirect("Faculty_add_CURR5.aspx");
        }
        else
        {
            //สร้าง session ส่งคืนกลับไปหน้า Faculty_add_CURR5.aspx
            Session["CurrCode"]    = CurrCode;
            Session["YearVersion"] = YearVersion;
            //Session["MajorCode"] = MajorCode;

            Response.Redirect("Faculty_add_CURR5.aspx");
        }
    }
        public static DdbClinet GetInstance()
        {
            PreRequisite.NotNullOrWhiteSpace(EndpointUri);
            PreRequisite.NotNullOrWhiteSpace(AuthorizationKey);
            PreRequisite.NotNullOrWhiteSpace(DatabaseName);

            var policy         = CreateConnectionPolicy(ConnectionMode, Protocol);
            var documentClinet = CreateDocumentClient(EndpointUri, AuthorizationKey, policy);
            var strategy       = GetRetryStrategy(null, RetryCount, RetryInterval, false);

            return(new DdbClinet(documentClinet.AsReliable(strategy), DatabaseName, FeedOptionMaxItemCount));
        }
Exemple #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Request.QueryString["CurrCode"] != "" && Request.QueryString["YearVersion"] != "")
            {
                code        = Request.QueryString["token"];
                CurrCode    = Request.QueryString["CurrCode"];
                YearVersion = Request.QueryString["YearVersion"];
            }
            else
            {
                code        = Request.QueryString["token"];
                CurrCode    = "";
                YearVersion = "";
            }

            TQF.Course course = new TQF.Course().getCourse(code);

            lblCourseName.Text = course.CourseThName + " (" + course.CourseEnName + ")";

            lblLevelCode.Text         = new Levels().getLevels(course.LevelCode).LevelName;
            lblCourseCode.Text        = course.CourseCode;
            lblCourseEnShortName.Text = course.CourseEnShortName;
            lblCourseFlagCode.Text    = new CourseFlag().getCourseFlag(course.CourseFlagCode).CourseFlagName;
            lblCourseTypeCode.Text    = new TQF.CourseType().getCourseType(course.CourseTypeCode).CourseTypeThaiName;
            lblSuFlage.Text           = new SuFlage().getSuFlage(course.SuFlage).SuFlageName;
            lblCourseThDesc.Text      = course.CourseThDesc;
            lblCourseEnDesc.Text      = course.CourseEnDesc;
            lblServiceStatus.Text     = new ServiceStatus().getServiceStatus(course.ServiceStatus).ServiceStatusName;
            lblMinCredits.Text        = course.MinCredits;
            lblDateApprove.Text       = course.DateApprove;

            string sqlPreRequisite           = "Select * From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And COURSECODE='" + course.CourseCode + "'";
            List <PreRequisite> preRequisite = new PreRequisite().getPreRequisiteManual(sqlPreRequisite);
            if (preRequisite.Count > 0)
            {
                foreach (PreRequisite data in preRequisite)
                {
                    lblPrequisite.Text += data.PreRequisiteCourseCode + "   " + new TQF.Course().getCourse(data.PreRequisiteCourseCode).CourseThName + " (" + new TQF.Course().getCourse(data.PreRequisiteCourseCode).CourseEnName + ")<br>";
                }
            }
            else
            {
                lblPrequisite.Text = "ไม่มี";
            }

            lblComments.Text = course.Comments;
        }
    }
        public ActionResult RemovePrerequisite(int?CourseId, int?Id)
        {
            if (Id == null && CourseId == null)
            {
                return(RedirectToAction("AddPrerequisite", new { courseId = CourseId }));
            }
            PreRequisite preRequisite = db.PrerequisiteCourses.Where(x => x.ActualCourseId == CourseId && x.RequiredCourseId == Id).FirstOrDefault();

            if (preRequisite != null)
            {
                db.PrerequisiteCourses.Remove(preRequisite);
                db.SaveChanges();
            }
            return(RedirectToAction("AddPrerequisite", new { courseId = CourseId }));
        }
        public ActionResult AddPrerequisiteConfirm(int?CourseId, int?Id)
        {
            if (Id == null || CourseId == null)
            {
                return(RedirectToAction("AddPrerequisite", new { courseId = CourseId }));
            }

            PreRequisite preRequisite = new PreRequisite();

            preRequisite.ActualCourseId   = (int)CourseId;
            preRequisite.RequiredCourseId = (int)Id;
            db.PrerequisiteCourses.Add(preRequisite);
            db.SaveChanges();
            return(RedirectToAction("AddPrerequisite", new { courseId = CourseId }));
        }
        public ActionResult StartStep(int id)
        {
            PreRequisite step = ContextProcess.Object.PreRequisites.Find(id);
            MainProcess  p    = ContextProcess.Object.MainProceses.Find(step.ProcessID);

            if (p.CurrentStateName == ProcState.Running && p.CurrentStep.ID == id)
            {
                History history = new History {
                    SessionID = p.CurrentResult.SessionID, ProcessID = p.ID, EventID = id
                };
                ContextProcess.Object.Historys.Add(history);
                ContextProcess.Object.SaveChanges();
                p.Refresh();
            }
            return(View("Index", ContextProcess.Object.MainProceses.ToArray()));
        }
Exemple #15
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string sql = "Select * From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + CourseCode + "' And PREREQUISITECOURSECODE='" + PreRequisiteCourseCode + "'";

        List <PreRequisite> preRequisite = new PreRequisite().getPreRequisiteManual(sql);

        if (preRequisite.Count > 0)
        {
            string sql2 = "Delete From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + CourseCode + "' And PREREQUISITECOURSECODE='" + PreRequisiteCourseCode + "' And PREREQUISITERULE='" + PreRequisiteRule + "'";

            string deletePreRequisite = new PreRequisite().deletePreRequisiteManual(sql2);

            if (deletePreRequisite == "Success")
            {
                Response.Redirect("addCOURSE_to_PREREQ.aspx?CurrCode=" + CurrCode + "&YearVersion=" + YearVersion + "&CurrFormatCode=" + CurrFormatCode + "&CurrTypeCode=" + CurrTypeCode + "&MajorCode=" + MajorCode + "&CategoryCode=" + CategoryCode + "&CourseGroupCode=" + CourseGroupCode + "&CourseTypeCode=" + CourseTypeCode + "&CourseCode=" + CourseCode + "");
            }
        }
        else
        {
            Response.Redirect("addCOURSE_to_PREREQ.aspx?CurrCode=" + CurrCode + "&YearVersion=" + YearVersion + "&CurrFormatCode=" + CurrFormatCode + "&CurrTypeCode=" + CurrTypeCode + "&MajorCode=" + MajorCode + "&CategoryCode=" + CategoryCode + "&CourseGroupCode=" + CourseGroupCode + "&CourseTypeCode=" + CourseTypeCode + "&CourseCode=" + CourseCode + "");
        }
    }
Exemple #16
0
        /// <summary>
        /// Commits the courses, that were moved to the
        /// pre-reqs listview, to the preReqs table
        /// </summary>
        public void CommitPreReqs()
        {
            try
            {
                using (var context = new SchoolU_DBEntities())
                {
                    // Gets all the courses names
                    IList <string> allCourseName = context.Courses.Where(i => i.CourseId != 0).Select(i => i.CourseName).ToList();
                    // Gets the course id for the course that was recently added
                    int courseAdded = context.Courses.Where(i => i.CourseName == CourseName).Select(i => i.CourseId).Single();

                    if (SelectedCourseCollection.Any())
                    {
                        // Stores the PreRequisite objects so they can be added all at the same time using the AddRange method
                        IList <PreRequisite> PreReqList = new List <PreRequisite>();

                        if (IsPreReqListDifferent())
                        {
                            for (int i = 0; i < GetPreReqIds().Count; i++)
                            {
                                var newPreReq = new PreRequisite()
                                {
                                    CourseId = courseAdded,
                                    PrereqId = GetPreReqIds().ElementAt(i)
                                };
                                PreReqList.Add(newPreReq);
                            }
                            context.PreRequisites.AddRange(PreReqList);
                        }
                        context.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
                return;
            }
        }
        public virtual void AddPreRequisites()
        {
            PreRequisite preReq = new PreRequisite("Subscription");

            preReq.Runnable = () =>
            {
                foreach (TestClientInfo tci in this.ConsumersInfo)
                {
                    int expectedMessages = 0;
                    if (this.SubscribeDestinationType != NetAction.DestinationType.TOPIC)
                    {
                        if ((ProducersInfo.Count % ConsumersInfo.Count) != 0)
                        {
                            throw new Exception(String.Format("When not using TOPIC subscriptions, publishers ({0}) must be multiple of consumers ({1}).", ProducersInfo.Count, ConsumersInfo.Count));
                        }
                        expectedMessages = ProducersInfo.Count / ConsumersInfo.Count;
                        Console.WriteLine("In here..");
                    }
                    else
                    {
                        expectedMessages = ProducersInfo.Count;
                    }

                    Console.WriteLine("expectedMessages: {0}", expectedMessages);


                    NotificationHandler notificationHandler = new NotificationHandler(tci.brokerClient, this.SubscribeDestinationType, expectedMessages);
                    tci.notificationHandler = notificationHandler;
                    tci.brokerClient.Subscribe(GetSubscription(notificationHandler));
                }
                preReq.Sucess = true;
                preReq.Done   = true;
                Thread.Sleep(1000);// giving time to subscribe. Not critical, so there's no need for something more sophisticated.
            };

            this.AddPrequisite(preReq);
        }
Exemple #18
0
    protected void htmlGenerateTab5(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode)
    {
        string html = "";

        html += "<div class=\"box-group-data\">";
        html += "<table class=\"table-course\">";

        //Body Table

        List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getDistinctCourseCodeTQF2Sec3PlanDetail(CurrCode, YearVersion);

        foreach (TQF2Sec3PlanDetail row in tqf2Sec3PlanDetail)
        {
            TQF.Course course = new TQF.Course().getCourse(row.CourseCode);

            html += "<tr>";
            html += "<td><strong>" + course.CourseCode + "</strong></td>";
            html += "<td><strong>";
            html += course.CourseThName + "<BR>";
            html += course.CourseEnName;
            html += "</strong></td>";
            html += "<td><strong>";
            html += course.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
            html += "</strong></td>";
            html += "</tr>";

            html += "<tr>";
            html += "<td>&nbsp;</td>";
            html += "<td colspan=\"2\">";

            html += "<table class=\"table-description\">";
            html += "<tr>";
            html += "<td>วิชาบังคับก่อน: &nbsp;&nbsp;</td>";
            html += "<td>";

            string sqlPreRequisite           = "Select * From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And COURSECODE='" + course.CourseCode + "'";
            List <PreRequisite> preRequisite = new PreRequisite().getPreRequisiteManual(sqlPreRequisite);
            foreach (PreRequisite data in preRequisite)
            {
                html += data.PreRequisiteCourseCode + "   " + new TQF.Course().getCourse(data.PreRequisiteCourseCode).CourseThName + "<br>";
            }

            html += "</td>";
            html += "</tr>";
            html += "</table>";

            html += "</td>";
            html += "</tr>";

            html += "<tr>";
            html += "<td>&nbsp;</td>";
            html += "<td colspan=\"2\">";

            html += "<table class=\"table-description\">";
            html += "<tr>";
            html += "<td>PreRequisite: &nbsp;&nbsp;";
            html += "<td>";

            foreach (PreRequisite data in preRequisite)
            {
                html += data.PreRequisiteCourseCode + "   " + new TQF.Course().getCourse(data.PreRequisiteCourseCode).CourseEnName + "<br>";
            }

            html += "</td>";
            html += "</tr>";
            html += "</table>";

            html += "</td>";
            html += "</tr>";

            html += "<tr>";
            html += "<td>&nbsp;</td>";
            html += "<td colspan=\"2\" class=\"course-description\">" + course.CourseThDesc + "</td>";
            html += "</tr>";

            html += "<tr>";
            html += "<td>&nbsp;</td>";
            html += "<td colspan=\"2\" class=\"course-description\">" + course.CourseEnDesc + "</td>";
            html += "</tr>";

            html += "<tr>";
            html += "<td>&nbsp;</td>";
            html += "<td>&nbsp;</td>";
            html += "<td>&nbsp;</td>";
            html += "</tr>";
        }

        html += "</table>";

        html += "</div>";

        Label lblHTML5 = new Label();

        lblHTML5.Text = html;
        placeHTML5.Controls.Add(lblHTML5);
    }
    //private string FacultyId;

    protected void Page_Load(object sender, EventArgs e)
    {
        CurrCode        = Request.QueryString["CurrCode"];
        YearVersion     = Request.QueryString["YearVersion"];
        CurrFormatCode  = Request.QueryString["CurrFormatCode"];
        CurrTypeCode    = Request.QueryString["CurrTypeCode"];
        MajorCode       = Request.QueryString["MajorCode"];
        CourseGroupCode = Request.QueryString["CourseGroupCode"];
        CategoryCode    = Request.QueryString["CategoryCode"];
        CourseTypeCode  = Request.QueryString["CourseTypeCode"];
        CourseCode      = Request.QueryString["CourseCode"];

        TQF.Curriculum currTitle = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion);
        lblHeader1.Text = currTitle.CurrCode + " หลักสูตร" + currTitle.CurrThName;
        lblHeader2.Text = currTitle.CurrEnName;

        string currStatus;

        if (currTitle.CurrStatus == "1")
        {
            currStatus      = "หลักสูตรใหม่";
            lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")";
        }
        if (currTitle.CurrStatus == "2")
        {
            currStatus      = "หลักปรับปรุง";
            lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")";
        }

        lblCurrFormatTitle.Text = new CurrFormat().getCurrFormat(CurrFormatCode).CurrFormatName + " (" + new TQF.Major().getMajor(MajorCode).MajorThName + ")";

        TQF.Course course = new TQF.Course().getCourse(CourseCode);
        lblCourseTitle.Text = course.CourseCode + " " + course.CourseThName + "<br> (" + course.CourseEnName + ")";

        // Head Table
        string[] ar = { "ลำดับเงื่อนไข", "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "เรียนก่อน/ร่วม", "ลบ" };
        tblCourse.Attributes.Add("class", "table table-striped table-bordered table-hover");
        tblCourse.Attributes.Add("id", "dt_basic");
        TableHeaderRow tRowHead = new TableHeaderRow();

        tRowHead.TableSection = TableRowSection.TableHeader;
        for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
        {
            TableHeaderCell cellHead = new TableHeaderCell();
            if (cellCtr == 1)
            {
                cellHead.Width = 50;
            }
            if (cellCtr == 2 || cellCtr == 4)
            {
                cellHead.Width = 80;
            }
            if (cellCtr == 5)
            {
                cellHead.Width = 120;
            }
            if (cellCtr == 6)
            {
                cellHead.Width = 60;
            }

            cellHead.Text = ar[cellCtr - 1];
            tRowHead.Cells.Add(cellHead);
        }
        tblCourse.Rows.Add(tRowHead);

        string sqlPreRequisite           = "Select * From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + CourseCode + "' Order by PREREQUISITERULE";
        List <PreRequisite> preRequisite = new PreRequisite().getPreRequisiteManual(sqlPreRequisite);

        foreach (PreRequisite data in preRequisite)
        {
            TQF.Course courseData = new TQF.Course().getCourse(data.PreRequisiteCourseCode);

            TableRow tRowBody = new TableRow();
            tRowBody.TableSection = TableRowSection.TableBody;

            //Cell [0]
            TableCell cellPreRequisiteRule = new TableCell();
            cellPreRequisiteRule.Text     = data.PreRequisiteRule;
            cellPreRequisiteRule.CssClass = "text-center";
            cellPreRequisiteRule.Width    = 50;
            tRowBody.Cells.Add(cellPreRequisiteRule);

            //Cell [1]
            TableCell cellCourseCode = new TableCell();
            //string urlShow = "showCOURSE.aspx?token=" + data.PreRequisiteCourseCode;
            string    urlShow = "showCOURSE.aspx?token=" + data.PreRequisiteCourseCode + "&CurrCode=" + data.CurrCode + "&YearVersion=" + data.YearVersion;
            HyperLink hypShow = new HyperLink();
            hypShow.Attributes.Add("data-target", "#showModal");
            hypShow.Attributes.Add("data-toggle", "modal");
            hypShow.Text        = data.PreRequisiteCourseCode;
            hypShow.NavigateUrl = urlShow;
            hypShow.ToolTip     = "Course details";
            cellCourseCode.Controls.Add(hypShow);
            cellCourseCode.CssClass = "text-center";
            cellCourseCode.Width    = 80;
            tRowBody.Cells.Add(cellCourseCode);

            //Cell [2]
            TableCell cellCourseThName = new TableCell();
            cellCourseThName.Text = courseData.CourseThName + "<BR>" + courseData.CourseEnName;
            tRowBody.Cells.Add(cellCourseThName);

            //Cell [3]
            TableCell cellNumCredit = new TableCell();
            cellNumCredit.Text  = courseData.Credit + "(" + courseData.TheoryHour + "-" + courseData.PracticeHour + "-" + courseData.SelfStudyHour + ")";
            cellNumCredit.Width = 80;
            tRowBody.Cells.Add(cellNumCredit);

            //Cell [4]
            TableCell cellPreRequisiteFormat = new TableCell();
            if (data.PreRequisiteFormat == "B")
            {
                cellPreRequisiteFormat.Text = "บังคับเรียนก่อน";
            }
            if (data.PreRequisiteFormat == "C")
            {
                cellPreRequisiteFormat.Text = "บังคับเรียนร่วมกัน";
            }
            if (data.PreRequisiteFormat == "D")
            {
                cellPreRequisiteFormat.Text = "บังคับเรียนก่อน/บังคับเรียนร่วมกัน";
            }
            //cellPreRequisiteFormat.Text = data.PreRequisiteFormat;
            cellPreRequisiteFormat.Width = 120;
            tRowBody.Cells.Add(cellPreRequisiteFormat);

            //Cell [5]
            TableCell cellDel = new TableCell();
            string    urlDel  = "deletePREREQ.aspx?CurrCode=" + data.CurrCode + "&YearVersion=" + data.YearVersion + "&CurrFormatCode=" + data.CurrFormatCode + "&CurrTypeCode=" + data.CurrTypeCode + "&MajorCode=" + data.MajorCode + "&CategoryCode=" + data.CategoryCode + "&CourseGroupCode=" + data.CourseGroupCode + "&CourseTypeCode=" + data.CourseTypeCode + "&CourseCode=" + data.CourseCode + "&PreRequisiteCourseCode=" + data.PreRequisiteCourseCode + "&PreRequisiteRule=" + data.PreRequisiteRule;
            HyperLink hypDel  = new HyperLink();
            hypDel.Attributes.Add("data-target", "#deletePREREQ");
            hypDel.Attributes.Add("data-toggle", "modal");
            hypDel.Text        = "<h4><i class='fa fa-trash-o'></i></h4>";
            hypDel.NavigateUrl = urlDel;
            hypDel.ToolTip     = "Delete";
            cellDel.Controls.Add(hypDel);
            cellDel.CssClass = "text-center";
            cellDel.Width    = 60;
            tRowBody.Cells.Add(cellDel);
            tblCourse.Rows.Add(tRowBody);
        }
    }