protected void Button1_Click(object sender, EventArgs e) { string loi = "Lỗi không xác định"; try { int id_sp = lay_id(); loi = "Giá không chứa dấu thập phân"; int.Parse(TextBox3.Text); int.Parse(TextBox4.Text); int.Parse(TextBox5.Text); loi = "Khối lượng không chứa dấu thập phân"; int.Parse(TextBox8.Text); connect = new connect(); SqlConnection connDB = new SqlConnection(connect.getconnect()); SqlCommand cmd = new SqlCommand("san_pham_them", connDB); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@id_san_pham", SqlDbType.NVarChar).Value = id_sp;//id_san_pham cmd.Parameters.Add("@id_thuong_hieu", SqlDbType.NVarChar).Value = DropDownList0.SelectedValue; cmd.Parameters.Add("@ten_san_pham", SqlDbType.NVarChar).Value = mH.Base64Encode(TextBox1.Text); cmd.Parameters.Add("@anh_san_pham", SqlDbType.NVarChar).Value = mH.Base64Encode(TextBox2.Text); cmd.Parameters.Add("@gia_cao", SqlDbType.NVarChar).Value = TextBox3.Text; cmd.Parameters.Add("@gia_ban_ra", SqlDbType.NVarChar).Value = TextBox4.Text; cmd.Parameters.Add("@gia_nhap_san_pham", SqlDbType.NVarChar).Value = TextBox5.Text; cmd.Parameters.Add("@mo_ta_san_pham_html", SqlDbType.NVarChar).Value = mH.Base64Encode(TextBox6.Text); cmd.Parameters.Add("@dac_tinh_san_pham", SqlDbType.NVarChar).Value = mH.Base64Encode(TextBox7.Text); cmd.Parameters.Add("@khoi_luong_san_pham_gram", SqlDbType.NVarChar).Value = TextBox8.Text;; cmd.Parameters.Add("@da_co_vat", SqlDbType.NVarChar).Value = 1; cmd.Parameters.Add("@ngay_cap_nhat", SqlDbType.NVarChar).Value = DateTime.Now.ToString(); connDB.Open(); cmd.ExecuteNonQuery(); connDB.Close(); Response.Write("<script language='javascript'> alert('Thêm thành công, tiến hành thêm ảnh cho sản phẩm này'); window.open('danhSachAnh.aspx?id_san_pham=" + id_sp + "','_self', 1);</script>"); } catch (Exception qr) { Response.Write("<script language='javascript'> alert('" + loi + "'); history.go(-1)</script>"); } }
void Start() { spawnedRooms.Add(GameObject.Find("StartRoom")); DontDestroyOnLoad(this); player = GameObject.FindWithTag("Player"); playerBehavouir = GetComponent <PlayerBehavouir> (); finalRoom = false; desireCanvas = GameObject.FindWithTag("desire"); slytterSheets = GetComponent <connect> (); try { print("using id from last scene"); uniqueId = GameObject.FindWithTag("id").GetComponent <idGen> ().uniqueId; } catch { Debug.LogError("couldd not find id, generating new."); uniqueId = Random.Range(0, 1000000); } bakeQueue = new Queue <IEnumerator> (); StartCoroutine(serveBakeQueue()); storyController = GameObject.FindWithTag("storyController").GetComponent <StoryController> (); }
protected void Button1_Click(object sender, EventArgs e) { try { c = new connect(); c.cmd.CommandText = "select * from category where category_id='" + TextBox1.Text + "' and category_name='" + TextBox2.Text + "' and subcategory='" + TextBox3.Text + "'"; ds = new DataSet(); adp1.SelectCommand = c.cmd; adp1.Fill(ds, "category"); adp1.Fill(dt); if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "") { // MessageBox.Show("Please enter all fields"); Page.ClientScript.RegisterStartupScript(this.GetType(), "msgbox", "<script>alert('Please enter all fields')</script>"); } else if (dt.Rows.Count > 0) { if ((ds.Tables["category"].Rows[0].ItemArray[0].ToString() == TextBox1.Text) && (ds.Tables["category"].Rows[0].ItemArray[1].ToString() == TextBox2.Text) && (ds.Tables["category"].Rows[0].ItemArray[2].ToString() == TextBox3.Text)) { // MessageBox.Show("Already exists"); Page.ClientScript.RegisterStartupScript(this.GetType(), "msgbox", "<script>alert('Already exists')</script>"); } } else { c = new connect(); c.cmd.CommandText = "insert into category values(@category_id,@category_name,@subcategory)"; c.cmd.Parameters.Add("@category_id", SqlDbType.Int).Value = Convert.ToInt16(TextBox1.Text); c.cmd.Parameters.Add("@category_name", SqlDbType.NVarChar).Value = TextBox2.Text; c.cmd.Parameters.Add("@subcategory", SqlDbType.NVarChar).Value = TextBox3.Text; c.cmd.ExecuteNonQuery(); Page.ClientScript.RegisterStartupScript(this.GetType(), "msgbox", "<script>alert('Category added')</script>"); } } catch (Exception) { throw; } }
public string doi_mat_khau(string email, string key, string mat_khau_moi) { if (Application[email] != null) { if (Application[email].ToString() == key) { connect connect = new connect(); SqlConnection connDB = new SqlConnection(connect.getconnect()); SqlCommand cmd = new SqlCommand("doi_mat_khau", connDB); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@email_nguoi", SqlDbType.NVarChar).Value = email; cmd.Parameters.Add("@mat_khau_nguoi", SqlDbType.NVarChar).Value = mat_khau_moi; connDB.Open(); cmd.ExecuteNonQuery(); connDB.Close(); Application[email] = null; return(new thong_bao(true, "Đổi mật khẩu thành công!", new System.Dynamic.ExpandoObject()).ParserJSon()); } } return(new thong_bao(false, "Code khôi phục mật khẩu đã hết hạn hoặc không tồn tại!", new System.Dynamic.ExpandoObject()).ParserJSon()); }
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "sendtologistic") { string n = ((System.Web.UI.WebControls.Label)e.Item.FindControl("Label4")).Text; string a = ((System.Web.UI.WebControls.Label)e.Item.FindControl("Label5")).Text; string cnt = ((System.Web.UI.WebControls.Label)e.Item.FindControl("Label6")).Text; string i = ((System.Web.UI.WebControls.Label)e.Item.FindControl("Label7")).Text; string d = ((System.Web.UI.WebControls.Label)e.Item.FindControl("Label8")).Text; string q = ((System.Web.UI.WebControls.Label)e.Item.FindControl("Label9")).Text; // string img = ((System.Web.UI.WebControls.Image)e.Item.FindControl("Image1")).ImageUrl; string p = ((System.Web.UI.WebControls.Label)e.Item.FindControl("Label10")).Text; string img = ((System.Web.UI.WebControls.Image)e.Item.FindControl("Image1")).ImageUrl; string t = ((System.Web.UI.WebControls.Label)e.Item.FindControl("Label11")).Text; c = new connect(); c.cmd.CommandText = "insert into logisticdetail values(@name,@address,@contact,@item_id,@date,@qty,@price,@image,@total)"; c.cmd.Parameters.Clear(); // c.cmd.Parameters.Add("@cart_id", SqlDbType.Int).Value = count; c.cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value = n; c.cmd.Parameters.Add("@address", SqlDbType.NVarChar).Value = a; c.cmd.Parameters.Add("@contact", SqlDbType.BigInt).Value = cnt; c.cmd.Parameters.Add("@item_id", SqlDbType.NVarChar).Value = i; c.cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = DateTime.Now; c.cmd.Parameters.Add("@qty", SqlDbType.Int).Value = q; // c.cmd.Parameters.Add("@totalprice", SqlDbType.BigInt).Value = Convert.ToInt16((Convert.ToInt16(p)) *(Convert.ToInt16(q))); c.cmd.Parameters.Add("@price", SqlDbType.BigInt).Value = p; c.cmd.Parameters.Add("@image", SqlDbType.NVarChar).Value = img; c.cmd.Parameters.Add("@total", SqlDbType.BigInt).Value = t; c.cmd.ExecuteNonQuery(); MessageBox.Show("Inserted"); Response.Redirect("~/logisticpage.aspx"); } }
protected void DropDownList2_SelectedIndexChanged1(object sender, EventArgs e) { try { c = new connect(); ds = new DataSet(); c.cmd.CommandText = "select * from category where subcategory='" + DropDownList2.SelectedItem.Text + "'"; adp.SelectCommand = c.cmd; adp.Fill(ds, "category"); //DropDownList3 .SelectedItem .Text = Convert.ToString(ds.Tables["item"].Rows[0].ItemArray[0]); TextBox1.Text = Convert.ToString(ds.Tables["category"].Rows[0].ItemArray[0]); TextBox2.Text = Convert.ToString(ds.Tables["category"].Rows[0].ItemArray[1]); TextBox3.Text = Convert.ToString(ds.Tables["category"].Rows[0].ItemArray[2]); c.cmd.ExecuteNonQuery(); } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { c = new connect(); int count, count1, count2; if (DropDownList1.Text == "UDUPI") { c.cmd.CommandText = "select count(*) from logistic"; count = Convert.ToInt16(c.cmd.ExecuteScalar()) + 1; TextBox1.Text = 'U' + count.ToString(); } else if (DropDownList1.Text == "MANGALORE") { c.cmd.CommandText = "select count(*) from logistic"; count1 = Convert.ToInt16(c.cmd.ExecuteScalar()) + 1; TextBox1.Text = 'M' + count1.ToString(); } else { c.cmd.CommandText = "select count(*) from logistic"; count2 = Convert.ToInt16(c.cmd.ExecuteScalar()) + 1; TextBox1.Text = 'K' + count2.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { mH = new maHoa(); connect = new connect(); System.Data.SqlClient.SqlConnection ketnoi = new System.Data.SqlClient.SqlConnection(connect.getconnect()); //1. danh sách TH string sql = "select id_thuong_hieu, ten_thuong_hieu from thuong_hieu"; connect = new connect(); DataTable tmp = new DataTable(); new System.Data.SqlClient.SqlDataAdapter(new System.Data.SqlClient.SqlCommand(sql, ketnoi)).Fill(tmp); for (int i = 0; i < tmp.Rows.Count; i++) { tmp.Rows[i][1] = mH.Base64Decode(tmp.Rows[i][1].ToString()); } if (!IsPostBack) { DropDownList0.DataSource = tmp; DropDownList0.DataTextField = "ten_thuong_hieu"; DropDownList0.DataValueField = "id_thuong_hieu"; DropDownList0.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e) { try { connect = new connect(); SqlConnection connDB = new SqlConnection(connect.getconnect()); SqlCommand cmd = new SqlCommand("proc_kho_hang_them", connDB); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@id_khu_vuc", SqlDbType.NVarChar).Value = DropDownList1.SelectedValue; cmd.Parameters.Add("@ten_kho_hang", SqlDbType.NVarChar).Value = TextBox7.Text; cmd.Parameters.Add("@dia_chi_kho_hang", SqlDbType.NVarChar).Value = TextBox3.Text; cmd.Parameters.Add("@dien_tich_kho", SqlDbType.NVarChar).Value = TextBox8.Text; cmd.Parameters.Add("@ngay_tao_kho", SqlDbType.NVarChar).Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");; cmd.Parameters.Add("@ghi_chu_kho", SqlDbType.NVarChar).Value = TextBox10.Text; connDB.Open(); cmd.ExecuteNonQuery(); connDB.Close(); Response.Write("<script language='javascript'> alert('Thêm thành công'); window.open('danhSach.aspx','_self', 1);</script>"); } catch (Exception qr) { Response.Write("<script language='javascript'> alert('Lỗi không xác định'); history.go(-1)</script>"); } }
private void ImprimirFactura_Load(object sender, EventArgs e) { //this.Fecha.Enabled = false; connect cli = new connect(); Conexion conec = new Conexion(); //textBox1.Text = Mantenimiento.codigoFactura().ToString(); Mantenimiento llenar = new Mantenimiento(); //llenar.llenarUsuario(comboBox1); //llenar.llenarEstado(comboBox2); double tot = 0; double imp = 0; double subt = 0; imp = double.Parse(isv.Text); subt = double.Parse(monto.Text); tot = subt + ((imp / 100) * subt); total.Text = tot.ToString(); }
public frm_thuephongtrong(frm_danhsachphong danhsachphong, connect _conn) { InitializeComponent(); _frm_danhsachphong = danhsachphong; conn = _conn; }
public frm_phieuchuyen(connect _conn) { InitializeComponent(); conn = _conn; }
public frm_danhsachphong(connect _conn) { InitializeComponent(); conn = _conn; }
public frm_phongdattruoc(frm_danhsachphong danhsachphong, connect _conn) { InitializeComponent(); _frm_danhsachphong = danhsachphong; conn = _conn; }
void Awake() { _instance = this; }
public DM_phong(connect _conn) { InitializeComponent(); conn = _conn; }
private void testConn_Click(object sender, EventArgs e) { connect conn = new connect(); conn.getConnection(); }
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "viewdetail") { Response.Redirect("~/viewdetail.aspx?id=" + e.CommandArgument.ToString()); } else if (e.CommandName == "addtocart") { string i = ((System.Web.UI.WebControls.Label)e.Item.FindControl("Label3")).Text; string p = ((System.Web.UI.WebControls.Label)e.Item.FindControl("Label1")).Text; string n = ((System.Web.UI.WebControls.Label)e.Item.FindControl("Label4")).Text; string img = ((System.Web.UI.WebControls.Image)e.Item.FindControl("Image1")).ImageUrl; string q = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("TextBox1")).Text; c = new connect(); int ddl = ((System.Web.UI.WebControls.DropDownList)e.Item.FindControl("DropDownList1")).SelectedIndex; if (ddl < 1) { MessageBox.Show("select quantity first"); } else { c = new connect(); int qty1; c.cmd.CommandText = "select qty from item where item_id='" + i + "'"; //object obj1 = c.cmd.ExecuteScalar(); //if (obj1 != null) // qty = Convert .ToInt16 (obj1.ToString()); qty1 = Convert.ToInt16(c.cmd.ExecuteScalar()); if (qty1 < Convert.ToInt16(q)) { MessageBox.Show("Quantity is less in stock"); } else { // int count; // c.cmd.CommandText = "select count(*) from cart"; // count = Convert.ToInt16(c.cmd.ExecuteScalar()) + 1; c.cmd.CommandText = "select * from cart where cust_id='" + Session["cust_id"] + "' and item_id='" + i + "'"; ds = new DataSet(); adp1.SelectCommand = c.cmd; adp1.Fill(ds, "cart"); adp1.SelectCommand = c.cmd; adp1.Fill(dt); if (dt.Rows.Count > 0) { // Session["cust_id"] = Convert.ToString(dt.Rows[0].ItemArray[0]); if ((ds.Tables["cart"].Rows[0].ItemArray[0].ToString() == i)) { MessageBox.Show("item already exist in cart"); } } else { int pr, qty, amt; pr = Convert.ToInt16(p); qty = Convert.ToInt16(q); amt = pr * qty; c.cmd.CommandText = "insert into cart values(@item_id,@cust_id,@item_name,@price,@image,@qty,@totalprice)"; c.cmd.Parameters.Clear(); // c.cmd.Parameters.Add("@cart_id", SqlDbType.Int).Value = count; c.cmd.Parameters.Add("@item_id", SqlDbType.NVarChar).Value = i; c.cmd.Parameters.Add("@cust_id", SqlDbType.NVarChar).Value = Session["cust_id"]; c.cmd.Parameters.Add("@item_name", SqlDbType.NVarChar).Value = n; c.cmd.Parameters.Add("@price", SqlDbType.BigInt).Value = p; c.cmd.Parameters.Add("@image", SqlDbType.NVarChar).Value = img; c.cmd.Parameters.Add("@qty", SqlDbType.Int).Value = q; c.cmd.Parameters.Add("@totalprice", SqlDbType.BigInt).Value = amt; c.cmd.ExecuteNonQuery(); MessageBox.Show("Inserted"); Response.Redirect("cart.aspx?id=" + e.CommandArgument.ToString()); //Class1.update_reg("add_reg", i, p, nm); //DataList1.EditItemIndex = -1; //Binddata(); } } } } }
public frm_Nhaphang(connect _conn) { InitializeComponent(); conn = _conn; }
public qlthietbi(connect _conn) { InitializeComponent(); conn = _conn; }
public them_khachhang(DM_khachhang khachhang, connect _conn) { InitializeComponent(); _dm_khachhang = khachhang; conn = _conn; }
protected void Button1_Click(object sender, EventArgs e) { //if (CheckBox1.Checked == true) //{ // Session["payment"] = "Debit card"; //} //else if (RadioButton1.Checked == true) //{ // Session["payment"] = "COD"; //} //else if (RadioButton2.Checked == true) //{ // Session["payment"] = "POD"; //} //else //{ // MessageBox.Show("Please select the payment mode"); //} if (CheckBox1.Checked == true) { Session["payment"] = "Debit card"; c = new connect(); DataTable dt = new DataTable(); SqlDataReader myreader2 = null; c.cmd.CommandText = "select * from card where name='" + Label4.Text + "'"; adp.SelectCommand = c.cmd; //adp.Fill(ds, "customer"); adp.SelectCommand = c.cmd; adp.Fill(dt); myreader2 = c.cmd.ExecuteReader(); while (myreader2.Read()) { Label29.Text = (myreader2["email"].ToString()); Label30.Text = (myreader2["cardno"].ToString()); Label31.Text = (myreader2["cvv"].ToString()); Label32.Text = (myreader2["month"].ToString()); Label33.Text = (myreader2["year"].ToString()); Label34.Text = (myreader2["balance"].ToString()); } myreader2.Close(); c.cmd.CommandText = "select * from card where email='" + TextBox11.Text + "'"; ds = new DataSet(); adp1.SelectCommand = c.cmd; adp1.Fill(ds, "card"); adp1.SelectCommand = c.cmd; adp1.Fill(dt); if (TextBox11.Text == "" || TextBox12.Text == "" || TextBox13.Text == "") { MessageBox.Show("Enter the fields"); } else if (ds.Tables["card"].Rows.Count > 0) { if (TextBox11.Text == Label29.Text && TextBox12.Text == Label30.Text && TextBox13.Text == Label31.Text) { if (Convert.ToInt16(DropDownList1.SelectedValue) <= DateTime.Today.Year) { if (Convert.ToInt16(DropDownList2.SelectedValue) <= DateTime.Today.Month) { MessageBox.Show(" Card has been expired"); } else { //if (TextBox11.Text == Label29.Text && TextBox12.Text == Label30.Text && TextBox13.Text == Label31.Text) //{ int t, b; t = Convert.ToInt16(Label17.Text); b = Convert.ToInt32(Label34.Text); if (t > b) { MessageBox.Show("Insufficient money!!"); } else { c.cmd.CommandText = "update card set balance=balance-@bal where cardno='" + TextBox12.Text + "'"; c.cmd.Parameters.Add("@bal", SqlDbType.Int).Value = Convert.ToInt16(Label17.Text); c.cmd.ExecuteNonQuery(); } } } } else if (TextBox11.Text != Label29.Text && Convert.ToInt64(TextBox12.Text) == Convert.ToInt64(Label30.Text) && Convert.ToInt16(TextBox13.Text) == Convert.ToInt16(Label31.Text)) { MessageBox.Show("Email id is incorrect"); } else if (TextBox11.Text == Label29.Text && Convert.ToInt64(TextBox12.Text) != Convert.ToInt64(Label30.Text) && Convert.ToInt16(TextBox13.Text) == Convert.ToInt16(Label31.Text)) { MessageBox.Show("card number is incorrect"); } else if (TextBox11.Text == Label29.Text && Convert.ToInt64(TextBox12.Text) == Convert.ToInt64(Label30.Text) && Convert.ToInt16(TextBox13.Text) != Convert.ToInt16(Label31.Text)) { MessageBox.Show("CVV in incorrect"); } } //else if (Convert.ToInt16(TextBox11.Text) != Convert.ToInt16(Label29.Text) && Convert.ToInt16(TextBox12.Text) == Convert.ToInt16(Label30.Text) && Convert.ToInt16(TextBox13.Text) == Convert.ToInt16(Label31.Text)) //{ MessageBox.Show("No card available in this name!!"); } //else if (Convert.ToInt16(TextBox11.Text) == Convert.ToInt16(Label29.Text) && Convert.ToInt16(TextBox12.Text) != Convert.ToInt16(Label30.Text) && Convert.ToInt16(TextBox13.Text) == Convert.ToInt16(Label31.Text)) //{ MessageBox.Show("Check card no!!"); } //else if (Convert.ToInt16(TextBox11.Text) == Convert.ToInt16(Label29.Text) && Convert.ToInt16(TextBox12.Text) == Convert.ToInt16(Label30.Text) && Convert.ToInt16(TextBox13.Text) != Convert.ToInt16(Label31.Text)) //{ MessageBox.Show("Invalid cvv!!"); } } else if (RadioButton1.Checked == true) { Session["payment"] = "COD"; } else { MessageBox.Show("Please select the payment mode"); } }
protected void Page_Load(object sender, EventArgs e) { connect connect = new connect(); System.Data.SqlClient.SqlConnection ketnoi = new System.Data.SqlClient.SqlConnection(connect.getconnect()); string loi = "Dữ liệu đầu vào lỗi"; string ngaybaydau = ""; string ngayketthuc = ""; try { try { if (Request.QueryString["ngaybaydau"] != null && Request.QueryString["ngaybaydau"].Length != 0) { ngaybaydau = Request.QueryString["ngaybaydau"]; } if (Request.QueryString["ngayketthuc"] != null && Request.QueryString["ngayketthuc"].Length != 0) { ngayketthuc = Request.QueryString["ngayketthuc"]; } } catch (Exception a) { } if (ngaybaydau.Length == 0 || ngayketthuc.Length == 0) { int.Parse("a"); } loi = "Lỗi không xác định!"; maHoa m = new maHoa(); ngaybaydau = m.Base64Decode(ngaybaydau); ngayketthuc = m.Base64Decode(ngayketthuc); if (!IsPostBack) { WebApplication2.QuanTri.maHoa mH = new WebApplication2.QuanTri.maHoa(); string sql = "select dh.id_don_hang, cast(FORMAT(dh.ngay_tao_don_hang, 'dd-MM-yyyy') as varchar) as ngay_tao_don_hang, " + " sp.ten_san_pham, ctdh.so_luong, " + " cast (sp.gia_nhap_san_pham as int) donGiaNhap, " + " cast(ctdh.so_luong * sp.gia_nhap_san_pham as int)thanhTienNhap, " + " cast(ctdh.gia_da_giam as int)donGiaBan, " + " cast(ctdh.so_luong * ctdh.gia_da_giam as int)thanhTienBan, " + " cast((ctdh.so_luong * ctdh.gia_da_giam - ctdh.so_luong * sp.gia_nhap_san_pham) as int) tienLoi " + " from don_hang dh join chi_tiet_don_hang ctdh on dh.id_don_hang = ctdh.id_don_hang " + " join san_pham sp on sp.id_san_pham=ctdh.id_san_pham " + " where " + " DATEDIFF(DAY,'" + ngaybaydau + "', dh.ngay_tao_don_hang) >= 0 " + " and DATEDIFF(DAY,dh.ngay_tao_don_hang, '" + ngayketthuc + "') >= 0 " + " and dh.id_ttdh=3 " + " order by dh.id_don_hang asc"; DataTable tmp = new DataTable(); new System.Data.SqlClient.SqlDataAdapter(new System.Data.SqlClient.SqlCommand(sql, ketnoi)).Fill(tmp); //khungHoaDon KHD = new khungHoaDon(); //DataTable BangChiTietDoanhThu = KHD.Tables["ChiTietSanPhamDonHang"]; DataTable BangChiTietDoanhThu = new DataTable(); BangChiTietDoanhThu.Columns.Add("id_don_hang"); BangChiTietDoanhThu.Columns.Add("ngay_tao_don_hang"); BangChiTietDoanhThu.Columns.Add("ten_san_pham"); BangChiTietDoanhThu.Columns.Add("so_luong"); BangChiTietDoanhThu.Columns.Add("donGiaNhap"); BangChiTietDoanhThu.Columns.Add("thanhTienNhap"); BangChiTietDoanhThu.Columns.Add("donGiaBan"); BangChiTietDoanhThu.Columns.Add("thanhTienBan"); BangChiTietDoanhThu.Columns.Add("tienLoi"); long tongdoanhthu = 0, tongtienloi = 0; for (int i = 0; i < tmp.Rows.Count; i++) { tongdoanhthu += int.Parse(tmp.Rows[i][7].ToString()); tongtienloi += int.Parse(tmp.Rows[i][8].ToString()); DataRow x = BangChiTietDoanhThu.NewRow(); x[0] = tmp.Rows[i][0].ToString(); x[1] = tmp.Rows[i][1].ToString(); x[2] = mH.Base64Decode(tmp.Rows[i][2].ToString()); x[3] = tmp.Rows[i][3].ToString(); x[4] = String.Format("{0:n0}", int.Parse(tmp.Rows[i][4].ToString())).Replace(",", ".") + " vnđ"; x[5] = String.Format("{0:n0}", int.Parse(tmp.Rows[i][5].ToString())).Replace(",", ".") + " vnđ"; x[6] = String.Format("{0:n0}", int.Parse(tmp.Rows[i][6].ToString())).Replace(",", ".") + " vnđ"; x[7] = String.Format("{0:n0}", int.Parse(tmp.Rows[i][7].ToString())).Replace(",", ".") + " vnđ"; x[8] = String.Format("{0:n0}", int.Parse(tmp.Rows[i][8].ToString())).Replace(",", ".") + " vnđ"; BangChiTietDoanhThu.Rows.Add(x); } ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("Report1.rdlc"); // ReportParameter[] param = new ReportParameter[4]; param[0] = new ReportParameter("thoiGianDauCuoi", "TỪ NGÀY " + ngaybaydau + " ĐẾN NGÀY " + ngayketthuc); param[1] = new ReportParameter("ngaytaobaocao", DateTime.Now.ToString("dd/MM/yyyy")); param[2] = new ReportParameter("tongdoanhthu", String.Format("{0:n0}", tongdoanhthu).Replace(",", ".") + " vnđ"); param[3] = new ReportParameter("tongtienloi", String.Format("{0:n0}", tongtienloi).Replace(",", ".") + " vnđ"); ReportViewer1.LocalReport.SetParameters(param); // ReportDataSource datasource = new ReportDataSource("PhaiChinhXac", BangChiTietDoanhThu); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource); } } catch (Exception a) { Response.Write("<script language='javascript'> alert('" + loi + "'); history.go(-1); </script>"); } // }
protected void Page_Load(object sender, EventArgs e) { mH = new WebApplication2.QuanTri.maHoa(); connect = new connect(); }
protected void Button1_Click(object sender, EventArgs e) { try { if (Session["cust_id"] == null) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msgbox", "<script> message('Please login first')</script>"); Response.Redirect("~/clogin.aspx"); } else { try { if (Session["cust_id"] != null) { if (!Page.IsPostBack) { connect c = new connect(); c.cmd.CommandText = "select item_id from item"; adp1.SelectCommand = c.cmd; dt.Clear(); adp1.Fill(dt); //int count; //c.cmd.CommandText = "select count(*) from cart"; //count = Convert.ToInt16(c.cmd.ExecuteScalar()) + 1; //Label lbl = DataList1.Items[i].FindControl("label3") as Label; // string labeltext = lbl.Text; // Label lbl1 = DataList1.Items[i].FindControl("label1") as Label; //string labeltext1 = lbl1.Text; //Session["item_id"] = CType(DataList1.Controls(0).FindControl("Label3"), System.Web.UI.WebControls.Label).Text; //Session["price"] = CType(DataList1.Controls(0).FindControl("Label1"), System.Web.UI.WebControls.Label).Text; //c.cmd.CommandText = "insert into cart values(@cart_id,@item_id,@cust_id,@qty,@price)"; //c.cmd.Parameters.Clear(); //c.cmd.Parameters.Add("@cart_id", SqlDbType.Int).Value = count; //c.cmd.Parameters.Add("@item_id", SqlDbType.Int).Value = Session["item_id"]; //c.cmd.Parameters.Add("@cust_id", SqlDbType.NVarChar).Value = Session["cust_id"]; //c.cmd.Parameters.Add("@price", SqlDbType.Int).Value = Session["price"]; //c.cmd.CommandText = "insert into cart(cart_id,item_id,cust_id,qty,price values('" + cart_id + "','" + Session["item_id"].ToString() + "','" + Session["cust_id"].ToString() + "','" + "'," + 1 + "," + Convert.ToInt64(s.Attributes["Label1"]) + ")"; //c.cmd.ExecuteNonQuery(); Page.ClientScript.RegisterStartupScript(this.GetType(), "msgbox", "<script> message('Item Successfully Added to Cart')</script>"); c.cmd.CommandText = "SELECT * FROM cart WHERE (cust_id = '" + Session["cust_id"].ToString() + "')"; adp1.SelectCommand = c.cmd; dt2.Clear(); adp1.Fill(dt2); } } } catch (NullReferenceException) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msgbox", "<script> alert('Error Occured') </script>"); } catch (Exception) { throw; } } } catch (NullReferenceException) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msgbox", "<script> message('You must login first')</script>"); Response.Redirect("~/clogin.aspx"); //Session["link"] = "item.aspx"; //Response.AddHeader("REFRESH", "3;URL=clogin.aspx?val=login"); } catch (Exception) { throw; } }
public chitiet_hoadon(connect _conn) { InitializeComponent(); conn = _conn; }
protected void Page_Load(object sender, EventArgs e) { mH = new maHoa(); connect connect; try { if (Request.QueryString["id_san_pham"] != null && Request.QueryString["id_san_pham"] != "") { id_san_pham = int.Parse(Request.QueryString["id_san_pham"]); } } catch (Exception qqe) { } if (id_san_pham == 0) { Response.Redirect("./danhSach.aspx"); } connect = new connect(); System.Data.SqlClient.SqlConnection ketnoi = new System.Data.SqlClient.SqlConnection(connect.getconnect()); string sql = "SELECT id_san_pham " + ",id_thuong_hieu " + " ,ten_san_pham " + ",anh_san_pham " + " ,cast(gia_cao as int)" + " ,cast(gia_ban_ra as int)" + ",cast(gia_nhap_san_pham as int)" + ",mo_ta_san_pham_html " + ",dac_tinh_san_pham " + ",khoi_luong_san_pham_gram " + ",da_co_vat " + " , cast(FORMAT(ngay_cap_nhat, 'yyyy-MM-dd') as varchar) as ngay_cap_nhat" + " FROM san_pham " + "where id_san_pham=" + id_san_pham; DataTable ds = new DataTable(); new System.Data.SqlClient.SqlDataAdapter(new System.Data.SqlClient.SqlCommand(sql, ketnoi)).Fill(ds); if (ds == null || ds.Rows.Count == 0) { Response.Redirect("./danhSach.aspx"); } anh = ds.Rows[0][3].ToString(); //1. danh sách tỉnh sql = "select id_thuong_hieu, ten_thuong_hieu from thuong_hieu"; connect = new connect(); DataTable tmp = new DataTable(); new System.Data.SqlClient.SqlDataAdapter(new System.Data.SqlClient.SqlCommand(sql, ketnoi)).Fill(tmp); for (int i = 0; i < tmp.Rows.Count; i++) { tmp.Rows[i][1] = mH.Base64Decode(tmp.Rows[i][1].ToString()); } if (!IsPostBack) { DropDownList0.DataSource = tmp; DropDownList0.DataTextField = "ten_thuong_hieu"; DropDownList0.DataValueField = "id_thuong_hieu"; DropDownList0.DataBind(); } if (!IsPostBack) { DropDownList0.SelectedValue = ds.Rows[0][1].ToString(); TextBox0.Text = ds.Rows[0][0].ToString(); TextBox1.Text = mH.Base64Decode(ds.Rows[0][2].ToString()); TextBox3.Text = ds.Rows[0][4].ToString(); TextBox4.Text = ds.Rows[0][5].ToString(); TextBox5.Text = ds.Rows[0][6].ToString(); TextBox6.Text = mH.Base64Decode(ds.Rows[0][7].ToString()); TextBox7.Text = mH.Base64Decode(ds.Rows[0][8].ToString()); TextBox8.Text = ds.Rows[0][9].ToString(); TextBox9.Text = ds.Rows[0][11].ToString(); } }
public DS_HOADON(connect _conn) { InitializeComponent(); conn = _conn; }
protected void Page_Load(object sender, EventArgs e) { connect connect; try { if (Request.QueryString["id_phieu_nhap"] != null && Request.QueryString["id_phieu_nhap"] != "") { id_phieu_nhap = int.Parse(Request.QueryString["id_phieu_nhap"]); } } catch (Exception a) { } if (id_phieu_nhap == 0) { Response.Redirect("./danhSach.aspx"); } WebApplication2.QuanTri.maHoa mH = new WebApplication2.QuanTri.maHoa(); string sql = "select id_kho_hang, ten_kho_hang from kho_hang"; connect = new connect(); System.Data.SqlClient.SqlConnection ketnoi = new System.Data.SqlClient.SqlConnection(connect.getconnect()); DataTable ds = new DataTable(); new System.Data.SqlClient.SqlDataAdapter(new System.Data.SqlClient.SqlCommand(sql, ketnoi)).Fill(ds); if (!IsPostBack) { DropDownList1.DataSource = ds; DropDownList1.DataTextField = "ten_kho_hang"; DropDownList1.DataValueField = "id_kho_hang"; DropDownList1.DataBind(); } sql = "select pnhh.id_phieu_nhap, pnhh.id_nguoi, n.ten_nguoi, pnhh.id_kho_hang, cast(FORMAT(pnhh.ngay_tao_phieu, 'yyyy-MM-dd') as varchar) as ngay_tao_phieu, pnhh.mo_ta_nguon_nhap, CASE WHEN DATEDIFF(HOUR, GETDATE(), pnhh.ngay_tao_phieu)>=-24 THEN 1 ELSE 0 END " + "from phieu_nhap_hang_hoa pnhh " + "join nguoi n on pnhh.id_nguoi=n.id_nguoi " + "where pnhh.id_phieu_nhap=" + id_phieu_nhap; connect = new connect(); ds = new DataTable(); new System.Data.SqlClient.SqlDataAdapter(new System.Data.SqlClient.SqlCommand(sql, ketnoi)).Fill(ds); if (ds == null || ds.Rows.Count == 0) { Response.Redirect("./danhSach.aspx"); } if (int.Parse(ds.Rows[0][6].ToString()) == 0) { hieu_luc = false; } else { hieu_luc = true; } if (hieu_luc == false) { Response.Redirect("./danhSach.aspx"); } if (!IsPostBack) { TextBox6.Text = ds.Rows[0][0].ToString(); TextBox7.Text = ds.Rows[0][2].ToString(); TextBox8.Text = ds.Rows[0][4].ToString(); TextBox3.Text = ds.Rows[0][5].ToString(); DropDownList1.SelectedValue = ds.Rows[0][3].ToString(); } }
public matkhau_baocaohoadon(connect _conn, frm_khachsan _khachsan) { InitializeComponent(); conn = _conn; khachsan = _khachsan; }