Beispiel #1
0
        public List <StudentGeneralAttendance> GetAllStudentGeneralAttendance(string userID)
        {
            List <StudentGeneralAttendance> retVal = new List <StudentGeneralAttendance>();
            MySqlConnection con       = new MySqlConnection(DbCon.connectionString);
            string          sqlInsert = "SELECT `id`, `studuserid`, `batchid`, `bgroup`, `present`, `createdate`, `modifydate` FROM `studentgeneralattendance` ";
            MySqlDataReader dr        = null;
            MySqlCommand    cmd;

            con.Open();
            cmd = new MySqlCommand(sqlInsert, con);
            dr  = cmd.ExecuteReader();

            while (dr.Read()) //iterate through the records in the result dataset
            {
                StudentGeneralAttendance Mod = new StudentGeneralAttendance();
                Mod.ID           = dr.GetInt32(0);
                Mod.StuduserId   = dr.GetString(1);
                Mod.BatchId      = dr.GetInt32(2);
                Mod.Bgroup       = dr.GetString(3);
                Mod.Present      = dr.GetInt32(4);
                Mod.DateCreted   = dr.GetDateTime(5);
                Mod.LastModified = dr.GetDateTime(6);

                retVal.Add(Mod);
            }


            con.Close();

            return(retVal);
        }
Beispiel #2
0
        public bool AddStudentGeneralAttendance(StudentGeneralAttendance fp, string userID)
        {
            bool            result    = false;
            MySqlConnection con       = new MySqlConnection(DbCon.connectionString);
            string          sqlInsert = "INSERT INTO `studentgeneralattendance`(`studuserid`, `batchid`, `bgroup`, `present`, `createdate`, `modifydate`) VALUES (@studuserid,@batchid,@bgroup,@present,@createdate,@modifydate)";

            con.Open();
            MySqlCommand cmd = new MySqlCommand(sqlInsert, con);

            cmd.Parameters.AddWithValue("@studuserid", fp.StuduserId);
            cmd.Parameters.AddWithValue("@batchid", fp.BatchId);
            cmd.Parameters.AddWithValue("@present", fp.Present);
            cmd.Parameters.AddWithValue("@createdate", fp.DateCreted);
            cmd.Parameters.AddWithValue("@modifydate", fp.LastModified);
            cmd.Parameters.AddWithValue("@bgroup", fp.Bgroup);
            if (cmd.ExecuteNonQuery() > 0)
            {
                result = true;
            }
            con.Close();
            return(result);
        }
Beispiel #3
0
        public bool UpdateStudentGeneralAttendance(StudentGeneralAttendance fp, string userID)
        {
            bool            result    = false;
            MySqlConnection con       = new MySqlConnection(DbCon.connectionString);
            string          sqlInsert = "UPDATE `studentgeneralattendance` SET `studuserid`=@studuserid,`batchid`=@batchid,`present`=@present,`modifydate`=@modifydate,bgroup = @bgroup WHERE id = @id";

            con.Open();
            MySqlCommand cmd = new MySqlCommand(sqlInsert, con);

            cmd.Parameters.AddWithValue("@studuserid", fp.StuduserId);
            cmd.Parameters.AddWithValue("@batchid", fp.BatchId);
            cmd.Parameters.AddWithValue("@present", fp.Present);
            cmd.Parameters.AddWithValue("@modifydate", fp.LastModified);
            cmd.Parameters.AddWithValue("@bgroup", fp.Bgroup);
            cmd.Parameters.AddWithValue("@id", fp.ID);

            if (cmd.ExecuteNonQuery() > 0)
            {
                result = true;
            }
            con.Close();
            return(result);
        }