Ejemplo n.º 1
0
    private void SaveUptakes()
    {
        Controls_v4_WSGeographyTree tree = FindControlRecursive(FormView1, "UptakeGeoTree") as Controls_v4_WSGeographyTree;
        int orgid = 0;

        int.TryParse(HiddenSelectedOrgID.Value, out orgid);
        OrganizationsDataObject.UpdateOrgUptake(orgid, tree.CheckedValues);
    }
Ejemplo n.º 2
0
    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";
        }
    }
Ejemplo n.º 3
0
    protected void GridViewDisplayUptakes_DataBinding(object sender, EventArgs e)
    {
        int orgid = 0;

        int.TryParse(HiddenSelectedOrgID.Value, out orgid);

        BasicUptakeGeography[] othersUptakes = OrganizationsDataObject.SelectOrgOthersUptake(orgid);
        otherUptakesDict = new Dictionary <int, List <BasicUptakeGeography> >();

        if (othersUptakes != null)
        {
            foreach (BasicUptakeGeography up in othersUptakes)
            {
                if (!otherUptakesDict.ContainsKey(up.GeoId))
                {
                    otherUptakesDict[up.GeoId] = new List <BasicUptakeGeography>();
                }
                otherUptakesDict[up.GeoId].Add(up);
            }
        }
    }
Ejemplo n.º 4
0
    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();
        }
    }