using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;

namespace WebAPIBase.NetCore.BusinessCore
{
    public sealed class SystemClassDescription
    {
        public static Hashtable m_Items = new Hashtable();

        public static void LoadItem()
        {
            m_Items.Add("Project", new SystemClassItem("0101", "Project", "ProjectCode", "", "", "", "ProjectCode"));
            m_Items.Add("Contract", new SystemClassItem("0501", "Contract", "ContractCode", "Type", "ContractPerson", "UnitCode", ""));
            m_Items.Add("Document", new SystemClassItem("1001", "Document", "DocumentCode", "GroupCode", "", "", ""));
            m_Items.Add("Payment", new SystemClassItem("0601", "Payment", "PaymentCode", "GroupCode", "ApplyPerson", "UnitCode", "ProjectCode"));
            m_Items.Add("Payout", new SystemClassItem("0602", "Payout", "PayoutCode", "GroupCode", "InputPerson", "", "ProjectCode"));
            m_Items.Add("Supplier", new SystemClassItem("1301", "pmSupplierType", "SupplierCode", "GroupCode", "", "", ""));
            m_Items.Add("Building", new SystemClassItem("0103", "Building", "BuildingCode", "", "", "", "ProjectCode"));
            m_Items.Add("Model", new SystemClassItem("0105", "Model", "ModelCode", "", "", "", "ProjectCode"));
            m_Items.Add("CBS", new SystemClassItem("0401", "CBS", "CostCode", "", "", "", "ProjectCode"));
            m_Items.Add("QualityCheck", new SystemClassItem("5701", "SafeQualityCheck", "CheckCode", "", "", "", "ProjectCode"));
            m_Items.Add("SafeCheck", new SystemClassItem("5801", "SafeQualityCheck", "CheckCode", "", "", "", "ProjectCode"));
            m_Items.Add("CostBudgetSet", new SystemClassItem("0411", "CostBudgetSet", "CostBudgetSetCode", "GroupCode", "CreatePerson", "UnitCode", "ProjectCode"));
            m_Items.Add("CostBudget", new SystemClassItem("0411", "CostBudget", "CostBudgetSetCode", "GroupCode", "CreatePerson", "UnitCode", "ProjectCode"));
            m_Items.Add("CostBudgetBackupSet", new SystemClassItem("0411", "CostBudgetBackupSet", "CostBudgetSetCode", "GroupCode", "CreatePerson", "UnitCode", ""));
            m_Items.Add("WorkFlowProcedure", new SystemClassItem("0902", "WorkFlowProcedure", "ProcedureCode", "SysType", "Creator", "", ""));
            m_Items.Add("Vise", new SystemClassItem("2201", "Vise", "ViseCode", "", "Person", "UnitCode", "ProjectCode"));
            m_Items.Add("DesignChanges", new SystemClassItem("2401", "DesignChanges", "DesignChangesCode", "", "Person", "UnitCode", "ProjectCode"));
            m_Items.Add("Bidding", new SystemClassItem("2101", "Bidding", "BiddingCode", "", "", "BiddingRemark1", "ProjectCode"));
            m_Items.Add("BiddingPreTrial", new SystemClassItem("2102", "BiddingPreTrial", "BiddingPreTrialCode", "", "CreatedMan", "", "ProjectCode"));
            m_Items.Add("Voucher", new SystemClassItem("0603", "Voucher", "VoucherCode", "", "Accountant", "", "ProjectCode"));
            m_Items.Add("CostAllocationDtl", new SystemClassItem("0421", "CostAllocationDtl", "CostAllocationDtlCode", "", "", "", "ProjectCode"));
            m_Items.Add("Notice", new SystemClassItem("0801", "Notice", "NoticeCode", "", "SubmitPerson", "", ""));
            m_Items.Add("TaskAttention", new SystemClassItem("0701", "TaskAttention", "MasterCode", "", "UserCode", "", ""));
            m_Items.Add("Task", new SystemClassItem("0701", "Task", "WBSCode", "", "", "", "ProjectCode"));
            m_Items.Add("OADIARY", new SystemClassItem("", "OADIARY", "MasterCode", "", "UserCode", "", ""));
            m_Items.Add("Budget", new SystemClassItem("0411", "Budget", "BudgetCode", "", "MakePerson", "", ""));
            m_Items.Add("MaterialCost", new SystemClassItem("1411", "MaterialCost", "MaterialCostCode", "GroupCode", "CreatePerson", "", ""));
            m_Items.Add("SupplierMaterial", new SystemClassItem("1413", "SupplierMaterial", "SupplierMaterialCode", "GroupCode", "CreatePerson", "", ""));
            m_Items.Add("Material", new SystemClassItem("1302", "Material", "MaterialCode", "GroupCode", "", "", ""));
            m_Items.Add("MaterialIn", new SystemClassItem("1503", "MaterialIn", "MaterialInCode", "GroupCode", "InPerson", "", "ProjectCode"));
            m_Items.Add("MaterialOut", new SystemClassItem("1505", "MaterialOut", "MaterialOutCode", "GroupCode", "OutPerson", "", "ProjectCode"));
            m_Items.Add("MaterialBudgetJG", new SystemClassItem("1513", "MaterialBudget", "MaterialBudgetCode", "", "", "", "ProjectCode"));
            m_Items.Add("MaterialBudgetJK", new SystemClassItem("1515", "MaterialBudget", "MaterialBudgetCode", "", "", "", "ProjectCode"));
            m_Items.Add("ProjectCost", new SystemClassItem("1521", "ProjectCost", "ProjectCostCode", "GroupCode", "InputPerson", "", ""));
            m_Items.Add("Enquiry", new SystemClassItem("1301", "Enquiry", "PurchaseCode", "ClassType", "EnquiryPerson", "", ""));
            m_Items.Add("Purchase", new SystemClassItem("1301", "Purchase", "PurchaseCode", "ClassType", "CreatePerson", "", ""));
            m_Items.Add("WorkFlowCommon", new SystemClassItem("0902", "WorkFlowCommon", "WorkFlowCommonCode", "Type", "Transactor", "", ""));
            m_Items.Add("PurchaseContract", new SystemClassItem("0511", "PurchaseContract", "PurchaseContractCode", "ContractType", "CreatePerson", "UnitCode", ""));
            m_Items.Add("Receipt", new SystemClassItem("0621", "Receipt", "ReceiptCode", "GroupCode", "CreatePerson", "UnitCode", ""));
            m_Items.Add("ReceiptAct", new SystemClassItem("0622", "ReceiptAct", "ReceiptActCode", "GroupCode", "CreatePerson", "UnitCode", ""));
            m_Items.Add("WorkFlowProcedureDataPurview", new SystemClassItem("0901", "WorkFlowProcedureDataPurview", "WorkFlowProcedureDataPurviewCode", "GroupCode", "", "", "ProjectCode"));
            m_Items.Add("FundPlan", new SystemClassItem("", "FundPlan", "FundPlanCode", "", "", "UnitCode", "ProjectCode"));
            m_Items.Add("ContractOtherPay", new SystemClassItem("", "ContractOtherPay", "ContractOtherPayCode", "", "InputPerson", "UnitCode", "ProjectCode"));
        }

        public static SystemClassItem GetSystemClassItem(string className)
        {
            if (!m_Items.Contains(className))
            {
                return null;
            }
            return (SystemClassItem)m_Items[className];
        }

        public static string GetItemClassCode(string className)
        {
            if (!m_Items.Contains(className))
            {
                return "";
            }
            return ((SystemClassItem)m_Items[className]).ClassCode;
        }

        public static string GetItemCreateUserColumnName(string className)
        {
            if (!m_Items.Contains(className))
            {
                return "";
            }
            return ((SystemClassItem)m_Items[className]).CreateUserColumnName;
        }

        public static string GetItemUnitColumnName(string className)
        {
            if (!m_Items.Contains(className))
            {
                return "";
            }
            return ((SystemClassItem)m_Items[className]).UnitColumnName;
        }

        public static string GetItemTableName(string className)
        {
            if (!m_Items.Contains(className))
            {
                return "";
            }
            return ((SystemClassItem)m_Items[className]).TableName;
        }

        public static string GetItemKeyColumnName(string className)
        {
            if (!m_Items.Contains(className))
            {
                return "";
            }
            return ((SystemClassItem)m_Items[className]).KeyColumnName;
        }

        public static string GetItemTypeColumnName(string className)
        {
            if (!m_Items.Contains(className))
            {
                return "";
            }
            return ((SystemClassItem)m_Items[className]).TypeColumnName;
        }

        public static ArrayList GetItemByClassCode(string classCode)
        {
            ArrayList arrayList = new ArrayList();
            foreach (object value in m_Items.Values)
            {
                string classCode2 = ((SystemClassItem)value).ClassCode;
                if (classCode2 == classCode)
                {
                    arrayList.Add(value);
                }
            }
            return arrayList;
        }

        public static string GetItemInfoByClassCode(string classCode)
        {
            string text = "";
            ArrayList itemByClassCode = GetItemByClassCode(classCode);
            foreach (SystemClassItem item in itemByClassCode)
            {
                if (text.Length > 0)
                {
                    text += ",";
                }
                text = item.TableName + "|" + item.TypeColumnName;
            }
            return text;
        }
    }
}
