Beispiel #1
0
 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 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("请选择要删除的消费记录!", "提示信息");
     }
 }