예제 #1
0
        public static string GetOrganization(int mLevel, string mCode, bool IsShowCompany)
        {
            HRM_DEPARTMENT hRMDEPARTMENT;

            string[] subsidiaryName;
            string   str = "/";

            (new SYS_USER()).GetUserName(MyLogin.Account);
            string subsidiaryName1 = "";

            if (mLevel == 0)
            {
                if (IsShowCompany)
                {
                    subsidiaryName1 = "Tất cả";
                }
            }
            else if (mLevel == 1)
            {
                HRM_SUBSIDIARY hRMSUBSIDIARY = new HRM_SUBSIDIARY();
                hRMSUBSIDIARY.Get(mCode);
                subsidiaryName1 = hRMSUBSIDIARY.SubsidiaryName;
            }
            else if (mLevel == 2)
            {
                HRM_BRANCH hRMBRANCH = new HRM_BRANCH();
                hRMBRANCH.Get(mCode);
                subsidiaryName1 = (!(hRMBRANCH.SubsidiaryName == "") ? string.Concat(hRMBRANCH.SubsidiaryName, str, hRMBRANCH.BranchName) : hRMBRANCH.BranchName);
            }
            else if (mLevel == 3)
            {
                hRMDEPARTMENT = new HRM_DEPARTMENT();
                hRMDEPARTMENT.Get(mCode);
                if (hRMDEPARTMENT.SubsidiaryName == "")
                {
                    subsidiaryName1 = (!(hRMDEPARTMENT.BranchName == "") ? string.Concat(hRMDEPARTMENT.BranchName, str, hRMDEPARTMENT.DepartmentName) : hRMDEPARTMENT.DepartmentName);
                }
                else if (!(hRMDEPARTMENT.BranchName == ""))
                {
                    subsidiaryName  = new string[] { hRMDEPARTMENT.SubsidiaryName, str, hRMDEPARTMENT.BranchName, str, hRMDEPARTMENT.DepartmentName };
                    subsidiaryName1 = string.Concat(subsidiaryName);
                }
                else
                {
                    subsidiaryName1 = string.Concat(hRMDEPARTMENT.SubsidiaryName, str, hRMDEPARTMENT.DepartmentName);
                }
            }
            else if (mLevel == 4)
            {
                HRM_GROUP hRMGROUP = new HRM_GROUP();
                hRMGROUP.Get(mCode);
                hRMDEPARTMENT = new HRM_DEPARTMENT();
                hRMDEPARTMENT.Get(hRMGROUP.DepartmentCode);
                if (hRMDEPARTMENT.SubsidiaryName == "")
                {
                    if (!(hRMDEPARTMENT.BranchName == ""))
                    {
                        subsidiaryName  = new string[] { hRMDEPARTMENT.BranchName, str, hRMDEPARTMENT.DepartmentName, str, hRMGROUP.GroupName };
                        subsidiaryName1 = string.Concat(subsidiaryName);
                    }
                    else
                    {
                        subsidiaryName1 = string.Concat(hRMDEPARTMENT.DepartmentName, str, hRMGROUP.GroupName);
                    }
                }
                else if (!(hRMDEPARTMENT.BranchName == ""))
                {
                    subsidiaryName  = new string[] { hRMDEPARTMENT.SubsidiaryName, str, hRMDEPARTMENT.BranchName, str, hRMDEPARTMENT.DepartmentName, str, hRMGROUP.GroupName };
                    subsidiaryName1 = string.Concat(subsidiaryName);
                }
                else
                {
                    subsidiaryName  = new string[] { hRMDEPARTMENT.SubsidiaryName, str, hRMDEPARTMENT.DepartmentName, str, hRMGROUP.GroupName };
                    subsidiaryName1 = string.Concat(subsidiaryName);
                }
            }
            return(subsidiaryName1);
        }
예제 #2
0
        public static void SetToTwoLabel(int mLevel, string mCode, LabelControl MainName, LabelControl SubName)
        {
            HRM_DEPARTMENT hRMDEPARTMENT;
            string         str = "/";

            if (mLevel == 0)
            {
                MainName.Text = "Công ty ABC";
                SubName.Text  = "";
            }
            else if (mLevel == 1)
            {
                HRM_SUBSIDIARY hRMSUBSIDIARY = new HRM_SUBSIDIARY();
                hRMSUBSIDIARY.Get(mCode);
                MainName.Text = hRMSUBSIDIARY.SubsidiaryName;
                SubName.Text  = "";
            }
            else if (mLevel == 2)
            {
                HRM_BRANCH hRMBRANCH = new HRM_BRANCH();
                hRMBRANCH.Get(mCode);
                if (!(hRMBRANCH.SubsidiaryName == ""))
                {
                    MainName.Text = string.Concat(hRMBRANCH.SubsidiaryName, str, hRMBRANCH.BranchName);
                }
                else
                {
                    MainName.Text = hRMBRANCH.BranchName;
                }
                SubName.Text = "";
            }
            else if (mLevel == 3)
            {
                hRMDEPARTMENT = new HRM_DEPARTMENT();
                hRMDEPARTMENT.Get(mCode);
                if (hRMDEPARTMENT.SubsidiaryName == "")
                {
                    if (!(hRMDEPARTMENT.BranchName == ""))
                    {
                        MainName.Text = string.Concat(hRMDEPARTMENT.BranchName, str, hRMDEPARTMENT.DepartmentName);
                        SubName.Text  = "";
                    }
                    else
                    {
                        MainName.Text = hRMDEPARTMENT.DepartmentName;
                        SubName.Text  = "";
                    }
                }
                else if (!(hRMDEPARTMENT.BranchName == ""))
                {
                    MainName.Text = string.Concat(hRMDEPARTMENT.SubsidiaryName, str, hRMDEPARTMENT.BranchName);
                    SubName.Text  = hRMDEPARTMENT.DepartmentName;
                }
                else
                {
                    MainName.Text = string.Concat(hRMDEPARTMENT.SubsidiaryName, str, hRMDEPARTMENT.DepartmentName);
                    SubName.Text  = "";
                }
            }
            else if (mLevel == 4)
            {
                HRM_GROUP hRMGROUP = new HRM_GROUP();
                hRMGROUP.Get(mCode);
                hRMDEPARTMENT = new HRM_DEPARTMENT();
                hRMDEPARTMENT.Get(hRMGROUP.DepartmentCode);
                if (hRMDEPARTMENT.SubsidiaryName == "")
                {
                    if (!(hRMDEPARTMENT.BranchName == ""))
                    {
                        MainName.Text = string.Concat(hRMDEPARTMENT.BranchName, str, hRMDEPARTMENT.DepartmentName);
                        SubName.Text  = hRMGROUP.GroupName;
                    }
                    else
                    {
                        MainName.Text = string.Concat(hRMDEPARTMENT.DepartmentName, str, hRMGROUP.GroupName);
                        SubName.Text  = "";
                    }
                }
                else if (!(hRMDEPARTMENT.BranchName == ""))
                {
                    MainName.Text = string.Concat(hRMDEPARTMENT.SubsidiaryName, str, hRMDEPARTMENT.BranchName);
                    SubName.Text  = string.Concat(hRMDEPARTMENT.DepartmentName, str, hRMGROUP.GroupName);
                }
                else
                {
                    MainName.Text = string.Concat(hRMDEPARTMENT.SubsidiaryName, str, hRMDEPARTMENT.DepartmentName);
                    SubName.Text  = hRMGROUP.GroupName;
                }
            }
        }