Ejemplo n.º 1
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);
        }
        public List <student_account_info> GetStudent_Account_Infos(Int32 stdid)
        {
            List <student_account_info> alist = new List <student_account_info>();
            string        q1     = "SELECT  t2.stdId,t2.class,t2.pdate as Month,t2.pay as Payable,t1.paid as Paid,t2.pay-t1.paid as Dues,t1.paiddate FROM (select Stdid,FORMAT ( pdate , 'MM-yyyy' ) as pdate,pay,class from payable) t2 left JOIN(select t1.stdId,t1.paiddate,sum(t1.paid) as paid from(select Stdid,FORMAT ( pmonth , 'MM-yyyy' ) as paiddate,paid,class from payment group by stdId,class,paid,pmonth) t1 group by t1.stdId,t1.paiddate) t1 ON  t2.stdId=t1.stdId and t2.pdate=t1.paiddate where t2.stdId=" + stdid + " group by t2.stdId,t2.class,t2.pdate,t2.pay,t1.paid,t1.paiddate order by t1.paiddate";
            SqlCommand    cmd1   = new SqlCommand(q1, cn.GetConnection());
            SqlDataReader reader = cmd1.ExecuteReader();

            while (reader.Read())
            {
                student_account_info student_Account_Info = new student_account_info();

                student_Account_Info.stdId = Convert.ToInt32(reader["stdId"].ToString());
                student_Account_Info.Class = Convert.ToInt32(reader["class"].ToString());
                //  student_Account_Info.paidmonth = Convert.ToDateTime(reader["paidmonth"]);

                student_Account_Info.pmonth = Convert.ToDateTime(reader["Month"] == DBNull.Value ? null : (DateTime?)Convert.ToDateTime(reader["month"]));
                //object v = (reader.IsDBNull(3) ? null : reader["paidmonth"]);
                //student_Account_Info.paidmonth = Convert.ToDateTime((DateTime?)v);
                //employee.FirstName = sqlreader[indexFirstName] as string;
                //employee.Age = sqlreader[indexAge] as int? ?? default(int);
                //  string s = reader["pmonth"].ToString();
                student_Account_Info.Month = Convert.ToDateTime(reader["Month"].ToString());


                student_Account_Info.payable = Convert.ToInt32(reader["payable"]);
                //d = Convert.ToDouble(reader["paid"] as float? ?? default(float));
                student_Account_Info.paid = reader["paid"] as Int32? ?? default(int);

                student_Account_Info.dues = reader["dues"] as int? ?? default(int);
                alist.Add(student_Account_Info);
            }
            return(alist);
        }
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 int save_month()
        {
            string        stdid, classs;
            int           cost, i = 1, p = 200;
            string        pp = "bank", rr = "", tt = "1";
            string        pdate = DateTime.Now.ToString();
            string        q     = "select promotion.Student_Id as studentid,promotion.Class as class,ClassCost.Cost as cost from promotion,ClassCost where promotion.Class = ClassCost.c_id ";
            SqlCommand    cmd   = new SqlCommand(q, cn.GetConnection());
            SqlDataReader reade = cmd.ExecuteReader();

            while (reade.Read())
            {
                stdid  = reade["studentid"].ToString();
                classs = reade["class"].ToString();
                cost   = Convert.ToInt32(reade["cost"].ToString());
                string l;
                l = "insert into Payment_Student(Studentid,Pmonth,payable,paid,pdate,paymethod,Money_Recpts,duestats,Class) values('" + stdid + "','" + pdate + "'," + cost + "," + p + ",'" + pdate + "','" + pp + "','" + rr + "','" + tt + "'," + classs + ")";
                SqlCommand cmd1 = new SqlCommand(l, cn.GetConnection());
                cmd1.ExecuteNonQuery();
            }
            return(i);
        }
Ejemplo n.º 5
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);
        }