Esempio n. 1
0
        private void btnAddPackage_Click(object sender, EventArgs e)
        {
            string company;

            if (radBtnFedex.Checked == true)
            {
                company = "Fedex";
            }
            else if (radBtnUPS.Checked == true)
            {
                company = "UPS";
            }
            else
            {
                company = "USPS";
            }
            if (radBtnOvernight.Checked == true)
            {
                ovPack = new OvernightPackage(txtBxSName.Text, txtBxSAddress.Text, txtBxSCity.Text, txtBxSState.Text, txtBxSZip.Text, txtBxRName.Text, txtBxRAddress.Text, txtBxRCity.Text, txtBxRState.Text, txtBxRZip.Text, Convert.ToDouble(txtBxWeight.Text), client.GetCost(company), company, client.GetOvernight());
                packages.Add(ovPack);
                lstBxPackages.Items.Clear();
                foreach (object pack in packages)
                {
                    lstBxPackages.Items.Add(pack);
                }
                ClearFields();
                btnCreateInvoice.Enabled = true;
            }
            else if (radBtnTwoDay.Checked == true)
            {
                twPack = new TwoDayPackage(txtBxSName.Text, txtBxSAddress.Text, txtBxSCity.Text, txtBxSState.Text, txtBxSZip.Text, txtBxRName.Text, txtBxRAddress.Text, txtBxRCity.Text, txtBxRState.Text, txtBxRZip.Text, Convert.ToDouble(txtBxWeight.Text), client.GetCost(company), company, client.GetFlatFee());
                packages.Add(twPack);
                lstBxPackages.Items.Clear();
                foreach (object pack in packages)
                {
                    lstBxPackages.Items.Add(pack);
                }
                ClearFields();
                btnCreateInvoice.Enabled = true;
            }
            else
            {
                lblMessage.Text = "Please select shipping method!";
            }
        }
Esempio n. 2
0
 private void lstBxPackages_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lstBxPackages.SelectedIndex == -1)
     {
     }
     else
     {
         ClearFields();
         EnableDisable(false);
         if (lstBxInvoices.SelectedIndex == -1)
         {
             btnDeletePackage.Enabled = true;
         }
         btnUnselectPackage.Enabled    = true;
         btnPrintShippingLabel.Enabled = true;
         int    index = lstBxPackages.SelectedIndex;
         string type  = packages[index].GetType().ToString();
         if (type == "Shipping.OvernightPackage")
         {
             OvernightPackage obj = (OvernightPackage)packages[index];
             txtBxSName.Text         = obj.SenderName;
             txtBxSAddress.Text      = obj.SenderAddress;
             txtBxSCity.Text         = obj.SenderCity;
             txtBxSState.Text        = obj.SenderState;
             txtBxSZip.Text          = obj.SenderZipCode;
             txtBxRName.Text         = obj.RecipientName;
             txtBxRAddress.Text      = obj.RecipientAddress;
             txtBxRCity.Text         = obj.RecipientCity;
             txtBxRState.Text        = obj.RecipientState;
             txtBxRZip.Text          = obj.RecipientZipCode;
             txtBxWeight.Text        = obj.Weight.ToString();
             radBtnOvernight.Checked = true;
             if (obj.Company == "USPS")
             {
                 radBtnUSPS.Checked = true;
             }
             else if (obj.Company == "UPS")
             {
                 radBtnUPS.Checked = true;
             }
             else
             {
                 radBtnFedex.Checked = true;
             }
         }
         else
         {
             TwoDayPackage obj = (TwoDayPackage)packages[index];
             txtBxSName.Text      = obj.SenderName;
             txtBxSAddress.Text   = obj.SenderAddress;
             txtBxSCity.Text      = obj.SenderCity;
             txtBxSState.Text     = obj.SenderState;
             txtBxSZip.Text       = obj.SenderZipCode;
             txtBxRName.Text      = obj.RecipientName;
             txtBxRAddress.Text   = obj.RecipientAddress;
             txtBxRCity.Text      = obj.RecipientCity;
             txtBxRState.Text     = obj.RecipientState;
             txtBxRZip.Text       = obj.RecipientZipCode;
             txtBxWeight.Text     = obj.Weight.ToString();
             radBtnTwoDay.Checked = true;
             if (obj.Company == "USPS")
             {
                 radBtnUSPS.Checked = true;
             }
             else if (obj.Company == "UPS")
             {
                 radBtnUPS.Checked = true;
             }
             else
             {
                 radBtnFedex.Checked = true;
             }
         }
     }
 }