protected void Page_Load(object sender, EventArgs e) { Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "ajaxupload_script", WebPath.GetPath("js/ajaxupload.3.5.js")); Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "contact_placeholder_script", WebPath.GetPath("js/jquery.watermarkinput.js")); var country = new List <string> { CRMJSResource.ChooseCountry }; var additionalCountries = new List <string> { CRMCommonResource.Country_Gambia, CRMCommonResource.Country_Ghana, CRMCommonResource.Country_RepublicOfCyprus, CRMCommonResource.Country_SierraLeone, CRMCommonResource.Country_Tanzania, CRMCommonResource.Country_Zambia, }; 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(); List <CustomField> data; var networks = new List <ContactInfo>(); 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); if (TargetContact == null) { if (UrlParameters.Type != "people") { data = Global.DaoFactory.GetCustomFieldDao().GetFieldsDescription(EntityType.Company); ExecAssignedContactsView(0); } else { data = Global.DaoFactory.GetCustomFieldDao().GetFieldsDescription(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 }); } } else { if (TargetContact is Person) { data = Global.DaoFactory.GetCustomFieldDao().GetEnityFields(EntityType.Person, TargetContact.ID, true); } else { data = Global.DaoFactory.GetCustomFieldDao().GetEnityFields(EntityType.Company, TargetContact.ID, true); } if (TargetContact is Company) { deleteContactButton.Text = CRMContactResource.DeleteThisCompany; deleteContactButton.OnClientClick = String.Format("return ASC.CRM.ContactActionView.confirmForDelete(1, '{0}');", TargetContact.GetTitle().ReplaceSingleQuote().HtmlEncode()); ExecAssignedContactsView(TargetContact.ID); } else { deleteContactButton.Text = CRMContactResource.DeleteThisPerson; deleteContactButton.OnClientClick = String.Format("return ASC.CRM.ContactActionView.confirmForDelete(0, '{0}');", TargetContact.GetTitle().ReplaceSingleQuote().HtmlEncode()); } 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 }); } String json; using (var stream = new MemoryStream()) { var serializer = new DataContractJsonSerializer(data.GetType()); serializer.WriteObject(stream, data); json = Encoding.UTF8.GetString(stream.ToArray()); } var script = String.Format( @"<script type='text/javascript'> var customFieldList = {0}; var contactNetworks = {1}; </script>", json, JavaScriptSerializer.Serialize(networks)); Page.ClientScript.RegisterStartupScript(typeof(ContactDetailsView), Guid.NewGuid().ToString(), script); if (TargetContact == null || TargetContact is Person) { InitContactSelectorAndCancelButton(); } else { cancelButton.Attributes.Add("href", String.Format("default.aspx?{0}={1}", UrlConstant.ID, TargetContact.ID)); } InitPrivatePanel(); if (TargetContact != null) { HavePermission = CRMSecurity.IsAdmin || TargetContact.CreateBy == SecurityContext.CurrentAccount.ID; } else { HavePermission = true; } }
protected void Page_Load(object sender, EventArgs e) { MobileVer = ASC.Web.Core.Mobile.MobileDetector.IsRequestMatchesMobile(this.Context); Utility.RegisterTypeForAjax(GetType()); Utility.RegisterTypeForAjax(typeof(AjaxProHelper)); _mergePanelPopup.Options.IsPopup = true; List <CustomField> data; if (TargetContact is Company) { data = Global.DaoFactory.GetCustomFieldDao().GetEnityFields(EntityType.Company, Convert.ToInt32(UrlParameters.ID), false); } else { data = Global.DaoFactory.GetCustomFieldDao().GetEnityFields(EntityType.Person, Convert.ToInt32(UrlParameters.ID), false); } var networks = Global.DaoFactory.GetContactInfoDao().GetList(TargetContact.ID, null, null, null).ConvertAll( n => new { Data = n.Data.HtmlEncode(), InfoType = n.InfoType, IsPrimary = n.IsPrimary, CategoryName = n.CategoryToString(), InfoTypeLocalName = n.InfoType.ToLocalizedString() }); InitTagControl(); ExecHistoryView(TargetContact.ID); ExecTasksView(); ExecFilesView(); ExecDealsView(TargetContact.ID); if (TargetContact is Company) { ExecPeopleContainerView(TargetContact.ID); } else { ContactsTab.Visible = false; } ContactsToMerge = Global.DaoFactory.GetContactDao().GetContactsByPrefix(TargetContact.GetTitle(), 0, 0, 30).Where(n => n.ID != TargetContact.ID).ToList(); InitMergeSelector(); String json; using (var stream = new MemoryStream()) { var serializer = new DataContractJsonSerializer(data.GetType()); serializer.WriteObject(stream, data); json = Encoding.UTF8.GetString(stream.ToArray()); } var listItems = Global.DaoFactory.GetListItemDao().GetItems(ListType.ContactStatus); var script = String.Format( @"<script type='text/javascript'> var customFieldList = {0}; var contactNetworks = {1}; var sliderListItems = {2}; var imgExst = {3}; </script>", json, JavaScriptSerializer.Serialize(networks), JavaScriptSerializer.Serialize(new { ID = TargetContact.ID, Status = TargetContact.StatusID, PositionsCount = listItems.Count, Items = listItems }), JavaScriptSerializer.Serialize(FileUtility.ImageExts) ); Page.ClientScript.RegisterStartupScript(typeof(ContactDetailsView), Guid.NewGuid().ToString(), script); _ctrlLoadPhotoContainer.Options.IsPopup = true; _ctrlImgDefaultAvatarSmall.ImageUrl = ContactPhotoManager.GetMediumSizePhoto(0, (TargetContact is Company)); }