Ejemplo n.º 1
0
 protected void DdlClientsSelectedIndexChanged(object sender, EventArgs e)
 {
     lblError.Text = "";
     if (ddlClients.SelectedIndex == 0)
     {
         ClearListBoxes();
     }
     else
     {
         try
         {
             using (var client = new QCAstServiceClient())
             {
                 ddlClientInvoiceHistory.Items.Clear();
                 ddlClientInvoiceHistory.DataSource =
                     client.GetInvoicesForClient(int.Parse(ddlClients.SelectedValue));
                 ddlClientInvoiceHistory.DataBind();
                 ddlClientInvoiceHistory.Items.Insert(0, new ListItem("-- Current Invoice --", "0"));
             }
         }
         catch (Exception ex)
         {
             NotifyWebmasterOfError("Billing", "Billing ddlSelectedIndex_Changed", ex.ToString());
             lblError.Text =
                 "The website encountered a problem retrieving the list of invoices for this client.  The webmaster has been notified and will be attending to the problem shortly.";
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["IdUser"] == null)
     {
         FormsAuthentication.RedirectToLoginPage();
     }
     else
     {
         if (!IsPostBack)
         {
             try
             {
                 using (QCAstServiceClient client = new QCAstServiceClient())
                 {
                     int  idUser = int.Parse(Session["IdUser"].ToString());
                     User user   = client.GetUserFromId(idUser);
                     if (user.IdClient == null)
                     {
                         Response.Redirect("AdminBilling.aspx");
                     }
                     else
                     {
                         int idClient = user.IdClient.Value;
                         ddlClientInvoiceHistory.Items.Clear();
                         ddlClientInvoiceHistory.DataSource = client.GetInvoicesForClient(idClient);
                         ddlClientInvoiceHistory.DataBind();
                         ddlClientInvoiceHistory.Items.Insert(0, new ListItem("Please select..", "0"));
                         Session.Add("IdClient", idClient);
                     }
                 }
             }
             catch (Exception ex)
             {
                 NotifyWebmasterOfError("Billing", "ClientBilling Page_Load", ex.ToString());
                 Response.Redirect("ErrorPage.aspx?Error=GeneralError");
             }
         }
     }
 }