コード例 #1
0
        /* public ArrayList Getassignmentbyassignmentid(int assignid)
         * {
         *   DatabaseRetriveQuery retrieveassignment = new DatabaseRetriveQuery("markingassign");
         *
         *   retrieveassignment.AddRestriction("assignid", "=", assignid.ToString());
         *
         *   SqlDataReader dr = retrieveassignment.RunQuery();
         *
         *   ArrayList result = new ArrayList();
         *
         *   while (dr.Read())
         *   {
         *       assignment a = new assignment();
         *       a.assignid = (int)dr["assignid"];
         *       a.studid = (int)dr["studid"];
         *       a.staffid = (int)dr["staffid"];
         *       a.mschemeid = (int)dr["mschemeid"];
         *       a.componentid = (int)dr["componentid"];
         *       result.Add(a);
         *   }
         *
         *   return result;
         * }
         */
        public ArrayList Getallassignment()
        {
            DatabaseRetriveQuery retrieveallassignment = new DatabaseRetriveQuery("markingassign");

            SqlDataReader dr = retrieveallassignment.RunQuery();

            ArrayList result = new ArrayList();

            while (dr.Read())
            {
                assignment a = new assignment();
                a.assignid    = (int)dr["assignid"];
                a.studid      = (int)dr["studid"];
                a.staffid     = (int)dr["staffid"];
                a.mschemeid   = (int)dr["mschemeid"];
                a.componentid = (string)dr["componentid"];

                if (dr["assessmsub"] != DBNull.Value)
                {
                    a.assessmsub = (string)dr["assessmsub"];
                }

                result.Add(a);
            }

            return(result);
        }
コード例 #2
0
        public bool Addassignment(assignment a)
        {
            DatabaseInsertQuery newassignment = new DatabaseInsertQuery("markingassign");


            newassignment.AddData("studid", a.studid.ToString());
            newassignment.AddData("staffid", a.staffid.ToString());
            newassignment.AddData("mschemeid", a.mschemeid.ToString());
            newassignment.AddData("componentid", a.componentid.ToString());
            newassignment.AddData("assessmsub", a.assessmsub.ToString());

            return(newassignment.RunQuery());
        }