/// <summary> /// send email /// </summary> /// <param name="subject">the subject of email</param> /// <param name="attachments">the attachments of email</param> /// <param name="templateName">the template name of the mail content</param> /// <param name="paraTable">email model</param> /// <param name="isAsync">if async or not</param> public bool SendMail(string subject, string[] attachments, string templateName, Hashtable paraTable, bool isAsync) { string template = XMLProvider.XMLDictionary.First(x => x.Key == ModuleName).Value[templateName]; template = _sqlParser.Parse(template, paraTable); return(_mailUtil.SendMail(subject, template, attachments, isAsync)); }
public int GetInt(string sql, object module) { SQLParser parser = new SQLParser(); parser.Parse(sql, module); return(template.GetInt(sql, parser.GetSqlParameterNames(), parser.GetSqlParameterValues(), 0)); }
public Result ParseAndRun(string sql) { try { return(RunSQL(SQLParser.Parse(sql))); } catch (BaseDbExc e) { return(new Result(false, e.Message)); } }
private static void GenerateIntelliDB(string path, string installationPath) { //nome file per gli oggetti di database string intelliFileDB = Path.Combine(installationPath, JsonConstants.INTELLI_FILE_DB); //cero le sottocartelle databasescript string[] folders = Directory.GetDirectories(path, "databasescript", SearchOption.AllDirectories); //per ognuna, se contiene la sub create\all, cerco tutti i file .sql List <String> files = new List <string>(); foreach (var folder in folders) { string sub = Path.Combine(folder, "create\\all"); if (Directory.Exists(sub)) { files.AddRange(Directory.GetFiles(sub, "*.sql")); } } if (UpdateNeeded(files.ToArray(), new string[] { intelliFileDB })) { string tmp = Path.GetTempFileName(); using (StreamWriter sw = new StreamWriter(tmp, false, new UTF8Encoding(false))) { using (RCJsonWriter writer = new RCJsonWriter(sw)) { writer.Formatting = Newtonsoft.Json.Formatting.Indented; writer.WriteStartArray(); foreach (string f in files) { SQLParser parser = new SQLParser(); parser.Parse(f); foreach (TableStructure t in parser.Tables) { t.WriteTo(writer); } } writer.WriteEndArray(); } } File.Copy(tmp, intelliFileDB, true); File.Delete(tmp); } }