public bool RegisterUser(string Practicetype, string Project_Code, string Project_Name, string Category, string Sub_Category, string Category_ID, string Sub_Category_ID, string Header, string Abstract, string Detailed_Content, string Meta_Tags, string Tangible_Intangible_Benefits, string KeyTeam_Involved, string Comments, string Status, string Pending_With, string AttachmentPath) { try { Best_Practice_dt userInfoDB = new Best_Practice_dt(); userInfoDB.Practicetype = Practicetype; userInfoDB.Project_Code = Project_Code; userInfoDB.Project_Name = Project_Name; userInfoDB.Category = Category; userInfoDB.Sub_Category = Sub_Category; userInfoDB.Category_ID = Category_ID; userInfoDB.Sub_Category_ID = Sub_Category_ID; userInfoDB.Header = Header; userInfoDB.Abstract = Abstract; userInfoDB.Detailed_Content = Detailed_Content; userInfoDB.Meta_Tags = Meta_Tags; userInfoDB.Tangible_Intangible_Benefits = Tangible_Intangible_Benefits; userInfoDB.KeyTeam_Involved = KeyTeam_Involved; userInfoDB.Status = Status; userInfoDB.Pending_With = Pending_With; userInfoDB.AttachmentPath = AttachmentPath; this.dbContext.Entry(userInfoDB).State = System.Data.Entity.EntityState.Added; return(this.dbContext.SaveChanges() > 0); } catch (Exception exception) { LogUtilities.LogException(exception, LogPriorityID.High, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name); throw; } }
// ReSharper disable once UnusedMember.Global public Stream Run(GeneConfig config, ILambdaContext context) { string snsTopicArn = null; var runLog = new StringBuilder(); try { LogUtilities.UpdateLogger(context.Logger, runLog); LogUtilities.LogLambdaInfo(context, CommandLineUtilities.InformationalVersion); LogUtilities.LogObject("Config", config); LogUtilities.Log(new[] { LambdaUrlHelper.UrlBaseEnvironmentVariableName, LambdaUtilities.SnsTopicKey }); LambdaUtilities.GarbageCollect(); snsTopicArn = LambdaUtilities.GetEnvironmentVariable(LambdaUtilities.SnsTopicKey); config.Validate(); string result = GetGeneAnnotation(config, _saManifestUrl, _saPathPrefix); return(LambdaResponse.Create(config.id, LambdaUrlHelper.SuccessMessage, result)); } catch (Exception e) { return(HandleException(config.id, snsTopicArn, e)); } }
/// <summary> /// Constructor. /// </summary> /// <param name="log">The logger to use for this metadata source.</param> public BCatalogOnlyMetadataSource(ILogger log, BProperties properties) { LogUtilities.LogFunctionEntrance(log, log); Log = log; m_Properties = properties; try { //get the client connection using (var client = ExternalServiceClient.GetClient(m_Properties.Server)) { //get the catalogs string[] catalogs = client.GetMetadataCatalogs(); //copy results m_Catalogs.AddRange(catalogs); } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.ToString()); } //m_Catalogs.Add(Driver.B_CATALOG); }
public static Stream Create(string id, string status, string nirvanaJson) { string statusJson = JsonConvert.SerializeObject(status); string outputStart = $"{{\"id\":\"{id}\",\"status\":{statusJson}"; string output; if (status == LambdaUrlHelper.SuccessMessage) { if (nirvanaJson == null) { throw new NoNullAllowedException("Nirvana annotation cannot be null when the job is successful."); } output = outputStart + OutputBeforeNirvanaJson + nirvanaJson + OutputEnd; } else { output = outputStart + OutputEnd; } LogUtilities.LogObject("Result", output); var outputStream = new MemoryStream(Encoding.UTF8.GetBytes(output)); return(outputStream); }
public void ShouldThrowIfUnknownLogLevelIsProvided() { var result = Assert.Throws <CommandException>(() => LogUtilities.ParseLogLevel("z")); result.Message.ShouldBeEquivalentTo("Unrecognized loglevel 'z'. Valid options are verbose, debug, information, warning, error and fatal. " + "Defaults to 'debug'."); }
public BQueryExecutor(ILogger log, BProperties properties, string sql) { //get function data LogUtilities.LogFunctionEntrance(log, log, sql); Log = log; m_Properties = properties; Sql = sql; // Create the prepared results. Results = new List <IResult>(); // Create the parameters. ParameterMetadata = new List <ParameterMetadata>(); //create our data IResult result = BResultTableFactory.CreateResultTable(log, sql, properties); if (result != null) { Results.Add(result); } else { throw new Exception("Failed to create the result table."); } }
public ValidationResult Run(ValidationConfig config, ILambdaContext context) { string snsTopicArn = null; try { LogUtilities.UpdateLogger(context.Logger, null); LogUtilities.LogLambdaInfo(context, CommandLineUtilities.InformationalVersion); LogUtilities.LogObject("Config", config); LogUtilities.Log(new[] { LambdaUrlHelper.UrlBaseEnvironmentVariableName, LambdaUtilities.SnsTopicKey }); LambdaUtilities.GarbageCollect(); snsTopicArn = LambdaUtilities.GetEnvironmentVariable(LambdaUtilities.SnsTopicKey); config.Validate(); GenomeAssembly genomeAssembly = GenomeAssemblyHelper.Convert(config.genomeAssembly); string nirvanaS3Ref = LambdaUrlHelper.GetRefUrl(genomeAssembly); var refProvider = ProviderUtilities.GetSequenceProvider(nirvanaS3Ref); using (var stream = PersistentStreamUtils.GetReadStream(config.customStrUrl)) TryLoadStrFile(stream, genomeAssembly, refProvider); } catch (Exception exception) { return(HandleException(config.id, exception, snsTopicArn)); } return(GetSuccessOutput(config.id)); }
/// <summary> /// Cancels the currently executing query. /// </summary> public void CancelExecute() { LogUtilities.LogFunctionEntrance(Log); // It's not possible to cancel execution in the UltraLight driver, as there is no actual // 'execution', everything is already hardcoded within the driver. }
public OperationResult UpdateAPNSToken(string userEmail, string apnsToken) { try { userEmail.GuardNullEmpty("User Email"); apnsToken.GuardNullEmpty("APNS Token"); using (UnitOfWork uow = new UnitOfWork()) { var userDB = uow.GetDbInterface <UserDB>(); bool isSuccess = userDB.UpdateAPNSToken(userEmail, apnsToken); return(new OperationResult() { Success = isSuccess, Message = isSuccess ? "Updated successfully" : "Unable to update apns token", MCode = isSuccess ? MessageCode.OperationSuccessful : MessageCode.OperationFailed }); } } catch (SIPException exception) { LogUtilities.LogException(exception, LogPriorityID.High, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name); return(exception.Result); } catch (Exception exception) { LogUtilities.LogException(exception, LogPriorityID.High, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name); throw; } }
/// <summary> /// Indicates that the cursor should be moved to before the first row. /// </summary> /// <returns>True if there are more rows; false otherwise.</returns> public bool MoveToBeforeFirstRow() { LogUtilities.LogFunctionEntrance(Log); m_IsFetching = true; m_Current = 0; return(m_Current < m_Columns.Count); }
public SpliceDriver() { LogUtilities.LogFunctionEntrance(Log); SetDriverPropertyValues(); // SAMPLE: Adding resource managers here allows you to localize the Simba DotNetDSI and/or ADO.Net components. //Simba.DotNetDSI.Properties.Resources.ResourceManager.AddResourceManager( // new System.Resources.ResourceManager("Simba.UltraLight.Properties.SimbaDotNetDSI", GetType().Assembly)); }
/// <summary> /// Attempts to establish a connection to the data source, using connection settings /// generated by a call to UpdateConnectionSettings(). /// </summary> /// <param name="connectionSettings">Connection settings used to authenticate the connection.</param> public override void Connect(Dictionary <string, object> connectionSettings) { // TODO(ODBC) #04: Establish a connection. // TODO(ADO) #06: Establish a connection. LogUtilities.LogFunctionEntrance(Log, connectionSettings); Utilities.NullCheck("connectionSettings", connectionSettings); // The SimbaEngine SDK will call UpdateConnectionSettings() prior to calling this method. // This will ensure that all valid keys required to create a connection have been specified // and are stored within in_connectionSettings. // // This method should validate each of the incoming values and throw an error in the event // of an invalid value. // This driver doesn't validate the given settings, it just requires them. string server = GetRequiredSetting(Driver.B_SERVER_KEY, connectionSettings).ToString(); string uid = GetRequiredSetting(Driver.B_UID_KEY, connectionSettings).ToString(); string pwd = GetRequiredSetting(Driver.B_PWD_KEY, connectionSettings).ToString(); string catalog = GetRequiredSetting(Driver.B_CATALOG_KEY, connectionSettings).ToString(); string strRows = GetRequiredSetting(Driver.B_ROWS_TO_FETCH_KEY, connectionSettings).ToString(); int rows = 1000; Int32.TryParse(strRows, out rows); object objResultType; BProperties.ResultTypes result_type = BProperties.ResultTypes.Normal; GetOptionalSetting(Driver.B_RESULT_TYPE_KEY, connectionSettings, out objResultType); if (objResultType == null) { Enum.TryParse <BProperties.ResultTypes>(objResultType.ToString(), true, out result_type); } if (string.IsNullOrWhiteSpace(uid) || string.IsNullOrWhiteSpace(pwd) || string.IsNullOrWhiteSpace(catalog) || string.IsNullOrWhiteSpace(server)) { throw new Exception("required parameters were not supplied or invalid"); } SetProperty(ConnectionPropertyKey.DSI_CONN_SERVER_NAME, server); SetProperty(ConnectionPropertyKey.DSI_CONN_CURRENT_CATALOG, catalog); SetProperty(ConnectionPropertyKey.DSI_CONN_USER_NAME, uid); m_Properties = new BProperties() { Server = server, UserName = uid, Password = pwd, Catalog = catalog, RowsToFetch = rows, ResultType = result_type }; }
public OperationResult VerifyCredentials(string userName, string password) { try { userName.GuardNullEmpty("User Name"); password.GuardNullEmpty("Password"); using (UnitOfWork uow = new UnitOfWork()) { var v = uow.GetDbInterface <UserDB>(); var userDetail = v.GetUser(userName); ////TODO: Need to uncomment after Mobile side implementaion done. ////string decryptedpassword = SIPAuthentication.Decrypt(password); ////if (userDetail != null && decryptedpassword.Equals(password)) if (userDetail != null && userDetail.Password.Equals(password)) { UserDTO user = new UserDTO { Id = userDetail.Id, EmailId = userDetail.EmailId, Password = userDetail.Password, APNSToken = userDetail.APNSToken, Name = userDetail.Name, PhoneNumber = userDetail.PhoneNumber, City = userDetail.City, CreatedDateTime = userDetail.CreatedDateTime.GetValueOrDefault() }; return(new OperationResult { Success = true, Data = user, MCode = MessageCode.OperationSuccessful, Message = "Valid User logged in" }); } } return(new OperationResult { Success = false, MCode = MessageCode.InvalidCredentials, Message = "Please provide valid username/password." }); } catch (SIPException exception) { LogUtilities.LogException(exception, LogPriorityID.High, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name); return(exception.Result); } catch (Exception exception) { LogUtilities.LogException(exception, LogPriorityID.High, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name); throw; } }
public int DeleteEnumeration(TemplateDto template) { try { return(objDBFrameworkBL.DeleteEnumeration(template)); } catch (Exception ex) { LogUtilities.LogException(ex); return(0); } }
/// <summary> /// Constructor. /// </summary> /// <param name="log">The logger to use for this metadata source.</param> public BTypeInfoMetadataSource(ILogger log) { LogUtilities.LogFunctionEntrance(log, log); Log = log; // Not using the restrictions, allow the SQLEngine to do filtering. InitializeDataTypes(); }
/// <summary> /// Executes the prepared statement for each parameter set provided, or once if there are /// no parameters supplied. /// </summary> /// <param name="contexts"> /// Holds ExecutionContext objects and parameter metadata for execution. There is one /// ExecutionContext for each parameter set to be executed. /// </param> /// <param name="warningListener">Used to post warnings about the execution.</param> public void Execute(ExecutionContexts contexts, IWarningListener warningListener) { LogUtilities.LogFunctionEntrance(Log, contexts, warningListener); //mark all context as success foreach (ExecutionContext context in contexts) { context.Succeeded = true; } }
/// <summary> /// Indicates that the cursor should be moved to the next row. /// </summary> /// <returns>True if there are more rows; false otherwise.</returns> public bool MoveToNextRow() { LogUtilities.LogFunctionEntrance(Log); if (m_IsFetching) { return(false); } m_IsFetching = true; return(true); }
/// <summary> /// Constructor. /// </summary> /// <param name="log">The logger to use for logging.</param> public BResultTable(ILogger log, string sql, BProperties properties) : base(log) { //get the parameters LogUtilities.LogFunctionEntrance(Log, log); m_Properties = properties; Sql = sql; //execute the first fetch ExecuteFetch(m_CurrentPage); }
public void Log(LogLevel logLevel, LogLocation logLocation, string context, string code, string message, Exception exception, params object[] parameters) { var lineMessage = LogUtilities.FormatMessage(logLevel, logLocation, context, message, exception, parameters); MessageLog.Add(new XUnitLogEvent(code, lineMessage, exception, logLevel)); output.WriteLine(lineMessage); if (exception != null) { output.WriteLine(exception.ToString()); } }
public UserInformation GetUser(string userName) { try { UserInformation userDetail = this.dbContext.UserInformations.Where(a => a.EmailId.Equals(userName)).FirstOrDefault(); return(userDetail); } catch (Exception exception) { LogUtilities.LogException(exception, LogPriorityID.High, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name); throw; } }
public Best_Practice_dt GetUser(string userName) { try { //Best_Practice_dt userDetail = this.dbContext.Best_Practice_dt.Where(a => a.EmailId.Equals(userName)).FirstOrDefault(); return(null); } catch (Exception exception) { LogUtilities.LogException(exception, LogPriorityID.High, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name); throw; } }
/// <summary> /// Indicates that the cursor should be moved to the next row. /// </summary> /// <returns>True if there are more rows; false otherwise.</returns> public bool MoveToNextRow() { LogUtilities.LogFunctionEntrance(Log); if (m_IsFetching) { m_Current++; } else { m_IsFetching = true; m_Current = 0; } return(m_Current < m_Tables.Count); }
public OperationResult RegisterUser(string EmailId, string Password, string APNSToken, string Name, string PhoneNumber, string City) { try { bool isSuccess; EmailId.GuardNullEmpty("EmailId"); Password.GuardNullEmpty("Password"); APNSToken.GuardNullEmpty("APNSToken"); Name.GuardNullEmpty("Name"); PhoneNumber.GuardNullEmpty("PhoneNumber"); City.GuardNullEmpty("City"); UserInformation user = default(UserInformation); using (UnitOfWork uow = new UnitOfWork()) { var userDB = uow.GetDbInterface <UserDB>(); isSuccess = userDB.RegisterUser(EmailId, Password, APNSToken, Name, PhoneNumber, City); } SendPushNotification pushNotify = new SendPushNotification(); pushNotify.Send(APNSToken); //SendPushNotification(); //if (isSuccess) //{ // NotificationHandler.NotificationHandler handler = new NotificationHandler.NotificationHandler(); // handler.Send("", user.APNSToken, "Registration success.", ICConstant.MsgForUserRegistration, ""); //} return(new OperationResult() { Success = true, Message = "User registered successfully", MCode = MessageCode.OperationSuccessful, Data = isSuccess }); } catch (SIPException exception) { LogUtilities.LogException(exception, LogPriorityID.High, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name); return(exception.Result); } catch (Exception exception) { LogUtilities.LogException(exception, LogPriorityID.High, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name); throw; } }
public virtual void Add(T t) { context.Configuration.AutoDetectChangesEnabled = false; // Need to save changes to aquire an entity that we can log set.Add(t); context.SaveChanges(); var module = LogUtilities.GetModuleFromType(typeof(T)); string data = LogUtilities.SerializeEntity(t, context); int entityID = (int)context.Entry(t).Property("ID").CurrentValue; log.Add(new Log(entityID, module, Activity.Created, user.ID, user.Name, data)); context.SaveChanges(); }
public bool UpdateAPNSToken(string userEmail, string apnsToken) { try { var user = this.dbContext.UserInformations.Where(a => a.EmailId == userEmail).FirstOrDefault(); user.APNSToken = apnsToken; this.dbContext.Entry(user).State = System.Data.Entity.EntityState.Modified; return(this.dbContext.SaveChanges() > 0); } catch (Exception exception) { LogUtilities.LogException(exception, LogPriorityID.High, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name); throw; } }
/// <summary> /// Fills in out_data with the data for a given column in the current row. /// </summary> /// <param name="columnTag">The column to retrieve data from.</param> /// <param name="offset">The number of bytes in the data to skip before copying.</param> /// <param name="maxSize">The maximum number of bytes of data to return.</param> /// <param name="out_data">The data to be returned.</param> /// <returns>True if there is more data in the column; false otherwise.</returns> public bool GetMetadata( MetadataSourceColumnTag columnTag, long offset, long maxSize, out object out_data) { LogUtilities.LogFunctionEntrance(Log, columnTag, offset, maxSize, "out_data"); switch (columnTag) { case MetadataSourceColumnTag.CATALOG_NAME: { out_data = m_Tables[m_Current].Catalog; return(false); } case MetadataSourceColumnTag.SCHEMA_NAME: { out_data = m_Tables[m_Current].Schema; return(false); } case MetadataSourceColumnTag.TABLE_NAME: { out_data = m_Tables[m_Current].Table; return(false); } case MetadataSourceColumnTag.TABLE_TYPE: { out_data = m_Tables[m_Current].TableType; return(false); } case MetadataSourceColumnTag.REMARKS: { out_data = m_Tables[m_Current].Remarks; return(false); } default: { throw ExceptionBuilder.CreateException( "Column Metadata Not Found", columnTag.ToString()); } } }
/// <summary> /// Initialize the column metadata for the result set. /// </summary> public void InitializeColumns(object obj) { LogUtilities.LogFunctionEntrance(Log); //get the info the build the columns ResultEntityType = obj.GetType(); ResultFields = ResultEntityType.GetFields().ToList(); //fields to remove that we do not want in results List <FieldInfo> remove = new List <FieldInfo>(); //parse the fields foreach (var field in ResultFields) { //make sure this not collection type if (field.FieldType.GetInterface("ICollection") != null) { //remove this field remove.Add(field); } else { //create the column DSIColumn column = new DSIColumn(TypeMetadataHelper.CreateTypeMetadata(field.FieldType)); column.IsNullable = Nullability.Nullable; column.Catalog = m_Properties.Catalog; column.Schema = Driver.B_SCHEMA; column.TableName = "Results"; column.Name = field.Name; column.Label = column.Name; if (field.FieldType == typeof(string)) { column.Size = 1000; column.IsSearchable = Searchable.Searchable; } else { column.IsSearchable = Searchable.PredicateBasic; } m_Columns.Add(column); } } //remove the fields foreach (var field in remove) { ResultFields.Remove(field); } }
public override void Connect( Dictionary <String, Object> connectionSettings) { LogUtilities.LogFunctionEntrance(Log, connectionSettings); Utilities.NullCheck("connectionSettings", connectionSettings); _drdaConnection = new DrdaConnection(new DrdaConnectionOptions { Port = Convert.ToInt32(GetRequiredSetting("PORT", connectionSettings)), HostName = Convert.ToString(GetRequiredSetting("HOST", connectionSettings)), UserName = Convert.ToString(GetRequiredSetting("UID", connectionSettings)), Password = Convert.ToString(GetRequiredSetting("PWD", connectionSettings)) }); _drdaConnection.ConnectAsync().Wait(); }
public static Stream GetStream(string id, string snsTopicArn, Exception e) { Logger.Log(e); GC.Collect(); string snsMessage = SNS.CreateMessage(e.Message, "exception", e.StackTrace); SNS.SendMessage(snsTopicArn, snsMessage); ErrorCategory errorCategory = ExceptionUtilities.ExceptionToErrorCategory(e); string message = GetMessage(errorCategory, e.Message); LogUtilities.LogObject("Result", message); return(SingleResult.Create(id, message, null)); }
static void Main(string[] args) { try { for (int i = 0; i < 1000; i++) { string queueName = $"TASK:{i}"; TestRedis.TestClient.SetEntryInHash(queueName, Guid.NewGuid().ToString("N"), "0"); } } catch (Exception ex) { LogUtilities.WriteException(ex); // throw; } }