Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Commit

Permalink
Merge branch 'Eakan'
Browse files Browse the repository at this point in the history
  • Loading branch information
Eakan-Git committed Jan 2, 2022
2 parents 6374782 + e6ce6cc commit 54b8300
Show file tree
Hide file tree
Showing 25 changed files with 3,812 additions and 653 deletions.
158 changes: 80 additions & 78 deletions PA2/HoaYeuThuong/HoaYeuThuong/AdminOrderForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 30 additions & 43 deletions PA2/HoaYeuThuong/HoaYeuThuong/AdminOrderForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public partial class AdminOrderForm : Form
public AdminOrderForm()
{
InitializeComponent();
type.SelectedValue = DANGXULI;
searchBox.Text = placeholder;
connection = new SqlConnection(str);
connection.Open();
Expand Down Expand Up @@ -81,16 +80,8 @@ private void type_SelectedIndexChanged(object sender, EventArgs e)
loadOrderList(DAHUY);
}
}

private void btnPrevious_Click(object sender, EventArgs e)
private void refresh()
{
offset -= maxRowsPerPage;
if (offset <= 0)
{
offset = 0;
btnPrevious.Enabled = false;
}
btnNext.Enabled = true;
if (type.SelectedIndex == DANGXULI)
{
loadOrderList(DANGXULI);
Expand All @@ -108,29 +99,25 @@ private void btnPrevious_Click(object sender, EventArgs e)
loadOrderList(DAHUY);
}
}
private void btnPrevious_Click(object sender, EventArgs e)
{
offset -= maxRowsPerPage;
if (offset <= 0)
{
offset = 0;
btnPrevious.Enabled = false;
}
btnNext.Enabled = true;
refresh();
}

private void btnNext_Click(object sender, EventArgs e)
{
btnPrevious.Enabled = true;
offset += maxRowsPerPage;
try
{
if (type.SelectedIndex == DANGXULI)
{
loadOrderList(DANGXULI);
}
else if (type.SelectedIndex == DANGGIAO)
{
loadOrderList(DANGGIAO);
}
else if (type.SelectedIndex == DAGIAO)
{
loadOrderList(DAGIAO);
}
else if (type.SelectedIndex == DAHUY)
{
loadOrderList(DAHUY);
}
refresh();
btnPrevious.Enabled = true;
}
catch (Exception)
Expand Down Expand Up @@ -174,29 +161,19 @@ private void AdminOrderForm_Load(object sender, EventArgs e)
btnCancel.Enabled = false;
btnCheck.Enabled = false;
btnShipped.Enabled = false;
type.SelectedIndex = DANGXULI;
}

private void btnReload_Click(object sender, EventArgs e)
{
offset = 0;
if (type.SelectedIndex == DANGXULI)
{
loadOrderList(DANGXULI);
}
else if (type.SelectedIndex == DANGGIAO)
{
loadOrderList(DANGGIAO);
}
else if (type.SelectedIndex == DAGIAO)
{
loadOrderList(DAGIAO);
}
else if (type.SelectedIndex == DAHUY)
{
loadOrderList(DAHUY);
}
refresh();
}
private void popProductImage()
{
Form form = new ProductImage(Convert.ToInt32(DetailOrderDGV.SelectedRows[0].Cells[0].Value));
form.Show();
}

private void btnCheck_Click(object sender, EventArgs e)
{

Expand Down Expand Up @@ -254,5 +231,15 @@ private void OrderDGV_CellDoubleClick(object sender, DataGridViewCellEventArgs e
MessageBox.Show(ex.Message);
}
}

private void DetailOrderDGV_DoubleClick(object sender, EventArgs e)
{

}

private void DetailOrderDGV_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
popProductImage();
}
}
}
4 changes: 3 additions & 1 deletion PA2/HoaYeuThuong/HoaYeuThuong/CartForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public partial class CartForm : Form
string salePriceDefault = "Giá món hàng: ";
string totalDefault = "Tổng tiền: ";
int price;
int totalPrice;
public CartForm(string _ID)
{
InitializeComponent();
Expand All @@ -47,6 +48,7 @@ private void loadTotalPrice()
adapter.SelectCommand = cmd;
adapter.Fill(dt);
labelTotal.Text = totalDefault + dt.Rows[0][0].ToString() + "đ";
totalPrice = Convert.ToInt32(dt.Rows[0][0]);
labelTotal.Visible = true;
}
catch(Exception ex)
Expand Down Expand Up @@ -159,7 +161,7 @@ private void productDGV_SelectionChanged(object sender, EventArgs e)

private void btnPurchase_Click(object sender, EventArgs e)
{
Form form = new CustomerCreateOrderForm(ID);
Form form = new CustomerCreateOrderForm(ID, totalPrice);
form.Show();
}
}
Expand Down
Loading

0 comments on commit 54b8300

Please sign in to comment.