public void LoadDataInBackground() { sqlPriceRepository = new SqlPriceListRepository(); listPrice = sqlPriceRepository.GetPriceListByCriteria(Utility.Utility.ConvertStringToDate("01/01/1990"), Utility.Utility.ConvertStringToDate("01/01/5555"), "", "", "", "", "", 1, ""); string searchValue = radTextBoxElementSearchWord.Text.ToLower().Trim(); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) { MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (listPrice != null) { if (!string.IsNullOrEmpty(searchValue)) showListPrice = listPrice.Where(c => c.Item.ToLower().Contains(searchValue)).ToList<VisitaJayaPerkasa.Entities.PriceList>(); else showListPrice = listPrice; } else showListPrice = null; if (showListPrice != null) { totalPage = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(showListPrice.Count() / Convert.ToDecimal(pageSize)))); currentPage = 1; } else totalPage = 0; sqlPriceRepository = null; }
private void LoadData() { sqlPriceListRepository = new SqlPriceListRepository(); PriceListGridView.ReadOnly = false; if (cboTypeSupplier.Text.ToLower().Equals("shipping lines")) { listPriceList = sqlPriceListRepository.GetPriceListByCriteria(pickerFrom.Value.Date, pickerTo.Value.Date, cbSupplier.SelectedValue.ToString(), cbDestination.SelectedValue.ToString(), (! cbDislayAll.Checked) ? searchResultCustomer.ID.ToString() : "", "", "", 1, ""); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); if(cbDislayAll.Checked) PriceListGridView.ReadOnly = true; } else if (cboTypeSupplier.Text.ToLower().Equals("dooring agent")) { listPriceList = sqlPriceListRepository.GetPriceListByCriteria(pickerFrom.Value.Date, pickerTo.Value.Date, cbSupplier.SelectedValue.ToString(), cbDestination.SelectedValue.ToString(), "", (! cbRecipientDisplay.Checked) ? cboRecipient.SelectedValue.ToString() : "", "", 1, ""); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); if (cbRecipientDisplay.Checked) PriceListGridView.ReadOnly = true; } else if (cboTypeSupplier.Text.ToLower().Equals("trucking")) { listPriceList = sqlPriceListRepository.GetPriceListByCriteria(pickerFrom.Value.Date, pickerTo.Value.Date, cbSupplier.SelectedValue.ToString(), "", (!cbDislayAll.Checked) ? searchResultCustomer.ID.ToString() : "", "", cboStuffingPlace.SelectedValue.ToString(), 1, ""); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); if (cbDislayAll.Checked) PriceListGridView.ReadOnly = true; } else if (cboTypeSupplier.Text.ToLower().Equals("general")) { listPriceList = sqlPriceListRepository.GetPriceListByCriteria(pickerFrom.Value.Date, pickerTo.Value.Date, cbSupplier.SelectedValue.ToString(), "", "", "", "", 1, ""); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } PriceListGridView.Enabled = true; if (listPriceList != null) { for (int i = 0; i < listPriceList.Count(); i++) { object[] obj = {listPriceList.ElementAt(i).ID, listPriceList.ElementAt(i).DateFrom, listPriceList.ElementAt(i).DateTo, listPriceList.ElementAt(i).SupplierID, listPriceList.ElementAt(i).Destination, listPriceList.ElementAt(i).TypeID, listPriceList.ElementAt(i).ConditionID, listPriceList.ElementAt(i).StuffingID, listPriceList.ElementAt(i).Recipient, listPriceList.ElementAt(i).PriceSupplier, listPriceList.ElementAt(i).CustomerID, listPriceList.ElementAt(i).PriceCustomer, listPriceList.ElementAt(i).PriceCourier }; PriceListGridView.Rows.Add(obj); } } sqlPriceListRepository = null; }
private void LoadData() { SqlPriceListRepository sqlPriceListRepository = new SqlPriceListRepository(); listPrice = sqlPriceListRepository.GetPriceListByCriteria(pickerFrom.Value.Date, pickerTo.Value.Date, "", cbDestination.SelectedValue.ToString(), searchResultCustomer.ID.ToString(), "", "", 0, cboType.SelectedValue.ToString()); radGridView1.Enabled = true; if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); else if (listPrice != null) { for (int i = 0; i < listPrice.Count(); i++) { object[] obj = {listPrice.ElementAt(i).ID, listPrice.ElementAt(i).DateFrom, listPrice.ElementAt(i).DateTo, listPrice.ElementAt(i).CustomerID, listPrice.ElementAt(i).Destination, listPrice.ElementAt(i).TypeID, listPrice.ElementAt(i).ConditionID, listPrice.ElementAt(i).PriceCustomer }; radGridView1.Rows.Add(obj); } } sqlPriceListRepository = null; }