Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo()
            {
                HTitle = txtTitle.Text
            };

            if (txtId.Text == "添加时无编号")
            {
                //添加
                if (hiBll.Add(hi))
                {
                    LoadList();
                }
            }
            else
            {
                //修改
                hi.Id = int.Parse(txtId.Text);
                if (hiBll.Edit(hi))
                {
                    LoadList();
                }
            }

            txtId.Text    = "添加时无编号";
            txtTitle.Text = "";
            btnSave.Text  = "添加";

            MyUpdateForm();
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo();

            hi.HTitle = txtTitle.Text;
            if (btnSave.Text == "添加")
            {
                if (hiBll.Add(hi))
                {
                    LoadHallInfoList();
                    UpdateHallInfoEvent();
                }
                else
                {
                    MessageBox.Show("添加失败!请稍后重试!");
                }
            }
            else
            {
                hi.HId = Convert.ToInt32(txtId.Text);
                //修改操作
                if (hiBll.Edit(hi))
                {
                    LoadHallInfoList();
                    UpdateHallInfoEvent();
                }
                else
                {
                    MessageBox.Show("修改失败!请稍后重试!");
                }
            }
        }
Esempio n. 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo()
            {
                HTitle = txtTitle.Text
            };

            if (txtId.Text == "No number")
            {
                if (hiBll.Add(hi))
                {
                    LoadList();
                }
            }
            else
            {
                hi.HId = int.Parse(txtId.Text);
                if (hiBll.Edit(hi))
                {
                    LoadList();
                }
            }

            txtId.Text    = "No number";
            txtTitle.Text = "";
            btnSave.Text  = "Add";

            //MyUpdateForm();
        }
Esempio n. 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo()
            {
                HTitle = txtHTitle.Text
            };

            if (btnSave.Text.Equals("添加"))
            {
                if (_hiBll.Add(hi))
                {
                    UpdateHallEvent?.Invoke();
                    LoadList();
                }
                else
                {
                    MessageBox.Show("添加失败");
                }
            }
            else if (btnSave.Text.Equals("修改"))
            {
                hi.HId = Convert.ToInt32(txtDId.Text);
                if (_hiBll.Edit(hi))
                {
                    UpdateHallEvent?.Invoke();
                    LoadList();
                }
                else
                {
                    MessageBox.Show("修改失败");
                }
            }
        }
        //添加\修改
        private void button1_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo();

            hi.HTitle = textBox1.Text;
            if (button1.Text.Equals("添加"))
            {
                //添加
                if (hiBll.Add(hi))
                {
                    button2_Click(null, null);
                    LoadList();
                    RefreshHallEvent();
                }
                else
                {
                    MessageBox.Show("添加失败,请稍后重试!!!");
                }
            }
            else
            {
                hi.HId = Convert.ToInt32(textBox3.Text);
                //修改
                if (hiBll.Edit(hi))
                {
                    button2_Click(null, null);
                    LoadList();
                    RefreshHallEvent();
                }
                else
                {
                    MessageBox.Show("修改失败,请稍后重试!!!");
                }
            }
        }
Esempio n. 6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //判断用户是否输入数据
            if (string.IsNullOrWhiteSpace(txtTitle.Text))
            {
                MessageBox.Show("请输入标题");
                txtTitle.Focus();
                return;
            }
            //获取用户输入数据,构建对象
            HallInfo hi = new HallInfo()
            {
                HTitle = txtTitle.Text
            };

            //判断是添加还是修改,并调用方法
            if (txtId.Text.Equals("添加时无编号"))
            {
                //添加操作
                if (hiBll.Add(hi))
                {
                    LoadList();
                }
                else
                {
                    MessageBox.Show("添加失败,请稍候重试");
                }
            }
            else
            {
                //修改操作
                hi.HId = int.Parse(txtId.Text);
                if (hiBll.Edit(hi))
                {
                    LoadList();
                }
                else
                {
                    MessageBox.Show("修改失败,请稍候重试");
                }
            }
            //刷新事件
            RefreshList();
            //恢复控件
            txtId.Text    = "添加时无编号";
            txtTitle.Text = "";
            btnSave.Text  = "添加";
        }
Esempio n. 7
0
        //保存修改按钮
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtId.Text == "添加时无编号")
            {
                #region Insert
                if (txtTitle.Text == "")
                {
                    MessageBox.Show("包房名称不可为空.", "提示");
                    return;
                }
                HallInfo hi = new HallInfo();
                hi.HTitle = txtTitle.Text;

                if (hiBll.Add(hi))
                {
                    LoadList();
                    MessageBox.Show("添加成功.");
                }
                else
                {
                    MessageBox.Show("添加失败.请稍后重试......");
                }
                #endregion
            }
            else
            {
                #region Update
                HallInfo hi = new HallInfo();
                hi.HId    = Convert.ToInt32(txtId.Text);
                hi.HTitle = txtTitle.Text;
                if (hiBll.Edit(hi))
                {
                    LoadList();
                    MessageBox.Show("修改成功.");
                }
                else
                {
                    MessageBox.Show("修改失败,请稍后再试......");
                }
                #endregion
            }
            MyUpdateForm();
            Clean();
        }
Esempio n. 8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo()
            {
                HTitle = txtTitle.Text
            };

            //判断添加操作还是修改操作
            if (txtId.Text == "添加时无编号")
            {
                //添加操作
                if (bll.Add(hi))
                {
                    MessageBox.Show("添加成功!");
                }
                else
                {
                    MessageBox.Show("添加失败!请稍后重试");
                }
            }
            else
            {
                //修改操作
                hi.HId = Convert.ToInt32(txtId.Text);
                if (bll.Edit(hi))
                {
                    MessageBox.Show("修改成功!");
                }
                else
                {
                    MessageBox.Show("修改失败!请稍后重试");
                }
            }

            txtId.Text    = "添加时无编号";
            txtTitle.Text = "";
            LoadList();
            UpdateForm();
        }
Esempio n. 9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo()
            {
                HTitle = txtTitle.Text
            };

            if (txtId.Text == "添加时无编号")
            {
                //添加
                if (hiBll.Add(hi))
                {
                    LoadList();
                }
                else
                {
                    MessageBox.Show("添加失败,请稍后重试");
                }
            }
            else
            {
                hi.HId = int.Parse(txtId.Text);
                if (hiBll.Edit(hi))
                {
                    LoadList();
                }
                else
                {
                    MessageBox.Show("修改失败,请稍后重试");
                }
            }
            txtId.Text    = "添加时无编号";
            txtTitle.Text = "";
            btnSave.Text  = "添加";
            //调用自定义事件,事件中的自定义方法都会被执行
            MyUpdateForm();
        }
Esempio n. 10
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo()
            {
                HTitle = txtTitle.Text
            };

            if (txtId.Text == "添加时无编号")
            {
                //添加
                if (hiBll.Add(hi))
                {
                    LoadList();
                }
                else
                {
                    MessageBox.Show("添加失败");
                }
            }
            else
            {
                //修改
                hi.HId = Convert.ToInt32(txtId.Text);
                if (hiBll.Edit(hi))
                {
                    LoadList();
                }
                else
                {
                    MessageBox.Show("修改失败");
                }
            }
            updateInfo();
            txtId.Text    = "添加时无编号";
            txtTitle.Text = "";
            btnSave.Text  = "添加";
        }