public static List <AppMenu> Menu(IAuthenticationManager authenticationManager) { List <AppMenu> menu = (List <AppMenu>)SessionHelper.Read(SessionName); if (menu == null || menu.Count == 0) { menu = new List <AppMenu>(); if (authenticationManager.IsAuthenticated) { List <AppMenuJson> menuJson = new List <AppMenuJson>(); string tenantName = MultiTenantHelper.Tenant.Name; // Menu.TenantName.json string filePath = Path.Combine(WebHelper.WebDirectory(ConfigurationHelper.AppSettings <string>("Directory.Configuration")), "JSON/Menu" + "." + tenantName + ".json"); // Menu.json | Menu.TenantName.json ??? //string filePath = Path.Combine(MvcHelper.WebDirectory(ConfigurationHelper.AppSettings<string>("Directory.Configuration")), // "JSON/Menu" + (String.IsNullOrEmpty(tenantName) ? "" : "." + tenantName) + ".json"); string json = File.ReadAllText(filePath); menuJson = JsonConvert.DeserializeObject <List <AppMenuJson> >(json); Parse(menu, menuJson, null, authenticationManager.IsAdministrator, authenticationManager.Roles); ResourcesManager resourcesManager = new ResourcesManager(); foreach (AppMenu appMenu in menu) { if (appMenu.Text.Contains("Resources.")) { string[] words = appMenu.Text.Split('.'); if (words.Length == 2) { switch (words[0]) { case "DashboardResources": appMenu.Text = resourcesManager.GetDashboardResource(words[1]); break; case "MenuResources": appMenu.Text = resourcesManager.GetMenuResource(words[1]); break; case "ReportResources": appMenu.Text = resourcesManager.GetReportResource(words[1]); break; default: appMenu.Text = resourcesManager.GetResource(words[0], words[1]); break; } } } } } SessionHelper.Write(SessionName, menu); } return(menu); }
/// <summary> /// 短信是否发送成功? /// 以八小时内是否有成功发送的短信为准 /// </summary> /// <param name="userInfo">用户</param> /// <param name="mobile">手机号码</param> /// <returns>是否成功到达</returns> public bool SentSuccessfully(BaseUserInfo userInfo, string mobile) { bool result = false; string connectionString = string.Empty; connectionString = ConfigurationHelper.AppSettings("OpenMasDbConnection", BaseSystemInfo.EncryptDbConnection); if (!string.IsNullOrEmpty(connectionString)) { using (IDbHelper dbHelper = DbHelperFactory.GetHelper(CurrentDbType.SqlServer, connectionString)) { /* * string commandText = @"SELECT COUNT(1) * FROM SMSSentLog * WHERE GatawayStatus = 'DELIVRD' * AND DATEDIFF(Hour, CreateTime, GETDATE()) < 8 * AND DestinationAddress = " + dbHelper.GetParameter("DestinationAddress"); */ string commandText = @"SELECT COUNT(1) FROM SMSSentLog WHERE DATEDIFF(Hour, CreateTime, GETDATE()) < 8 AND DestinationAddress = " + dbHelper.GetParameter("DestinationAddress"); object remainingNumber = dbHelper.ExecuteScalar(commandText, new IDbDataParameter[] { dbHelper.MakeParameter("DestinationAddress", mobile) }); if (remainingNumber != null) { result = int.Parse(remainingNumber.ToString()) > 0; } } } return(result); }
/// <summary> /// Report Initialization method that is triggered when report begin processed. /// </summary> /// <param name="reportOptions">The ReportViewer options.</param> public void OnInitReportOptions(ReportViewerOptions reportOptions) { //throw new NotImplementedException(); // Add RDL Server and database credentials here // Report Server string user = ConfigurationHelper.AppSettings <string>("EasyLOB.Report.RDL.User"); string password = ConfigurationHelper.AppSettings <string>("EasyLOB.Report.RDL.Password"); reportOptions.ReportModel.ReportServerCredential = new System.Net.NetworkCredential(user, password); //string domain = ConfigurationHelper.AppSettings<string>("EasyLOB.Report.RDL.Domain"); //reportOptions.ReportModel.ReportServerCredential = new System.Net.NetworkCredential(user, password, domain); // Report Path //reportOptions.ReportModel.ReportPath = ... // Data Source Credentials //string connection = MultiTenantHelper.Tenant.Connections[0].ConnectionName; //string[] userPassword = AdoNetHelper.GetUserPassword(connection); //DataSourceCredentials dataSourceCredentials = new DataSourceCredentials(connection, userPassword[0], userPassword[1]); //reportOptions.ReportModel.DataSourceCredentials.Add(dataSourceCredentials); }
/// <summary> /// 扣除短信费用(主要账户发?分账户发?不拆分账户发?拆分账户发?) /// </summary> /// <param name="applicationCode">网点编号</param> /// <param name="accountCode">网点编号或者员工编号</param> /// <param name="messageCount">消息长度</param> /// <returns>影响行数</returns> public int Costing(string applicationCode, string accountCode, int messageCount) { int result = 0; // 这里需要帐户余额减掉 string connectionString = ConfigurationHelper.AppSettings("OpenMasDbConnection", BaseSystemInfo.EncryptDbConnection); if (!string.IsNullOrEmpty(connectionString)) { using (IDbHelper dbHelper = DbHelperFactory.GetHelper(CurrentDbType.SqlServer, connectionString)) { string commandText = @"UPDATE SMSUserAccount SET RemainingNumber = RemainingNumber - " + messageCount + ", AllCount = AllCount + " + messageCount + " WHERE ApplicationCode = " + dbHelper.GetParameter("ApplicationCode") + " AND AccountCode = " + dbHelper.GetParameter("AccountCode"); result = dbHelper.ExecuteNonQuery(commandText, new[] { dbHelper.MakeParameter("ApplicationCode", applicationCode), dbHelper.MakeParameter("AccountCode", accountCode) }); if (result == 0) { result = dbHelper.ExecuteNonQuery(commandText, new[] { dbHelper.MakeParameter("ApplicationCode", applicationCode), dbHelper.MakeParameter("AccountCode", applicationCode) }); } // 有没有扣费成功的情况发生、需要写日志 if (result == 0) { LogUtil.WriteException(new Exception(string.Format("Costing函数扣费失败 ApplicationCode:{0} AccountCode:{1}", applicationCode, accountCode))); } } } return(result); }
public ActionResult RDLExport(string exportFormat, string reportDirectory, string reportName) { OperationResultModel viewModel = new OperationResultModel(); string exportPath = Path.Combine(Server.MapPath(ConfigurationHelper.AppSettings <string>("EasyLOB.Directory.Export")), reportName + String.Format(".{0:yyyyMMdd.HHmmss.fff}", DateTime.Now)); IDictionary <string, string> reportParameters = new Dictionary <string, string>(); if (System.Web.HttpContext.Current.Request.QueryString.Count > 3) { for (int q = 3; q < System.Web.HttpContext.Current.Request.QueryString.Count; q++) { reportParameters.Add(System.Web.HttpContext.Current.Request.QueryString.AllKeys[q], System.Web.HttpContext.Current.Request.QueryString[q]); } } if (SyncfusionHelper.ExportRDL(viewModel.OperationResult, ref exportPath, exportFormat, reportDirectory, reportName, reportParameters)) { byte[] file = System.IO.File.ReadAllBytes(exportPath); return(File(file, LibraryHelper.GetContentType(LibraryHelper.GetFileType(Path.GetExtension(exportPath))), Path.GetFileName(exportPath))); } return(ZViewOperationResult(viewModel.OperationResult)); }
public ActionResult ExportSecurity(TaskViewModel viewModel) { viewModel.OperationResult.Clear(); try { if (IsTask("ExportSecurity", viewModel.OperationResult)) { if (IsValid(viewModel.OperationResult, viewModel)) { string templateDirectory = Server.MapPath(ConfigurationHelper.AppSettings <string>("EasyLOB.Directory.Template")); string fileDirectory = Server.MapPath(ConfigurationHelper.AppSettings <string>("EasyLOB.Directory.Export")); string filePath; if (ExportSecurity(viewModel.OperationResult, templateDirectory, fileDirectory, out filePath)) { byte[] file = System.IO.File.ReadAllBytes(filePath); return(File(file, LibraryHelper.GetContentType(ZFileTypes.ftXLSX), Path.GetFileName(filePath))); } } } } catch (Exception exception) { viewModel.OperationResult.ParseException(exception); } return(ZView("Task", viewModel)); }
public DataTable GetDataTableByPage(BaseUserInfo userInfo, out int recordCount, string tableName, string selectField, int pageIndex, int pageSize, string conditions, IDbDataParameter[] dbParameters, string orderBy) { DataTable result = null; recordCount = 0; string connectionString = string.Empty; connectionString = ConfigurationHelper.AppSettings("OpenMasDbConnection", BaseSystemInfo.EncryptDbConnection); if (!string.IsNullOrEmpty(connectionString)) { if (SecretUtil.IsSqlSafe(conditions)) { using (IDbHelper dbHelper = DbHelperFactory.GetHelper(CurrentDbType.SqlServer, connectionString)) { recordCount = DbLogic.GetCount(dbHelper, tableName, conditions, dbParameters); result = DbLogic.GetDataTableByPage(dbHelper, tableName, selectField, pageIndex, pageSize, conditions, dbParameters, orderBy); } } else { if (System.Web.HttpContext.Current != null) { // 记录注入日志 FileUtil.WriteMessage("userInfo:" + userInfo.Serialize() + " " + conditions, System.Web.HttpContext.Current.Server.MapPath("~/Log/") + "SqlSafe" + DateTime.Now.ToString(BaseSystemInfo.DateFormat) + ".txt"); } } } return(result); }
public bool Connect(string environment = null) { environment = String.IsNullOrEmpty(environment) ? ConfigurationHelper.AppSettings <string>("Protheus.Environment") : environment; if (Environment != environment) { Disconnect(); } if (!Connection.Connected || Environment != environment) { Connection.Environment = environment; Connection.Server = Server; Connection.Port = Port; Connection.User = User; Connection.Password = Password; Environment = environment; Empresa = ""; Filial = ""; Connection.Connect(); } return(Connection.Connected); }
public static void Main(string[] args) { Configuration = ConfigurationHelper.AppSettings(); ServiceCollection = new ServiceCollection().ConfigureServices(); ServiceProvider = ServiceCollection.BuildServiceProvider(); ServiceProvider.GetRequiredService <App>().Run(); }
public EdmManagerFileSystem() { RootDirectory = ConfigurationHelper.AppSettings <string>("EasyLOB.EDM.FileSystem.Directory"); if (!String.IsNullOrEmpty(MultiTenantHelper.Tenant.Name)) { RootDirectory = Path.Combine(RootDirectory, MultiTenantHelper.Tenant.Name); } }
private static void LibraryEdmDemo(IEdmManager edmManager) { Console.WriteLine("\nEDM Demo\n"); string rootDirectory = ConfigurationHelper.AppSettings <string>("EDM.FileSystemDirectory"); Console.WriteLine("IMPORTANT: Create \"" + rootDirectory + "\" directory !"); Console.Write("\nPress <KEY> to continue... "); Console.ReadKey(); Console.WriteLine("\n"); string txtFilePath = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.txt"; using (StreamWriter writer = new StreamWriter(txtFilePath)) { writer.Write("EasyLOB"); } byte[] file; int key; string entityName = "Entity", exportPath; ZFileTypes fileType; // 1 Console.WriteLine("1"); key = 1; fileType = ZFileTypes.ftTXT; exportPath = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.1.txt"; Console.WriteLine(" Write TXT"); edmManager.WriteFile(entityName, key, fileType, txtFilePath); Console.WriteLine(" Read TXT"); file = edmManager.ReadFile(entityName, key, fileType); File.WriteAllBytes(exportPath, file); //Console.WriteLine(" Delete TXT"); //edmManager.EdmEngine.DeleteFile(entityName, key, fileType); // 101 Console.WriteLine("101"); key = 101; fileType = ZFileTypes.ftTXT; exportPath = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.101.txt"; Console.WriteLine(" Write TXT"); edmManager.WriteFile(entityName, key, fileType, txtFilePath); Console.WriteLine(" Read TXT"); file = edmManager.ReadFile(entityName, key, fileType); File.WriteAllBytes(exportPath, file); //Console.WriteLine(" Delete TXT"); //edmManager.edmEngine.DeleteFile(entityName, key, fileType); }
private static void PathsDemo() { string path = ConfigurationHelper.AppSettings <string>("EasyLOB.Directory.Configuration"); Console.WriteLine("\nPaths Demo"); Console.WriteLine("\nWebHelper.WebDirectory(path): {0}", WebHelper.WebDirectory(path)); Console.WriteLine("WebHelper.IsWeb: {0}", WebHelper.IsWeb.ToString()); Console.WriteLine("WebHelper.WebUrl: {0}", WebHelper.WebUrl); Console.WriteLine("WebHelper.WebPath: {0}", WebHelper.WebPath); Console.WriteLine("WebHelper.WebDomain: {0}", WebHelper.WebDomain); Console.WriteLine("WebHelper.WebSubDomain: {0}", WebHelper.WebSubDomain); Console.WriteLine("\nAppDomain.CurrentDomain.BaseDirectory: {0}", AppDomain.CurrentDomain.BaseDirectory); }
public EdmManagerFTP() { RootDirectory = ConfigurationHelper.AppSettings <string>("EDM.FTP.Root"); ftpClient = new FtpClient(); ftpClient.Host = ConfigurationHelper.AppSettings <string>("EDM.FTP.Server"); ftpClient.Port = ConfigurationHelper.AppSettings <int>("EDM.FTP.Port"); ftpClient.Credentials = new NetworkCredential(ConfigurationHelper.AppSettings <string>("EDM.FTP.User"), ConfigurationHelper.AppSettings <string>("EDM.FTP.Password")); ftpClient.Connect(); }
/// <summary> /// Execute Reader. /// </summary> /// <param name="dbCommand">Command</param> /// <param name="isolationLevel">Isolation level</param> /// <returns>Data Reader</returns> public static DbDataReader ExecuteReader(this DbCommand dbCommand, IsolationLevel isolationLevel) { if (ConfigurationHelper.AppSettings <bool>("EasyLOB.AdoNet.IsolationLevel")) { ZDBMS dbms = AdoNetHelper.GetDBMS(dbCommand.Connection); string sql = AdoNetHelper.SqlIsolationLevel(dbms, isolationLevel); dbCommand.CommandText = (String.IsNullOrEmpty(sql) ? "" : sql + Environment.NewLine) + dbCommand.CommandText; } return(dbCommand.ExecuteReader()); }
/// <summary> /// 验证手机验证码 /// 2015-11-10 吉日嘎拉 手机验证码确认的代码进行优化 /// </summary> /// <param name="userInfo">用户</param> /// <param name="mobile">手机号码</param> /// <param name="code">验证码</param> /// <returns>成功验证</returns> public bool ValidateVerificationCode(BaseUserInfo userInfo, string mobile, string code) { bool result = false; if (string.IsNullOrEmpty(mobile)) { return(false); } if (string.IsNullOrEmpty(code)) { return(false); } string connectionString = string.Empty; connectionString = ConfigurationHelper.AppSettings("OpenMasDbConnection", BaseSystemInfo.EncryptDbConnection); if (!string.IsNullOrEmpty(connectionString)) { using (IDbHelper dbHelper = DbHelperFactory.GetHelper(CurrentDbType.SqlServer, connectionString)) { string commandText = @"SELECT COUNT(1) FROM SMSSentLog WHERE DATEDIFF(Hour, CreateTime, GETDATE()) < 8 AND MessageCode = " + dbHelper.GetParameter("MessageCode") + " AND DestinationAddress = " + dbHelper.GetParameter("DestinationAddress"); object remainingNumber = dbHelper.ExecuteScalar(commandText , new IDbDataParameter[] { dbHelper.MakeParameter("MessageCode", code) , dbHelper.MakeParameter("DestinationAddress", mobile) }); if (remainingNumber != null) { result = int.Parse(remainingNumber.ToString()) > 0; } } // 手机验证码通过审核了 if (result && userInfo != null) { BaseUserContactEntity userContactEntity = BaseUserContactManager.GetObjectByCache(userInfo.Id); if (userContactEntity != null) { // 2016-02-13 吉日嘎拉 这里还需要进行缓存更新操作 userContactEntity.MobileValiated = 1; userContactEntity.MobileVerificationDate = DateTime.Now; new BaseUserContactManager().Update(userContactEntity); } } } return(result); }
private void Mail(MimeMessage message) { if (message != null) { string host = ConfigurationHelper.AppSettings <string>("EasyLOB.Mail.Host"); int port = ConfigurationHelper.AppSettings <int>("EasyLOB.Mail.Port"); string userName = ConfigurationHelper.AppSettings <string>("EasyLOB.Mail.UserName"); string password = ConfigurationHelper.AppSettings <string>("EasyLOB.Mail.Password"); bool ssl = ConfigurationHelper.AppSettings <bool>("EasyLOB.Mail.SSL"); Mail(message, host, port, userName, password, ssl); } }
public ResourcesManager() { IniManagerDashboard = new IniManager(Path.Combine(WebHelper.WebDirectory(ConfigurationHelper.AppSettings <string>("Directory.Configuration")), "INI/DashboardResources.ini")); IniManagerMenu = new IniManager(Path.Combine(WebHelper.WebDirectory(ConfigurationHelper.AppSettings <string>("Directory.Configuration")), "INI/MenuResources.ini")); IniManagerReport = new IniManager(Path.Combine(WebHelper.WebDirectory(ConfigurationHelper.AppSettings <string>("Directory.Configuration")), "INI/ReportResources.ini")); }
public string GetExternalUserName(string id) { string result = null; string connectionString = ConfigurationHelper.AppSettings("WeChatDbConnection", BaseSystemInfo.EncryptDbConnection); if (!string.IsNullOrEmpty(connectionString)) { List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >(); parameters.Add(new KeyValuePair <string, object>("Id", id)); IDbHelper dbHelper = DbHelperFactory.GetHelper(CurrentDbType.Oracle, connectionString); result = DbLogic.GetProperty(dbHelper, "ExternalUser", parameters, "NICKNAME"); } return(result); }
private static void EDMFilePathDemo(IEdmManager edmManager) { Console.WriteLine("\nEDM { File Path } Demo\n"); string rootDirectory = ConfigurationHelper.AppSettings <string>("EDM.FileSystem.Directory"); Console.WriteLine("IMPORTANT: Create \"" + rootDirectory + "\" directory !"); Console.Write("\nPress <KEY> to continue... "); Console.ReadKey(); Console.WriteLine("\n"); string txtFilePath = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.txt"; using (StreamWriter writer = new StreamWriter(txtFilePath)) { writer.Write("EasyLOB"); } byte[] file; string edmFilePath, exportPath; // 1 Console.WriteLine("A/B/C"); edmFilePath = "A/B/C/txt.txt"; exportPath = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.1.txt"; Console.WriteLine(" Write TXT"); edmManager.WriteFile(edmFilePath, txtFilePath); Console.WriteLine(" Read TXT"); file = edmManager.ReadFile(edmFilePath); File.WriteAllBytes(exportPath, file); //Console.WriteLine(" Delete TXT"); //edmManager.EdmEngine.DeleteFile(edmFilePath); // 101 Console.WriteLine("101"); edmFilePath = "A/D/E/txt.txt"; exportPath = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.101.txt"; Console.WriteLine(" Write TXT"); edmManager.WriteFile(edmFilePath, txtFilePath); Console.WriteLine(" Read TXT"); file = edmManager.ReadFile(edmFilePath); File.WriteAllBytes(exportPath, file); //Console.WriteLine(" Delete TXT"); //edmManager.EdmEngine.DeleteFile(edmFilePath); }
private static void DemoEnvironmentApplication() { Console.WriteLine("\nAppDomain.CurrentDomain.BaseDirectory: {0}", AppDomain.CurrentDomain.BaseDirectory); string path = ConfigurationHelper.AppSettings <string>("EasyLOB.Directory.Configuration"); Console.WriteLine("\nApplication Demo"); Console.WriteLine("\nApplicationDirectory: {0}", DIHelper.EnvironmentManager.ApplicationDirectory); Console.WriteLine("WebDirectory(path): {0}", DIHelper.EnvironmentManager.ApplicationPath(path)); Console.WriteLine("IsWeb: {0}", DIHelper.EnvironmentManager.IsWeb.ToString()); Console.WriteLine("WebUrl: {0}", DIHelper.EnvironmentManager.WebUrl); Console.WriteLine("WebPath: {0}", DIHelper.EnvironmentManager.WebPath); Console.WriteLine("WebDomain: {0}", DIHelper.EnvironmentManager.WebDomain); Console.WriteLine("WebSubDomain: {0}", DIHelper.EnvironmentManager.WebSubDomain); }
/// <summary> /// 获取可发送短信的余额 /// </summary> /// <param name="userInfo">当前用户信息</param> /// <param name="applicationCode">公司编号、应用编号</param> /// <param name="accountCode">用户工号、用户账户</param> /// <returns>短信余额</returns> public int GetRemainingCount(string applicationCode, string accountCode) { int result = 0; string connectionString = string.Empty; connectionString = ConfigurationHelper.AppSettings("OpenMasDbConnection", BaseSystemInfo.EncryptDbConnection); if (!string.IsNullOrEmpty(connectionString)) { using (IDbHelper dbHelper = DbHelperFactory.GetHelper(CurrentDbType.SqlServer, connectionString)) { string commandText = @"SELECT RemainingNumber + Credit FROM SMSUserAccount WHERE ApplicationCode = " + dbHelper.GetParameter("ApplicationCode") + " AND AccountCode = " + dbHelper.GetParameter("AccountCode"); object remainingNumber = dbHelper.ExecuteScalar(commandText , new IDbDataParameter[] { dbHelper.MakeParameter("ApplicationCode", applicationCode) , dbHelper.MakeParameter("AccountCode", accountCode) }); // 若是空的,那就找整个公司是否购买了短信?不分配短信也可以才对 if (remainingNumber == null) { commandText = "SELECT RemainingNumber + Credit " + " FROM SMSUserAccount " + " WHERE SplitAccount = " + dbHelper.GetParameter("SplitAccount") + " AND Enabled = " + dbHelper.GetParameter("Enabled") + " AND ApplicationCode = " + dbHelper.GetParameter("ApplicationCode") + " AND AccountCode = " + dbHelper.GetParameter("AccountCode"); remainingNumber = dbHelper.ExecuteScalar(commandText , new IDbDataParameter[] { dbHelper.MakeParameter("SplitAccount", 0) , dbHelper.MakeParameter("Enabled", 1) , dbHelper.MakeParameter("ApplicationCode", applicationCode) , dbHelper.MakeParameter("AccountCode", applicationCode) }); } if (remainingNumber != null) { result = int.Parse(remainingNumber.ToString()); } } } return(result); }
public TaskAgent() { ServiceName = ConfigurationHelper.AppSettings("ServiceName", false); Intervals = new Int32[ThreadCount]; for (int i = 0; i < ThreadCount; i++) { if (i == 0) { Intervals[i] = 60; } else { Intervals[i] = 20; } } }
/// <summary> /// 组织机构更新后执行的方法 /// </summary> /// <param name="entity">组织机构实体</param> public virtual void AfterUpdate(BaseOrganizeEntity entity) { #region 更新网点基础资料 string connectionString = ConfigurationHelper.AppSettings("K8Connection", BaseSystemInfo.EncryptDbConnection); if (!string.IsNullOrEmpty(connectionString)) { IDbHelper dbHelper = DbHelperFactory.GetHelper(CurrentDbType.Oracle, connectionString); string commandText = string.Format(@"UPDATE TAB_SITE SET PROVINCE = {0}, CITY = {1} , RANGE_NAME = {2} , COUNTY_NAME = {3} , MANAGER = {4} , MANAGER_PHONE = {5}, PRINCIPAL = {6}, EXIGENCE_PHONE={7}, SALE_PHONE={8}, SITE_DESC={9} WHERE Id = {10}" , dbHelper.GetParameter(BaseOrganizeEntity.FieldProvince) , dbHelper.GetParameter(BaseOrganizeEntity.FieldCity) , dbHelper.GetParameter(BaseOrganizeEntity.FieldDistrict) , dbHelper.GetParameter(BaseOrganizeEntity.FieldStreet) , dbHelper.GetParameter(BaseOrganizeEntity.FieldMaster) , dbHelper.GetParameter(BaseOrganizeEntity.FieldMasterMobile) , dbHelper.GetParameter(BaseOrganizeEntity.FieldManager) , dbHelper.GetParameter(BaseOrganizeEntity.FieldEmergencyCall) , dbHelper.GetParameter(BaseOrganizeEntity.FieldBusinessPhone) , dbHelper.GetParameter(BaseOrganizeEntity.FieldDescription) , dbHelper.GetParameter(BaseOrganizeEntity.FieldId)); dbHelper.ExecuteNonQuery(commandText, new IDbDataParameter[] { dbHelper.MakeParameter(BaseOrganizeEntity.FieldProvince, entity.Province) , dbHelper.MakeParameter(BaseOrganizeEntity.FieldCity, entity.City) , dbHelper.MakeParameter(BaseOrganizeEntity.FieldDistrict, entity.District) , dbHelper.MakeParameter(BaseOrganizeEntity.FieldStreet, entity.Street) , dbHelper.MakeParameter(BaseOrganizeEntity.FieldMaster, entity.Master) , dbHelper.MakeParameter(BaseOrganizeEntity.FieldMasterMobile, entity.MasterMobile) , dbHelper.MakeParameter(BaseOrganizeEntity.FieldManager, entity.Manager) , dbHelper.MakeParameter(BaseOrganizeEntity.FieldEmergencyCall, entity.EmergencyCall) , dbHelper.MakeParameter(BaseOrganizeEntity.FieldBusinessPhone, entity.BusinessPhone) , dbHelper.MakeParameter(BaseOrganizeEntity.FieldDescription, entity.Description) , dbHelper.MakeParameter(BaseOrganizeEntity.FieldId, entity.Id) }); System.Console.WriteLine(commandText); } #endregion }
public ProtheusManager() { Connection = new APConnX(); //Connection.DateFormat = "YYYYMMDD"; //Connection.ShowErrors = true; Environment = ConfigurationHelper.AppSettings <string>("Protheus.Environment"); Server = ConfigurationHelper.AppSettings <string>("Protheus.Server"); Port = ConfigurationHelper.AppSettings <int>("Protheus.Port"); User = ConfigurationHelper.AppSettings <string>("Protheus.User"); Password = ConfigurationHelper.AppSettings <string>("Protheus.Password"); Empresa = ""; Filial = ""; IsPrepared = false; }
public string GetResource(string resourceClass, string resourceKey) { string result = ""; List <string> namespaces = new List <string>() { "EasyLOB.Activity.Resources", "EasyLOB.Activity.Data.Resources", "EasyLOB.AuditTrail.Resources", "EasyLOB.AuditTrail.Data.Resources", "EasyLOB.Extensions.Edm.Resources", "EasyLOB.Identity.Resources", "EasyLOB.Identity.Data.Resources", "EasyLOB.Library.Resources", "EasyLOB.Library.Syncfusion.Resources", "EasyLOB.Log.Resources", "EasyLOB.Resources", "EasyLOB.Security.Resources" }; string[] resources = ConfigurationHelper.AppSettings <string>("EasyLOB.Resources").Split(','); foreach (string r in resources.Reverse()) { namespaces.Insert(0, r); } Type type; foreach (string n in namespaces) { type = LibraryHelper.GetType(n + "." + resourceClass); if (type != null) { try { result = (string)LibraryHelper.GetStaticPropertyValue(type, resourceKey); break; } catch { } } } return(result); }
public bool PrepareEnvironment(string empresa = null, string filial = null) { empresa = String.IsNullOrEmpty(empresa) ? ConfigurationHelper.AppSettings <string>("Protheus.Empresa") : empresa; filial = String.IsNullOrEmpty(filial) ? ConfigurationHelper.AppSettings <string>("Protheus.Filial") : filial; if (!IsPrepared || Empresa != empresa || Filial != filial) { object[] tabelas = { }; IsPrepared = Connection.PrepareEnv(Environment, empresa, filial, tabelas); if (IsPrepared) { Empresa = empresa; Filial = filial; } } return(IsPrepared); }
/// <summary> /// 同步数据 /// </summary> /// <param name="all">同步所有数据</param> /// <returns>影响行数</returns> public int Synchronous(bool all = false) { int result = 0; string connectionString = ConfigurationHelper.AppSettings("K8Connection", BaseSystemInfo.EncryptDbConnection); string conditional = null; if (!all) { int id = 0; string commandText = "SELECT MAX(id) FROM BaseOrganize WHERE id < 1000000"; Object maxObject = DbHelper.ExecuteScalar(commandText); if (maxObject != null) { id = int.Parse(maxObject.ToString()); } conditional = " AND ID > " + id.ToString(); } result = Synchronous(connectionString, conditional); return(result); }
static ResourcesHelper() { string iniPath; iniPath = Path.Combine(DIHelper.EnvironmentManager.ApplicationPath(ConfigurationHelper.AppSettings <string>("EasyLOB.Directory.Configuration")), "INI/DashboardResources.ini"); IniManagerDashboard = DIHelper.DIManager.GetService <IIniManager>(); IniManagerDashboard.Load(iniPath); iniPath = Path.Combine(DIHelper.EnvironmentManager.ApplicationPath(ConfigurationHelper.AppSettings <string>("EasyLOB.Directory.Configuration")), "INI/MenuResources.ini"); IniManagerMenu = DIHelper.DIManager.GetService <IIniManager>(); IniManagerMenu.Load(iniPath); iniPath = Path.Combine(DIHelper.EnvironmentManager.ApplicationPath(ConfigurationHelper.AppSettings <string>("EasyLOB.Directory.Configuration")), "INI/ReportResources.ini"); IniManagerReport = DIHelper.DIManager.GetService <IIniManager>(); IniManagerReport.Load(iniPath); Namespaces = new List <string>() { "EasyLOB.Activity.Resources", "EasyLOB.Activity.Data.Resources", "EasyLOB.AuditTrail.Resources", "EasyLOB.AuditTrail.Data.Resources", "EasyLOB.Extensions.Edm.Resources", "EasyLOB.Identity.Resources", "EasyLOB.Identity.Data.Resources", "EasyLOB.Library.Resources", "EasyLOB.Library.Syncfusion.Resources", "EasyLOB.Log.Resources", "EasyLOB.Resources", "EasyLOB.Security.Resources" }; string[] resources = ConfigurationHelper.AppSettings <string>("EasyLOB.Resources").Split(','); foreach (string r in resources.Reverse()) { Namespaces.Insert(0, r); } }
public int GetSendVerificationCodeCount(string mobile) { int result = 0; string connectionString = string.Empty; connectionString = ConfigurationHelper.AppSettings("OpenMasDbConnection", BaseSystemInfo.EncryptDbConnection); if (!string.IsNullOrEmpty(connectionString)) { using (IDbHelper dbHelper = DbHelperFactory.GetHelper(CurrentDbType.SqlServer, connectionString)) { string commandText = @"SELECT COUNT(1) FROM SmsSentLog WHERE UserId = 'VerificationCode' AND DestinationAddress = " + dbHelper.GetParameter("Mobile") + " AND CreateTime > DATEADD(day, -1, GETDATE()) AND CreateTime < GETDATE()"; result = int.Parse(dbHelper.ExecuteScalar(commandText, new IDbDataParameter[] { dbHelper.MakeParameter("Mobile", mobile) }).ToString()); } } return(result); }
private void Mail(MimeMessage message, string host, int port, string userName, string password, bool ssl) { host = host ?? ""; userName = userName ?? ""; password = password ?? ""; if (!String.IsNullOrEmpty(UserName)) { userName = UserName; password = Password; } string toAddress = ConfigurationHelper.AppSettings <string>("EasyLOB.Mail.ToAddress"); if (!String.IsNullOrEmpty(toAddress)) { message.To.Clear(); message.To.Add(new MailboxAddress(toAddress)); } // GMail // 465 = SSL // 587 = TLS // How do I access GMail using MailKit? // http://www.mimekit.net/docs/html/Frequently-Asked-Questions.htm#GMailAccess // Less Secure Accounts // https://myaccount.google.com/lesssecureapps SmtpClient smtp = new SmtpClient(); //smtp.ServerCertificateValidationCallback = (s, c, h, e) => true; smtp.Connect(host, port, SecureSocketOptions.Auto); //smtp.Connect(host, port, ssl); // SSL //smtp.Connect(host, port, SecureSocketOptions.StartTls); // TLS smtp.Authenticate(userName, password); smtp.Send(message); smtp.Disconnect(true); }