private void PopulateSpecialOffer(int specialofferid)
        {
            DataGridViewRow row = new DataGridViewRow();

            row = dgSpecialOffers.CurrentRow;
            if (row == null)
            {
                return;
            }
            ClearFields();
            try
            {
                foreach (DataGridViewCell cell in row.Cells)
                {
                    switch (cell.OwningColumn.Name)
                    {
                    case "SpecialOfferID":
                        m_SpecialOfferID = Int32.Parse(cell.Value.ToString());
                        break;

                    case "Description":
                        txtDescription.Text = cell.Value.ToString();
                        break;

                    case "DiscountPct":
                        txtDiscount.Text = cell.Value.ToString();
                        break;

                    case "Type":
                        int index = cmbDiscountType.FindString(cell.Value.ToString());
                        cmbDiscountType.SelectedIndex = index;
                        break;

                    case "StartDate":
                        if (cell.Value != null & cell.Value.ToString() != "")
                        {
                            dtStartDate.Value = DateTime.Parse(cell.Value.ToString());
                        }
                        break;

                    case "EndDate":
                        if (cell.Value != null & cell.Value.ToString() != "")
                        {
                            dtEndDate.Value = DateTime.Parse(cell.Value.ToString());
                        }
                        break;

                    case "MinQty":
                        txtMinQuantity.Text = cell.Value.ToString();
                        break;

                    case "MaxQty":
                        txtMaxQuantity.Text = cell.Value.ToString();
                        break;
                    }
                }
                //Get special offer products
                if (m_SpecialOfferID != 0)
                {
                    SpecialOfferProduct sop = new SpecialOfferProduct();
                    Product             p   = new Product();
                    string where = " SpecialOfferID=" + m_SpecialOfferID.ToString();
                    string  OrderBy = " ProductID";
                    DataSet ds      = new DataSet();
                    ds = sop.GetSpecialOfferProductsDataSet(where, OrderBy);
                    int      count         = ds.Tables[0].Rows.Count;
                    string[] ProdutIdArray = new string[count];
                    int      i             = 0;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        ProdutIdArray[i++] = dr["ProductID"].ToString();
                    }
                    where = "ProductId in (";
                    for (i = 0; i < count; i++)
                    {
                        where += ProdutIdArray[i].ToString() + ",";
                    }
                    where  += "0)";
                    OrderBy = "p.Description";
                    ds      = p.GetProductsDataSet(where, OrderBy);
                    PopulateProductGrid(ds, true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "MICS", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
            }
        }