public float parcentance(string stdid)
        {
            int           classs = 0;
            string        q      = "select class from promotion where Student_Id='" + stdid + "'";
            SqlCommand    cmd    = new SqlCommand(q, cn.GetConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                classs = Convert.ToInt32(reader["class"]);
            }
            cn.getClose();
            int           totalclass = 0;
            string        q1         = "select t1.class,count(t1.Adate) as totalClass from  (select class, Adate from Attendence_st group by Adate,class) t1 where class=" + classs + " group by t1.class";
            SqlCommand    cmd1       = new SqlCommand(q1, cn.GetConnection());
            SqlDataReader reader1    = cmd1.ExecuteReader();

            if (reader1.Read())
            {
                totalclass = Convert.ToInt32(reader1["totalClass"]);
            }

            float         parcen  = 0;
            string        q2      = "select t1.sid,t1.class, cast(round(count(*)/" + totalclass + ".0*100, 2)as numeric(8,2)) as percentage   from (select CAST(Adate as DATE) as t,sid,class,COUNT(*) as alls from attendence_st where Atten='true' group by CAST(Adate as DATE),Sid,class) t1 where t1.Sid='" + stdid + "' group by t1.Sid,t1.class";
            SqlCommand    cmd2    = new SqlCommand(q2, cn.GetConnection());
            SqlDataReader reader2 = cmd2.ExecuteReader();

            if (reader2.Read())
            {
                parcen = Convert.ToSingle(reader2["percentage"]);
            }
            cn.getClose();

            return(parcen);
        }
Ejemplo n.º 2
0
        public string view(Student_admission student)
        {
            //Student_addmissions student_ = new Student_addmissions();
            string        s      = "select *from student where St_id='" + student.Stdid + "'";
            SqlCommand    cmd1   = new SqlCommand(s, cn.GetConnection());
            SqlDataReader reader = cmd1.ExecuteReader();

            if (reader.Read())
            {
                student.Stdid     = reader["St_id"].ToString();
                student.Sname     = reader["St_name"].ToString();
                student.Fname     = reader["St_fname"].ToString();
                student.Mname     = reader["St_mname"].ToString();
                student.Class     = Convert.ToInt32(reader["St_class"]);
                student.Phone     = reader["St_phone"].ToString();
                student.Address   = reader["St_address"].ToString();
                student.Birthdate = Convert.ToDateTime(reader["St_date_of_birth"]);
                student.Religion  = reader["St_Religion"].ToString();
                student.Gender    = reader["St_gender"].ToString();
                student.Status    = reader["St_type"].ToString();
                student.Images    = reader["St_image"].ToString();
            }
            cn.getClose();
            return(student.Images);
        }
Ejemplo n.º 3
0
        public int saveadmit(Student_admission student)
        {
            Dbconnection cn     = new Dbconnection();
            string       adate  = DateTime.Now.ToString();
            string       ststus = "Active";
            string       q      = "insert into student values('" + student.Stdid + "','" + student.Sname + "','" + student.Fname + "','" + student.Mname + "','" + student.Class + "','" + student.Phone + "','" + student.Address + "','" + student.Birthdate + "','" + adate + "','" + student.Religion + "','" + student.Gender + "','" + ststus + "','" + student.Images + "','" + student.Password + "')";
            SqlCommand   cmd    = new SqlCommand(q, cn.GetConnection());
            int          row    = cmd.ExecuteNonQuery();

            cn.getClose();
            return(row);
        }
Ejemplo n.º 4
0
        public string view(Student_admission student)
        {
            string        s      = "select *from student where St_id='" + student.Stdid + "'";
            SqlCommand    cmd1   = new SqlCommand(s, cn.GetConnection());
            SqlDataReader reader = cmd1.ExecuteReader();

            if (reader.Read())
            {
                student.Images = reader["St_image"].ToString();
            }
            cn.getClose();
            return(student.Images);
        }