public string insert(AssignmentUpload up)
        {
            try
            {
                string Date = DateTime.Now.ToShortDateString();
                con.Open();
                string     q   = "insert into UploadAssignment (T_id,ClassID,LessonNo,AssignmentName,AssignmentFile,DateOfSubmission,DatabaseName) values (@T_id, @ClassID,@LessonNo,@assName,@AssignmentFile, @Date,@DatabaseName)";
                SqlCommand cmd = new SqlCommand(q, con);
                cmd.Parameters.AddWithValue("@T_id", up.T_id);
                cmd.Parameters.AddWithValue("@ClassID", up.ClassID);
                cmd.Parameters.AddWithValue("@LessonNo", up.LessonNo);
                cmd.Parameters.AddWithValue("@assName", up.AssignmentName);

                cmd.Parameters.AddWithValue("@AssignmentFile", up.AssignmentFile);

                cmd.Parameters.AddWithValue("@Date", Date);
                cmd.Parameters.AddWithValue("@DatabaseName", up.DatabaseName);

                cmd.ExecuteNonQuery();
                con.Close();

                return("succesfull ");
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }
        public List <AssignmentUpload> getListOfstudents(int lessonNo)
        {
            con.Open();
            List <AssignmentUpload> stList = new List <AssignmentUpload>();

            try
            {
                SqlCommand    cmd = new SqlCommand("select DISTINCT UserName,LessonNo,DatabaseName from StudentAssignment where LessonNo =" + lessonNo + "", con);
                SqlDataReader sdr = cmd.ExecuteReader();
                while (sdr.Read())
                {
                    AssignmentUpload up = new AssignmentUpload();
                    up.UserName     = sdr["UserName"].ToString();
                    up.LessonNo     = int.Parse(sdr["LessonNo"].ToString());
                    up.DatabaseName = sdr["DatabaseName"].ToString();
                    stList.Add(up);
                }

                con.Close();
                return(stList);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
        public bool TeacherLogin(AssignmentUpload c)
        {
            con.Open();
            string        q   = "select * from[fyp].[dbo].[Teacher] where T_id ='" + c.T_id + "' and U_Password='******'";
            string        p   = q;
            SqlCommand    cmd = new SqlCommand(q, con);
            SqlDataReader sdr = cmd.ExecuteReader();

            if (sdr.Read())
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public AssignmentUpload gets(int AssignmentNO)
        {
            try
            {
                con.Open();
                AssignmentUpload up  = new AssignmentUpload();
                SqlCommand       cmd = new SqlCommand("select * from UploadAssignment where LessonNO=" + AssignmentNO + "", con);
                SqlDataReader    sdr = cmd.ExecuteReader();
                while (sdr.Read())
                {
                    up.AssignmentName = sdr["AssignmentName"].ToString();
                    up.AssignmentFile = (byte[])sdr["AssignmentFile"];
                    up.ss             = Convert.ToBase64String(up.AssignmentFile);
                    up.LessonNo       = int.Parse(sdr["LessonNO"].ToString());
                    up.AssignmentID   = int.Parse(sdr["AssignmentID"].ToString());
                }

                con.Close();
                return(up);
            }catch (Exception ex)
            {
                return(null);
            }
        }