public EntityMstData GetGroup(string random, int kbn, string ID)
        {
            #region 認証処理

            string companyId = "";
            string groupId = "";
            string userId = "";
            string ipAdress = "";
            string sessionString = "";

            try
            {
                companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]);
                groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]);
                userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]);
                ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]);
                sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]);

                string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]));
                if (_message != "")
                {
                    EntityMstData entity = new EntityMstData();
                    entity.MESSAGE = _message;
                    return entity;
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetGroup(認証処理)", ex);
                EntityMstData entity = new EntityMstData();
                entity.MESSAGE = "認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();
                return entity;
            }

            #endregion

            EntityMstData objList = null;
            StringBuilder sb;
            DataTable dt;
            ExMySQLData db;

            try
            {
                db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]),
                                            ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]));
                sb = new StringBuilder();

                #region SQL

                sb.Append("SELECT MT.* " + Environment.NewLine);
                sb.Append("  FROM M_CLASS AS MT" + Environment.NewLine);
                sb.Append(" WHERE MT.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND MT.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND MT.COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("   AND MT.CLASS_DIVISION_ID = " + kbn.ToString() + Environment.NewLine);
                sb.Append("   AND MT.ID = " + ExEscape.zRepStr(ID) + Environment.NewLine);
                sb.Append(" LIMIT 0, 1");

                #endregion

                dt = db.GetDataTable(sb.ToString());

                if (dt.DefaultView.Count > 0)
                {
                    objList = new EntityMstData(ExCast.zCStr(dt.DefaultView[0]["ID"]),
                                                "",
                                                ExCast.zCStr(dt.DefaultView[0]["NAME"])
                                                );
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetGroup", ex);
            }
            return objList;
        }
        public EntityMstData GetPurchase(string random, string ID)
        {
            #region 認証処理

            string companyId = "";
            string groupId = "";
            string userId = "";
            string ipAdress = "";
            string sessionString = "";

            try
            {
                companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]);
                groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]);
                userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]);
                ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]);
                sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]);

                string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]));
                if (_message != "")
                {
                    EntityMstData entity = new EntityMstData();
                    entity.MESSAGE = _message;
                    return entity;
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetPurchase(認証処理)", ex);
                EntityMstData entity = new EntityMstData();
                entity.MESSAGE = CLASS_NM + ".GetPurchase : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();
                return entity;
            }

            #endregion

            EntityMstData objList = null;
            StringBuilder sb;
            DataTable dt;
            ExMySQLData db;

            try
            {
                db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]),
                                            ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]));
                sb = new StringBuilder();

                #region SQL

                string _id = ID;
                if (ExCast.IsNumeric(_id))
                {
                    _id = ExCast.zCDbl(_id).ToString();
                }

                sb.Append("SELECT MT.* " + Environment.NewLine);
                sb.Append("  FROM M_PURCHASE AS MT" + Environment.NewLine);
                sb.Append(" WHERE MT.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND MT.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND MT.COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("   AND MT.ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(_id)) + Environment.NewLine);

                #endregion

                dt = db.GetDataTable(sb.ToString());

                if (dt.DefaultView.Count > 0)
                {
                    objList = new EntityMstData(ExCast.zCStr(dt.DefaultView[0]["ID"]),
                                                ExCast.zCStr(dt.DefaultView[0]["ID"]),
                                                ExCast.zCStr(dt.DefaultView[0]["NAME"])
                                                );
                    objList.ATTRIBUTE1 = ExCast.zCStr(dt.DefaultView[0]["BUSINESS_DIVISION_ID"]);
                    objList.ATTRIBUTE2 = ExCast.zCStr(dt.DefaultView[0]["TAX_CHANGE_ID"]);
                    objList.ATTRIBUTE3 = ExCast.zCStr(dt.DefaultView[0]["PRICE_FRACTION_PROC_ID"]);
                    objList.ATTRIBUTE4 = ExCast.zCStr(dt.DefaultView[0]["TAX_FRACTION_PROC_ID"]);
                    objList.ATTRIBUTE5 = ExCast.zCStr(dt.DefaultView[0]["UNIT_KIND_ID"]);
                    objList.ATTRIBUTE7 = ExCast.zCStr(dt.DefaultView[0]["PAYMENT_CREDIT_PRICE"]);

                    objList.ATTRIBUTE10 = ExCast.zCStr(dt.DefaultView[0]["SUMMING_UP_GROUP_ID"]);
                    objList.ATTRIBUTE11 = ExCast.zCStr(dt.DefaultView[0]["PAYMENT_DIVISION_ID"]);
                    objList.ATTRIBUTE12 = ExCast.zCStr(dt.DefaultView[0]["PAYMENT_CYCLE_ID"]);
                    objList.ATTRIBUTE13 = ExCast.zCStr(dt.DefaultView[0]["PAYMENT_DAY"]);
                    objList.ATTRIBUTE14 = ExCast.zCStr(dt.DefaultView[0]["BILL_SITE"]);
                    objList.ATTRIBUTE15 = ExCast.zCStr(dt.DefaultView[0]["PRICE_FRACTION_PROC_ID"]);
                    objList.ATTRIBUTE16 = ExCast.zCStr(dt.DefaultView[0]["TAX_FRACTION_PROC_ID"]);

                    //objList.ATTRIBUTE17 = ExCast.zCStr(dt.DefaultView[0]["INVOICE_CREDIT_LIMIT_PRICE"]);
                    objList.ATTRIBUTE18 = ExCast.zCStr(dt.DefaultView[0]["PAYMENT_CREDIT_PRICE"]);

                    objList.ATTRIBUTE19 = ExCast.zCStr(dt.DefaultView[0]["CREDIT_RATE"]);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetPurchase", ex);
            }
            return objList;
        }
        public EntityMstData GetZip(string random, string zipFrom, string zipTo)
        {
            #region 認証処理

            string companyId = "";
            string groupId = "";
            string userId = "";
            string ipAdress = "";
            string sessionString = "";

            try
            {
                companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]);
                groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]);
                userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]);
                ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]);
                sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]);

                string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]));
                if (_message != "")
                {
                    EntityMstData entity = new EntityMstData();
                    entity.MESSAGE = _message;
                    return entity;
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetZip(認証処理)", ex);
                EntityMstData entity = new EntityMstData();
                entity.MESSAGE = "認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();
                return entity;
            }

            #endregion

            EntityMstData objList = null;
            StringBuilder sb;
            DataTable dt;

            try
            {
                sb = new StringBuilder();

                #region SQL

                sb.Append("SELECT ZP.* " + Environment.NewLine);
                sb.Append("  FROM SYS_M_ZIP AS ZP" + Environment.NewLine);
                sb.Append(" WHERE ZP.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND ZP.DISPLAY_FLG = 1 " + Environment.NewLine);
                if (zipFrom != "" && zipTo != "")
                {
                    sb.Append("   AND ZP.ZIP = " + ExEscape.zRepStr(ExCast.zCInt(zipFrom).ToString() + zipTo) + Environment.NewLine);
                }
                sb.Append(" LIMIT 0, 1");

                #endregion

                dt = CommonUtl.gMySqlDt.GetDataTable(sb.ToString());

                if (dt.DefaultView.Count > 0)
                {
                    string zip = string.Format("{0:0000000}", ExCast.zCInt(dt.DefaultView[0]["ZIP"]));
                    string zip1 = zip.Substring(0, 3);
                    string zip2 = zip.Substring(3, 4);

                    objList = new EntityMstData(zip,
                                                "",
                                                ExCast.zCStr(dt.DefaultView[0]["PREDECTURE_NAME"]) +
                                                ExCast.zCStr(dt.DefaultView[0]["CITY_NAME"]) +
                                                ExCast.zCStr(dt.DefaultView[0]["TOWN_NAME"])
                                                );
                    objList.ATTRIBUTE1 = zip1;                                                      // 郵便番号前3桁
                    objList.ATTRIBUTE2 = zip2;                                                      // 郵便番号後4桁
                    objList.ATTRIBUTE3 = ExCast.zCStr(dt.DefaultView[0]["PREDECTURE_NAME"]);        // 都道府県名
                    objList.ATTRIBUTE4 = ExCast.zCStr(dt.DefaultView[0]["CITY_NAME"]);              // 市区郡名
                    objList.ATTRIBUTE5 = ExCast.zCStr(dt.DefaultView[0]["TOWN_NAME"]);              // 町村名

                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetZip", ex);
            }
            return objList;
        }
        public EntityMstData GetCompanyGroup(string random, string ID)
        {
            #region 認証処理

            string companyId = "";
            string groupId = "";
            string userId = "";
            string ipAdress = "";
            string sessionString = "";

            try
            {
                companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]);
                groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]);
                userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]);
                ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]);
                sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]);

                string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]));
                if (_message != "")
                {
                    EntityMstData entity = new EntityMstData();
                    entity.MESSAGE = _message;
                    return entity;
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetCompanyGroup(認証処理)", ex);
                EntityMstData entity = new EntityMstData();
                entity.MESSAGE = "認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();
                return entity;
            }

            #endregion

            EntityMstData objList = null;
            StringBuilder sb;
            DataTable dt;

            try
            {
                sb = new StringBuilder();

                #region SQL

                sb.Append("SELECT CG.* " + Environment.NewLine);
                sb.Append("  FROM SYS_M_COMPANY_GROUP AS CG" + Environment.NewLine);
                sb.Append(" WHERE CG.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND CG.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND CG.COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("   AND CG.ID = " + ExEscape.zRepStr(ID) + Environment.NewLine);

                #endregion

                dt = CommonUtl.gMySqlDt.GetDataTable(sb.ToString());

                if (dt.DefaultView.Count > 0)
                {
                    objList = new EntityMstData(ExCast.zCStr(dt.DefaultView[0]["ID"]),
                                                "",
                                                ExCast.zCStr(dt.DefaultView[0]["NAME"])
                                                );
                }
                else
                {
                    //if (ID == "0" || ID == "00" || ID == "000")
                    //{
                    //    objList = new EntityMstData("000",
                    //                                "000",
                    //                                "全グループ"
                    //                                );

                    //}
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetCompanyGroup", ex);
            }
            return objList;
        }
        public EntityMstData GetCommodity(string random, string ID, string dataGirdSelectedIndex)
        {
            #region 認証処理

            string companyId = "";
            string groupId = "";
            string userId = "";
            string ipAdress = "";
            string sessionString = "";

            try
            {
                companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]);
                groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]);
                userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]);
                ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]);
                sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); 

                string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]));
                if (_message != "")
                {
                    EntityMstData entity = new EntityMstData();
                    entity.MESSAGE = _message;
                    return entity;
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetCommodity(認証処理)", ex);
                EntityMstData entity = new EntityMstData();
                entity.MESSAGE = "認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();
                return entity;
            }

            #endregion

            EntityMstData objList = null;
            StringBuilder sb;
            DataTable dt;
            ExMySQLData db;

            try
            {
                db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]),
                                            ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]));
                sb = new StringBuilder();

                #region SQL

                sb.Append("SELECT GS.* " + Environment.NewLine);
                sb.Append("  FROM M_COMMODITY AS GS" + Environment.NewLine);
                sb.Append(" WHERE GS.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND GS.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND GS.COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("   AND GS.ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(ID)) + Environment.NewLine);

                #endregion

                dt = db.GetDataTable(sb.ToString());

                if (dt.DefaultView.Count > 0)
                {
                    objList = new EntityMstData(ExCast.zCStr(dt.DefaultView[0]["ID"]),
                                                "",
                                                ExCast.zCStr(dt.DefaultView[0]["NAME"])
                                                );
                    objList.ATTRIBUTE1 = ExCast.zCStr(dt.DefaultView[0]["UNIT_ID"]);                                // 単位ID
                    objList.ATTRIBUTE2 = ExCast.zCStr(dt.DefaultView[0]["ENTER_NUMBER"]);                           // 入数
                    objList.ATTRIBUTE3 = ExCast.zCStr(dt.DefaultView[0]["NUMBER_DECIMAL_DIGIT"]);                   // 数量小数桁
                    objList.ATTRIBUTE4 = ExCast.zCStr(dt.DefaultView[0]["UNIT_DECIMAL_DIGIT"]);                     // 単価小数桁
                    objList.ATTRIBUTE5 = ExCast.zCStr(dt.DefaultView[0]["TAXATION_DIVISION_ID"]);                   // 課税区分ID
                    objList.ATTRIBUTE6 = ExCast.zCStr(dt.DefaultView[0]["INVENTORY_MANAGEMENT_DIVISION_ID"]);       // 在庫管理区分ID
                    objList.ATTRIBUTE7 = ExCast.zCStr(dt.DefaultView[0]["JUST_INVENTORY_NUMBER"]);                  // 適正在庫数
                    objList.ATTRIBUTE8 = ExCast.zCStr(dt.DefaultView[0]["INVENTORY_NUMBER"]);                       // 現在庫数
                    objList.ATTRIBUTE9 = ExCast.zCStr(dt.DefaultView[0]["RETAIL_PRICE_SKIP_TAX"]);                  // 上代税抜
                    objList.ATTRIBUTE10 = ExCast.zCStr(dt.DefaultView[0]["RETAIL_PRICE_BEFORE_TAX"]);               // 上代税込
                    objList.ATTRIBUTE11 = ExCast.zCStr(dt.DefaultView[0]["SALES_UNIT_PRICE_SKIP_TAX"]);             // 売上単価税抜
                    objList.ATTRIBUTE12 = ExCast.zCStr(dt.DefaultView[0]["SALES_UNIT_PRICE_BEFORE_TAX"]);           // 売上単価税込
                    objList.ATTRIBUTE13 = ExCast.zCStr(dt.DefaultView[0]["SALES_COST_PRICE_SKIP_TAX"]);             // 売上原価税抜
                    objList.ATTRIBUTE14 = ExCast.zCStr(dt.DefaultView[0]["SALES_COST_PRICE_BEFORE_TAX"]);           // 売上原価税込
                    objList.ATTRIBUTE15 = ExCast.zCStr(dt.DefaultView[0]["PURCHASE_UNIT_PRICE_SKIP_TAX"]);          // 仕入単価税抜
                    objList.ATTRIBUTE16 = ExCast.zCStr(dt.DefaultView[0]["PURCHASE_UNIT_PRICE_BEFORE_TAX"]);        // 仕入単価税込
                    objList.ATTRIBUTE20 = dataGirdSelectedIndex;
                }
                else
                {
                    objList = new EntityMstData();
                    objList.ATTRIBUTE20 = dataGirdSelectedIndex;
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetCommodity", ex);
            }
            return objList;
        }
        public EntityMstData GetSupplier(string random, string CustomerID, string ID)
        {
            #region 認証処理

            string companyId = "";
            string groupId = "";
            string userId = "";
            string ipAdress = "";
            string sessionString = "";

            try
            {
                companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]);
                groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]);
                userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]);
                ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]);
                sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); 

                string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]));
                if (_message != "")
                {
                    EntityMstData entity = new EntityMstData();
                    entity.MESSAGE = _message;
                    return entity;
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetSupplier(認証処理)", ex);
                EntityMstData entity = new EntityMstData();
                entity.MESSAGE = "認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();
                return entity;
            }

            #endregion

            EntityMstData objList = null;

            StringBuilder sb;
            DataTable dt;
            ExMySQLData db;

            try
            {
                db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]),
                                            ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]));

                sb = new StringBuilder();

                #region SQL

                sb.Length = 0;
                sb.Append("SELECT SR.* " + Environment.NewLine);
                sb.Append("  FROM M_SUPPLIER AS SR" + Environment.NewLine);
                sb.Append(" WHERE SR.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND SR.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND SR.COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("   AND SR.CUSTOMER_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(CustomerID)) + Environment.NewLine);
                sb.Append("   AND SR.ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(ID)) + Environment.NewLine);
                sb.Append(" ORDER BY SR.CUSTOMER_ID ");
                sb.Append("         ,SR.ID ");

                #endregion

                dt = db.GetDataTable(sb.ToString());

                if (dt.DefaultView.Count > 0)
                {
                    objList = new EntityMstData(ExCast.zCStr(dt.DefaultView[0]["ID"]),
                                                ExCast.zCStr(dt.DefaultView[0]["CUSTOMER_ID"]),
                                                ExCast.zCStr(dt.DefaultView[0]["NAME"]));
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetSupplier", ex);
            }
            finally
            {
                db = null;
            }
            return objList;
        }
        public EntityMstData GetCustomer(string random, string ID)
        {
            #region 認証処理

            string companyId = "";
            string groupId = "";
            string userId = "";
            string ipAdress = "";
            string sessionString = "";
            int idFigureCustomer = 0;

            try
            {
                companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]);
                groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]);
                userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]);
                ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]);
                sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]);
                idFigureCustomer = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_CUSTOMER]);

                string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]));
                if (_message != "")
                {
                    EntityMstData entity = new EntityMstData();
                    entity.MESSAGE = _message;
                    return entity;
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetCustomer(認証処理)", ex);
                EntityMstData entity = new EntityMstData();
                entity.MESSAGE = "認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();
                return entity;
            }

            #endregion

            EntityMstData objList = null;
            StringBuilder sb;
            DataTable dt;
            ExMySQLData db;

            try
            {
                db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]),
                                            ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]));
                sb = new StringBuilder();

                #region SQL

                string _id = ID;
                if (ExCast.IsNumeric(_id))
                {
                    _id = ExCast.zCDbl(_id).ToString();
                }

                sb.Append("SELECT  CM.COMPANY_ID" + Environment.NewLine);
                sb.Append("      , CM.ID" + Environment.NewLine);
                sb.Append("      , CM.NAME" + Environment.NewLine);
                sb.Append("      , CM.KANA" + Environment.NewLine);
                sb.Append("      , CM.ABOUT_NAME" + Environment.NewLine);
                sb.Append("      , CM.ZIP_CODE" + Environment.NewLine);
                sb.Append("      , CM.PREFECTURE_ID" + Environment.NewLine);
                sb.Append("      , CM.CITY_ID" + Environment.NewLine);
                sb.Append("      , CM.TOWN_ID" + Environment.NewLine);
                sb.Append("      , CM.ADRESS_CITY" + Environment.NewLine);
                sb.Append("      , CM.ADRESS_TOWN" + Environment.NewLine);
                sb.Append("      , CM.ADRESS1" + Environment.NewLine);
                sb.Append("      , CM.ADRESS2" + Environment.NewLine);
                sb.Append("      , CM.STATION_NAME" + Environment.NewLine);
                sb.Append("      , CM.POST_NAME" + Environment.NewLine);
                sb.Append("      , CM.PERSON_NAME" + Environment.NewLine);
                sb.Append("      , CM.TITLE_ID" + Environment.NewLine);
                sb.Append("      , CM.TITLE_NAME" + Environment.NewLine);
                sb.Append("      , CM.TEL" + Environment.NewLine);
                sb.Append("      , CM.FAX" + Environment.NewLine);
                sb.Append("      , CM.MAIL_ADRESS" + Environment.NewLine);
                sb.Append("      , CM.MOBILE_TEL" + Environment.NewLine);
                sb.Append("      , CM.MOBILE_ADRESS" + Environment.NewLine);
                sb.Append("      , CM.URL" + Environment.NewLine);
                sb.Append("      , CM.INVOICE_ID" + Environment.NewLine);
                sb.Append("      , SK.NAME AS INVOICE_NAME" + Environment.NewLine);
                sb.Append("      , CM.BUSINESS_DIVISION_ID" + Environment.NewLine);
                sb.Append("      , CM.UNIT_KIND_ID" + Environment.NewLine);
                sb.Append("      , CM.CREDIT_RATE" + Environment.NewLine);
                sb.Append("      , CM.TAX_CHANGE_ID" + Environment.NewLine);
                sb.Append("      , CM.SUMMING_UP_GROUP_ID" + Environment.NewLine);
                sb.Append("      , CM.PRICE_FRACTION_PROC_ID" + Environment.NewLine);
                sb.Append("      , CM.TAX_FRACTION_PROC_ID" + Environment.NewLine);
                sb.Append("      , CM.CREDIT_LIMIT_PRICE" + Environment.NewLine);
                sb.Append("      , CM.SALES_CREDIT_PRICE" + Environment.NewLine);
                sb.Append("      , CM.RECEIPT_DIVISION_ID" + Environment.NewLine);
                sb.Append("      , CM.COLLECT_CYCLE_ID" + Environment.NewLine);
                sb.Append("      , CM.COLLECT_DAY" + Environment.NewLine);
                sb.Append("      , CM.BILL_SITE" + Environment.NewLine);
                sb.Append("      , CM.GROUP1_ID" + Environment.NewLine);
                sb.Append("      , CM.GROUP2_ID" + Environment.NewLine);
                sb.Append("      , CM.GROUP3_ID" + Environment.NewLine);
                sb.Append("      , CM.MEMO" + Environment.NewLine);
                sb.Append("      , SK.CREDIT_LIMIT_PRICE AS INVOICE_CREDIT_LIMIT_PRICE" + Environment.NewLine);
                sb.Append("      , SK.SALES_CREDIT_PRICE AS INVOICE_SALES_CREDIT_PRICE" + Environment.NewLine);
                sb.Append("  FROM M_CUSTOMER AS CM" + Environment.NewLine);

                #region Join

                // 請求先
                sb.Append("  LEFT JOIN M_CUSTOMER AS SK" + Environment.NewLine);
                sb.Append("    ON SK.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND SK.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND SK.COMPANY_ID = CM.COMPANY_ID " + Environment.NewLine);
                sb.Append("   AND SK.ID = CM.INVOICE_ID" + Environment.NewLine);

                #endregion

                sb.Append(" WHERE CM.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND CM.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND CM.COMPANY_ID = " + ExCast.zNumZeroNothingFormat(companyId) + Environment.NewLine);
                sb.Append("   AND CM.ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(_id)) + Environment.NewLine);

                #endregion

                dt = db.GetDataTable(sb.ToString());

                if (dt.DefaultView.Count > 0)
                {
                    objList = new EntityMstData(ExCast.zCStr(dt.DefaultView[0]["ID"]),
                                                ExCast.zCStr(dt.DefaultView[0]["ID"]),
                                                ExCast.zCStr(dt.DefaultView[0]["NAME"])
                                                );
                    objList.ATTRIBUTE1 = ExCast.zCStr(dt.DefaultView[0]["BUSINESS_DIVISION_ID"]);
                    objList.ATTRIBUTE2 = ExCast.zCStr(dt.DefaultView[0]["TAX_CHANGE_ID"]);
                    objList.ATTRIBUTE3 = ExCast.zCStr(dt.DefaultView[0]["PRICE_FRACTION_PROC_ID"]);
                    objList.ATTRIBUTE4 = ExCast.zCStr(dt.DefaultView[0]["TAX_FRACTION_PROC_ID"]);
                    objList.ATTRIBUTE5 = ExCast.zCStr(dt.DefaultView[0]["UNIT_KIND_ID"]);
                    objList.ATTRIBUTE6 = ExCast.zCStr(dt.DefaultView[0]["CREDIT_LIMIT_PRICE"]);
                    objList.ATTRIBUTE7 = ExCast.zCStr(dt.DefaultView[0]["SALES_CREDIT_PRICE"]);
                    objList.ATTRIBUTE8 = ExCast.zFormatForID(dt.DefaultView[0]["INVOICE_ID"], idFigureCustomer);
                    objList.ATTRIBUTE9 = ExCast.zCStr(dt.DefaultView[0]["INVOICE_NAME"]);

                    objList.ATTRIBUTE10 = ExCast.zCStr(dt.DefaultView[0]["SUMMING_UP_GROUP_ID"]);
                    objList.ATTRIBUTE11 = ExCast.zCStr(dt.DefaultView[0]["RECEIPT_DIVISION_ID"]);
                    objList.ATTRIBUTE12 = ExCast.zCStr(dt.DefaultView[0]["COLLECT_CYCLE_ID"]);
                    objList.ATTRIBUTE13 = ExCast.zCStr(dt.DefaultView[0]["COLLECT_DAY"]);
                    objList.ATTRIBUTE14 = ExCast.zCStr(dt.DefaultView[0]["BILL_SITE"]);
                    objList.ATTRIBUTE15 = ExCast.zCStr(dt.DefaultView[0]["PRICE_FRACTION_PROC_ID"]);
                    objList.ATTRIBUTE16 = ExCast.zCStr(dt.DefaultView[0]["TAX_FRACTION_PROC_ID"]);

                    objList.ATTRIBUTE17 = ExCast.zCStr(dt.DefaultView[0]["INVOICE_CREDIT_LIMIT_PRICE"]);
                    objList.ATTRIBUTE18 = ExCast.zCStr(dt.DefaultView[0]["INVOICE_SALES_CREDIT_PRICE"]);

                    objList.ATTRIBUTE19 = ExCast.zCStr(dt.DefaultView[0]["CREDIT_RATE"]);

                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetCustomer", ex);
            }
            return objList;
        }