/// <summary> /// Binds all the grids /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BindGrids(object sender, EventArgs e) { CompanyGrid.DataBind(); DetailsView1.DataBind(); MarketGrid.DataBind(); CallCenterGrid.DataBind(); NotesList.DataBind(); EmailDeliveryGrid.DataBind(); ContactGrid.DataBind(); ContactEmailGrid.DataBind(); ContactPhoneGrid.DataBind(); BillingGrid.DataBind(); BillingEmailGrid.DataBind(); BillingPhoneGrid.DataBind(); }
/// <summary> /// Based on the command name, update the database with the data. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, CommandEventArgs e) { string commandType = e.CommandName; int id = 0; if (Request.QueryString["AID"] != null) { id = Convert.ToInt32(Request.QueryString["AID"]); } switch (commandType) { case "AddContact": rs.insertContact(txtCFirstName.Text, txtCLastName.Text, txtCAddress1.Text, txtCCity.Text, ddlCState.SelectedValue, txtCZip.Text, id); processDropDowns(id); ContactGrid.DataBind(); break; case "AddContactEmail": rs.insertContactEmail(txtCEmail.Text, Convert.ToInt32(ddlCEmail.SelectedValue), id); ContactEmailGrid.DataBind(); break; case "AddContactPhone": rs.insertContactPhone(txtCPhone.Text, Convert.ToInt32(ddlCPhone.SelectedValue), id); ContactPhoneGrid.DataBind(); break; case "AddBilling": rs.insertBilling(txtBFirstName.Text, txtBLastName.Text, txtBAddress1.Text, txtBCity.Text, ddlBState.SelectedValue, txtBZip.Text, id); processDropDowns(id); BillingGrid.DataBind(); break; case "AddBillingEmail": rs.insertBillingEmail(txtBEmail.Text, Convert.ToInt32(ddlBEmail.SelectedValue), id); BillingEmailGrid.DataBind(); break; case "AddBillingPhone": rs.insertBillingPhone(txtBPhone.Text, Convert.ToInt32(ddlBPhone.SelectedValue), id); BillingPhoneGrid.DataBind(); break; case "AddMarket": int mid = rs.insertMarket(txtMarketName.Text, txtMonthlyBudgets.Text, ddlStatus.SelectedValue, txtMarketZip.Text, txtExcludeZip.Text, id); foreach (ListItem s in ddlCallCenterName.Items) { rs.insertMarketCC(Convert.ToInt32(s.Value), "000-000-0000", mid, id, "Off"); } processDropDowns(id); MarketGrid.DataBind(); CallCenterGrid.DataBind(); break; case "AddMarketCC": rs.insertMarketCC(Convert.ToInt32(ddlCallCenterName.SelectedValue), txtCallCenterPhone.Text, Convert.ToInt32(ddlCCMarket.SelectedValue), id, ddlCCStatus.SelectedValue); CallCenterGrid.DataBind(); break; case "AddMarketEALD": rs.insertMarketEALD(id, txtEmailAddresses.Text); EmailDeliveryGrid.DataBind(); break; default: break; } foreach (Control x in this.Controls) { if (x is TextBox) { ((TextBox)x).Text = ((TextBox)x).ToolTip; } } }