private void btnCancel_Click(object sender, EventArgs e) { if (dgvRoomSell.SelectedRows.Count > 0) { if (UIMessageDialog.ShowMessageDialog("你确定要删除该消费记录吗?", UILocalize.WarningTitle, true, Style)) { string time = dgvRoomSell.SelectedRows[0].Cells["clSpendTime"].Value.ToString(); string name = dgvRoomSell.SelectedRows[0].Cells["clSpendName"].Value.ToString(); string price = dgvRoomSell.SelectedRows[0].Cells["clSpendPrice"].Value.ToString(); SellThing s = SellThingManager.SelectSellThingByNameAndPrice(name, price); decimal num = Convert.ToDecimal(dgvRoomSell.SelectedRows[0].Cells["clSpendAmount"].Value.ToString()); string Stock = (s.Stock + num).ToString(); if (SellThingManager.DeleteSellThing(txtRoomNo.Text, time) > 0) { int n = SellThingManager.UpdateSellThing(Stock, s.SellNo); UIMessageTip.ShowOk("撤销成功!", 1000); LoadSpendInfo(txtRoomNo.Text); LoadSellThingInfo(); } } else { UIMessageTip.ShowError("操作取消!", 1000); } } else { MessageBox.Show("请选择要删除的消费记录!", "提示信息"); } }
private void picGetCustoNo_Click(object sender, EventArgs e) { picGetCustoNo.BackgroundImage = Resources.获取用户编号_ia; string SellId = SellThingManager.GetRandomSellNo(); txtSellNo.Text = SellId; }
private void btnCancel_Click(object sender, EventArgs e) { if (dgvSellthing.SelectedRows.Count > 0) { DialogResult dr = MessageBox.Show("你确定要删除该消费记录吗?", "删除提示", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (dr == DialogResult.Yes) { string time = dgvRoomSell.SelectedRows[0].Cells["SpendTime"].Value.ToString(); string name = dgvRoomSell.SelectedRows[0].Cells["SpendName"].Value.ToString(); string price = dgvRoomSell.SelectedRows[0].Cells["SpendPrice"].Value.ToString(); SellThing s = SellThingManager.SelectSellThingByNameAndPrice(name, price); decimal num = Convert.ToDecimal(dgvRoomSell.SelectedRows[0].Cells["SpendAmount"].Value.ToString()); string Stock = (s.Stock + num).ToString(); if (SellThingManager.DeleteSellThing(txtRoomNo.Text, time) > 0) { MessageBox.Show("删除成功!", "删除提示"); int n = SellThingManager.UpdateSellThing(Stock, s.SellNo); LoadSpendInfo(txtRoomNo.Text); LoadSellThingInfo(); } } else { return; } } else { MessageBox.Show("请选择要删除的消费记录!", "提示信息"); } }
private void btnAddSellThing_Click(object sender, EventArgs e) { st = new SellThing() { SellNo = txtSellNo.Text, SellName = txtSellName.Text, SellPrice = Convert.ToDecimal(txtSellPrice.Text), format = Convert.ToString(txtformat.Text), Stock = Convert.ToInt32(txtStock.Text), }; SellThingManager.InsertSellThing(st); MessageBox.Show("添加商品成功"); dgvSellthing.DataSource = SellService.SelectSellThingAll(); }
private void dgvRoomSell_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (dgvSellthing.SelectedRows.Count > 0) { txtRoomNo.Text = dgvRoomSell.SelectedRows[0].Cells["RoomNo"].Value.ToString(); txtSellName.Text = dgvRoomSell.SelectedRows[0].Cells["SpendName"].Value.ToString(); nudNum.Value = Convert.ToDecimal(dgvRoomSell.SelectedRows[0].Cells["SpendAmount"].Value.ToString()); txtPrice.Text = dgvRoomSell.SelectedRows[0].Cells["SpendPrice"].Value.ToString(); SellThing s = SellThingManager.SelectSellThingByNameAndPrice(txtSellName.Text, txtPrice.Text); txtSellNo.Text = s.SellNo; } } catch { return; } }
private void LoadThingByName() { //List<DataGridViewColumnEntity> lstCulumns = new List<DataGridViewColumnEntity>(); //lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "SellNo", HeadText = "商品编号", Width = 20, WidthType = SizeType.Percent }); //lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "SellName", HeadText = "商品名称", Width = 30, WidthType = SizeType.Percent }); //lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "SellPrice", HeadText = "商品价格", Width = 20, WidthType = SizeType.Percent }); //lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "format", HeadText = "规格", Width = 20, WidthType = SizeType.Percent }); //lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Stock", HeadText = "库存", Width = 15, WidthType = SizeType.Percent }); //this.dgvRoomSell.Columns = lstCulumns; //this.dgvRoomSell.IsShowCheckBox = false; List <SellThing> lstSource = SellThingManager.SelectThingByName(txtFind.Text); this.dgvRoomSell.DataSource = lstSource; this.dgvRoomSell.AutoGenerateColumns = false; }
private void btnAdd_Click(object sender, EventArgs e) { if (rs == 1)//判断房间编号是否可消费 { if (CheckInput()) { SellThing st = SellThingManager.SelectSellThingByNo(txtSellNo.Text); Room r = RoomManager.SelectRoomByRoomNo(txtRoomNo.Text); Spend s = new Spend() { RoomNo = txtRoomNo.Text, SpendName = txtSellName.Text, SpendAmount = (int)nudNum.Value, CustoNo = r.CustoNo, SpendPrice = Convert.ToDecimal(txtPrice.Text), SpendMoney = Convert.ToDecimal(txtPrice.Text) * nudNum.Value, SpendTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")), MoneyState = "未结算", }; int m = SpendManager.InsertSpendInfo(s); if (m > 0) { MessageBox.Show("添加成功"); string Stock = (st.Stock - nudNum.Value).ToString(); int n = SellThingManager.UpdateSellThing(Stock, st.SellNo); LoadSpendInfo(r.RoomNo); LoadSellThingInfo(); #region 获取添加操作日志所需的信息 Operation o = new Operation(); o.OperationTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd,HH:mm:ss")); o.Operationlog = LoginInfo.WorkerClub + LoginInfo.WorkerPosition + LoginInfo.WorkerName + "于" + DateTime.Now + "帮助" + dgvRoomSell.SelectedRows[0].Cells["CustoNo"].Value.ToString() + "进行了消费商品:" + txtSellName.Text + "操作!"; o.OperationAccount = LoginInfo.WorkerClub + LoginInfo.WorkerPosition + LoginInfo.WorkerName; #endregion OperationManager.InsertOperationLog(o); } else { MessageBox.Show("添加失败"); } } } }
private void btnAdd_Click(object sender, EventArgs e) { if (rs == 1)//判断房间编号是否可消费 { if (CheckInput()) { SellThing st = SellThingManager.SelectSellThingByNo(txtSellNo.Text); Room r = RoomManager.SelectRoomByRoomNo(txtRoomNo.Text); Spend s = new Spend() { RoomNo = txtRoomNo.Text, SpendName = txtSellName.Text, SpendAmount = (int)nudNum.Value, CustoNo = r.CustoNo, SpendPrice = Convert.ToDecimal(txtPrice.Text), SpendMoney = Convert.ToDecimal(txtPrice.Text) * nudNum.Value, SpendTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")), MoneyState = "未结算", }; int m = SpendManager.InsertSpendInfo(s); if (m > 0) { MessageBox.Show("添加成功"); string Stock = (st.Stock - nudNum.Value).ToString(); int n = SellThingManager.UpdateSellThing(Stock, st.SellNo); LoadSpendInfo(r.RoomNo); LoadSellThingInfo(); } else { MessageBox.Show("添加失败"); } } } }
private void btnFind_Click(object sender, EventArgs e) { dgvSellthing.DataSource = SellThingManager.SelectThingByName(txtFind.Text); }
private void FrmSellThingManager_Load(object sender, EventArgs e) { dgvSellthing.DataSource = SellThingManager.SelectSellThingAll(); dgvSellthing.AutoGenerateColumns = false; CmpSetDgv(); }
public void LoadSellThingInfo() { dgvSellthing.DataSource = SellThingManager.SelectSellThingAll(); }
private void LoadThingByName() { dgvSellthing.DataSource = SellThingManager.SelectThingByName(txtFind.Text); }