Ejemplo n.º 1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0 || dataGridView1.SelectedRows.Count > 1)
            {
                MessageBox.Show("请选择一行!");
                return;
            }
            VIPManagement vipm = new VIPManagement();

            vipm.VipCard     = dataGridView1.CurrentRow.Cells[0].Value.ToString();
            vipm.UserName    = dataGridView1.CurrentRow.Cells[2].Value.ToString();
            vipm.VipType     = dataGridView1.CurrentRow.Cells[1].Value.ToString();
            vipm.PhoneNumber = dataGridView1.CurrentRow.Cells[3].Value.ToString();
            vipm.Balance     = (int)dataGridView1.CurrentRow.Cells[4].Value;
            vipm.CreateTime  = dataGridView1.CurrentRow.Cells[5].Value.ToString();
            vip = new VIPManager(vipm);
            vip.StartPosition = FormStartPosition.CenterParent;
            vip.ShowDialog();
            if (vip.DialogResult == DialogResult.OK)
            {
                MessageBox.Show("操作成功");
                vip.Close();
                button1_Click(null, null);
            }
        }
Ejemplo n.º 2
0
 public Consumption(VIPManagement v)
 {
     InitializeComponent();
     gt                = new GoodsType();
     textBox1.Text     = v.VipCard;
     textBox2.Text     = v.UserName;
     textBox3.Text     = v.VipType;
     textBox4.Text     = v.Balance.ToString();
     textBox5.Text     = v.PhoneNumber;
     groupBox1.Enabled = false;
     sp                = new ShoppingCart(v);
 }
Ejemplo n.º 3
0
 public VIPManager(VIPManagement _vip)
 {
     InitializeComponent();
     vip              = _vip;
     Type             = "修改";
     textBox1.Text    = vip.VipCard.ToString();
     textBox2.Text    = vip.UserName.ToString();
     comboBox1.Text   = vip.VipType.ToString();
     textBox5.Text    = vip.PhoneNumber.ToString();
     textBox6.Text    = vip.Balance.ToString();
     textBox1.Enabled = false;
     textBox6.Enabled = false;
 }
Ejemplo n.º 4
0
 public AddBalance(VIPManagement v)
 {
     InitializeComponent();
     vip                      = v;
     bl                       = new Banlance(vip);
     textBox1.Text            = v.VipCard;
     textBox2.Text            = v.UserName;
     textBox3.Text            = v.VipType;
     textBox4.Text            = v.Balance.ToString();
     textBox5.Text            = v.PhoneNumber;
     groupBox1.Enabled        = false;
     dataGridView1.DataSource = bl.ShowHistory();
     SetdataGridViewHeaderCell();
 }
Ejemplo n.º 5
0
        //新增
        public string AddVipUser(VIPManagement vip)
        {
            vip.CreateTime = DateTime.Now.ToLocalTime().ToString();
            string result = "ERROR:";

            GetAllVipInfo();
            foreach (var item in AllVIP)
            {
                if (item.VipCard == vip.VipCard)
                {
                    result += $"已存在卡号为{vip.VipCard}的会员信息!";
                    return(result);
                }
            }
            File.WriteAllText(Properties.Settings.Default.VIP + $"/{vip.VipCard}", JsonConvert.SerializeObject(vip));
            return("OK");
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button4_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count == 0)
     {
         MessageBox.Show("请最少选择一行!");
         return;
     }
     if (MessageBox.Show("是否删除?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         //删除
         for (int i = 0; i < dataGridView1.SelectedRows.Count; i++)
         {
             VIPManagement.DeleteVipUser(dataGridView1.Rows[i].Cells[0].Value.ToString());
         }
         MessageBox.Show("执行成功");
         button1_Click(null, null);
     }
 }
Ejemplo n.º 7
0
 public Banlance(VIPManagement vip)
 {
     this.svip        = vip;
     this.vipcard     = vip.VipCard;
     this.vtype       = vip.VipType;
     this.username    = vip.UserName;
     this.phonenumber = vip.PhoneNumber;
     if (AllBanlance == null)
     {
         AllBanlance = new List <Banlance>();
         string url = Properties.Settings.Default.History;
         if (!System.IO.Directory.Exists(url))
         {
             System.IO.Directory.CreateDirectory(url);//不存在就创建文件夹
         }
         string filefullname = Properties.Settings.Default.History + $"/{vip.VipCard}";
         if (File.Exists(filefullname))
         {
             string vipinfo = File.ReadAllText(filefullname);
             AllBanlance = JsonConvert.DeserializeObject <List <Banlance> >(vipinfo);
         }
     }
 }
Ejemplo n.º 8
0
 public ShoppingCart(VIPManagement _vip)
 {
     cifo  = new List <ConsumptionInfo>();
     vinfo = _vip;
 }
Ejemplo n.º 9
0
 public VIPManager()
 {
     InitializeComponent();
     vip  = new VIPManagement();
     Type = "新增";
 }
Ejemplo n.º 10
0
 //修改
 public string EditVipUser(VIPManagement vip)
 {
     File.Delete(Properties.Settings.Default.VIP + $"/{vip.VipCard}");
     File.WriteAllText(Properties.Settings.Default.VIP + $"/{vip.VipCard}", JsonConvert.SerializeObject(vip));
     return("OK");
 }