protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.PickDateTime.MaxDate = DateTime.Now; this.PickDateTime.SelectedDate = DateTime.Now; this.PickDateTime.FocusedDate = DateTime.Now; this.PickDateTime.DateInput.Culture = new System.Globalization.CultureInfo("sv-SE"); this.PickEndDate.DateInput.Culture = new System.Globalization.CultureInfo("sv-SE"); this.PickDateTime.TimeView.Culture = new System.Globalization.CultureInfo("sv-SE"); this.LabelCountResults.Text = Organization.FromIdentity(Organization.PPSEid).GetMemberCount().ToString(); this.LabelStartDate.Text = DateTime.Today.ToString("yyyy-MM-dd"); this.TextHeight.Text = "5"; this.TextWidth.Text = "7"; int[] orgsToList = new int[] { Organization.PPSEid, Organization.UPSEid }; DropDownListOrg.Items.Clear(); foreach (int orgId in orgsToList) { Organization org = Organization.FromIdentity(orgId); DropDownListOrg.Items.Add(new ListItem(org.Name, org.Identity.ToString())); } } this.TextHeight.Style.Add(HtmlTextWriterStyle.Width, "40px"); this.TextWidth.Style.Add(HtmlTextWriterStyle.Width, "40px"); this.DropUnit.Style.Add(HtmlTextWriterStyle.Width, "70px"); Controls_v4_WSGeographyTreeDropDown.EmitScripts(this); }
protected void Page_Load(object sender, EventArgs e) { this.pagePermissionDefault = new PermissionSet(Permission.CanEditOrg); enteringMode = FormView1.CurrentMode; Controls_v4_WSGeographyTreeDropDown.EmitScripts(this); Controls_v4_WSOrgTreeDropDown.EmitScripts(this); WSOrgTreeDropDownSelectForEdit.tree.SetAuthority(_authority, Permission.CanEditOrg); programmedStyleTag.InnerHtml = programmedStyleTag.InnerHtml .Replace("RadMultiPage1.ClientID", RadMultiPage1.ClientID) .Replace("RadTabStrip1.ClientID", RadTabStrip1.ClientID); WSOrgTreeDropDownSelectForEdit.tree.topSortCountryId = _currentUser.CountryId; //current users country at the top of the dropdown if (!IsPostBack) { FormView1.ChangeMode(FormViewMode.ReadOnly); } //if (Request.Browser.IsBrowser("Firefox")) //{ // RadAjaxManager1.EnableAJAX = false; // ScriptManager.GetCurrent(this).EnablePartialRendering = false; //} }
private void PrepareInsertView(int orgid) { Organization org = Organization.FromIdentity(orgid); //Current selected(parent) FillDefaultCountry(org.DefaultCountry.Code); HiddenField ParentIdentityHidden = FindControlRecursive(FormView1, "ParentIdentityHidden") as HiddenField; if (ParentIdentityHidden != null) { TextBox ParentIdentityTextBox = FindControlRecursive(FormView1, "ParentIdentityTextBox") as TextBox; ParentIdentityHidden.Value = orgid.ToString(); ParentIdentityTextBox.Text = Organization.FromIdentity(orgid).Name; } Controls_v4_WSGeographyTreeDropDown ancorDrop = FindControlRecursive(FormView1, "AnchorGeographyDropdown") as Controls_v4_WSGeographyTreeDropDown; if (ancorDrop != null) { ancorDrop.RootId = Geography.RootIdentity; ancorDrop.SelectedGeographyId = org.AnchorGeographyId; } Controls_v4_WSGeographyTree tree = FindControlRecursive(FormView1, "UptakeGeoTree") as Controls_v4_WSGeographyTree; tree.tree.CheckBoxes = true; tree.tree.ClearSelectedNodes(); tree.tree.ClearCheckedNodes(); //mark wich ones are already taken and by whom UptakeGeography[] othersUptakes = OrganizationsDataObject.SelectOrgOthersUptake(orgid); tree.EnsureGeographyLoaded(org.AnchorGeographyId, 1); foreach (UptakeGeography up in othersUptakes) { RadTreeNode node = tree.EnsureGeographyLoaded(up.GeoId, 0); node.BackColor = Color.Silver; node.ToolTip += up.Organization.Name + "\r\n"; } }
private void PrepareEditView(int orgid) { Organization org = Organization.FromIdentity(orgid); FillDefaultCountry(org.DefaultCountry.Code); Controls_v4_WSOrgTreeDropDown WSOrgTreeDropDownParentOrg = FindControlRecursive(FormView1, "WSOrgTreeDropDownParentOrg") as Controls_v4_WSOrgTreeDropDown; if (WSOrgTreeDropDownParentOrg != null) { WSOrgTreeDropDownParentOrg.tree.SetAuthority(_authority, Permission.CanEditOrg); WSOrgTreeDropDownParentOrg.SelectedOrganizationId = org.ParentOrganizationId; } Controls_v4_WSGeographyTreeDropDown ancorDrop = FindControlRecursive(FormView1, "AnchorGeographyDropdown") as Controls_v4_WSGeographyTreeDropDown; if (ancorDrop != null) { ancorDrop.RootId = Geography.RootIdentity; ancorDrop.SelectedGeographyId = org.AnchorGeographyId; } Controls_v4_WSGeographyTree tree = FindControlRecursive(FormView1, "UptakeGeoTree") as Controls_v4_WSGeographyTree; if (tree != null) { BasicUptakeGeography[] uptakes = OrganizationsDataObject.SelectOrgMineUptake(orgid); List <int> uptakeIds = new List <int>(); foreach (BasicUptakeGeography up in uptakes) { uptakeIds.Add(up.GeoId); } tree.tree.CheckBoxes = true; Style s = new Style(); s.BorderColor = Color.Green; s.BorderStyle = BorderStyle.Solid; s.BorderWidth = Unit.Pixel(2); s.BackColor = Color.LightGreen; tree.SetNodeStyles(uptakeIds.ToArray(), s); tree.tree.ClearSelectedNodes(); tree.CheckedValues = uptakeIds.ToArray(); UptakeGeography[] othersUptakes = OrganizationsDataObject.SelectOrgOthersUptake(orgid); List <int> othersUptakeIds = new List <int>(); foreach (UptakeGeography up in othersUptakes) { RadTreeNode node = tree.EnsureGeographyLoaded(up.GeoId, 0); node.BackColor = Color.Silver; node.ToolTip += up.Organization.Name + "\r\n"; node.Style["padding-top"] = "1px"; node.Style["padding-left"] = "2px"; node.Style["padding-bottom"] = "1px"; node.Style["padding-right"] = "2px"; node.Style["margin-top"] = "2px"; node.Style["margin-left"] = "0px"; node.Style["margin-bottom"] = "2px"; node.Style["margin-right"] = "0px"; } } GridView gv = FindControlRecursive(FormView1, "GridViewMailEdit") as GridView; if (gv != null) { List <AddressList> addresses = new List <AddressList>(); if (orgid > 0) { foreach (MailAuthorType ma in Enum.GetValues(typeof(MailAuthorType))) { if (ma != MailAuthorType.Unknown) { AddressList a = new AddressList(); a.maType = ma.ToString(); FunctionalMail.AddressItem aitem = org.GetFunctionalMailAddress(ma); FunctionalMail.AddressItem bitem = org.GetFunctionalMailAddressInh(ma); if (aitem != null) { a.name = aitem.Name; a.email = aitem.Email; } else { a.name = ""; a.email = ""; } if (bitem != null) { addresses.Add(a); } } } } gv.DataSource = addresses; gv.DataBind(); } }