Beispiel #1
0
        public citydetails bindcity()
        {
            List <bindcity> citylist = new List <bindcity>();
            citydetails     details  = new citydetails();

            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand("usp_api_bindcity", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    SqlDataAdapter sda = new SqlDataAdapter(cmd);
                    DataTable      dt  = new DataTable();
                    sda.Fill(dt);
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dtrow in dt.Rows)
                        {
                            var slist = new bindcity();
                            slist.citycode = Convert.ToInt32(dtrow["code"]);
                            slist.cityname = Convert.ToString(dtrow["name"]);
                            citylist.Add(slist);
                        }
                        details.citydetail = citylist;
                    }
                }
            }
            return(details);
        }
Beispiel #2
0
        public citydetails bindworkshopcity()
        {
            List <bindcity> citylist = new List <bindcity>();
            citydetails     details  = new citydetails();

            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand("select Code,DESCN  from codemaster where TYPE='loc'", con))
                {
                    cmd.CommandType = CommandType.Text;
                    SqlDataAdapter sda = new SqlDataAdapter(cmd);
                    DataTable      dt  = new DataTable();
                    sda.Fill(dt);
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dtrow in dt.Rows)
                        {
                            var slist = new bindcity();
                            slist.citycode = Convert.ToInt32(dtrow["code"]);
                            slist.cityname = Convert.ToString(dtrow["DESCN"]);
                            citylist.Add(slist);
                        }
                        details.citydetail = citylist;
                    }
                }
            }
            return(details);
        }