Пример #1
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;
             }
         }
     }
 }