public void AddTermRule(mst_term_rules mst)
        {
            try
            {
                using (MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()))
                {
                    mst_sessionMain sess = new mst_sessionMain();

                    string maxid = @"SELECT 
                                        IFNULL(MAX(evaluation_id), 0) + 1
                                    FROM
                                        mst_term_rules
                                    WHERE
                                        session = @session";

                    int id = con.Query <int>(maxid, new { session = sess.findFinal_Session() }).SingleOrDefault();

                    string query = @"INSERT INTO `mst_term_rules`
                                (`session`,
                                `evaluation_id`,
                                `term_id`,
                                `class_id`,
                                `evaluation_name`,
                                `exam_id1`,
                                `exam_id2`,
                                `rule`)
                                VALUES
                                (@session,
                                 @evaluation_id,
                                @term_id,
                                @class_id,
                                @evaluation_name,
                                @exam_id1,
                                @exam_id2,
                                @rule)";

                    mst.session = sess.findFinal_Session();

                    mst.evaluation_id = id;

                    con.Execute(query, new
                    {
                        mst.session,
                        mst.evaluation_id,
                        mst.term_id,
                        mst.class_id,
                        mst.evaluation_name,
                        mst.exam_id1,
                        mst.exam_id2,
                        mst.rule
                    });
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public mst_term_rules DeleteTermRule(mst_term_rules rule)
        {
            using (MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()))
            {
                string Query = @"DELETE FROM `mst_term_rules` 
                                WHERE
                                    `session` = @session
                                    AND `evaluation_id` = @evaluation_id
                                    AND `term_id` = @term_id
                                    AND `class_id` = @class_id";

                return(con.Query <mst_term_rules>(Query, rule).SingleOrDefault());
            }
        }