public void CreateDictionary()
    {
        List <StoreComboObject> list = new List <StoreComboObject>();

        dictionary = new Dictionary <string, string>();
        // lấy danh sách các bảng danh mục
        string[] dsDanhMuc = ListCategoriesTableName.Split(',');
        foreach (var it in dsDanhMuc)
        {
            switch (it.Trim())
            {
            case "DM_TT_HN":        // DM_TT_HN
                list = new DM_TT_HNController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_TINHTHANH":        // DM_TinhThanh
                list = new DM_TINHTHANHController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_NUOC":         // DM_NUOC
                list = new DM_NUOCController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_DANTOC":       // DM_DANTOC
                list = new DM_DANTOCController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_TONGIAO":      // DM_TONGIAO
                list = new DM_TONGIAOController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_TT_SUCKHOE":       // DM_TT_SUCKHOE
                list = new DM_TT_SUCKHOEController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_TRINHDO":      // DM_TRINHDO
                list = new DM_TRINHDOController().GetAll1();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_TD_VANHOA":        // DM_TD_VANHOA
                list = new DM_TD_VANHOAController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_NGOAINGU":         // DM_NGOAINGU
                list = new DM_NGOAINGUController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_TINHOC":       // DM_TINHOC
                list = new DM_TINHOCController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_CHUCVU":       // DM_CHUCVU
                list = new DanhMucChucVuController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_NGACH":        // DM_NGACH
                list = new DM_NGACHController().GetAll1();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_DONVI":        // DM_DONVI
                list = new DM_DONVIController().GetAll1();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_NOICAP_CMND":      // DM_NOICAP_CMND
                list = new DM_NOICAP_CMNDController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_LOAI_HDONG":       // DM_LOAI_HDONG
                list = new DM_LOAI_HDONGController().GetAll1();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_CONGVIEC":         // DM_CONGVIEC
                list = new DM_CONGVIECController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_CHUYENNGANH":      // DM_CHUYENNGANH
                list = new DM_CHUYENNGANHController().GetAll1();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_TP_BANTHAN":       // DM_TP_BANTHAN
                list = new DM_TP_BANTHANController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_TP_GIADINH":       // DM_TP_GIADINH
                list = new DM_TP_GIADINHController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_NOICAP_HOCHIEU":       // DM_NOICAP_HOCHIEU
                list = new DM_NOICAP_HOCHIEUController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_TRUONG_DAOTAO":        // DM_TRUONG_DAOTAO
                list = new DM_TRUONG_DAOTAOController().GetAll1();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_XEPLOAI":      // DM_XEPLOAI
                list = new DM_XEPLOAIController().GetAll1();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_HT_TUYENDUNG":         // DM_HT_TUYENDUNG
                list = new DM_HT_TUYENDUNGController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_CONGTRINH":        // DM_CONGTRINH
                list = new DM_CONGTRINHController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_LOAI_CS":          // DM_LOAI_CS
                list = new DM_LOAI_CSController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_NOI_KCB":      // DM_NOI_KCB
                list = new DM_NOI_KCBController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_NOICAP_BHXH":      // DM_NOICAP_BHXH
                list = new DM_NOICAPBAOHIEMXHController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_TD_CHINHTRI":      // DM_TD_CHINHTRI
                list = new DM_TD_CHINHTRIController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_CHUCVU_DANG":      // DM_CHUCVU_DANG
                list = new DM_CHUCVU_DANGController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_CHUCVU_DOAN":      // DM_CHUCVU_DOAN
                list = new DM_CHUCVU_DOANController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_BAC_QDOI":         // DM_BAC_QDOI
                list = new DM_CAPBAC_QDOIController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_CHUCVU_QDOI":      // DM_CHUCVU_QDOI
                list = new DM_CHUCVU_QDOIController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_TD_QUANLY":        // DM_TD_QUANLY
                list = new DM_TD_QUANLYController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_TD_QLKT":      // DM_TD_QLKT
                list = new DM_TD_QLKTController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_NH":       // DM_NH
                list = new DM_NGANHANGController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;

            case "DM_LYDO_NGHI":        // DM_LYDO_NGHI
                list = new DM_LYDO_NGHIController().GetAll();
                foreach (var item in list)
                {
                    if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
                    {
                        dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
                    }
                }
                break;
            }
        }
    }
Beispiel #2
0
    public void CreateDictionary()
    {
        List <StoreComboObject> list = new List <StoreComboObject>();

        dictionary = new Dictionary <string, string>();
        // DM_TT_HN
        list = new DM_TT_HNController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_TinhThanh
        list = new DM_TINHTHANHController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_NUOC
        list = new DM_NUOCController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_DANTOC
        list = new DM_DANTOCController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_TONGIAO
        list = new DM_TONGIAOController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_TT_SUCKHOE
        list = new DM_TT_SUCKHOEController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_TRINHDO
        list = new DM_TRINHDOController().GetAll1();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_TD_VANHOA
        list = new DM_TD_VANHOAController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_TD_NGOAINGU
        list = new DM_NGOAINGUController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_TD_TINHOC
        list = new DM_TINHOCController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_CHUCVU
        list = new DanhMucChucVuController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_NGACH
        list = new DM_NGACHController().GetAll1();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_DONVI
        list = new DM_DONVIController().GetAll1();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_NOICAP_CMND
        list = new DM_NOICAP_CMNDController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_LOAI_HDONG
        list = new DM_LOAI_HDONGController().GetAll1();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_CONGVIEC
        list = new DM_CONGVIECController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_CHUYENNGANH
        list = new DM_CHUYENNGANHController().GetAll1();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_TP_BANTHAN
        list = new DM_TP_BANTHANController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_TP_GIADINH
        list = new DM_TP_GIADINHController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_NOICAP_HOCHIEU
        list = new DM_NOICAP_HOCHIEUController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_TRUONG_DAOTAO
        list = new DM_TRUONG_DAOTAOController().GetAll1();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_XEPLOAI
        list = new DM_XEPLOAIController().GetAll1();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_HT_TUYENDUNG
        list = new DM_HT_TUYENDUNGController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_CONGTRINH
        list = new DM_CONGTRINHController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_LOAI_CS
        list = new DM_LOAI_CSController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_NOI_KCB
        list = new DM_NOI_KCBController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_NOICAP_BHXH
        list = new DM_NOICAPBAOHIEMXHController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_TD_CHINHTRI
        list = new DM_TD_CHINHTRIController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_CHUCVU_DANG
        list = new DM_CHUCVU_DANGController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_CHUCVU_DOAN
        list = new DM_CHUCVU_DOANController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_BAC_QDOI
        list = new DM_CAPBAC_QDOIController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_CHUCVU_QDOI
        list = new DM_CHUCVU_QDOIController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_TD_QUANLY
        list = new DM_TD_QUANLYController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_TD_QLKT
        list = new DM_TD_QLKTController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_NH
        list = new DM_NGANHANGController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // DM_LYDO_NGHI
        list = new DM_LYDO_NGHIController().GetAll();
        foreach (var item in list)
        {
            if (!dictionary.ContainsKey(item.TEN.ToLower().Trim()))
            {
                dictionary.Add(item.TEN.ToLower().Trim(), item.MA);
            }
        }
        // HinhThucLamViec
        //IEnumerable<DAL.ThamSoTrangThai> lt = new ThamSoTrangThaiController().GetByParamName("HinhThucLamViec", true);
        //foreach (var item in lt)
        //{
        //    if (!dictionary.ContainsKey(item.Value.ToLower().Trim()))
        //        dictionary.Add(item.Value.ToLower().Trim(), item.ID.ToString());
        //}
    }