Exemple #1
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         lblInstaller.Text = string.Empty;
         LinqToSqlDataContext dataCtxt = new LinqToSqlDataContext();
         string installerName          = installerCompanyName.Text.Trim().ToLower();
         string postCode = txtPostCode.Text.Trim().ToLower();
         List <GetInstallersByNameOrPostCodeResult> installerQry = dataCtxt.GetInstallersByNameOrPostCode(installerName, postCode, Convert.ToInt32(Session[enumSessions.ARC_Id.ToString()])).ToList();
         var listCount = installerQry.Count();
         if (listCount > 0)
         {
             rptInstallerCompanies.DataSource = installerQry;
             rptInstallerCompanies.DataBind();
             lblErrorMessage.Text = string.Empty;
         }
         else
         {
             rptInstallerCompanies.DataSource = null;
             rptInstallerCompanies.DataBind();
             lblErrorMessage.Text = "No Installers match your search criteria, please try again.";
         }
     }
     catch (Exception exp)
     {
         ListItem item = new ListItem();
         item.Text = "Error Loading.. ";
     }
 }
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         LinqToSqlDataContext dataCtxt = new LinqToSqlDataContext();
         string installerName          = installerCompanyName.Text.Trim().ToLower();
         string postCode = txtPostCode.Text.Trim().ToLower();
         List <GetInstallersByNameOrPostCodeResult> installerQry = dataCtxt.GetInstallersByNameOrPostCode(installerName, postCode, Convert.ToInt32(Session[enumSessions.ARC_Id.ToString()])).ToList();
         var listCount = installerQry.Count();
         if (listCount > 0)
         {
             rptInstallerCompanies.DataSource = installerQry;
             rptInstallerCompanies.DataBind();
             lblErrorMessage.Text = string.Empty;
         }
         else
         {
             rptInstallerCompanies.DataSource = null;
             rptInstallerCompanies.DataBind();
             string script = "alertify.alert('" + ltrNoMatch.Text + "');";
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
         }
         AjaxControlToolkit.ModalPopupExtender mpInstaller = Parent.FindControl("mpInstaller") as AjaxControlToolkit.ModalPopupExtender;
         if (mpInstaller != null)
         {
             mpInstaller.Show();
         }
     }
     catch (Exception objException)
     {
         CSLOrderingARCBAL.LinqToSqlDataContext db;
         db = new CSLOrderingARCBAL.LinqToSqlDataContext();
         db.USP_SaveErrorDetails(Request.Url.ToString(), ((System.Reflection.MemberInfo)(objException.TargetSite)).Name, Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
     }
 }