Exemple #1
0
        private void FrmVip_Load(object sender, EventArgs e)
        {
            List <VipsMDL> list = VipsBLL.GetVip(0);

            list.Insert(0, new VipsMDL()
            {
                VipName = "添加", VipID = 0
            });
            foreach (VipsMDL item in list)
            {
                ListViewItem lvi = new ListViewItem();
                if (item.VipID == 0)
                {
                    lvi.ImageIndex = 0;
                }
                else
                {
                    lvi.ImageIndex = 1;
                }

                lvi.Tag  = item.VipID;
                lvi.Text = item.VipName;

                listView1.Items.Add(lvi);
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string jiname = this.txtGrade.Text;

            string zhe = this.txtD.Text;

            if (jiname == "" || zhe == "")
            {
                MessageBox.Show("数据不能为空");
            }
            else
            {
                /////判断是否
                bool b = VipsBLL.insert(jiname, zhe);
                if (b == true)
                {
                    this.Close();

                    MessageBox.Show("添加成功");
                }
                else
                {
                    MessageBox.Show("添加失败");
                }
            }
        }
Exemple #3
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (this.lv2.SelectedItems.Count != 1)
     {
         MessageBox.Show("还没选择项");
     }
     else
     {
         DialogResult a = MessageBox.Show(this, "是否删除", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);
         if (a == DialogResult.Yes)
         {
             string b  = this.lv2.SelectedItems[0].Text;
             bool   id = VipsBLL.database(b);
             if (id == true)
             {
                 this.lv2.Items.Clear();
                 SX();
                 MessageBox.Show("删除成功");
             }
             else
             {
                 MessageBox.Show("删除失败");
             }
         }
     }
 }
Exemple #4
0
        private void button5_Click(object sender, EventArgs e)
        {
            //判断是否选择数据
            if (this.lv3.SelectedItems.Count <= 0)
            {
                MessageBox.Show("未选中任何数据!请选择!");
                return;
            }
            DialogResult dr = MessageBox.Show(this, "确定要删除该条数据吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr != DialogResult.Yes)
            {
                return;
            }
            int  id = Convert.ToInt32(this.lv3.SelectedItems[0].SubItems[0].Text);
            bool bl = VipsBLL.delete(id);

            if (true == bl)
            {
                MessageBox.Show(this, "删除成功!", "提示");
                查询所有会员();
            }
            else
            {
                MessageBox.Show("删除失败");
            }
        }
Exemple #5
0
        private void MemberManagementForm_Load(object sender, EventArgs e)
        {
            //标题
            this.Text = "商品设置";
            //房间类型
            //背景
            dataGridView1.BackgroundColor = Color.White;
            //禁止添加
            dataGridView1.AllowUserToAddRows = false;
            //禁止调整列
            dataGridView1.AllowUserToResizeColumns = false;
            //禁止调整行
            dataGridView1.AllowUserToResizeRows = false;
            //取消头列
            dataGridView1.RowHeadersVisible = false;
            //禁止多选
            dataGridView1.MultiSelect = false;
            //加载数据
            DataTable dt = VipsBLL.getTableVip();

            dataGridView1.DataSource = dt;

            //相应图片赋值
            tpbAdd.Image    = imageList1.Images[2];
            tpbUpdate.Image = imageList1.Images[0];
            tpbDelete.Image = imageList1.Images[1];
            tpbSelect.Image = imageList1.Images[3];
        }
Exemple #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.txtGrade.Text == "" || this.txtD.Text == "")
            {
                MessageBox.Show("数据部能为空");
            }
            else
            {
                int a = Convert.ToInt32(this.txtid.Text);

                string b = this.txtGrade.Text;

                double c = Convert.ToDouble(this.txtD.Text);

                VipGrade v = new VipGrade();
                v.VGID       = a;
                v.VGName     = b;
                v.VGDiscount = c;

                bool bb = VipsBLL.update(v);
                if (bb == true)
                {
                    this.Close();

                    // MessageBox.Show("成功");
                }

                else
                {
                    MessageBox.Show("失败");
                }
            }
        }
Exemple #7
0
        private void MemberEditorForm_Load(object sender, EventArgs e)
        {
            //标题
            this.Text = "会员编辑";
            if (vip.VipID1 != -1)
            {
                txtNo.Text   = vip.VipID1.ToString();
                txtName.Text = vip.VipName1;
                txtTel.Text  = vip.VipTel1;;
                txtTop.Text  = vip.GradeID1;
                txtSex.Text  = vip.VipSex1;
                dtpTime.Text = vip.VipEndDate1;
            }
            //加载数据
            DataTable dt = VipsBLL.getTableVipIndex();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                txtTop.Items.Add(dt.Rows[i]["VGName"].ToString());
            }
            //下拉框性别
            txtSex.Items.Add("男");
            txtSex.Items.Add("女");
            txtTop.SelectedIndex = 0;
            txtSex.SelectedIndex = 0;
        }
Exemple #8
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            string vipid = textBox1.Text;

            if (vipid.Length == 0)
            {
                label15.Text = "";
                label16.Text = "";
                VGDiscount   = 1;
                label17.Text = "";
                label10.Text = price + "";
                label22.Text = 0 + "";
                return;
            }
            List <VipsMDL> list = VipsBLL.GetVip(int.Parse(textBox1.Text));

            if (list.Count <= 0)
            {
                label15.Text = "会员不存在/已过期";
                label16.Text = "";
                VGDiscount   = 1;
                label17.Text = "";
                label10.Text = price + "";

                return;
            }
            label15.Text = list[0].VipName;
            label16.Text = list[0].VGName;
            VGDiscount   = list[0].VGDiscount;
            label17.Text = VGDiscount.ToString();
            label10.Text = price * VGDiscount + "";
            label22.Text = price - (price * VGDiscount) + "";
        }
Exemple #9
0
        //查询
        private void tpbSelect_Click(object sender, EventArgs e)
        {
            string    name = tpbText.Text.Trim();
            VipsModel vip  = new VipsModel();

            vip.VipID21  = name;
            vip.VipName1 = name;
            DataTable dt = VipsBLL.getSelectVip(vip);

            dataGridView1.DataSource = dt;
        }
Exemple #10
0
        private void FrmVipsT_Load(object sender, EventArgs e)
        {
            //用无间道显示会员等级
            List <VIPGrades> list = VipsBLL.selVG();

            this.cbograde.DisplayMember = "VGName";
            this.cbograde.ValueMember   = "VGID";
            this.cbograde.DataSource    = list;
            //用单值查询显示id
            this.txtid.Text = (VipsBLL.selectID() + 1).ToString();
            //默认性别为男
            this.cbosex.SelectedIndex = 0;
        }
Exemple #11
0
        private void SX()
        {
            this.lv2.Items.Clear();
            List <VipGrade> vip = VipsBLL.selectvip();

            foreach (var item in vip)
            {
                ListViewItem lvi = new ListViewItem(item.VGID.ToString());
                lvi.SubItems.Add(item.VGName);
                lvi.SubItems.Add(item.VGDiscount.ToString());
                this.lv2.Items.Add(lvi);
            }
        }
Exemple #12
0
        private void FrmVipsX_Load(object sender, EventArgs e)
        {
            //用无间道显示会员等级
            List <VIPGrades> list = VipsBLL.selVG();

            this.cbograde.DisplayMember = "VGName";
            this.cbograde.ValueMember   = "VGID";
            this.cbograde.DataSource    = list;
            //在窗体加载的时候将数据传过来
            this.txtid.Text    = publlei.VipID.ToString();
            this.txtname.Text  = publlei.VipName;
            this.txttel.Text   = publlei.VipTel;
            this.cbograde.Text = publlei.Grname.ToString();
            this.cbosex.Text   = publlei.VipSex;
            this.dt.Text       = publlei.VipEndDate;
        }
Exemple #13
0
 private void button1_Click(object sender, EventArgs e)
 {
     //验证内容
     if (textBox1.Text.Trim().Length <= 0 || textBox2.Text.Trim().Length <= 0)
     {
         new Warning("信息填写不完整", 图标.Erro).Show();
         return;
     }
     //添加
     if (showState == 1)
     {
         try
         {
             VipsMDL v = new VipsMDL();
             v.VipName    = textBox1.Text;
             v.VipTel     = textBox2.Text;
             v.GradeID    = Convert.ToInt32(comboBox1.SelectedValue);
             v.VipSex     = radioButton1.Checked ? "男" : "女";
             v.VipEndDate = dateTimePicker1.Value.ToString();
             if (VipsBLL.AddVip(v) > 0)
             {
                 this.Close();
             }
         }
         catch (Exception)
         {
             MessageBox.Show("发生未只的异常,请联系开发者", "未知异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         //修改会员
         VipsMDL v = new VipsMDL();
         v.VipName    = textBox1.Text;
         v.VipTel     = textBox2.Text;
         v.GradeID    = Convert.ToInt32(comboBox1.SelectedValue);
         v.VipSex     = radioButton1.Checked ? "男" : "女";
         v.VipEndDate = dateTimePicker1.Value.ToString();
         v.VipID      = Convert.ToInt32(label7.Text);
         if (VipsBLL.UpdateVip(v) > 0)
         {
             new Warning("修改成功", 图标.Yes).Show();
             this.Close();
         }
         //执行修改
     }
 }
Exemple #14
0
 private void pictureBox3_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         //执行删除
         if (VipsBLL.DeleteVip(Convert.ToInt32(listView1.SelectedItems[0].Tag)) > 0)
         {
             new Warning("删除成功", 图标.Yes).Show();
             listView1.Items.Clear();
             FrmVip_Load(null, null);
         }
     }
     else
     {
         new Warning("未选择", 图标.Erro).Show();
     }
 }
Exemple #15
0
        private void 查询所有会员()
        {
            this.lv3.Items.Clear();
            List <Vips> list = VipsBLL.select();

            foreach (var item in list)
            {
                ListViewItem lvi = new ListViewItem(item.VipID.ToString());
                lvi.SubItems.Add(item.VipName.ToString());
                lvi.SubItems.Add(item.VipSex.ToString());
                lvi.SubItems.Add(item.VGName.ToString());
                lvi.SubItems.Add(item.VGDiscount.ToString());
                lvi.SubItems.Add(item.VipTel.ToString());
                lvi.SubItems.Add(item.VipStartDate.ToString());
                lvi.SubItems.Add(item.VipEndDate.ToString());
                this.lv3.Items.Add(lvi);
            }
        }
Exemple #16
0
        //删除
        private void tpbDelete_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("确定删除该行数据?", "温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                int       index = Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value);
                VipsModel vip   = new VipsModel();
                vip.VipID1 = index;
                int result = VipsBLL.getDeleteVip(vip);
                if (result > 0)
                {
                    MessageBox.Show("OK");
                    MemberManagementForm_Load(null, null);
                }
                else
                {
                    MessageBox.Show("NO");
                }
            }
        }
Exemple #17
0
        private void vipAdd_Load(object sender, EventArgs e)
        {
            List <VipGradeMDL> list = VipGradeBLL.getlist(null);

            list.Insert(1, new VipGradeMDL()
            {
                vgname = "其他会员", vgid = 0
            });
            comboBox1.DataSource    = list;
            comboBox1.DisplayMember = "vgname";
            comboBox1.ValueMember   = "vgid";
            if (showState == 1)
            {
                label7.Text = (VipsBLL.GetMaxID() + 1).ToString();
                label8.Text = "添加会员";
            }
            else
            {
                label8.Text = "修改会员";
                label7.Text = id.ToString();
                List <VipsMDL> list_v = VipsBLL.GetVips(id);
                if (list_v.Count <= 0)
                {
                    return;
                }
                textBox1.Text           = list_v[0].VipName;
                textBox2.Text           = list_v[0].VipTel;
                comboBox1.SelectedValue = list_v[0].GradeID;
                if (list_v[0].VipSex == "男")
                {
                    radioButton1.Checked = true;
                }
                else
                {
                    radioButton2.Checked = true;
                }
                dateTimePicker1.Value = Convert.ToDateTime(list_v[0].VipEndDate);
            }
        }
Exemple #18
0
        private void button1_Click(object sender, EventArgs e)
        {
            Vips v = new Vips();

            v.VipName    = this.txtname.Text;
            v.VipSex     = this.cbosex.Text;
            v.GradeID    = this.cbograde.SelectedValue.ToString();
            v.VipTel     = this.txttel.Text;
            v.VipEndDate = this.dt.Value.ToString();
            v.VipID      = this.txtid.Text.ToString();
            bool bl = VipsBLL.upbyid(v);

            if (true == bl)
            {
                MessageBox.Show("修改成功");
                this.Close();
            }
            else
            {
                MessageBox.Show("修改失败");
            }
        }
Exemple #19
0
        private void button2_Click(object sender, EventArgs e)
        {
            Boolean     b    = false; //判断是否为int类型 false-否 true-是
            string      Sid  = this.txtname2.Text;
            int         Sidi = 0;
            List <Vips> list;

            try
            {
                Sidi = int.Parse(Sid);
                b    = true;
            }
            catch (Exception)
            {
                b = false;
            }
            if (b == true)
            {
                list = VipsBLL.Sel(Sidi);
            }
            else
            {
                list = VipsBLL.Sel(Sid);
            }
            this.lv3.Items.Clear();
            foreach (var item in list)
            {
                ListViewItem lvi = new ListViewItem(item.VipID.ToString());
                lvi.SubItems.Add(item.VipName.ToString());
                lvi.SubItems.Add(item.VipSex.ToString());
                lvi.SubItems.Add(item.VGName.ToString());
                lvi.SubItems.Add(item.VGDiscount.ToString());
                lvi.SubItems.Add(item.VipTel.ToString());
                lvi.SubItems.Add(item.VipStartDate.ToString());
                lvi.SubItems.Add(item.VipEndDate.ToString());
                this.lv3.Items.Add(lvi);
            }
        }
Exemple #20
0
        private void button1_Click(object sender, EventArgs e)
        {
            //获取数据

            //判断是否为空
            if (this.txtname.Text == "" || this.txttel.Text == "")
            {
                MessageBox.Show("请输入完整的信息");
                return;
            }
            //获取数据
            string name = this.txtname.Text;
            string sex  = this.cbosex.Text;
            string gid  = this.cbograde.SelectedValue.ToString();
            string tel  = this.txttel.Text;
            string sj   = this.dt.Value.ToString();
            //赋值数据
            Vips v = new Vips();

            v.VipName    = name;
            v.VipSex     = sex;
            v.GradeID    = gid.ToString();;
            v.VipTel     = tel;
            v.VipEndDate = sj;
            bool bl = VipsBLL.Insert(v);

            if (true == bl)
            {
                MessageBox.Show("添加成功");
                this.Close();
            }
            else
            {
                MessageBox.Show("添加失败");
            }
        }
Exemple #21
0
 private void dataGridView1_VisibleChanged(object sender, EventArgs e)
 {
     dataGridView1.DataSource = VipsBLL.GetJL();
 }
Exemple #22
0
        private void AccountsForm1_Load(object sender, EventArgs e)
        {
            //标题
            this.Text = "宾客结账";
            //房间类型
            //背景
            dataGridView1.BackgroundColor = Color.White;
            //禁止添加
            dataGridView1.AllowUserToAddRows = false;
            //禁止调整列
            dataGridView1.AllowUserToResizeColumns = false;
            //禁止调整行
            dataGridView1.AllowUserToResizeRows = false;
            //取消头列
            dataGridView1.RowHeadersVisible = false;
            //禁止多选
            dataGridView1.MultiSelect = false;
            //背景
            dataGridView2.BackgroundColor = Color.White;
            //禁止添加
            dataGridView2.AllowUserToAddRows = false;
            //禁止调整列
            dataGridView2.AllowUserToResizeColumns = false;
            //禁止调整行
            dataGridView2.AllowUserToResizeRows = false;
            //取消头列
            dataGridView2.RowHeadersVisible = false;
            //禁止多选
            dataGridView2.MultiSelect = false;
            //账单单号
            this.lblNo.Text = cbm.CBID1.ToString();
            //餐台
            this.lblTableName.Text = tables.TableName1;
            //加载消费列表
            ConsumerDetailsModel cdm = new ConsumerDetailsModel();

            cdm.CBID1 = cbm.CBID1;
            DataTable dt = ConsumerDetailsBLL.getTableJZ(cdm);

            dataGridView1.DataSource         = dt;
            dataGridView1.Columns[0].Visible = false;
            //总计金额
            double sum = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                sum += Convert.ToDouble(dt.Rows[i]["应收金额"]);
            }
            //消费金额
            double sum2 = sum / Convert.ToDouble(lblBL.Text);

            lblMoney2.Text = sum2.ToString();
            //应收金额
            this.lblMoney.Text  = sum.ToString();
            this.lblYMoney.Text = (sum2 - sum).ToString();
            //影藏会员
            this.panel1.Visible = false;
            DataTable dt2 = VipsBLL.getTableJZ();

            dataGridView2.DataSource         = dt2;
            dataGridView2.Columns[5].Visible = false;
        }
Exemple #23
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (vip.VipID1 == -1)
     {
         //新增
         string   name      = txtName.Text.Trim();
         string   tel       = txtTel.Text.Trim();
         string   sex       = txtSex.Text.Trim();
         string   top       = txtTop.Text.Trim();
         string   index     = VipsBLL.getTableVipIndex(top).ToString();
         string   startTime = DateTime.Now.ToString("yyyy-MM-dd");
         string   endTime2  = dtpTime.Text.Trim();
         string   endTime   = "";
         string[] time      = endTime2.Split('.');
         for (int i = 0; i < time.Length; i++)
         {
             endTime += time[i];
         }
         VipsModel vip2   = new VipsModel(name, sex, index, tel, startTime, endTime);
         int       result = VipsBLL.getAddVip(vip2);
         if (result > 0)
         {
             MessageBox.Show("OK");
             this.Close();
             MemberManagementForm mmf = new MemberManagementForm();
             mmf.Show();
         }
         else
         {
             MessageBox.Show("NO");
         }
     }
     else
     {
         //修改
         //新增
         string   name      = txtName.Text.Trim();
         string   tel       = txtTel.Text.Trim();
         string   sex       = txtSex.Text.Trim();
         string   top       = txtTop.Text.Trim();
         string   index     = VipsBLL.getTableVipIndex(top).ToString();
         string   startTime = "";
         string   endTime2  = dtpTime.Text.Trim();
         string   endTime   = "";
         string[] time      = endTime2.Split('.');
         for (int i = 0; i < time.Length; i++)
         {
             endTime += time[i];
         }
         VipsModel vip2   = new VipsModel(vip.VipID1, name, sex, index, tel, startTime, endTime);
         int       result = VipsBLL.getUpdateVip(vip2);
         if (result > 0)
         {
             MessageBox.Show("OK");
             this.Close();
             MemberManagementForm mmf = new MemberManagementForm();
             mmf.Show();
         }
         else
         {
             MessageBox.Show("NO");
         }
     }
 }