public WebHospConf WebGetHospConf(int hospid)
        {
            WebHospConf ret = new WebHospConf();

            try
            {
                ServiceIF serv = new ServiceIF();
                OrderTool_Serv.Class.HospitalConfig hospData = null;

                ResultData inRet = serv.GetHospConf_Serv(hospid, out hospData);

                if (inRet.Result)
                {
                    LogControl.WriteLog(LogType.ORE, "WebGetHospConf", "【施設マスタ取得】 施設ID:" + hospData);
                    ret.Items = hospData;
                }
                else
                {
                    ret.Message = inRet.Message;
                }

                ret.Result = inRet.Result;
            }
            catch (Exception e)
            {
                ret.Result  = false;
                ret.Message = "処理中に障害が発生いたしました。\nシステム管理者にお問い合わせください。";
                LogControl.WriteLog(LogType.ERR, "WebGetHospConf", e.Message);
            }

            return(ret);
        }
Example #2
0
        public static HospitalConfig GetHospConfig(int id)
        {
            HospitalConfig ret = new HospitalConfig();

            // DB接続
            using (var con = new AccDbConnection(Conf._settings))
            {
                ret = getHospConfig(con, id);

                if (ret.Conf.Length == 0)
                {
                    ret = getHospConfig(con, 0);
                }
            }

            return(ret);
        }
Example #3
0
        private static HospitalConfig getHospConfig(AccDbConnection con, int id)
        {
            HospitalConfig ret   = new HospitalConfig();
            List <Config>  confs = new List <Config>();

            // コマンドオブジェクト生成
            using (var cmd = con.CreateCommand())
            {
                // SQL生成
                // ----------------------------
                // SELECT key,value
                // FROM HospConfig
                // WHERE hosp_id=id
                // ----------------------------
                StringBuilder selSQL = new StringBuilder();
                selSQL.Append("SELECT");
                selSQL.Append(" key");
                selSQL.Append(",value");
                selSQL.Append(" FROM");
                selSQL.Append(" HospConfig");
                selSQL.Append(" WHERE");
                selSQL.Append(" hosp_id=");
                selSQL.Append(cmd.Add(id).ParameterName);

                cmd.CommandText = selSQL.ToString();

                // SQL実行
                using (var dr = cmd.ExecuteReader())
                    // 該当データがある場合、返却値を設定
                    while (dr.Read())
                    {
                        Config tmpConf = new Config();
                        tmpConf.Key = dr["key"].ToString();
                        if (dr["value"] != DBNull.Value)
                        {
                            tmpConf.Value = dr["value"].ToString();
                        }

                        confs.Add(tmpConf);
                    }
            }

            ret.Conf = confs.ToArray();

            return(ret);
        }