protected void sign_up_Click(object sender, EventArgs e) { cls_con.Open(); string query = "insert into Infoxx(TenNguoiDung,TenDangNhap,ThuDienTu,MatKhau,DiaChi,SoDienThoai) VALUES('" + txtname.Text + "','" + txtuser.Text + "','" + txtemail.Text + "','" + txtpassword.Text + "','" + txtadress.Text + "','" + txtnumber.Text + "');"; SqlCommand sqlcm = new SqlCommand(query, cls_con.sql_con); int result = sqlcm.ExecuteNonQuery(); cls_con.Closed(); }
protected void Page_Load(object sender, EventArgs e) { string st = Request.QueryString.Get("id"); Connect_DB cls_con = new Connect_DB(); cls_con.Open(); string query = "Select ID,Name,Price from KhuyenMaiHapDan where ID='" + st + "';"; sqlcm = new SqlCommand(query, cls_con.sql_con); SqlDataReader result = sqlcm.ExecuteReader(); while (result.Read()) { Name_Pro.Text = result.GetValue(1).ToString(); Price_Pro.Text = result.GetValue(2).ToString() + " đ"; } cls_con.Closed(); }
protected void Page_Load(object sender, EventArgs e) { Connect_DB cls_con = new Connect_DB(); cls_con.Open(); string query = "select Name,Price,status from ThoiTrang;"; SqlCommand sqlFashion = new SqlCommand(query, cls_con.sql_con); SqlDataReader result = sqlFashion.ExecuteReader(); string st = ""; int i = 0; string status = ""; while (result.Read()) { if (result.GetValue(2).ToString() == "true") { status = "Còn Hàng"; } else if (result.GetValue(2).ToString() == "false") { status = " Đã Hết Hàng"; } i++; st = st + "<div class=\"col-md-3 col-sm-4 col-xs-6\">" + "<div class=\"product\">" + "<div class=\"img\">" + "<img src=\"../Images/Fashion/fashion" + i + ".jpg\"/>" + "<button Class=\"btn btn-success\"/>Mua Ngay</button>" + "<span class=\"status\">" + status + "</span>" + "</div>" + "<span class=\"product__name\">" + result.GetValue(0).ToString() + "</span>" + "<hr />" + "<span class=\"product__price\">" + result.GetValue(1).ToString() + "</span><sup style=\"color: red\">đ</sup>" + "</div/>" + "</div/>"; } result.Close(); View.Text = st; }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserAdmin"] == null) { Response.Redirect("login.aspx"); } cls_con.Open(); // đếm tổng số sản phẩm string query = "select sum(count) from CountProduct;"; SqlCommand sqlcm = new SqlCommand(query, cls_con.sql_con); int tong = (int)sqlcm.ExecuteScalar(); lblProduct.Text = tong.ToString(); // Tính doanh thu string query2 = "select countProduct.count,AmThuc.Price from CountProduct, AmThuc where CountProduct.id_Product = AmThuc.Id_Product;"; SqlCommand sqlcm2 = new SqlCommand(query2, cls_con.sql_con); SqlDataReader result = sqlcm2.ExecuteReader(); double sum = 0; while (result.Read()) { int price = Convert.ToInt32(result.GetValue(0).ToString()); int count = Convert.ToInt32(result.GetValue(1).ToString()); sum = sum + (price * count); } lblMoney.Text = sum.ToString(); // Tính số Lương user //string query3 = "select Count(TenDangNhap) from Infoxx;"; //SqlCommand sqlcm3 = new SqlCommand(query3,cls_con.sql_con); //int tonguer = (int) sqlcm3.ExecuteScalar(); //lblUser.Text = tonguer.ToString(); cls_con.Closed(); }
protected void Page_Load(object sender, EventArgs e) { Connect_DB cls_con = new Connect_DB(); cls_con.Open(); String query_khuyenmaihapdan = "select Sale,name,status,price,ID from KhuyenMaiHapDan;"; sqlcm = new SqlCommand(query_khuyenmaihapdan, cls_con.sql_con); SqlDataReader Result = sqlcm.ExecuteReader(); string[] sale = new string[30]; string[] name = new string[30]; string[] price = new string[30]; string[] Status = new string[30]; string[] Id = new string[30]; int i = 0; while (Result.Read()) { sale[i] = Result.GetValue(0).ToString(); name[i] = Result.GetValue(1).ToString(); Status[i] = Result.GetValue(2).ToString(); price[i] = Result.GetValue(3).ToString(); Id[i] = Result.GetValue(4).ToString(); i++; } sale_1.Text = "-" + sale[0] + "%"; sale_2.Text = "-" + sale[1] + "%"; sale_3.Text = "-" + sale[2] + "%"; sale_4.Text = "-" + sale[3] + "%"; sale_5.Text = "-" + sale[4] + "%"; sale_6.Text = "-" + sale[5] + "%"; sale_7.Text = "-" + sale[6] + "%"; name_1.Text = name[0]; name_2.Text = name[1]; name_3.Text = name[2]; name_4.Text = name[3]; name_5.Text = name[4]; name_6.Text = name[5]; name_7.Text = name[6]; if (Status[0] == "True") { status_1.Text = "Còn Hàng"; } else { status_1.Text = "Hết Hàng"; } if (Status[1] == "True") { status_2.Text = "Còn Hàng"; } else { status_2.Text = "Hết Hàng"; } if (Status[2] == "True") { status_3.Text = "Còn Hàng"; } else { status_3.Text = "Hết Hàng"; } if (Status[3] == "True") { status_4.Text = "Còn Hàng"; } else { status_4.Text = "Hết Hàng"; } if (Status[4] == "True") { status_5.Text = "Còn Hàng"; } else { status_5.Text = "Hết Hàng"; } if (Status[5] == "True") { status_6.Text = "Còn Hàng"; } else { status_6.Text = "Hết Hàng"; } if (Status[6] == "True") { status_7.Text = "Còn Hàng"; } else { status_7.Text = "Hết Hàng"; } //cls_con.Closed(); String query_HangMoiVe = "select Name,status,price,ID from HangMoive;"; sqlcm = new SqlCommand(query_HangMoiVe, cls_con.sql_con); SqlDataReader Result1 = sqlcm.ExecuteReader(); string[] sale1 = new string[30]; string[] name1 = new string[30]; string[] Status1 = new string[30]; int i1 = 0; while (Result1.Read()) { name1[i] = Result.GetValue(1).ToString(); Status1[i] = Result.GetValue(2).ToString(); i1++; } name_8.Text = name1[0]; name_9.Text = name1[1]; name_10.Text = name1[2]; name_11.Text = name1[3]; if (Status[0] == "True") { status_8.Text = "Còn Hàng"; } else { status_9.Text = "Hết Hàng"; } if (Status[1] == "True") { status_10.Text = "Còn Hàng"; } else { status_11.Text = "Hết Hàng"; } }