public int?AddGroup(Group group) { try { var values = new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_Group.Name, group.GroupName }, { GlobalAppSettings.DbColumns.DB_Group.Description, group.GroupDescription }, { GlobalAppSettings.DbColumns.DB_Group.Color, group.GroupColor }, { GlobalAppSettings.DbColumns.DB_Group.IsActive, true }, { GlobalAppSettings.DbColumns.DB_Group.ModifiedDate, DateTime.UtcNow.ToString(GlobalAppSettings.GetDateTimeFormat()) } }; var output = new List <string> { GlobalAppSettings.DbColumns.DB_Group.GroupId }; var result = _dataProvider.ExecuteScalarQuery(_queryBuilder.AddToTable( GlobalAppSettings.DbColumns.DB_Group.DB_TableName, values, output)); if (result.Status) { return(Convert.ToInt32(result.ReturnValue)); } return(null); } catch (Exception e) { LogExtension.LogError("Error while adding group", e, MethodBase.GetCurrentMethod(), " GroupName - " + group.GroupName + " GroupDescription - " + group.GroupDescription + " GroupColor - " + group.GroupColor); return(null); } }
/// <summary> /// Save all the system setting properties into the Systemsettings table /// </summary> /// <param name="data"></param> /// <param name="connectionString"></param> public void InsertSystemSettings(SystemSettings data, string connectionString) { var listValues = new List <Dictionary <string, object> > { { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.OrganizationName.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, data.OrganizationName }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.LoginLogo.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, data.LoginLogo }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.MainScreenLogo.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, data.MainScreenLogo }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.FavIcon.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, data.FavIcon }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.WelcomeNoteText.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, data.WelcomeNoteText }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.Language.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, data.Language }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.TimeZone.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, data.TimeZone }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.DateFormat.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, data.DateFormat }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.ActivationExpirationDays.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, data.ActivationExpirationDays.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.ReportCount.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, data.ReportCount.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.MailSettingsAddress.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, String.Empty }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.MailSettingsPassword.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, String.Empty }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.MailSettingsHost.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, String.Empty }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.MailSettingsSenderName.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, String.Empty }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.MailSettingsPort.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, "0" }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.MailSettingsIsSecureAuthentication.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, false }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } }, { new Dictionary <string, object> { { GlobalAppSettings.DbColumns.DB_SystemSettings.Key, EnumClass.SystemSettingKeys.BaseUrl.ToString() }, { GlobalAppSettings.DbColumns.DB_SystemSettings.Value, data.BaseUrl }, { GlobalAppSettings.DbColumns.DB_SystemSettings.IsActive, true } } } }; var query = String.Empty; for (var t = 0; t < listValues.Count; t++) { query += queryBuilder.AddToTable(GlobalAppSettings.DbColumns.DB_SystemSettings.DB_TableName, listValues[t]); if (t != listValues.Count - 1) { query += "; "; } } dataProvider.ExecuteBulkQuery(query, connectionString); }