Beispiel #1
0
        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("添加失败");
                    }
                }
            }
        }