Пример #1
0
        private void ExecutedScriptCommand(FunctionListObject functionObj, Window frmParent)
        {
            //string funcName = System.Reflection.MethodBase.GetCurrentMethod().Name;
            //Lấy tên function hiện tại
            string strScript = GetScriptCommandByFuncName(functionObj.FuncName);

            strScript = GenerateScriptWithParameters(functionObj, strScript, frmParent);
            if (string.IsNullOrEmpty(strScript))
            {
                ShowMessengeInfo("Không có mã thực thi");
                return;
            }
            SQLAppWaitingDialog.ShowDialog();
            string sourceUrl = GetSourceCodePath();
            string output    = SQLApp.ExecutedPowerShell(string.Format("cd {0} {1} {2}", sourceUrl, Environment.NewLine, strScript));
            string strType   = SQLApp.GetIniFile(strFileCfgScript, strDynPara, functionObj.Name + "Show");

            if (!string.IsNullOrEmpty(strType))
            {
                ShowScriptCommand(output, strType);
                SQLAppWaitingDialog.HideDialog();
                return;
            }
            SQLAppWaitingDialog.HideDialog();
            ShowMessengeInfo(output);
        }
Пример #2
0
 public void GetAllLanguage(Window frmParent)
 {
     try
     {
         string     sourceUrl = SQLApp.GetIniFile(strFileName, "SourceCode", "SourceUrl");
         string[]   listFiles = Directory.GetFiles(string.Format("{0}\\database\\seeds\\lang", sourceUrl), "*_lang.php", SearchOption.AllDirectories);
         DataTable  dtLang    = new DataTable("Language");
         DataColumn col       = new DataColumn("Group");
         dtLang.Columns.Add(col);
         col = new DataColumn("Key");
         dtLang.Columns.Add(col);
         col = new DataColumn("Text_vi");
         dtLang.Columns.Add(col);
         col = new DataColumn("Text_en");
         dtLang.Columns.Add(col);
         col = new DataColumn("Text_ja");
         dtLang.Columns.Add(col);
         foreach (string item in listFiles)
         {
             string strContent = SQLApp.ExecutedPowerShell(string.Format("php -r \"echo json_encode(require '{0}');\"", item));
             object obj        = JsonConvert.DeserializeObject(strContent);
             string objGroup   = (obj as Newtonsoft.Json.Linq.JObject).GetValue("group").ToString();
             Newtonsoft.Json.Linq.JArray objLang = (obj as Newtonsoft.Json.Linq.JObject).GetValue("lang") as Newtonsoft.Json.Linq.JArray;
             foreach (object objItem in objLang)
             {
                 DataRow dr = dtLang.NewRow();
                 dr["Group"]   = objGroup;
                 dr["Key"]     = (objItem as Newtonsoft.Json.Linq.JObject).GetValue("key").ToString();
                 dr["Text_vi"] = (objItem as Newtonsoft.Json.Linq.JObject).SelectToken("text.vi").ToString();
                 dr["Text_en"] = (objItem as Newtonsoft.Json.Linq.JObject).SelectToken("text.en").ToString();
                 dr["Text_ja"] = (objItem as Newtonsoft.Json.Linq.JObject).SelectToken("text.ja").ToString();
                 dtLang.Rows.Add(dr);
             }
         }
         ShowResultData(frmParent, dtLang);
     }
     catch (Exception ex)
     {
     }
 }