public HashSet <Medicine> FiltterMedicine(Fillter stock, Fillter batch, Fillter Price, string medicinename) { string qStocked; if (stock.IsActive) { qStocked = $"stocked between {stock.LowValue} and {stock.HighValue}"; } else { qStocked = $"stocked between {0} and {int.MaxValue}"; } string qBatch; if (batch.IsActive) { qBatch = $"Batch between {batch.LowValue} and {batch.HighValue}"; } else { qBatch = $"Batch between {0} and {int.MaxValue}"; } string qPrice; if (Price.IsActive) { qPrice = $"price between {Price.LowValue} and {Price.HighValue}"; } else { qPrice = $"price between {0} and {int.MaxValue}"; } string cQuery = $"select * from FullMedicineStatusViewAdvance " + $"where {qStocked} and {qBatch} and {qPrice} and medName like'{medicinename}%' "; MySqlCommand cmd = new MySqlCommand(cQuery, globalCon); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { string name = reader.GetString(0); int stocked = reader.GetInt16(1); int stockedExpB = reader.GetInt16(2); int batchs = reader.GetInt16(3); int medPrice = reader.GetInt16(4); int onSchedule = reader.GetInt16(5); Medicine medicine = BindData(name, stocked, stockedExpB, batchs, medPrice, onSchedule); if (!filtterdMedicine.Contains(medicine)) { filtterdMedicine.Add(medicine); } } reader.Close(); return(filtterdMedicine); }
//init vars public void Init() { state = State.None; fillter = Fillter.AllWords; sorter = Sorter.Alphabetical; _letter = 'A'; _listPicked = null; _listpickedindex = 0; kepper = new WordsKepper(); words = kepper.GetArrayWordList(); //26 letters }
void Fillter() { FilttedMedicineSet.Clear(); bool bStock = (bool)chkStocked.IsChecked; bool bBatch = (bool)chkBatch.IsChecked; bool bPrice = (bool)chkPrice.IsChecked; Fillter fillterStock = new Fillter(int.Parse(txtChkStockedLow.Text), int.Parse(txtChkStockdeHigh.Text), bStock); Fillter fillterBatch = new Fillter(int.Parse(txtChkBatchLow.Text), int.Parse(txtChkBatchHigh.Text), bBatch); Fillter fillterPrice = new Fillter(int.Parse(txtChkPriceLow.Text), int.Parse(txtChkPriceHigh.Text), bPrice); FilttedMedicineSet = new MySqlMedicineListing().FiltterMedicine(fillterStock, fillterBatch, fillterPrice, txtMedicineSearchBox.Text); FillWithData(FilttedMedicineSet); }
public async Task <IActionResult> GetProducts([FromQuery] Fillter fillterProduct, [FromQuery] string?platform) { if (platform is null) { var result = await _productService.GetProduct(fillterProduct); return(Ok(result)); } else { return(Ok(new { status = true, data = await _context.Products.ToListAsync() })); } }
public async Task <Object> GetProduct(Fillter fillter) { var product = _dbContext.Products.AsEnumerable <Product>(); if (fillter.IdCatalog != -1) { product = product.Where(p => p.IdCatalog == fillter.IdCatalog); } if (fillter.key != "") { product = product.Where(p => p.Name.ToLower().Contains(fillter.key)); } return(PaginatedList <Product> .Create(product, fillter.page, 12)); }
//The function update the Fillter from a choosen string private void UpdateFillter(String filt) { if (filt != null) { switch (filt) { case "All Words": fillter = Fillter.AllWords; break; case "Known Words": fillter = Fillter.KnownWords; break; case "Unknown Words": fillter = Fillter.UnknownWords; break; case "New Words": fillter = Fillter.NewWords; break; default: fillter = Fillter.AllWords; break; } RunFillter(); } }
public void StartNotifycation(string conectionString, string tableEvent, String notificationName, List <string> columNotify, List <EvnetFillterDataBase> eventDatabase, List <RecipientType> recipientsType, String fillterValidation, String queryPostNotificaiton, Boolean isNnotificationFromTable, int?delayNotification) { NotificationName = notificationName; RecipientType = recipientsType; ConectionString = conectionString; TableEvnet = tableEvent; FillterValidatePostScript = fillterValidation; NoficationFromTable = isNnotificationFromTable; QueryPostNotification = queryPostNotificaiton; if (delayNotification.HasValue) { DelayNotification = delayNotification.Value; } if (!NoficationFromTable) { String where = ""; int countColum = 0; columNotify.ForEach(c => { if (countColum == 0) { ColumsNotify += c; } else { ColumsNotify += "," + c; } countColum++; }); int countFillger = 0; eventDatabase.ForEach(t => { if (!where.ToUpper().Contains(t.FillterDatabsase.ToUpper())) { if (countFillger == 0) { where += "(" + t.FillterDatabsase + ")"; } else { where += " OR " + "(" + t.FillterDatabsase + ")"; } } countFillger++; }); eventDatabase.ForEach(e => { EventSupportFromQuery.Add(CastEventFromQuery(e.EventDatabse)); }); Fillter = String.Format("Select {0} from dbo.{1} Where {2}", ColumsNotify, tableEvent, where); if (String.IsNullOrEmpty(where)) { Fillter = Fillter.Replace("Where", ""); } StartServiceQueryDependecy(); } else { eventDatabase.ForEach(e => { EventSupportFromTable.Add(CastEventFromTable(e.EventDatabse)); }); StartServiceTableDependecy(ConectionString, EventSupportFromTable); } }