public static List <countrydetails> GetChartData() { DataTable dt = new DataTable(); using (SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=ShoppingDB;User ID=sa;Password=pass123!@#")) { con.Open(); SqlCommand cmd = new SqlCommand("select Name,count,rates,total=value from CountryDetails order by total desc", con); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); con.Close(); } List <countrydetails> dataList = new List <countrydetails>(); foreach (DataRow dtrow in dt.Rows) { countrydetails details = new countrydetails(); details.Countryname = dtrow[0].ToString(); details.Total = Convert.ToInt32(dtrow[1]); details.count = Convert.ToInt32(dtrow[2]); details.rates = Convert.ToInt32(dtrow[3]); dataList.Add(details); } return(dataList); }
public static List<countrydetails> GetChartData() { DataTable dt = new DataTable(); using (SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=ShoppingDB;User ID=sa;Password=pass123!@#")) { con.Open(); SqlCommand cmd = new SqlCommand("select count,rates,total=value from CountryDetails order by total desc", con); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); con.Close(); } List<countrydetails> dataList = new List<countrydetails>(); foreach (DataRow dtrow in dt.Rows) { countrydetails details = new countrydetails(); // details.Countryname = dtrow[0].ToString(); details.Total = Convert.ToInt32(dtrow[0]); details.count = Convert.ToInt32(dtrow[1]); details.rates = Convert.ToInt32(dtrow[2]); dataList.Add(details); } return dataList; }
public countrydetails bindcountry() { List <bindcountry> countrylist = new List <bindcountry>(); countrydetails details = new countrydetails(); using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand("usp_api_bindcountry", 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 bindcountry(); slist.countrycode = Convert.ToInt32(dtrow["code"]); slist.countryname = Convert.ToString(dtrow["name"]); countrylist.Add(slist); } details.countrydetail = countrylist; } } } return(details); }
public static List <countrydetails> dienthoai() { DataTable dt = XLDL.LayDuLieu("SELECT tensp,soluongban from dienthoai left join kho on dienthoai.masp=kho.masp"); List <countrydetails> dataList = new List <countrydetails>(); foreach (DataRow dtrow in dt.Rows) { countrydetails details = new countrydetails(); details.Countryname = dtrow[0].ToString(); details.Total = Convert.ToInt32(dtrow[1]); dataList.Add(details); } return(dataList); }
public static List <countrydetails> congty() { DataTable dt = XLDL.LayDuLieu("select tencty,count(masp) from congty,dienthoai where congty.macty=dienthoai.macty group by tencty"); List <countrydetails> dataList = new List <countrydetails>(); foreach (DataRow dtrow in dt.Rows) { countrydetails details = new countrydetails(); details.Countryname = dtrow[0].ToString(); details.Total = Convert.ToInt32(dtrow[1]); dataList.Add(details); } return(dataList); }
public static List <countrydetails> thanhtoan() { DataTable dt = XLDL.LayDuLieu("select thanhtoan,count(sodh) from donhang group by thanhtoan"); List <countrydetails> dataList = new List <countrydetails>(); string str = ""; foreach (DataRow dtrow in dt.Rows) { if (dtrow[0].ToString() == "True") { str = "Chuyển Khoản"; } else { str = "Tiền Mặt"; } countrydetails details = new countrydetails(); details.Countryname = str; details.Total = Convert.ToInt32(dtrow[1]); dataList.Add(details); } return(dataList); }