using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MySql.Data.MySqlClient;
using System.Configuration;
using System.Web.Services;
using Newtonsoft.Json;
using System.Web.Script.Serialization;
public partial class module_examfeereceipt : System.Web.UI.Page
{
    public static string constring = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
    public static MySqlConnection con = new MySqlConnection(constring);
    public static DateTime date1; public static DateTime date2;
    public static int installsids;
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    [WebMethod]

    public static object GetData(string studids,  string yearsid, string classid, string divisionid, string expkgid, string semisterid, string examre)
    {
        string data = " ";
      
        using (MySqlConnection con = new MySqlConnection(constring))
        {
            using (MySqlCommand cmd = new MySqlCommand("SELECT st.*,class_master.class as clsname,division_master.division as divsname,date_format(pkg.examdt,'%d-%m-%Y') as recptdate,pkg.*,examfeemaster.*,semistertbl.semnos From student_detail AS st   LEFT JOIN exampackageassign AS pkg ON st.studid = pkg.studids left join examfeemaster on pkg.exampkgid = examfeemaster.id left join class_master ON st.classd  = class_master.id left join division_master on st.division = division_master.id  left join semistertbl on examfeemaster.semisteryears = semistertbl.id  WHERE  pkg.studids = '" + studids + "' and pkg.yearid = '" + yearsid + "' and pkg.classids = '" + classid + "' and pkg.divisonsid = '" + divisionid + "' and pkg.semisterid = '" + semisterid + "' and pkg.exampkgid = '" + expkgid + "' and pkg.examrecpt = '" + examre + "' ORDER BY st.id desc", con))
            {
                if (con.State != ConnectionState.Open) { con.Open(); }
                DataSet ds = new DataSet();
                using (MySqlDataAdapter da = new MySqlDataAdapter(cmd))
                {
                    da.Fill(ds); con.Close();
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        data = JsonConvert.SerializeObject(ds.Tables[0]);
                    }


                }
            }
        }
        return data;
    }
}