protected int LoadPermits()
        {
            int rowsReturned = 0;

            try
            {
                DataA dataA = new DataA();

                string firstNameWhereStr = "";
                string lastNameWhereStr  = "";

                if (rbtByNames.Checked)
                {
                    firstNameWhereStr = tbxFirstNameSearch.Value;
                    lastNameWhereStr  = tbxLastNameSearch.Value;
                }

                DataTable dtPermits = dataA.SearchBuildingPermits(firstNameWhereStr, lastNameWhereStr);

                rowsReturned = dtPermits.Rows.Count;

                if (rowsReturned > 0)
                {
                    dgPermits.DataSource = dtPermits;
                }
                else
                {
                    dgPermits.DataSource = null;
                }
                dgPermits.DataBind();
                ToggleDeleteAndEditButtons();
            }
            catch (Exception ex)
            {
                this.ReportExceptions(ex, "Error while loading permits. ", "");
            }
            return(rowsReturned);
        }
コード例 #2
0
    public static object SearchLinkedBuildingPermits(List <BuildingPDirty> searchParams)
    {
        string firstName = searchParams[0].ApplicantFirstName;
        string lastName  = searchParams[0].ApplicantLastName;

        try
        {
            //BuildingPCollection linkedBuildingPermitsCollection = new BuildingPCollection();
            BuildingPDirtyCollection linkedBuildingPermitsCollection = new BuildingPDirtyCollection();

            if (firstName.Length < 41 && lastName.Length < 41)
            {
                DataA     dataA = new DataA();
                DataTable linkedBuildingPermits = dataA.SearchBuildingPermits(firstName, lastName);

                if (linkedBuildingPermits.Rows.Count > 0)
                {
                    foreach (DataRow r in linkedBuildingPermits.Rows)
                    {
                        BuildingPDirty buildingPDirty = new BuildingPDirty();
                        buildingPDirty.ApplicantFirstName    = r["ApplicantFirstName"].ToString();
                        buildingPDirty.ApplicantLastName     = r["ApplicantLastName"].ToString();
                        buildingPDirty.SquareFeet            = r["SquareFeet"].ToString();
                        buildingPDirty.Height                = r["Height"].ToString();
                        buildingPDirty.ConstructionStartDate = r["StartDate"].ToString();
                        if (r["EndDate"].ToString() == DateTime.MaxValue.ToString())
                        {
                            buildingPDirty.EstimatedCompletionDate = "";
                        }
                        else
                        {
                            //DateTime endDateLong = DateTime.Parse(r["EndDate"].ToString());
                            buildingPDirty.EstimatedCompletionDate = r["EndDate"].ToString();
                        }
                        buildingPDirty.Address = r["Address"].ToString();
                        buildingPDirty.City    = r["City"].ToString();
                        buildingPDirty.Zip     = r["Zip"].ToString();
                        buildingPDirty.RemodelOrNewConstruction = r["RemodelOrNewConstruction"].ToString();
                        buildingPDirty.PermitId = r["PermitID"].ToString();
                        //buildingPDirty.PassedValidation = true;
                        //BuildingP buildingP = new BuildingP(buildingPDirty);
                        linkedBuildingPermitsCollection.BuildingPDirtyList.Add(buildingPDirty);
                    }
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                return("firstNameOrLastNameTooLong");
            }

            return(linkedBuildingPermitsCollection);
        }
        catch (Exception)
        {
            return("serverError");
        }
    }