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); }
protected void btnUpdateAddressStreetAndSuburb_Click(object sender, EventArgs e) { DataTable addrChannels = AddressChannelDB.GetDataTable(); ddlAddressAddressChannel.Items.Clear(); ddlAddressAddressChannel.Items.Add(new ListItem("--", "-1")); foreach (DataRow row in addrChannels.Rows) { ddlAddressAddressChannel.Items.Add(new ListItem(row["ac_descr"] + " " + row["act_descr"], row["ac_address_channel_id"].ToString())); } //ddlAddressChannel.SelectedValue = thisRow["ad_address_channel_id"] == DBNull.Value ? "-1" : thisRow["ad_address_channel_id"].ToString(); }
protected void SetupAddressGUI() { string allFeaturesType = "dialogWidth:500px;dialogHeight:750px;center:yes;resizable:no; scroll:no"; string jsType = "javascript:window.showModalDialog('" + "ContactTypeListV2.aspx', '', '" + allFeaturesType + "');document.getElementById('btnUpdateAddressType').click();return false;"; string allFeatures = "dialogWidth:1100px;dialogHeight:600px;center:yes;resizable:no; scroll:no"; string js = "javascript:window.showModalDialog('" + "StreetAndSuburbInfo.aspx', '', '" + allFeatures + "');document.getElementById('btnUpdateAddressStreetAndSuburb').click();return false;"; lnkAddressUpdateType.NavigateUrl = " "; lnkAddressUpdateType.Text = "Add/Edit"; lnkAddressUpdateType.Attributes.Add("onclick", jsType); lnkAddressUpdateChannel.NavigateUrl = " "; lnkAddressUpdateChannel.Text = "Add/Edit"; lnkAddressUpdateChannel.Attributes.Add("onclick", js); string allFeaturesType2 = "dialogWidth:500px;dialogHeight:750px;center:yes;resizable:no; scroll:no"; string jsType2 = "javascript:window.showModalDialog('" + "ContactTypeListV2.aspx', '', '" + allFeaturesType2 + "');document.getElementById('btnUpdatePhoneType').click();return false;"; string allFeaturesType3 = "dialogWidth:500px;dialogHeight:750px;center:yes;resizable:no; scroll:no"; string jsType3 = "javascript:window.showModalDialog('" + "ContactTypeListV2.aspx', '', '" + allFeaturesType3 + "');document.getElementById('btnUpdateEmailType').click();return false;"; lnkEmailUpdateType.NavigateUrl = " "; lnkEmailUpdateType.Text = "Add/Edit"; lnkEmailUpdateType.Attributes.Add("onclick", jsType3); ddlAddressContactType.DataSource = ContactTypeDB.GetDataTable(1); ddlAddressContactType.DataBind(); ddlAddressContactType.SelectedValue = "36"; // set default as business address DataTable dt_PhoneNumbers = ContactTypeDB.GetDataTable(2); ddlPhoneNumber1.DataSource = dt_PhoneNumbers.Copy(); ddlPhoneNumber2.DataSource = dt_PhoneNumbers.Copy(); ddlPhoneNumber1.DataBind(); ddlPhoneNumber2.DataBind(); ddlPhoneNumber1.SelectedValue = "30"; // mobile ddlPhoneNumber2.SelectedValue = "34"; // office lnkPhone1UpdateType.NavigateUrl = " "; lnkPhone1UpdateType.Text = "Add/Edit"; lnkPhone1UpdateType.Attributes.Add("onclick", jsType2); lnkPhone2UpdateType.NavigateUrl = " "; lnkPhone2UpdateType.Text = "Add/Edit"; lnkPhone2UpdateType.Attributes.Add("onclick", jsType2); DataTable emailWeb = ContactTypeDB.GetDataTable(4); DataView dv = emailWeb.DefaultView; dv.RowFilter = string.Format("at_contact_type_id={0}", 27); DataTable emailOnly = dv.ToTable(); ddlEmailContactType.DataSource = emailOnly; //ddlEmailContactType.DataSource = ContactTypeDB.GetDataTable(4); ddlEmailContactType.DataBind(); if (Utilities.GetAddressType().ToString() == "Contact") { // newOrgAddressRow5.Visible = true; DataTable addrChannels = AddressChannelDB.GetDataTable(); ddlAddressAddressChannel.Items.Add(new ListItem("--", "-1")); foreach (DataRow row in addrChannels.Rows) { ddlAddressAddressChannel.Items.Add(new ListItem(row["ac_descr"] + " " + row["act_descr"], row["ac_address_channel_id"].ToString())); } } else if (Utilities.GetAddressType().ToString() == "ContactAus") { //newOrgAddressRow6.Visible = true; DataTable addrChannelTypes = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "AddressChannelType", "", "descr", "address_channel_type_id", "descr"); ddlAddressAddressChannelType.Items.Add(new ListItem("--", "-1")); foreach (DataRow row in addrChannelTypes.Rows) { ddlAddressAddressChannelType.Items.Add(new ListItem(row["descr"].ToString(), row["address_channel_type_id"].ToString())); } } else { throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString()); } DataTable countries = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Country", "", "descr", "country_id", "descr"); ddlAddressCountry.Items.Add(new ListItem("--", "-1")); foreach (DataRow row in countries.Rows) { ddlAddressCountry.Items.Add(new ListItem(row["descr"].ToString(), row["country_id"].ToString())); } ddlAddressCountry.SelectedIndex = Utilities.IndexOf(ddlAddressCountry, "australia"); bool editable = true; Utilities.SetEditControlBackColour(ddlAddressContactType, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(txtAddressAddrLine1, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(txtAddressAddrLine2, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(ddlAddressAddressChannel, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(txtStreet, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(ddlAddressAddressChannelType, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(ddlAddressCountry, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(txtAddressFreeText, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(ddlPhoneNumber1, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(ddlPhoneNumber2, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(txtPhoneNumber1, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(txtPhoneNumber2, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(txtPhoneNumber1FreeText, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(txtPhoneNumber2FreeText, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(ddlEmailContactType, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); Utilities.SetEditControlBackColour(txtEmailAddrLine1, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty); }