示例#1
0
        public List <Institutions> GetCollegeId(string name)
        {
            con.Open();
            cmd = new SqlCommand("select Institute_id from Edu_Inst1 where Inst_name='" + name + "'", con);
            dr  = cmd.ExecuteReader();
            dr.Read();
            id = dr.GetValue(0).ToString();
            dr.Close();
            con.Close();
            Institutions        i    = new Institutions();
            List <Institutions> list = new List <Institutions>();

            i.Inst_name = id;
            list.Add(i);
            return(list);
        }
示例#2
0
        public List <Institutions> Get_Institute_home(string id)
        {
            con.Open();
            cmd = new SqlCommand("select Institute_id,Inst_name,Inst_web,Category,Street,City,Pin,Fax,State,No_of_likes,isVerified,Inst_logo,Inst_photo,Inst_phone,Inst_email,HOI,Title_HOI,Admin_name,Description from Edu_Inst1 where Institute_id='" + id + "' ", con);
            da  = new SqlDataAdapter();
            da.SelectCommand = cmd;
            DataSet myDataSet = new DataSet();

            da.Fill(myDataSet);
            // Iterate thorugh data set and return list
            List <Institutions> list = new List <Institutions>();

            foreach (DataTable table in myDataSet.Tables)
            {
                foreach (DataRow row in table.Rows)
                {
                    Institutions i = new Institutions();
                    i.Institute_id = row["Institute_id"].ToString();
                    i.Inst_name    = row["Inst_name"].ToString();
                    i.Inst_web     = row["Inst_web"].ToString();

                    i.Category          = row["Category"].ToString();
                    i.Street            = row["Street"].ToString();
                    i.City              = row["City"].ToString();
                    i.State             = row["State"].ToString();
                    i.Pin               = row["Pin"].ToString();
                    i.Fax               = row["Fax"].ToString();
                    i.Inst_phone        = row["Inst_phone"].ToString();
                    i.Inst_email        = row["Inst_email"].ToString();
                    i.no_of_likes       = row["No_of_likes"].ToString();
                    i.isVerified        = int.Parse(row["isVerified"].ToString());
                    i.Inst_logo         = row["Inst_logo"].ToString();
                    i.Inst_photo        = row["Inst_photo"].ToString();
                    i.Head_of_institute = row["HOI"].ToString();
                    i.Title_HOI         = row["Title_HOI"].ToString();
                    i.Admin_name        = row["Admin_name"].ToString();
                    i.Description       = row["Description"].ToString();
                    list.Add(i);
                    con.Close();
                }
            }

            return(list);
        }