private void LoadROrderInfoProductByOrderId(int p) { R_OrderInfo_ProductBLL bll = new R_OrderInfo_ProductBLL(); dgvAllPro.AutoGenerateColumns = false; dgvAllPro.DataSource = bll.GetROrderProduct(p); //dgvAllPro.SelectedRows[0].Selected = false; }
private void LoadROrderInfoProductByOrderId(int p) { R_OrderInfo_ProductBLL bll = new R_OrderInfo_ProductBLL(); dgvROrderProduct.AutoGenerateColumns = false; dgvROrderProduct.DataSource = bll.GetROrderProduct(p); if(dgvROrderProduct.SelectedRows.Count>0) { dgvROrderProduct.SelectedRows[0].Selected = false; } // R_OrderInfo_Product rop = bll.GetMoneyAndCount(p); labSumMoney.Text = rop.MONEY.ToString(); labCount.Text = rop.CT.ToString(); }
//start order with cell double click event private void dgvProduct_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int proId = Convert.ToInt32(dgvProduct.SelectedRows[0].Cells[0].Value.ToString()); R_OrderInfo_Product rop = new R_OrderInfo_Product(); rop.OrderId = Convert.ToInt32(labOrderId.Text); rop.ProId = proId; rop.DelFlag = 0; rop.SubTime = System.DateTime.Now; rop.State = 0; if(string.IsNullOrEmpty(txtCount.Text) || txtCount.Text=="0" || txtCount.Text=="1") { rop.UnitCount = 1; } else { rop.UnitCount = Convert.ToInt32(txtCount.Text); } R_OrderInfo_ProductBLL bll = new R_OrderInfo_ProductBLL(); string msg = bll.AddROrderInfoProduct(rop) ? "成功" : "失败"; LoadROrderInfoProductByOrderId(Convert.ToInt32(rop.OrderId)); }
private void btnDeleteRorderPro_Click(object sender, EventArgs e) { if(dgvROrderProduct.SelectedRows.Count > 0) { int id = Convert.ToInt32(dgvROrderProduct.SelectedRows[0].Cells[0].Value.ToString()); R_OrderInfo_ProductBLL bll = new R_OrderInfo_ProductBLL(); string msg = bll.SoftDeletROrderProName(id) ? "退菜成功" : "退菜失败"; MessageBox.Show(msg); LoadROrderInfoProductByOrderId(Convert.ToInt32(labOrderId.Text)); } else { MessageBox.Show("请选择要取消的order"); } }