예제 #1
0
 private void btConfirm_Click(object sender, EventArgs e)
 {
     if (tbID.Text.Trim() == "" || tbRoomType.Text.Trim() == "")
     {
         MessageBox.Show("输入信息不完整!", "修改失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         flag = 1;
     }
     if (flag == 0)
     {
         if (tbRoomType.Text.Trim() == "双人间" || tbRoomType.Text.Trim() == "单人间" || tbRoomType.Text.Trim() == "套房")
         {
             Maticsoft.BLL.Goods go = new BLL.Goods();
             string      str1       = string.Format("goodsID = '{0}'", tbID.Text.Trim());
             Model.Goods gmodel     = new Model.Goods();
             if (go.GetRecordCount(str1) > 0)
             {
                 gmodel.goodsID    = tbID.Text.Trim();
                 gmodel.goodsName  = tbName.Text.Trim();
                 gmodel.goodsPrice = Convert.ToDecimal(tbPrice.Text.Trim());
                 gmodel.roomTypeID = tbRoomType.Text.Trim();
                 if (go.Update(gmodel) == true)
                 {
                     MessageBox.Show("修改成功!");
                     ((Main_Admin)this.Owner).RoomGoodsLoad();
                     this.DialogResult = DialogResult.OK;
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("修改失败!");
                 }
             }
             else
             {
                 MessageBox.Show("不存在此物品编号!", "修改失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
         else
         {
             MessageBox.Show("房型不存在!", "修改失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
 }
예제 #2
0
 private void btConfirm_Click(object sender, EventArgs e)
 {
     if (tbID.Text.Trim() == "" || tbRoomType.Text.Trim() == "")
     {
         MessageBox.Show("输入信息不完整!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         flag = 1;
     }
     if (flag == 0)
     {
         if (tbRoomType.Text.Trim() == "双人间" || tbRoomType.Text.Trim() == "单人间" || tbRoomType.Text.Trim() == "套房")
         {
             Maticsoft.BLL.Goods go = new BLL.Goods();
             string str1            = string.Format("goodsID = '{0}'", tbID.Text.Trim());
             string string1         = string.Format("{0}", tbID.Text.Trim());
             string str2            = string.Format("{0}", tbRoomType.Text.Trim());
             if (go.GetRecordCount(str1) > 0)
             {
                 if (go.Delete(string1, str2) == true)
                 {
                     MessageBox.Show("删除成功!");
                     ((Main_Admin)this.Owner).RoomGoodsLoad();
                     this.DialogResult = DialogResult.OK;
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("删除失败!");
                 }
             }
             else
             {
                 MessageBox.Show("不存在此物品编号!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
         else
         {
             MessageBox.Show("房型不存在!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
 }