public MOET_Sku_Search() { InitializeComponent(); SetConnectionString(); MoetWait.Hide(); MoetResult.Hide(); LoadCountryDropdown(); }
private void button1_Click(object sender, EventArgs e) { OrderType = MoetOrder.Text; CountryName = Country.Text; CustomerType = MoetCusType.Text; CustomerID = CustomerNumber.Text; CurrencyCode = Currency.Text; if (OrderType == "") { MessageBox.Show("Please select orderType"); } else if (CountryName == "") { MessageBox.Show("Please select CountryName"); } else if (CustomerType == "") { MessageBox.Show("Please select Customer Type"); } else if (CustomerID == "") { MessageBox.Show("Please Enter Customer Number"); } else if (CurrencyCode == "") { MessageBox.Show("Please select Currency"); } else if (OrderType == "FPP Order") { MoetWait.Show(); MoetSearch.Enabled = false; SqlConnection Conn = new SqlConnection(ConnectionString); CountryCode = GetCountryCode(CountryName); SqlCommand cmd = new SqlCommand("select top 10 * from Customer", Conn); SqlDataAdapter adapter = new SqlDataAdapter(cmd); Conn.Open(); adapter.Fill(dt); MoetWait.Hide(); Conn.Close(); MoetResult.Show(); MoetResult.DataSource = dt; MoetSearch.Enabled = true; } else if (OrderType == "Open Business Order") { string Status = GetStatus(StatusCode); if (Status == "ACT") { MoetWait.Show(); MoetSearch.Enabled = false; CountryCode = GetCountryCode(CountryName); SqlConnection Conn = new SqlConnection(ConnectionString); SqlCommand cmd = new SqlCommand(String.Format(@"select C.CustomerNumber,OP.Partnumber,C.CurrencyCode,SL.SalesLocationName,OP.PriceLocal, * from OpenVItemPriceList OP join customer C on C.CustomerID = OP.CustomerID join saleslocation SL on SL.SalesLocationCode = C.SalesLocationCode where CustomerStatusCode = 'ACT' and SL.SalesLocationCode = '{0}' and C.CurrencyCode = '{1}' and CustomerNumber = '{2}' and CustomerTypeCode = '{3}'", CountryCode, CurrencyCode, CustomerID, CustomerType), Conn); SqlDataAdapter adapter = new SqlDataAdapter(cmd); Conn.Open(); adapter.Fill(dt); MoetWait.Hide(); Conn.Close(); MoetResult.Show(); MoetResult.DataSource = dt; MoetSearch.Enabled = true; } else { MessageBox.Show("Customer Number is Invalid or not active"); } } else if (OrderType == "Open Business +500 Order") { MoetWait.Show(); MoetSearch.Enabled = false; SqlConnection Conn = new SqlConnection(ConnectionString); CountryCode = GetCountryCode(CountryName); SqlCommand cmd = new SqlCommand(String.Format(@"select C.CustomerNumber,P.Partnumber,C.CurrencyCode,SL.SalesLocationName,P.PriceLocal, * from MOLPItemPriceList P join customer C on C.CustomerID = P.CustomerID join saleslocation SL on SL.SalesLocationCode = C.SalesLocationCode where CustomerStatusCode = 'ACT' and SL.SalesLocationCode = '{0}' and C.CurrencyCode = '{1}' and CustomerNumber = '{2}' and CustomerTypeCode = '{3}'", CountryCode, CurrencyCode, CustomerID, CustomerType), Conn); SqlDataAdapter adapter = new SqlDataAdapter(cmd); Conn.Open(); adapter.Fill(dt); MoetWait.Hide(); Conn.Close(); MoetResult.Show(); MoetResult.DataSource = dt; MoetSearch.Enabled = true; } }