Example #1
0
        //public CustomerQuery(Boolean ddc)
        //{
        //    InitializeComponent();
        //    disableDoubleClient = ddc;
        //}

        private void buttonSearch_Click(object sender, EventArgs e)
        {
            String filter       = "";
            String brideName    = textBrideName.Text.Trim();
            String brideContact = textBrideContact.Text.Trim();

            int    status       = comboBoxStatus.SelectedIndex;
            String consultant   = textBoxConsultant.Text.Trim();
            String operatorName = textBoxOperator.Text.Trim();
            String reserveDate  = dtDate.Enabled ? dtDate.Value.ToString("yyyy-MM-dd") : "";

            if (status != 0)
            {
                filter = "status=" + status + "";
            }
            if (reserveDate.Length != 0)
            {
                filter += (filter.Length != 0) ? " and " : "";
                filter += status == 10 ? "marryDay=\'" + reserveDate + "\' " : "reserveDate=\'" + reserveDate + "\' ";
            }

            if (brideName.Length != 0)
            {
                filter += (filter.Length != 0) ? " and " : "";
                filter += "brideName=\'" + brideName + "\' ";
            }

            if (brideContact.Length != 0)
            {
                filter += (filter.Length != 0) ? " and " : "";
                filter += "brideContact=\'" + brideContact + "\' ";
            }

            if (consultant.Length != 0)
            {
                filter += (filter.Length != 0) ? " and " : "";
                filter += "jdgw=\'" + consultant + "\' ";
            }

            if (operatorName.Length != 0)
            {
                filter += (filter.Length != 0) ? " and " : "";
                filter += "operatorName=\'" + operatorName + "\' ";
            }
            //if (Sharevariables.DefaultStoreId == 0)
            //{
            //    filter = (filter.Length != 0) ? " where " + filter : "";
            //}
            //else
            //{
            filter = (filter.Length != 0) ? " where storeId=" + Sharevariables.StoreId + " and " + filter : " where storeId=" + Sharevariables.StoreId;
            //}

            string orderBy = "order by createDate desc";
            Data   stores  = ShardDb.getCustomers(filter, orderBy);

            if (!stores.Success)
            {
                this.Close();
                return;
            }
            dataGridViewCustomers.DataSource = stores.DataTable;
            changeDataGridViewTitle();
            dataGridViewCustomers.Columns["id"].Visible = false;
        }