protected void Page_Load(object sender, EventArgs e) { ContactInfoTypes = (from ContactInfoType item in Enum.GetValues(typeof(ContactInfoType)) where (item != ContactInfoType.Address && item != ContactInfoType.Email && item != ContactInfoType.Phone) select item).ToList(); LinkMessageId = UrlParameters.LinkMessageId; saveContactButton.Text = SaveContactButtonText; saveContactButton.OnClientClick = String.Format("return ASC.CRM.ContactActionView.submitForm('{0}');", saveContactButton.UniqueID); saveAndCreateContactButton.Text = SaveAndCreateContactButtonText; saveAndCreateContactButton.OnClientClick = String.Format("return ASC.CRM.ContactActionView.submitForm('{0}');", saveAndCreateContactButton.UniqueID); List <CustomField> data; var networks = new List <ContactInfo>(); if (TargetContact == null) { data = Global.DaoFactory.GetCustomFieldDao().GetFieldsDescription(UrlParameters.Type != "people" ? EntityType.Company : EntityType.Person); var URLEmail = UrlParameters.Email; if (!String.IsNullOrEmpty(URLEmail)) { networks.Add(new ContactInfo() { Category = (int)ContactInfoBaseCategory.Work, ContactID = 0, Data = URLEmail.HtmlEncode(), ID = 0, InfoType = ContactInfoType.Email, IsPrimary = true }); } if (UrlParameters.Type != "people") { //init ListContactView RegisterClientScriptHelper.DataListContactTab(Page, 0, EntityType.Company); } } else { data = Global.DaoFactory.GetCustomFieldDao().GetEnityFields( TargetContact is Person ? EntityType.Person : EntityType.Company, TargetContact.ID, true); networks = Global.DaoFactory.GetContactInfoDao().GetList(TargetContact.ID, null, null, null).ConvertAll( n => new ContactInfo() { Category = n.Category, ContactID = n.ContactID, Data = n.Data.HtmlEncode(), ID = n.ID, InfoType = n.InfoType, IsPrimary = n.IsPrimary }); if (TargetContact is Company) { //init ListContactView RegisterClientScriptHelper.DataListContactTab(Page, TargetContact.ID, EntityType.Company); } } RegisterClientScriptHelper.DataContactActionView(Page, TargetContact, data, networks); if (TargetContact != null) { cancelButton.Attributes.Add("href", String.Format("default.aspx?{0}={1}{2}", UrlConstant.ID, TargetContact.ID, !String.IsNullOrEmpty(UrlParameters.Type) ? String.Format("&{0}={1}", UrlConstant.Type, UrlParameters.Type) : String.Empty)); } else { cancelButton.Attributes.Add("href", Request.UrlReferrer != null && Request.Url != null && String.Compare(Request.UrlReferrer.PathAndQuery, Request.Url.PathAndQuery) != 0 ? Request.UrlReferrer.OriginalString : "default.aspx"); } InitContactManagerSelector(); RegisterScript(); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } MobileVer = Core.Mobile.MobileDetector.IsRequestMatchesMobile(this.Context); var country = new List <string> { CRMJSResource.ChooseCountry }; var enUs = CultureInfo.GetCultureInfo("en-US"); var additionalCountries = new List <string> { CRMCommonResource.ResourceManager.GetString("Country_Gambia", enUs), CRMCommonResource.ResourceManager.GetString("Country_Ghana", enUs), CRMCommonResource.ResourceManager.GetString("Country_RepublicOfCyprus", enUs), CRMCommonResource.ResourceManager.GetString("Country_SierraLeone", enUs), CRMCommonResource.ResourceManager.GetString("Country_Tanzania", enUs), CRMCommonResource.ResourceManager.GetString("Country_Zambia", enUs), CRMCommonResource.ResourceManager.GetString("Country_RepublicOfMadagascar", enUs), CRMCommonResource.ResourceManager.GetString("Country_SolomonIslands", enUs), CRMCommonResource.ResourceManager.GetString("Country_RepublicOfMoldova", enUs), CRMCommonResource.ResourceManager.GetString("Country_RepublicOfMauritius", enUs) }; var standardCountries = Global.GetCountryList(); standardCountries.AddRange(additionalCountries); country.AddRange(standardCountries.OrderBy(c => c)); contactCountry.DataSource = country; contactCountry.Name = "contactInfo_Address_" + (int)ContactInfoBaseCategory.Work + "_" + AddressPart.Country; contactCountry.DataBind(); ContactInfoTypes = (from ContactInfoType item in Enum.GetValues(typeof(ContactInfoType)) where (item != ContactInfoType.Address && item != ContactInfoType.Email && item != ContactInfoType.Phone) select item).ToList(); saveContactButton.Text = SaveContactButtonText; saveContactButton.OnClientClick = String.Format("return ASC.CRM.ContactActionView.submitForm('{0}');", saveContactButton.UniqueID); saveAndCreateContactButton.Text = SaveAndCreateContactButtonText; saveAndCreateContactButton.OnClientClick = String.Format("return ASC.CRM.ContactActionView.submitForm('{0}');", saveAndCreateContactButton.UniqueID); List <CustomField> data; var networks = new List <ContactInfo>(); if (TargetContact == null) { data = Global.DaoFactory.GetCustomFieldDao().GetFieldsDescription(UrlParameters.Type != "people" ? EntityType.Company : EntityType.Person); var URLEmail = UrlParameters.Email; if (!String.IsNullOrEmpty(URLEmail)) { networks.Add(new ContactInfo() { Category = (int)ContactInfoBaseCategory.Work, ContactID = 0, Data = URLEmail.HtmlEncode(), ID = 0, InfoType = ContactInfoType.Email, IsPrimary = true }); } if (UrlParameters.Type != "people") { //init ListContactView RegisterClientScriptHelper.DataListContactTab(Page, 0, EntityType.Company); } } else { data = Global.DaoFactory.GetCustomFieldDao().GetEnityFields( TargetContact is Person ? EntityType.Person : EntityType.Company, TargetContact.ID, true); networks = Global.DaoFactory.GetContactInfoDao().GetList(TargetContact.ID, null, null, null).ConvertAll( n => new ContactInfo() { Category = n.Category, ContactID = n.ContactID, Data = n.Data.HtmlEncode(), ID = n.ID, InfoType = n.InfoType, IsPrimary = n.IsPrimary }); if (TargetContact is Company) { //init ListContactView RegisterClientScriptHelper.DataListContactTab(Page, TargetContact.ID, EntityType.Company); } } RegisterClientScriptHelper.DataContactActionView(Page, TargetContact, data, networks); if (TargetContact != null) { cancelButton.Attributes.Add("href", String.Format("default.aspx?{0}={1}{2}", UrlConstant.ID, TargetContact.ID, !String.IsNullOrEmpty(UrlParameters.Type) ? String.Format("&{0}={1}", UrlConstant.Type, UrlParameters.Type) : String.Empty)); } else { cancelButton.Attributes.Add("href", Request.UrlReferrer != null && Request.Url != null && String.Compare(Request.UrlReferrer.PathAndQuery, Request.Url.PathAndQuery) != 0 ? Request.UrlReferrer.OriginalString : "default.aspx"); } InitContactManagerSelector(); RegisterScript(); }