private void btn_enter_Click(object sender, EventArgs e)
        {
            int           num  = 0;
            List <string> list = new List <string>();
            string        text = "SELECT * FROM hypos_CUST_RTL WHERE 1 = 1 ";

            if (tb_phone.Text != "請輸入會員聯絡電話或手機")
            {
                text = text + " AND (Telphone like {" + num + "} or Mobile like {" + num + "})";
                list.Add("%" + tb_phone.Text + "%");
                num++;
            }
            if (tb_vipNo.Text != "請刷會員卡(條碼)或輸入會員號")
            {
                text = text + " AND VipNo like {" + num + "}";
                list.Add("%" + tb_vipNo.Text + "%");
                num++;
            }
            if (tb_name.Text != "請輸入會員姓名關鍵字")
            {
                text = text + " AND Name like {" + num + "}";
                list.Add("%" + tb_name.Text + "%");
                num++;
            }
            if (tb_idno.Text != "請輸入會員身分證字號")
            {
                text = text + " AND IdNo like {" + num + "}";
                list.Add("%" + tb_idno.Text + "%");
                num++;
            }
            if (tb_companyIdno.Text != "請輸入統一編號")
            {
                text = text + " AND CompanyIdNo like {" + num + "}";
                list.Add("%" + tb_companyIdno.Text + "%");
                num++;
            }
            if (clb_memberType.CheckedItems.Count > 0)
            {
                bool flag  = false;
                bool flag2 = false;
                foreach (CheckboxItem checkedItem in clb_memberType.CheckedItems)
                {
                    if (!"4".Equals(checkedItem.Value.ToString()))
                    {
                        if ("5".Equals(checkedItem.Value.ToString()))
                        {
                            flag = true;
                        }
                        else
                        {
                            flag2 = true;
                        }
                    }
                }
                if (flag2)
                {
                    text += " AND Type in (";
                    foreach (CheckboxItem checkedItem2 in clb_memberType.CheckedItems)
                    {
                        if (!"4".Equals(checkedItem2.Value.ToString()) && !"5".Equals(checkedItem2.Value.ToString()))
                        {
                            text = text + "{" + num + "},";
                            list.Add(checkedItem2.Value.ToString());
                            num++;
                        }
                    }
                    text = text.Substring(0, text.Length - 1) + ")";
                }
                if (flag)
                {
                    text += " AND Credit > 0";
                }
            }
            string text2 = (cb_status.SelectedItem as ComboboxItem).Value.ToString();

            if (!string.IsNullOrEmpty(text2))
            {
                text = text + " AND status = {" + num + "}";
                list.Add(text2);
            }
            text += " ORDER BY CreateDate DESC";
            frmMemberMangement obj = (frmMemberMangement)base.Owner;

            obj.dt = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, text, list.ToArray(), CommandOperationType.ExecuteReaderReturnDataTable);
            obj.changePage(1);
            obj.pageTotal = (int)Math.Ceiling((double)obj.dt.Rows.Count / 8.0);
            Close();
        }
Beispiel #2
0
        private void btn_Cancel_Click(object sender, EventArgs e)
        {
            int    num  = 0;
            string text = "1999-01-01";
            string str  = DateTime.Now.ToString("D");

            try
            {
                string text2 = "";
                string text3 = "";
                if (!"".Equals(text))
                {
                    text2 = text + " 00:00:00";
                    text3 = str + " 23:59:59";
                }
                else
                {
                    DateTime now = DateTime.Now;
                    text2 = now.AddDays(-7.0).ToString("yyyy-MM-dd 00:00:00");
                    text3 = now.ToString("yyyy-MM-dd 23:59:59");
                }
                string str2 = "SELECT * FROM hypos_user_consumelog WHERE memberId ={0} AND editdate >={1} AND editdate <={2}";
                switch (num)
                {
                case 1:
                    str2 += " and sellType ='0'";
                    break;

                case 2:
                    str2 += " and sellType ='1'";
                    break;

                case 3:
                    str2 += " and sellType ='2'";
                    break;
                }
                if (((DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, str2 + " ORDER BY editdate desc", new string[3]
                {
                    l_VIPNO.Text,
                    text2,
                    text3
                }, CommandOperationType.ExecuteReaderReturnDataTable)).Rows.Count > 0)
                {
                    MessageBox.Show("會員已有消費紀錄,不可刪除");
                    return;
                }
                DialogResult dialogResult = MessageBox.Show("確定刪除?", "會員號: " + l_VIPNO.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.Yes)
                {
                    string    sql       = "DELETE FROM hypos_CUST_RTL WHERE VipNo ={0}";
                    DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, sql, new string[1]
                    {
                        l_VIPNO.Text
                    }, CommandOperationType.ExecuteReaderReturnDataTable);
                    frmMemberMangement frmMemberMangement = new frmMemberMangement();
                    frmMemberMangement.Location = new Point(Form.ActiveForm.Location.X, Form.ActiveForm.Location.Y);
                    Form.ActiveForm.Close();
                    frmMemberMangement.Show();
                    frmMemberMangement.Focus();
                }
                else
                {
                    int num2 = 7;
                }
            }
            catch (Exception)
            {
            }
        }