public static string C_GETtDBCheckStock(string ptPlantCode)
        {
            StringBuilder oSql = new StringBuilder();

            try
            {
                var tPath  = "~/Config/DBStock.json";
                var oDBStk = new mlDBStk();
                oDBStk = JsonConvert.DeserializeObject <mlDBStk>(File.ReadAllText(HttpContext.Current.Server.MapPath(tPath)));

                //Memcach init
                var oMC_Usr = new BaseCacheManager <mlDBStk>(cCNVB.oCMConfig);
                oMC_Usr.AddOrUpdate("key", oDBStk, _ => oDBStk);
                oDBStk = oMC_Usr.Get("key");

                //Select DB form Brance json
                var aDB = (from oResultDBStk in oDBStk.DatabaseStock
                           where oResultDBStk.Brance == ptPlantCode.Substring(2, 2)
                           select oResultDBStk).ToList();

                oSql.AppendLine("Data Source = " + aDB[0].ServerName + " ");
                oSql.AppendLine(";Initial Catalog =  " + aDB[0].DabaseName + " ");
                oSql.AppendLine(";Persist Security Info=True;User ID =" + aDB[0].User + " ");
                oSql.AppendLine(";Password = "******" ");
                oSql.AppendLine(";Connection Timeout=15;Connection Lifetime=0;Min Pool Size=0;Max Pool Size=30;Pooling=true");
                return(oSql.ToString());
            }
            catch (Exception oEx)
            {
                throw oEx;
            }
        }
 public ActionResult UPDxDBQuota(mlDBStk poDBStk)
 {
     try
     {
         WRIxJSON(poDBStk);
         SETxReadDBQuota();
         SETxReadDBByTdr();
         return(View("wConfig", oC_DBStk));
     }
     catch (Exception ex)
     {
         oC_Log.Error(ex.Message);
     }
     return(View("wConfig", oC_DBStk));
 }
 private void SETxReadDBQuota()
 {
     try
     {
         string tPath1 = "";
         string tPath2 = "";
         tPath1   = "~/Config/DBStock.json";
         tPath2   = HttpContext.Server.MapPath(tPath1);
         oC_DBStk = JsonConvert.DeserializeObject <mlDBStk>(System.IO.File.ReadAllText(tPath2));
     }
     catch (Exception ex)
     {
         oC_Log.Error(ex.Message);
     }
 }
 private void WRIxJSON(mlDBStk poDBStk)
 {
     try
     {
         string tPath1 = "";
         string tPath2 = "";
         tPath1 = "~/Config/DBStock.json";
         tPath2 = HttpContext.Server.MapPath(tPath1);
         string tJson = JsonConvert.SerializeObject(poDBStk, Newtonsoft.Json.Formatting.Indented);
         System.IO.File.WriteAllText(tPath2, tJson);
     }
     catch (Exception ex)
     {
         oC_Log.Error(ex.Message);
     }
 }