コード例 #1
0
    public static Contact LoadAll(DataRow row)
    {
        Contact a = Load(row, "ad_");

        a.ContactType = ContactTypeDB.Load(row, "at_");
        a.ContactType.ContactTypeGroup = IDandDescrDB.Load(row, "atg_contact_type_group_id", "atg_descr");
        if (row["act_address_channel_type_id"] != DBNull.Value)
        {
            a.AddressChannel = AddressChannelDB.Load(row, "ac_");
            a.AddressChannel.AddressChannelType = IDandDescrDB.Load(row, "act_address_channel_type_id", "act_descr");
        }
        if (row["s_suburb_id"] != DBNull.Value)
        {
            a.Suburb = SuburbDB.Load(row, "s_");
        }
        if (row["c_country_id"] != DBNull.Value)
        {
            a.Country = IDandDescrDB.Load(row, "c_country_id", "c_descr");
        }
        if (row["ad_site_id"] != DBNull.Value)
        {
            a.Site.Name = Convert.ToString(row["site_name"]);
        }
        return(a);
    }
コード例 #2
0
    protected void FillSuburbGrid()
    {
        DataTable dt = SuburbDB.GetDataTable(false, txtSearchSuburbName.Text.Trim(), true, null, (ddlState.SelectedValue == "All" ? null : ddlState.SelectedValue));

        Session["suburb_data"] = dt;

        if (dt.Rows.Count > 0)
        {
            if (IsPostBack && Session["suburb_sortExpression"] != null && Session["suburb_sortExpression"].ToString().Length > 0)
            {
                DataView dataView = new DataView(dt);
                dataView.Sort        = Session["suburb_sortExpression"].ToString();
                GrdSuburb.DataSource = dataView;
            }
            else
            {
                GrdSuburb.DataSource = dt;
            }

            try
            {
                GrdSuburb.DataBind();
                GrdSuburb.PagerSettings.FirstPageText = "1";
                GrdSuburb.PagerSettings.LastPageText  = GrdSuburb.PageCount.ToString();
                GrdSuburb.DataBind();
            }
            catch (Exception ex)
            {
                this.lblErrorMessage.Visible = true;
                this.lblErrorMessage.Text    = ex.ToString();
            }
        }
        else
        {
            dt.Rows.Add(dt.NewRow());
            GrdSuburb.DataSource = dt;
            GrdSuburb.DataBind();

            int TotalColumns = GrdSuburb.Rows[0].Cells.Count;
            GrdSuburb.Rows[0].Cells.Clear();
            GrdSuburb.Rows[0].Cells.Add(new TableCell());
            GrdSuburb.Rows[0].Cells[0].ColumnSpan = TotalColumns;
            GrdSuburb.Rows[0].Cells[0].Text       = "No Record Found";
        }
    }
コード例 #3
0
    protected void UpdateSuburbInfo(bool redirect)
    {
        return;

        int newSuburbID = Convert.ToInt32(suburbID.Value);

        if (newSuburbID == -1)
        {
            lblSuburbText.Text = "--";
        }
        else
        {
            Suburb suburb = SuburbDB.GetByID(newSuburbID);
            lblSuburbText.Text = suburb.Name + ", " + suburb.State + "(" + suburb.Postcode + ")";
        }

        if (redirect)
        {
            string url = Request.RawUrl;
            url = UrlParamModifier.Update(newSuburbID != -1, url, "suburb", newSuburbID == -1 ? "" : newSuburbID.ToString());
            Response.Redirect(url);
        }
    }
コード例 #4
0
    protected string GetMatches()
    {
        string suburbNameMatch = Request.QueryString["q"];

        if (suburbNameMatch == null || suburbNameMatch.Length == 0)
        {
            throw new CustomMessageException();
        }

        string stateMatch = Request.QueryString["state"];

        //suburbNameMatch = suburbNameMatch.Replace("[", "").Replace("]", "").Trim();


        int maxResults = 80;

        if (Request.QueryString["max_results"] != null)
        {
            if (!Regex.IsMatch(Request.QueryString["max_results"], @"^\d+$"))
            {
                throw new CustomMessageException();
            }
            maxResults = Convert.ToInt32(Request.QueryString["max_results"]);
        }

        string link_href = Request.QueryString["link_href"];

        if (link_href == null)
        {
            throw new CustomMessageException();
        }
        link_href = System.Web.HttpUtility.UrlDecode(link_href);

        string link_onclick = Request.QueryString["link_onclick"];

        if (link_onclick == null)
        {
            throw new CustomMessageException();
        }
        link_onclick = System.Web.HttpUtility.UrlDecode(link_onclick);


        DataTable results = SuburbDB.GetDataTable(true, suburbNameMatch, true, null, stateMatch);

        if (results.Rows.Count > maxResults)
        {
            return("Too many results (" + results.Rows.Count + ")");
        }

        string result      = string.Empty;
        string tableResult = string.Empty;

        foreach (DataRow row in results.Rows)
        {
            string href    = link_href.Replace("[suburb_id]", row["suburb_id"].ToString()).Replace("[state]", row["state"].ToString()).Replace("[postcode]", row["postcode"].ToString()).Replace("[name]", row["name"].ToString());
            string onclick = link_onclick.Replace("[suburb_id]", row["suburb_id"].ToString()).Replace("[state]", row["state"].ToString()).Replace("[postcode]", row["postcode"].ToString()).Replace("[name]", row["name"].ToString().Replace("'", "\\'"));

            //string link = "<a " + (onclick.Length == 0 ? "" : " onclick=\"" + onclick + "\" ") + " href='" + href + @"' onmouseover=""show_staff_detail('suburb_detail_" + row["suburb_id"].ToString() + "', " + row["suburb_id"].ToString() + @"); return true;"" onmouseout=""hide_suburb_detail('suburb_detail_" + row["suburb_id"].ToString() + @"'); return true;"" >" + row["name"] + ", " + row["postcode"] + ", " + row["state"] + @"</a>";
            string link     = "<a " + (onclick.Length == 0 ? "" : " onclick=\"" + onclick + "\" ") + " href='" + href + @"'>" + row["name"] + ", " + row["postcode"] + ", " + row["state"] + @"</a>";
            string hoverDiv = @"<div id=""suburb_detail_" + row["suburb_id"].ToString() + @""" style=""display: none;"" class=""FAQ"">IMAGE OR TEXT HERE<br> </div>";

            result      += (result.Length == 0 ? "" : "<br />") + link;
            tableResult += "<tr><td>" + link + "</td><td>" + hoverDiv + "</td></tr>";
        }


        bool useTableResult = true;

        if (useTableResult)
        {
            return("<table>" + tableResult + "</table>");
        }
        else
        {
            return(result);
        }
    }