Exemplo n.º 1
0
        public eMSL()
        {
            InitializeComponent();

            MSLWait.Hide();
            dataGridView1.Hide();
            SetConnectionString();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            CountryName          = Country.Text;
            ProgramName          = Program.Text;
            CustomerTypeCode     = CustomerType.Text;
            LicenseAgreementType = LicAgreementType.Text;
            string Offerings      = ProgramOfferings.Text;
            string OfferingLevels = OfferingLevel.Text;


            if (CountryName == "")
            {
                MessageBox.Show("Please Select Country");
            }

            else if (ProgramName == "")
            {
                MessageBox.Show("Please Select Program");
            }

            else if (CustomerTypeCode == "")
            {
                MessageBox.Show("Please Select Customer Type");
            }

            else if (LicenseAgreementType == "")
            {
                MessageBox.Show("Please Select LicenseAgreementType");
            }

            else if (Offerings == "")
            {
                MessageBox.Show("Please Select Program Offerings");
            }

            else if (OfferingLevels == "")
            {
                MessageBox.Show("Please Select Offering Levels");
            }


            else
            {
                MSLWait.Show();

                button1.Enabled = false;

                string countryCode = GetCountryCode(CountryName);

                string programCode  = GetProgramCode(ProgramName);
                string customerType = GetCustomerTypeCode(CustomerTypeCode);
                string Lictype      = GetLicenseAgreementType(LicenseAgreementType);

                SqlConnection conn = new SqlConnection(ConnectionString);

                SqlCommand cmd = new SqlCommand(String.Format(@"Select DISTINCT Top 1000 partnumber,ApprovedPriceBeforeTax,ProductFamilyNAme, * From ChannelNetprice CNP with (nolock)
                                                INNER JOIN Item I with (Nolock)
                                                on CNP.itemid=I.itemid
                                                Where  CNP.countrycode ='{0}'
												and CNP.programcode = '{1}'
                                                and CNP.customerTypecode = '{2}'
                                                and CNP.LicenseAgreementTypeCode = '{3}'
                                                and CNP.programofferingcode ='{4}'
                                                and CNP.OfferingLevelcode ='{5}'
                                                and CNP.EndEffectiveDate is NULL
												and (i.ReplacedByPartNumber is null  or i.ReplacedByPartNumber='')"                                                , countryCode, programCode, customerType, Lictype, Offerings, OfferingLevels), conn);


                conn.Open();



                System.Data.DataTable dt = new System.Data.DataTable();

                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                adapter.Fill(dt);
                MSLWait.Hide();
                dataGridView1.Show();
                conn.Close();
                dataGridView1.DataSource = dt;

                button1.Enabled = true;
            }
        }