private void btnOk_Click(object sender, EventArgs e) { if (CheckEmpty()) { RoomInfo r = new RoomInfo(); r.IsDefault = txtIsDefault.Text;//默认的编号 r.RoomMaxNum = Convert.ToInt32(txtRPerNum.Text);//容纳人数 r.RoomMinMoney = Convert.ToDouble(txtRMinMoney.Text);//最低消费 r.RoomName = txtRName.Text;//名字 r.RoomType = Convert.ToInt32(txtRType.Text); //增加或者修改 if (Temp == 1)//新增 { r.DelFlag = 0; r.SubBy = 1; r.SubTime = System.DateTime.Now;//当前的时间 } else if (Temp == 2)//修改 { r.RoomId = Convert.ToInt32(labId.Text); } RoomInfoBLL rBll = new RoomInfoBLL(); string msg = rBll.AddOrUpdateRoomInfo(r, Temp) ? "操作成功" : "操作失败"; md.MsgDivShow(msg, 1, Bind); } }
public static FrmBilling Single(int deskId,string deakName,RoomInfo room) { //餐桌id 名字 房间id 最低消费 if (_instance == null || _instance.IsDisposed) { _instance = new FrmBilling(deskId, deakName, room); } return _instance; }
private int ordId; //用来存储订单的id #endregion Fields #region Constructors private FrmBilling(int deskId, string deakName, RoomInfo room) { InitializeComponent(); //还没有把值存起来 labDeskName.Text = deakName;//餐桌的编号 labRoomName.Text = room.RoomName;//房间 labLittleMoney.Text = room.RoomMinMoney.ToString();//最低消费 labId.Text = deskId.ToString();//餐桌的id }
public static FrmRoomAddOrModify Single(int temp, RoomInfo room) { if (instance == null || instance.IsDisposed) { instance = new FrmRoomAddOrModify(room); Temp = temp; } return instance; }
/// <summary> /// 新增或者修改房间信息 /// </summary> /// <param name="r">房间对象</param> /// <param name="temp">标识:1---新增,2----修改</param> /// <returns>是否成功</returns> public bool AddOrUpdateRoomInfo(RoomInfo r, int temp) { if (temp == 1)//新增 { return rDal.AddRomInfo(r) > 0; } else if (temp == 2)//修改 { return rDal.UpdateRoomInfi(r) > 0; } return false; }
private static int Temp; //存标识 #endregion Fields #region Constructors private FrmRoomAddOrModify(RoomInfo room) { InitializeComponent(); if (room!=null)//修改 { //为所有的文本框赋值 txtIsDefault.Text = room.IsDefault;//房间的默认编号 txtRMinMoney.Text = room.RoomMinMoney.ToString();//最低消费 txtRName.Text = room.RoomName;//房间的名字 txtRPerNum.Text = room.RoomMaxNum.ToString();//房间的最多容纳人数 txtRType.Text = room.RoomType.ToString();//房间的类型 labId.Text = room.RoomId.ToString();//房间的id } }
private void ShowFrmRoomAddOrModify(int temp, RoomInfo room) { this.Hide();//不是关闭是隐藏 不是close!! FrmRoomAddOrModify fram = FrmRoomAddOrModify.Single(temp, room); // fram.Show(); 不是写在这里 fram.FormClosed += new FormClosedEventHandler(fram_FormClose); fram.Show(); }