public PriceSezrchForm() { View_PriceBusinessLogic view_PriceBusinessLogic = new View_PriceBusinessLogic(); List <View_Price> priceList = new List <View_Price>(); InitializeComponent(); priceList = view_PriceBusinessLogic.GetAllPrice(); this.dataGridView1.DataSource = priceList; setColumn(); }
private void button1_Click(object sender, EventArgs e) { string munename = txbMunename.Text.Trim(); string startDate = txbdate1.Text.Trim(); string endDate = txbdate2.Text.Trim(); View_PriceBusinessLogic view_PriceBusinessLogic = new View_PriceBusinessLogic(); List <View_Price> priceList = new List <View_Price>(); if (munename != "") { if (startDate == "" && endDate == "") { //startDate != ""; priceList = view_PriceBusinessLogic.GetPriceByName(munename); } if (startDate != "" && endDate != "") { //startDate != ""; priceList = view_PriceBusinessLogic.GetPriceByName(munename, startDate, endDate); } if (startDate != "" && endDate == "") { priceList = view_PriceBusinessLogic.GetPriceByStartDate(munename, startDate); } if (startDate == "" && endDate != "") { priceList = view_PriceBusinessLogic.GetPriceByEndDate(munename, endDate); } } else { if (startDate == "" && endDate == "") { //startDate != ""; priceList = view_PriceBusinessLogic.GetAllPrice(); } if (startDate != "" && endDate != "") { //startDate != ""; priceList = view_PriceBusinessLogic.GetAllPriceByDate(startDate, endDate); } if (startDate != "" && endDate == "") { priceList = view_PriceBusinessLogic.GetAllPriceByStartDate(startDate); } if (startDate == "" && endDate != "") { priceList = view_PriceBusinessLogic.GetAllPriceByEndDate(endDate); } } this.dataGridView1.DataSource = priceList; }