protected void btnFilter_Click(object sender, EventArgs e) { //----Login filter if (!string.IsNullOrEmpty(txtSearchArtNo.Text)) { var sfilter = new CompareFieldFilter { Expression = txtSearchArtNo.Text, ParamName = "@artNo" }; _paging.Fields["ArtNo"].Filter = sfilter; } else { _paging.Fields["ArtNo"].Filter = null; } //----Firstname filter if (!string.IsNullOrEmpty(txtSearchName.Text)) { var nfilter = new CompareFieldFilter { Expression = txtSearchName.Text, ParamName = "@Name" }; _paging.Fields["Name"].Filter = nfilter; } else { _paging.Fields["Name"].Filter = null; } pageNumberer.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtSearchName.Text)) { var sfilter = new CompareFieldFilter { Expression = txtSearchName.Text, ParamName = "@Name" }; _paging.Fields["BrandName"].Filter = sfilter; } else { _paging.Fields["BrandName"].Filter = null; } if (!string.IsNullOrEmpty(txtSearchProducts_Count.Text)) { var sfilter = new EqualFieldFilter { Value = txtSearchProducts_Count.Text, ParamName = "@ProductsCount" }; _paging.Fields["ProductsCount"].Filter = sfilter; } else { _paging.Fields["ProductsCount"].Filter = null; } ViewState["Show"] = true; pageNumberer.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { //-----Selection filter if (string.Compare(ddSelect.SelectedIndex.ToString(), "0") != 0) { if (string.Compare(ddSelect.SelectedIndex.ToString(), "2") == 0) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; //New InSetFieldFilter() //_SelectionFilter.IncludeValues = True } } _paging.Fields["ID"].Filter = _selectionFilter; } else { _paging.Fields["ID"].Filter = null; } //----Name filter if (!string.IsNullOrEmpty(txtName.Text)) { var nfilter = new CompareFieldFilter { Expression = txtName.Text, ParamName = "@Name" }; _paging.Fields["CityName"].Filter = nfilter; } else { _paging.Fields["CityName"].Filter = null; } //---RegionSort filter if (!string.IsNullOrEmpty(txtRegSort.Text)) { var nfilter = new CompareFieldFilter { Expression = txtRegSort.Text, ParamName = "@CitySort" }; _paging.Fields["CitySort"].Filter = nfilter; } else { _paging.Fields["CitySort"].Filter = null; } pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { //-----Selection filter if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "0") != 0) { if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "2") == 0) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; } } _paging.Fields["ID"].Filter = _selectionFilter; } else { _paging.Fields["ID"].Filter = null; } //----Name filter if (!string.IsNullOrEmpty(txtName.Text)) { var nfilter = new CompareFieldFilter { Expression = txtName.Text, ParamName = "@Name" }; _paging.Fields["Name"].Filter = nfilter; } else { _paging.Fields["Name"].Filter = null; } if (!string.IsNullOrEmpty(txtSortOrder.Text)) { var nfilter = new CompareFieldFilter { Expression = txtSortOrder.Text.TryParseInt().ToString(), ParamName = "@Sort" }; _paging.Fields["Sort"].Filter = nfilter; } else { _paging.Fields["Sort"].Filter = null; } pageNumberer.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { //-----Selection filter if (ddSelect.SelectedIndex != 0) { if (ddSelect.SelectedIndex == 2) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; } } _paging.Fields["ID"].Filter = _selectionFilter; } else { _paging.Fields["ID"].Filter = _selectionFilter; } //----Name filter if (!string.IsNullOrEmpty(txtGroupName.Text)) { var nfilter = new CompareFieldFilter { Expression = txtGroupName.Text, ParamName = "@GroupName" }; _paging.Fields["GroupName"].Filter = nfilter; } else { _paging.Fields["GroupName"].Filter = null; } pageNumberer.CurrentPageIndex = 1; pageNumberer.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { //-----Selection filter if (ddSelect.SelectedIndex != 0) { if (ddSelect.SelectedIndex == 2) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; } } _paging.Fields["ID"].Filter = _selectionFilter; } else { _paging.Fields["ID"].Filter = _selectionFilter; } //----Name filter if (!string.IsNullOrEmpty(txtUrlFilter.Text)) { var nfilter = new CompareFieldFilter { Expression = txtUrlFilter.Text, ParamName = "@URL" }; _paging.Fields["URL"].Filter = nfilter; } else { _paging.Fields["URL"].Filter = null; } //----CurrencyValue filter if (!string.IsNullOrEmpty(txtSortOrder.Text)) { var nfilter = new CompareFieldFilter { Expression = txtSortOrder.Text, ParamName = "@SortOrder" }; _paging.Fields["SortOrder"].Filter = nfilter; } else { _paging.Fields["SortOrder"].Filter = null; } if (ddlEnabled.SelectedIndex != 0) { var eFilter = new EqualFieldFilter { ParamName = "@Enabled" }; if (ddlEnabled.SelectedIndex == 1) { eFilter.Value = "1"; } if (ddlEnabled.SelectedIndex == 2) { eFilter.Value = "0"; } _paging.Fields["Enabled"].Filter = eFilter; } else { _paging.Fields["Enabled"].Filter = null; } pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { //-----Selection filter if (ddSelect.SelectedIndex != 0) { if (ddSelect.SelectedIndex == 2) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; } } _paging.Fields["ID"].Filter = _selectionFilter; } else { _paging.Fields["ID"].Filter = _selectionFilter; } //----ActivateDate filter if (!string.IsNullOrEmpty(txtMessageText.Text)) { var nfilter = new CompareFieldFilter { Expression = txtMessageText.Text, ParamName = "@MessageText" }; _paging.Fields["MessageText"].Filter = nfilter; } else { _paging.Fields["MessageText"].Filter = null; } //---OrderDate filter var dfilter = new DateTimeRangeFieldFilter { ParamName = "@AddDate" }; if (!string.IsNullOrEmpty(txtDateFrom.Text)) { DateTime?d = null; try { d = DateTime.Parse(txtDateFrom.Text); } catch (Exception) { } if (d.HasValue) { var dt = new DateTime(d.Value.Year, d.Value.Month, d.Value.Day, 0, 0, 0, 0); dfilter.From = dt; } } if (!string.IsNullOrEmpty(txtDateTo.Text)) { DateTime?d = null; try { d = DateTime.Parse(txtDateTo.Text); } catch (Exception) { } if (d.HasValue) { var dt = new DateTime(d.Value.Year, d.Value.Month, d.Value.Day, 23, 59, 59, 99); dfilter.To = dt; } } if (dfilter.From.HasValue || dfilter.To.HasValue) { _paging.Fields["AddDate"].Filter = dfilter; } else { _paging.Fields["AddDate"].Filter = null; } pageNumberer.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { //-----Selection filter if (ddSelect.SelectedIndex != 0) { if (ddSelect.SelectedIndex == 2) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; } } _paging.Fields["ID"].Filter = _selectionFilter; } else { _paging.Fields["ID"].Filter = _selectionFilter; } //----Name filter if (!string.IsNullOrEmpty(txtName.Text)) { var nfilter = new CompareFieldFilter { Expression = txtName.Text, ParamName = "@Name" }; _paging.Fields["Name"].Filter = nfilter; } else { _paging.Fields["Name"].Filter = null; } //----CurrencyValue filter if (!string.IsNullOrEmpty(txtValue.Text)) { var nfilter = new CompareFieldFilter { Expression = txtValue.Text, ParamName = "@CurrencyValue" }; _paging.Fields["CurrencyValue"].Filter = nfilter; } else { _paging.Fields["CurrencyValue"].Filter = null; } //---ISO3 filter if (!string.IsNullOrEmpty(txtISO3.Text)) { var nfilter = new CompareFieldFilter { Expression = txtISO3.Text, ParamName = "@CurrencyISO3" }; _paging.Fields["CurrencyISO3"].Filter = nfilter; } else { _paging.Fields["CurrencyISO3"].Filter = null; } //----IsCodeBefore filter if (ddBefore.SelectedIndex != 0) { var beforeFilter = new EqualFieldFilter { ParamName = "@IsCodeBefore" }; if (ddBefore.SelectedIndex == 1) { beforeFilter.Value = "1"; } if (ddBefore.SelectedIndex == 2) { beforeFilter.Value = "0"; } _paging.Fields["IsCodeBefore"].Filter = beforeFilter; } else { _paging.Fields["IsCodeBefore"].Filter = null; } pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { //-----Selection filter if (ddSelect.SelectedIndex != 0) { if (ddSelect.SelectedIndex == 2) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; } } if (_selectionFilter != null) { _paging.Fields["ID"].Filter = _selectionFilter; } } else { _paging.Fields["ID"].Filter = null; } //----Enabled filter if (ddlEnabled.SelectedIndex != 0) { var efilter = new EqualFieldFilter { ParamName = "@enabled" }; if (ddlEnabled.SelectedIndex == 1) { efilter.Value = "1"; } if (ddlEnabled.SelectedIndex == 2) { efilter.Value = "0"; } _paging.Fields["Enabled"].Filter = efilter; } else { _paging.Fields["Enabled"].Filter = null; } //----Price filter var priceFilter = new RangeFieldFilter { ParamName = "@price" }; int priceFrom; priceFilter.From = int.TryParse(txtPriceFrom.Text, out priceFrom) ? priceFrom : 0; int priceTo; priceFilter.To = int.TryParse(txtPriceTo.Text, out priceTo) ? priceTo : int.MaxValue; if (!string.IsNullOrEmpty(txtPriceFrom.Text) || !string.IsNullOrEmpty(txtPriceTo.Text)) { _paging.Fields["Price"].Filter = priceFilter; } else { _paging.Fields["Price"].Filter = null; } //----Qty filter var qtyFilter = new RangeFieldFilter { ParamName = "@Amount" }; int from; qtyFilter.From = int.TryParse(txtQtyFrom.Text, out from) ? from : int.MinValue; int to; qtyFilter.To = int.TryParse(txtQtyTo.Text, out to) ? to : int.MaxValue; if (!string.IsNullOrEmpty(txtQtyFrom.Text) || !string.IsNullOrEmpty(txtQtyTo.Text)) { _paging.Fields["Amount"].Filter = qtyFilter; } else { _paging.Fields["Amount"].Filter = null; } //----SortOrder filter var soFilter = new RangeFieldFilter { ParamName = "@SortOrder" }; try { soFilter.From = int.Parse(txtSortOrderFrom.Text); } catch (Exception) { soFilter.From = int.MinValue; } try { soFilter.To = int.Parse(txtSortOrderTo.Text); } catch (Exception) { soFilter.To = int.MaxValue; } if (ShowMethod == EShowMethod.Normal) { if (!string.IsNullOrEmpty(txtSortOrderFrom.Text) || !string.IsNullOrEmpty(txtSortOrderTo.Text)) { _paging.Fields["ProductCategories.SortOrder"].Filter = soFilter; } else { _paging.Fields["ProductCategories.SortOrder"].Filter = null; } } if (!string.IsNullOrEmpty(txtArtNo.Text)) { var sfilter = new CompareFieldFilter { Expression = txtArtNo.Text, ParamName = "@artno" }; _paging.Fields["ArtNo"].Filter = sfilter; } else { _paging.Fields["ArtNo"].Filter = null; } //----Name filter if (!string.IsNullOrEmpty(txtName.Text)) { var nfilter = new CompareFieldFilter { Expression = txtName.Text, ParamName = "@name" }; _paging.Fields["Name"].Filter = nfilter; } else { _paging.Fields["Name"].Filter = null; } //---Photo filter if (ddPhoto.SelectedIndex != 0) { var phfilter = new NullFieldFilter(); if (ddPhoto.SelectedIndex == 1) { phfilter.Null = false; } if (ddPhoto.SelectedIndex == 2) { phfilter.Null = true; } phfilter.ParamName = "@PhotoName"; _paging.Fields["PhotoName"].Filter = phfilter; } else { _paging.Fields["PhotoName"].Filter = null; } pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; //lblFound.Text = _paging.TotalRowsCount.ToString(); //pnlFilterCount.Visible = true; //pnlNormalCount.Visible = false; }
protected void btnFilter_Click(object sender, EventArgs e) { if (ddSelect.SelectedIndex != 0) { if (ddSelect.SelectedIndex == 2) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; } } _paging.Fields["ID"].Filter = _selectionFilter; } else { _paging.Fields["ID"].Filter = null; } //----Firstname filter if (!string.IsNullOrEmpty(txtSearchFirstName.Text)) { var nfilter = new CompareFieldFilter { Expression = txtSearchFirstName.Text, ParamName = "@firstname" }; _paging.Fields["Firstname"].Filter = nfilter; } else { _paging.Fields["Firstname"].Filter = null; } //----lastname filter if (!string.IsNullOrEmpty(txtSearchLastname.Text)) { var nfilter = new CompareFieldFilter { Expression = txtSearchLastname.Text, ParamName = "@lastname" }; _paging.Fields["Lastname"].Filter = nfilter; } else { _paging.Fields["Lastname"].Filter = null; } //----email filter if (!string.IsNullOrEmpty(txtSearchEmail.Text)) { var nfilter = new CompareFieldFilter { Expression = txtSearchEmail.Text, ParamName = "@email" }; _paging.Fields["Email"].Filter = nfilter; } else { _paging.Fields["Email"].Filter = null; } //----RegDate filter if (!string.IsNullOrEmpty(txtDateFrom.Text) || !string.IsNullOrEmpty(txtDateTo.Text)) { var nfilter = new DateTimeRangeFieldFilter(); try { nfilter.From = DateTime.Parse(txtDateFrom.Text); } catch (Exception) { nfilter.From = DateTime.Parse("01.01.1900"); } try { nfilter.To = DateTime.Parse(txtDateTo.Text); } catch (Exception) { nfilter.To = DateTime.MaxValue; } nfilter.ParamName = "@RegistrationDateTime"; _paging.Fields["RegistrationDateTime"].Filter = nfilter; } else { _paging.Fields["RegistrationDateTime"].Filter = null; } _paging.Fields["CustomerGroupId"].Filter = ddlCustomerGroup.SelectedValue != "0" ? new EqualFieldFilter { ParamName = "@CustomerGroupId", Value = ddlCustomerGroup.SelectedValue } : null; pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { //-----Selection filter if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "0") != 0) { if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "2") == 0) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; } } _paging.Fields["ID"].Filter = _selectionFilter; } else { _paging.Fields["ID"].Filter = null; } //----Name filter if (!string.IsNullOrEmpty(txtName.Text)) { var nfilter = new CompareFieldFilter { Expression = txtName.Text, ParamName = "@Name" }; _paging.Fields["Name"].Filter = nfilter; } else { _paging.Fields["Name"].Filter = null; } //----RegNumber filter if (!string.IsNullOrEmpty(txtRegNumber.Text)) { var nfilter = new CompareFieldFilter { Expression = txtRegNumber.Text, ParamName = "@RegNumber" }; _paging.Fields["RegNumber"].Filter = nfilter; } else { _paging.Fields["RegNumber"].Filter = null; } //----Country filter if (ddlCountryFilter.SelectedIndex != 0) { var nfilter = new CompareFieldFilter { Expression = ddlCountryFilter.SelectedItem.Text, ParamName = "@Country" }; _paging.Fields["CountryName"].Filter = nfilter; } else { _paging.Fields["CountryName"].Filter = null; } //----Enabled filter if (ddlEnabled.SelectedIndex != 0) { var efilter = new EqualFieldFilter { ParamName = "@Enabled" }; if (ddlEnabled.SelectedIndex == 1) { efilter.Value = "1"; } if (ddlEnabled.SelectedIndex == 2) { efilter.Value = "0"; } _paging.Fields["Enabled"].Filter = efilter; } else { _paging.Fields["Enabled"].Filter = null; } pageNumberer.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { //-----Selection filter if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "0") != 0) { if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "2") == 0) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; //New InSetFieldFilter() //_SelectionFilter.IncludeValues = True } } _paging.Fields["ID"].Filter = _selectionFilter; } else { _paging.Fields["ID"].Filter = null; } //----Id filter if (!string.IsNullOrEmpty(txtId.Text)) { var nfilter = new CompareFieldFilter { Expression = txtId.Text, ParamName = "@id" }; _paging.Fields["ID"].Filter = nfilter; } else { _paging.Fields["ID"].Filter = null; } //---RedirectFrom filter if (!string.IsNullOrEmpty(txtRedirectFrom.Text)) { var nfilter = new CompareFieldFilter { Expression = txtRedirectFrom.Text, ParamName = "@RedirectFrom" }; _paging.Fields["RedirectFrom"].Filter = nfilter; } else { _paging.Fields["RedirectFrom"].Filter = null; } //---RedirectTo filter if (!string.IsNullOrEmpty(txtRedirectTo.Text)) { var nfilter = new CompareFieldFilter { Expression = txtRedirectTo.Text, ParamName = "@RedirectTo" }; _paging.Fields["RedirectTo"].Filter = nfilter; } else { _paging.Fields["RedirectTo"].Filter = null; } pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { //-----Selection filter if (ddSelect.SelectedIndex != 0) { if (ddSelect.SelectedIndex == 2) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; } } _paging.Fields["ID"].Filter = _selectionFilter; } else { _paging.Fields["ID"].Filter = _selectionFilter; } if (!string.IsNullOrEmpty(txtProductName.Text.Trim())) { var nfilter = new CompareFieldFilter { Expression = txtProductName.Text, ParamName = "@ProductName" }; _paging.Fields["ProductName"].Filter = nfilter; } else { _paging.Fields["ProductName"].Filter = null; } if (!string.IsNullOrEmpty(txtUserName.Text.Trim())) { var nfilter = new CompareFieldFilter { Expression = txtUserName.Text, ParamName = "@FLName" }; _paging.Fields["UserName"].Filter = nfilter; } else { _paging.Fields["UserName"].Filter = null; } if (!string.IsNullOrEmpty(txtEmail.Text)) { var nfilter = new CompareFieldFilter { Expression = txtEmail.Text, ParamName = "@Email" }; _paging.Fields["Email"].Filter = nfilter; } else { _paging.Fields["Email"].Filter = null; } if (!string.IsNullOrEmpty(txtPhone.Text)) { var nfilter = new CompareFieldFilter { Expression = txtPhone.Text, ParamName = "@Phone" }; _paging.Fields["Phone"].Filter = nfilter; } else { _paging.Fields["Phone"].Filter = null; } if (ddlIsComplete.SelectedIndex != 0) { var isCompleteFilter = new EqualFieldFilter { ParamName = "@IsComplete" }; if (ddlIsComplete.SelectedIndex == 1) { isCompleteFilter.Value = "1"; } if (ddlIsComplete.SelectedIndex == 2) { isCompleteFilter.Value = "0"; } _paging.Fields["IsComplete"].Filter = isCompleteFilter; } else { _paging.Fields["IsComplete"].Filter = null; } pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { //-----Selection filter if (ddSelect.SelectedIndex != 0) { if (ddSelect.SelectedIndex == 2) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; } } _paging.Fields["ID"].Filter = _selectionFilter; } else { _paging.Fields["ID"].Filter = _selectionFilter; } //----FirstName filter if (!string.IsNullOrEmpty(txtFirstName.Text)) { var nfilter = new CompareFieldFilter { Expression = txtFirstName.Text, ParamName = "@FirstName" }; _paging.Fields["FirstName"].Filter = nfilter; } else { _paging.Fields["FirstName"].Filter = null; } //----Login filter //if (!string.IsNullOrEmpty(txtLogin.Text)) //{ // var nfilter = new CompareFieldFilter { Expression = txtLogin.Text, ParamName = "@Login" }; // _paging.Fields["Login"].Filter = nfilter; //} //else //{ // _paging.Fields["Login"].Filter = null; //} //---LastName if (!string.IsNullOrEmpty(txtLastName.Text)) { var nfilter = new CompareFieldFilter { Expression = txtLastName.Text, ParamName = "@LastName" }; _paging.Fields["LastName"].Filter = nfilter; } else { _paging.Fields["LastName"].Filter = null; } //---Email Filter if (!string.IsNullOrEmpty(txtEmail.Text)) { var nfilter = new CompareFieldFilter { Expression = txtEmail.Text, ParamName = "@Email" }; _paging.Fields["Email"].Filter = nfilter; } else { _paging.Fields["Email"].Filter = null; } //----Subscribed4News if (subscribed4News.SelectedIndex != 0) { var beforeFilter = new EqualFieldFilter { ParamName = "@Subscribed4News" }; if (subscribed4News.SelectedIndex == 1) { beforeFilter.Value = "1"; } if (subscribed4News.SelectedIndex == 2) { beforeFilter.Value = "0"; } _paging.Fields["Subscribed4News"].Filter = beforeFilter; } else { _paging.Fields["Subscribed4News"].Filter = null; } //---OrderDate filter var dfilter = new DateTimeRangeFieldFilter { ParamName = "@RegistrationDateTime" }; if (!string.IsNullOrEmpty(txtDateFrom.Text)) { DateTime?d = null; try { d = DateTime.Parse(txtDateFrom.Text); } catch (Exception) { } if (d.HasValue) { var dt = new DateTime(d.Value.Year, d.Value.Month, d.Value.Day, 0, 0, 0, 0); dfilter.From = dt; } } if (!string.IsNullOrEmpty(txtDateTo.Text)) { DateTime?d = null; try { d = DateTime.Parse(txtDateTo.Text); } catch (Exception) { } if (d.HasValue) { var dt = new DateTime(d.Value.Year, d.Value.Month, d.Value.Day, 23, 59, 59, 99); dfilter.To = dt; } } if (dfilter.From.HasValue || dfilter.To.HasValue) { _paging.Fields["RegistrationDateTime"].Filter = dfilter; } else { _paging.Fields["RegistrationDateTime"].Filter = null; } pageNumberer.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { var flogical = new LogicalFilter(); //-----Selection filter if (ddSelect.SelectedIndex != 0) { if (ddSelect.SelectedIndex == 2) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; } } flogical.AddFilter(_selectionFilter); } //----OrderID filter if (!string.IsNullOrEmpty(txtOrderID.Text)) { flogical.AddLogicalOperation("AND"); flogical.AddFilter(new EqualFieldFilter { Value = txtOrderID.Text.TryParseInt().ToString(), ParamName = "@OrderId" }); } _paging.Fields["ID"].Filter = flogical.FilterCount() > 0 ? flogical : null; //----Status filter var stFilter = new CompareFieldFilter(); if (!string.IsNullOrEmpty(ddlStatusName.SelectedValue)) { if (!OrderService.GetOrderStatuses(true).Any(item => item.Key.ToLower() == ddlStatusName.SelectedValue)) { ddlStatusName.Items.Remove(ddlStatusName.SelectedValue); ddlStatusName.SelectedValue = string.Empty; } else if (ddlStatusName.SelectedIndex != 0) { stFilter.ParamName = "@StatusName"; stFilter.Expression = ddlStatusName.SelectedValue; _paging.Fields["StatusName"].Filter = stFilter; } else { _paging.Fields["StatusName"].Filter = null; } } else { _paging.Fields["StatusName"].Filter = null; } //----Sum filter var sumFilter = new RangeFieldFilter { ParamName = "@Sum" }; try { int priceFrom = 0; sumFilter.From = int.TryParse(txtSumFrom.Text, out priceFrom) ? priceFrom : 0; } catch (Exception) { } try { int priceTo = 0; sumFilter.To = int.TryParse(txtSumTo.Text, out priceTo) ? priceTo : int.MaxValue; } catch (Exception) { } _paging.Fields["Sum"].Filter = sumFilter.From.HasValue || sumFilter.To.HasValue ? sumFilter : null; //---- Name filter _paging.Fields["BuyerName"].Filter = !string.IsNullOrEmpty(txtBuyerName.Text) ? new CompareFieldFilter { ParamName = "@BuyerName", Expression = txtBuyerName.Text } : null; //---- Billing Name filter _paging.Fields["BillingName"].Filter = !string.IsNullOrEmpty(txtBillingName.Text) ? new CompareFieldFilter { ParamName = "@BillingName", Expression = txtBillingName.Text } : null; _paging.Fields["PaymentMethod"].Filter = ddlPaymentMethod.SelectedValue != "any" ? new EqualFieldFilter { ParamName = "@PaymentMethod", Value = ddlPaymentMethod.SelectedValue } : null; _paging.Fields["ShippingMethodName"].Filter = ddlShippingMethod.SelectedValue != "any" ? new EqualFieldFilter { ParamName = "@ShippingMethodName", Value = ddlShippingMethod.SelectedValue } : null; _paging.Fields["PaymentDate"].Filter = ddlPayed.SelectedValue != "any" ? ddlPayed.SelectedValue == "yes" ? new NullFieldFilter { ParamName = "@PaymentDate", Null = false } : new NullFieldFilter { ParamName = "@PaymentDate", Null = true } : null; //---OrderDate filter var dfilter = new DateTimeRangeFieldFilter { ParamName = "@dateOrdSearch" }; if (!string.IsNullOrEmpty(txtDateFrom.Text)) { DateTime?d = null; try { d = DateTime.Parse(txtDateFrom.Text); } catch (Exception) { } if (d.HasValue) { var dt = new DateTime(d.Value.Year, d.Value.Month, d.Value.Day, 0, 0, 0, 0); dfilter.From = dt; } } if (!string.IsNullOrEmpty(txtDateTo.Text)) { DateTime?d = null; try { d = DateTime.Parse(txtDateTo.Text); } catch (Exception) { } if (d.HasValue) { var dt = new DateTime(d.Value.Year, d.Value.Month, d.Value.Day, 23, 59, 59, 99); dfilter.To = dt; } } if (dfilter.From.HasValue || dfilter.To.HasValue) { _paging.Fields["OrderDate"].Filter = dfilter; } else { _paging.Fields["OrderDate"].Filter = null; } pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { //-----Selection filter if (ddSelect.SelectedIndex != 0) { if (ddSelect.SelectedIndex == 2) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; //New InSetFieldFilter() //_SelectionFilter.IncludeValues = True } } _paging.Fields["ID"].Filter = _selectionFilter; } else { _paging.Fields["ID"].Filter = null; } //----UserName filter if (!string.IsNullOrEmpty(txtUserName.Text)) { var userfilter = new CompareFieldFilter { ParamName = "@PriceRange", Expression = txtUserName.Text }; _paging.Fields["PriceRange"].Filter = userfilter; } else { _paging.Fields["PriceRange"].Filter = null; } //----Text filter if (!string.IsNullOrEmpty(txtText.Text)) { var textFilter = new CompareFieldFilter { ParamName = "@PercentDiscount", Expression = txtText.Text }; _paging.Fields["PercentDiscount"].Filter = textFilter; } else { _paging.Fields["PercentDiscount"].Filter = null; } pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; }
protected void btnFilter_Click(object sender, EventArgs e) { //-----Selection filter if (ddSelect.SelectedIndex != 0) { if (ddSelect.SelectedIndex == 2) { if (_selectionFilter != null) { _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues; } else { _selectionFilter = null; } } _paging.Fields["Id"].Filter = _selectionFilter; } else { _paging.Fields["Id"].Filter = _selectionFilter; } //----Email filter if (!string.IsNullOrEmpty(txtEmail.Text)) { var nfilter = new CompareFieldFilter { Expression = txtEmail.Text, ParamName = "@Email" }; _paging.Fields["Email"].Filter = nfilter; } else { _paging.Fields["Email"].Filter = null; } //---AddDate filter var dfilter1 = new DateTimeRangeFieldFilter { ParamName = "@SubscribeDate" }; if (!string.IsNullOrEmpty(txtSubscribeDateFrom.Text)) { DateTime?d = null; try { d = DateTime.Parse(txtSubscribeDateFrom.Text); } catch (Exception) { } if (d.HasValue) { var dt = new DateTime(d.Value.Year, d.Value.Month, d.Value.Day, 0, 0, 0, 0); dfilter1.From = dt; } } if (!string.IsNullOrEmpty(txtSubscribeDateTo.Text)) { DateTime?d = null; try { d = DateTime.Parse(txtSubscribeDateTo.Text); } catch (Exception) { } if (d.HasValue) { var dt = new DateTime(d.Value.Year, d.Value.Month, d.Value.Day, 23, 59, 59, 99); dfilter1.To = dt; } } if (dfilter1.From.HasValue || dfilter1.To.HasValue) { _paging.Fields["SubscribeDate"].Filter = dfilter1; } else { _paging.Fields["SubscribeDate"].Filter = null; } //---AddDate filter var dfilter2 = new DateTimeRangeFieldFilter { ParamName = "@UnsubscribeDate" }; if (!string.IsNullOrEmpty(txtUnsubscribeDateFrom.Text)) { DateTime?d = null; try { d = DateTime.Parse(txtUnsubscribeDateFrom.Text); } catch (Exception) { } if (d.HasValue) { var dt = new DateTime(d.Value.Year, d.Value.Month, d.Value.Day, 0, 0, 0, 0); dfilter2.From = dt; } } if (!string.IsNullOrEmpty(txtUnsubscribeDateTo.Text)) { DateTime?d = null; try { d = DateTime.Parse(txtUnsubscribeDateTo.Text); } catch (Exception) { } if (d.HasValue) { var dt = new DateTime(d.Value.Year, d.Value.Month, d.Value.Day, 23, 59, 59, 99); dfilter2.To = dt; } } if (dfilter2.From.HasValue || dfilter2.To.HasValue) { _paging.Fields["UnsubscribeDate"].Filter = dfilter2; } else { _paging.Fields["UnsubscribeDate"].Filter = null; } //----Enable filter if (ddSubscribe.SelectedIndex != 0) { var enableFilter = new EqualFieldFilter { ParamName = "@Subscribe" }; if (ddSubscribe.SelectedIndex == 1) { enableFilter.Value = "1"; } if (ddSubscribe.SelectedIndex == 2) { enableFilter.Value = "0"; } _paging.Fields["Subscribe"].Filter = enableFilter; } else { _paging.Fields["Subscribe"].Filter = null; } pageNumberer.CurrentPageIndex = 1; }