Exemplo n.º 1
0
        private void btnHold_Click(object sender, System.EventArgs e)
        {
            //占位
            try
            {
                if (txtSeat.Text == "")
                {
                    throw new BusinessException("展位预留", "请选择展位");
                }
                if (txtSeat.Tag == null || txtSeat.Tag.ToString() == "")
                {
                    throw new BusinessException("展位预留", "请选择展位");
                }
                if (null == cmbShow.SelectedItem)
                {
                    throw new BusinessException("展位预留", "请选择招聘会");
                }
                if (null == cmbFloor.SelectedItem)
                {
                    throw new BusinessException("展位预留", "请选择展位大厅");
                }

                ShowSeat seat = new ShowSeat();
                seat.cnvcSeat     = txtSeat.Text;
                seat.cnnJobID     = int.Parse(cmbShow.SelectedItem.DataValue.ToString());
                seat.cnvcFloor    = cmbFloor.SelectedItem.DataValue.ToString();
                seat.cnvcOperName = this.oper.cnvcOperName;
                seat.cndOperDate  = DateTime.Now;

                DataTable dtSeat = Helper.Query("select * from tbShowSeat where cnnJobID=" + seat.cnnJobID + " and cnvcState='" + seat.cnvcOperName + "'");
                if (dtSeat.Rows.Count > 0)
                {
                    ShowSeat oldSeat = new ShowSeat(dtSeat);
                    throw new BusinessException("展位预留", "你已经占了一个位置,不能再占了。你占的位置是:" + oldSeat.cnvcSeat);
                }
                JobManage jm = new JobManage();
                jm.HoldSeat(seat);
                MessageBox.Show(this, "占位成功", "展位预留", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //LoadPanel();
                this.btnLoadSeat_Click(null, null);
            }
            catch (BusinessException bex)
            {
                MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }