public static void SaveLot(LotModel lot) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) // connection to SQlite { cnn.Execute("insert into Lots (Title,Description,Min_Price,To_Date) values (@Title,@Description,@Min_Price,@To_Date)", lot); } }
private void LotsDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { if (LotsDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null) { currLot = (LotModel)LotsDataGrid.CurrentRow.DataBoundItem; //Отрмую нажату книгу lotSelectedLabel.Text = "Вибраний лот: " + currLot; } } }
public List <OfferModel> GetOffersOutOfDate(List <OfferModel> offerModels, List <LotModel> lotModels) { List <OfferModel> tempListOffers = new List <OfferModel>(); foreach (OfferModel offer in offerModels) { LotModel temoLot = lotModels.Find(item => item.Lot_Id == offer.Lot_Id); DateTime lotDate = DateTime.Parse(temoLot.To_Date); DateTime dateNow = DateTime.Now; if (lotDate <= dateNow) { tempListOffers.Add(offer); } } return(tempListOffers); }