コード例 #1
0
        private IList <UnderManagment> CreateUnderManagementList_UnderManagementPersonnel(string strUnderManagementList)
        {
            List <UnderManagment> UnderManagementList = new List <UnderManagment>();

            if (strUnderManagementList != string.Empty)
            {
                strUnderManagementList = strUnderManagementList.Replace("Key=", string.Empty).Replace("Type=", string.Empty).Replace("Access=", string.Empty).Replace("SubDep=", string.Empty);
                string[] UnderManagementListParts = strUnderManagementList.Split(new char[] { '#' });
                foreach (string UnderManagementListPartItem in UnderManagementListParts)
                {
                    if (UnderManagementListPartItem != string.Empty)
                    {
                        decimal             departmentID = 0;
                        decimal             personnelID  = 0;
                        UnderManagmentTypes UMT          = UnderManagmentTypes.Department;
                        bool hasAccess = false;
                        bool hasSubDep = false;

                        string[] UnderManagementListPartSections = UnderManagementListPartItem.Split(new char[] { '%' });
                        departmentID = decimal.Parse(UnderManagementListPartSections[0].Substring(3, UnderManagementListPartSections[0].IndexOf("prs") - 3), CultureInfo.InvariantCulture);
                        personnelID  = decimal.Parse(UnderManagementListPartSections[0].Substring(UnderManagementListPartSections[0].IndexOf("prs") + 3, UnderManagementListPartSections[0].Length - UnderManagementListPartSections[0].IndexOf("prs") - 3), CultureInfo.InvariantCulture);
                        UMT          = (UnderManagmentTypes)Enum.Parse(typeof(UnderManagmentTypes), UnderManagementListPartSections[1]);
                        hasAccess    = bool.Parse(UnderManagementListPartSections[2]);
                        hasSubDep    = bool.Parse(UnderManagementListPartSections[3]);

                        UnderManagment underManagment = new UnderManagment();
                        Department     department     = new Department();
                        department.ID             = departmentID;
                        underManagment.Department = department;
                        switch (UMT)
                        {
                        case UnderManagmentTypes.Department:
                            break;

                        case UnderManagmentTypes.Person:
                            Person personnel = new Person();
                            personnel.ID          = personnelID;
                            underManagment.Person = personnel;
                            break;

                        default:
                            break;
                        }
                        underManagment.Contains           = hasAccess;
                        underManagment.ContainInnerChilds = hasSubDep;

                        UnderManagementList.Add(underManagment);
                    }
                }
            }
            return(UnderManagementList);
        }
コード例 #2
0
    private IList <PersonDepartmentProxy> CreateUnderManagementList_SendPrivateMessage(string strUnderManagementList)
    {
        List <PersonDepartmentProxy> PersonDepartmentList = new List <PersonDepartmentProxy>();

        if (strUnderManagementList != string.Empty)
        {
            strUnderManagementList = strUnderManagementList.Replace("Key=", string.Empty).Replace("Type=", string.Empty).Replace("Access=", string.Empty).Replace("SubDep=", string.Empty);
            string[] UnderManagementListParts = strUnderManagementList.Split(new char[] { '#' });
            foreach (string UnderManagementListPartItem in UnderManagementListParts)
            {
                if (UnderManagementListPartItem != string.Empty)
                {
                    decimal             departmentID = 0;
                    decimal             personnelID  = 0;
                    UnderManagmentTypes UMT          = UnderManagmentTypes.Department;
                    bool hasAccess = false;
                    bool hasSubDep = false;

                    string[] UnderManagementListPartSections = UnderManagementListPartItem.Split(new char[] { '%' });
                    departmentID = decimal.Parse(UnderManagementListPartSections[0].Substring(3, UnderManagementListPartSections[0].IndexOf("prs") - 3));
                    personnelID  = decimal.Parse(UnderManagementListPartSections[0].Substring(UnderManagementListPartSections[0].IndexOf("prs") + 3, UnderManagementListPartSections[0].Length - UnderManagementListPartSections[0].IndexOf("prs") - 3));
                    UMT          = (UnderManagmentTypes)Enum.Parse(typeof(UnderManagmentTypes), UnderManagementListPartSections[1]);
                    hasAccess    = bool.Parse(UnderManagementListPartSections[2]);
                    hasSubDep    = bool.Parse(UnderManagementListPartSections[3]);
                    PersonDepartmentProxy personDepartment = new PersonDepartmentProxy();

                    personDepartment.DepartmentId = departmentID;
                    switch (UMT)
                    {
                    case UnderManagmentTypes.Department:
                        break;

                    case UnderManagmentTypes.Person:
                        Person personnel = new Person();
                        personnel.ID = personnelID;
                        personDepartment.PersonId = personnelID;
                        break;

                    default:
                        break;
                    }

                    personDepartment.ContainsInnerchilds = hasSubDep;

                    PersonDepartmentList.Add(personDepartment);
                }
            }
        }
        return(PersonDepartmentList);
    }