Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (selectMemberControl1.SelectedMembers.Count == 0)
            {
                MessageBox.Show("请选择会员!");
                selectMemberControl1.Focus();
                return;
            }
            Renew renew = new Renew();

            renew.Member = selectMemberControl1.SelectedMembers[0];//comboBox2.SelectedItem as Member;
            renew.卡种     = comboBox3.SelectedItem as CardType;
            renew.卡号     = textBox2.Text.Trim();
            renew.续卡时间   = DateTime.Parse(textBox3.Text.Trim());
            renew.经手人    = (selectStaffControl1.SelectedStaffs != null && selectStaffControl1.SelectedStaffs.Count > 0) ? selectStaffControl1.SelectedStaffs[0] : null;
            renew.备注     = textBox6.Text;
            RenewLogic rl = RenewLogic.GetInstance();
            int        id = rl.AddRenew(renew);

            if (id > 0)
            {
                renew.ID = id;
                LoadRenews();
                MessageBox.Show("添加成功!");
            }
        }
Exemple #2
0
        private DataTable Search(string name, int sex = 0, CardType cardType = null, string cardNo = null, string mobile = null)
        {
            string nm = "";

            if (!string.IsNullOrEmpty(name) && name.Trim() != "")
            {
                nm = " and TF_Member.姓名 like '%" + name + "%'";
            }
            string sx = "";

            if (sex > 0)
            {
                sx = " and TF_Member.性别=" + sex;
            }
            string ct = "";

            if (cardType != null)
            {
                ct = " and TF_Member.卡种=" + cardType.ID;
            }
            string cn = "";

            if (!string.IsNullOrEmpty(cardNo) && cardNo.Trim() != "")
            {
                cn = " and TF_Member.卡号 like '%" + cardNo.Trim() + "%'";
            }
            string mb = "";

            if (!string.IsNullOrEmpty(mobile) && mobile.Trim() != "")
            {
                mb = " and TF_Member.电话 like '%" + mobile.Trim() + "%'";
            }
            string where = nm + sx + ct + cn + mb + " order by TF_Renew.ID desc";
            return(RenewLogic.GetInstance().GetRenews(where));
        }
Exemple #3
0
        private DataTable Search(string name, int sex = 0, CardType cardType = null, string cardNo = null, string mobile = null)
        {
            string nm = "";

            if (!string.IsNullOrEmpty(name) && name.Trim() != "")
            {
                nm = " and 会员 like '%" + name + "%'";
            }
            string sx = "";

            if (sex > 0)
            {
                sx = " and 性别='" + (性别)Enum.ToObject(typeof(性别), (sex - 1)) + "'";
            }
            string ct = "";

            if (cardType != null)
            {
                ct = " and 卡种='" + cardType.卡种 + "'";
            }
            string cn = "";

            if (!string.IsNullOrEmpty(cardNo) && cardNo.Trim() != "")
            {
                cn = " and 卡号 like '%" + cardNo.Trim() + "%'";
            }
            string mb = "";

            if (!string.IsNullOrEmpty(mobile) && mobile.Trim() != "")
            {
                mb = " and 电话 like '%" + mobile.Trim() + "%'";
            }
            string where = "(1=1)" + nm + sx + ct + cn + mb;
            return(RenewLogic.GetInstance().GetRenews(where));
        }
Exemple #4
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         if (selectMemberControl1.SelectedMembers.Count == 0)
         {
             MessageBox.Show("请选择会员!");
             selectMemberControl1.Focus();
             return;
         }
         Renew renew = (Renew)comboBox1.SelectedItem;
         renew.Member = selectMemberControl1.SelectedMembers[0];//comboBox2.SelectedItem as Member;
         renew.卡种     = comboBox3.SelectedItem as CardType;
         renew.卡号     = textBox2.Text.Trim();
         renew.续卡时间   = DateTime.Parse(textBox3.Text.Trim());
         renew.经手人    = (selectStaffControl1.SelectedStaffs != null && selectStaffControl1.SelectedStaffs.Count > 0) ? selectStaffControl1.SelectedStaffs[0] : null;
         renew.备注     = textBox6.Text;
         RenewLogic rl = RenewLogic.GetInstance();
         if (rl.UpdateRenew(renew))
         {
             LoadRenews();
             MessageBox.Show("修改成功!");
         }
     }
     else
     {
         MessageBox.Show("先选定要修改的续卡记录!");
     }
 }
Exemple #5
0
        public static RenewLogic GetInstance()
        {
            if (instance == null)
            {
                instance = new RenewLogic();
            }

            return(instance);
        }
Exemple #6
0
        private void LoadRenews()
        {
            List <Renew> elements = RenewLogic.GetInstance().GetAllRenews();

            comboBox1.Items.Clear();
            foreach (Renew element in elements)
            {
                comboBox1.Items.Add(element);
            }
        }
Exemple #7
0
        private void LoadRenews()
        {
            List <Renew> elements = RenewLogic.GetInstance().GetAllRenews();

            comboBox1.Items.Clear();
            foreach (Renew element in elements)
            {
                comboBox1.Items.Add(element);
            }
            dataGridView1.DataSource = RenewLogic.GetInstance().GetRenews(string.Empty);
        }
Exemple #8
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         if (MessageBox.Show("确定要删除该续卡记录?", "删除提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
         {
             Renew renew = (Renew)comboBox1.SelectedItem;
             if (RenewLogic.GetInstance().DeleteRenew(renew))
             {
                 LoadRenews();
             }
         }
     }
     else
     {
         MessageBox.Show("先选定要删除的续卡记录!");
     }
 }
Exemple #9
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         Renew renew = new Renew();
         renew.ID     = ((Product)comboBox1.SelectedItem).ID;
         renew.Member = comboBox2.SelectedItem as Member;
         renew.卡种     = renew.Member.卡种;
         renew.卡号     = textBox2.Text.Trim();
         renew.续卡时间   = DateTime.Parse(textBox3.Text.Trim());
         renew.经手人    = (selectStaffControl1.SelectedStaffs != null && selectStaffControl1.SelectedStaffs.Count > 0) ? selectStaffControl1.SelectedStaffs[0] : null;
         renew.备注     = textBox6.Text;
         RenewLogic rl = RenewLogic.GetInstance();
         if (rl.UpdateRenew(renew))
         {
             LoadRenews();
             MessageBox.Show("修改成功!");
         }
     }
     else
     {
         MessageBox.Show("先选定要修改的续卡记录!");
     }
 }