Beispiel #1
0
        private string ValidateAndInsertParamList(string sql, ref Dictionary <string, SqlScriptParameter> paramList, ref Dictionary <string, string> sqlPrmNameValueList, ref OperationResult op)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(sql);

            if (paramList.Count != sqlPrmNameValueList.Count)
            {
                op.AddError("Number of given parameters do not match what is needed!");
                return(string.Empty);
            }

            foreach (KeyValuePair <string, SqlScriptParameter> item in paramList)
            {
                if (!sqlPrmNameValueList.ContainsKey(item.Key))
                {
                    op.AddError("One or more parameters are missing");
                    return(string.Empty);
                }

                string val = sqlPrmNameValueList[item.Key];

                if ((item.Value.Type == SqlScriptParameterTypeEnum.Decimal && !BCHUtilities.IsNumeric(val)) ||
                    (item.Value.Type == SqlScriptParameterTypeEnum.Integer && !BCHUtilities.IsInteger(val)))
                {
                    op.AddError("One or more parameters are not the correct type");
                    return(string.Empty);
                }

                sb.Replace(item.Value.Marker, val);
            }

            return(sb.ToString());
        }
        private void GetMp3songs(ref OperationResult op)
        {
            if (!Directory.Exists(dddtbGetMp3RootDir.ItemText))
            {
                op.AddError($"\"{dddtbGetMp3RootDir.ItemText}\" does not exists.");
                return;
            }

            List <string> extentionFilters = new List <string> {
                ".mp3"
            };
            List <string> mp3Files = BCHFileIO.GetAllFilesInDir(dddtbGetMp3RootDir.ItemText, ref extentionFilters, true, ref op);

            if (!op.Success)
            {
                return;
            }

            if (mp3Files == null || !mp3Files.Any())
            {
                op.AddError($"No mp3 files.");
                return;
            }

            ddlbMp3s.AddFiles(mp3Files, false);
        }
        public async Task <OperationResult> Update(Account account)
        {
            Guard.NotNull(account, nameof(account));

            var result = new OperationResult {
                Success = false
            };

            var user = await _userManager.FindByIdAsync(account.Id);

            if (user != null)
            {
                user.UserName = account.UserName;
                user.Email    = account.Email;
                var userValidationResult = await _userValidator.ValidateAsync(_userManager, user);

                if (!userValidationResult.Succeeded)
                {
                    result.AddError(userValidationResult.Errors.Select(e => e.Description));
                }

                IdentityResult passwordValidationResult = null;

                if (!string.IsNullOrEmpty(account.Password))
                {
                    passwordValidationResult = await _passwordValidator.ValidateAsync(_userManager, user, account.Password);

                    if (passwordValidationResult.Succeeded)
                    {
                        user.PasswordHash = _passwordHasher.HashPassword(user, account.Password);
                    }
                    else
                    {
                        result.AddError(passwordValidationResult.Errors.Select(e => e.Description));
                    }
                }

                if (userValidationResult.Succeeded &&
                    (passwordValidationResult == null || passwordValidationResult.Succeeded))
                {
                    var updatingResult = await _userManager.UpdateAsync(user);

                    if (updatingResult.Succeeded)
                    {
                        result.Success = true;
                    }
                    else
                    {
                        result.AddError(updatingResult.Errors.Select(e => e.Description));
                    }
                }
            }
            else
            {
                result.AddError(Errors.UserNotFound);
            }

            return(result);
        }
Beispiel #4
0
        public void SetM3U(string fileNameAndPath, List <string> list, bool isNew, ref OperationResult op)
        {
            try
            {
                if (!isNew && !File.Exists(fileNameAndPath))
                {
                    op.AddError("The File: " + fileNameAndPath + " deos not exist!");
                    return;
                }

                if (Directory.Exists(Path.GetFullPath(fileNameAndPath)))
                {
                    op.AddError("The Path: " + Path.GetFullPath(fileNameAndPath) + " deos not exist!");
                    return;
                }

                if (!isNew)
                {
                    List <string> fileContents = BCHFileIO.ReadFullFile(fileNameAndPath, ref op);
                    fileContents =
                        (
                            from line in fileContents
                            where
                            !line.Trim().StartsWith("#")
                            &&
                            line.Trim().Length > 1
                            select line
                        ).ToList <string>();

                    if (!op.Success)
                    {
                        return;
                    }

                    this.M3USongList = fileContents;
                }
                else
                {
                    this.M3USongList = new List <string>();
                    this.M3USongList.AddRange(list);
                }
                this.M3UFileNameAndPath = fileNameAndPath;
                this.M3UFileName        = Path.GetFileName(fileNameAndPath);
                this.M3UPath            = Path.GetFullPath(fileNameAndPath);

                _isSet = true;
            }
            catch (Exception ex)
            {
                op.AddException(ex);
                return;
            }
        }
Beispiel #5
0
        public OperationResult Validate(double?data)
        {
            var result = new OperationResult();

            if (ValidationData.Mandatory && data == null)
            {
                result.AddError(
                    new Error <Dictionary <string, string> >(
                        (int)ErrorCodesEnum.IsMandatory,
                        "Value is mandatory, so it cannot be null.",
                        new Dictionary <string, string>()
                {
                    { "Name", ValidationData.Name }
                }
                        )
                    );
            }
            if (data == null)
            {
                return(result);
            }
            if (data < ValidationData.MinValue)
            {
                result.AddError(
                    new Error <Dictionary <string, string> >(
                        (int)ErrorCodesEnum.IsTooShort,
                        $"Value '{data}' is too small, it can't be smaller than {ValidationData.MinValue}.",
                        new Dictionary <string, string>()
                {
                    { "Name", ValidationData.Name }, { "Value", ((double)data).ToString() }
                }
                        )
                    );
            }
            if (data > ValidationData.MaxValue)
            {
                result.AddError(
                    new Error <Dictionary <string, string> >(
                        (int)ErrorCodesEnum.IsTooLong,
                        $"Value '{data}' is too big, it can't be bigger than {ValidationData.MaxValue}.",
                        new Dictionary <string, string>()
                {
                    { "Name", ValidationData.Name }, { "Value", ((double)data).ToString() }
                }
                        )
                    );
            }
            return(result);
        }
Beispiel #6
0
        public void InsertMP3(MP3FileDataType mp3, ref OperationResult op)
        {
            if (this.DataStore == null)
            {
                op.AddError("DataStore not set!");
                return;
            }

            InsertMP3FileInfo(mp3, ref op);

            if (!op.Success)
            {
                return;
            }

            InsertMP3Info(mp3, ref op);

            if (!op.Success)
            {
                return;
            }

            InsertMP3Artists(mp3, ref op);

            if (!op.Success)
            {
                return;
            }
        }
Beispiel #7
0
 public void ValidateLangauge(byte languageID)
 {
     if (languageID != 1 && languageID != 2)
     {
         OperationResult.AddError(MessageCodes.MissingLangauge);
     }
 }
Beispiel #8
0
        public DataTable ExecSql(string sql, ref OperationResult op)
        {
            if (string.IsNullOrEmpty(ConnectionString))
            {
                op.AddError("The connection string is not set.");
                return(null);
            }

            string    connStr = string.Empty;
            DataTable table   = null;

            try
            {
                using (OleDbConnection conn = new OleDbConnection(ConnectionString))
                {
                    using (OleDbCommand cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = sql;
                        conn.Open();
                        cmd.CommandType = this.CommandType;

                        table = new DataTable();
                        new OleDbDataAdapter(cmd).Fill(table);
                        return(table);
                    }
                }
            }
            catch (Exception ex)
            {
                op.AddException(ex);
            }

            return(null);
        }
        /// <summary>
        /// Returns OpertaionResult with just added entity wrapped to ViewModel
        /// </summary>
        /// <param name="model">CreateViewModel with data for new object</param>
        /// <param name="funcBeforeAddExecuted"></param>
        /// <param name="actionAfterSaveChanges"></param>
        /// <returns></returns>
        public OperationResult <TModel> Add(TCreateModel model, Func <TModel, TCreateModel, OperationResult <TModel> > funcBeforeAddExecuted, Action <TModel> actionAfterSaveChanges)
        {
            var operation = new OperationResult <TModel>();
            var entity    = Mapper.Map <TModel>(model);
            var result    = funcBeforeAddExecuted?.Invoke(entity, model);

            if (result == null || result.Ok)
            {
                Context.Set <TModel>().Add(entity);
                try {
                    Context.SaveChanges();
                    actionAfterSaveChanges?.Invoke(entity);
                    operation.Result = entity;
                }
                catch (Exception exception) {
                    operation.AddError(ExceptionHelper.GetMessages(exception));
                    operation.Error = exception;
                    LogService.LogError(operation.Error);
                }
            }
            else
            {
                if (!result.Ok)
                {
                    return(result);
                }
            }
            return(operation);
        }
Beispiel #10
0
        public void TruncateTable(string tableName, string idName, ref OperationResult op)
        {
            if (string.IsNullOrEmpty(ConnectionString))
            {
                op.AddError("The connection string is not set.");
                return;
            }

            string connStr = string.Empty;

            try
            {
                using (OleDbConnection conn = new OleDbConnection(ConnectionString))
                {
                    using (OleDbCommand cmd = new OleDbCommand("ALTER TABLE [" + tableName + "] ALTER COLUMN " + idName + " COUNTER (1, 1)", conn))
                    {
                        conn.Open();

                        cmd.ExecuteNonQuery();

                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                op.AddException(ex);
            }

            return;
        }
Beispiel #11
0
        private void ConvertToArchosFormat(ref M3UEditor me, ref OperationResult op)
        {
            List <string> list = new List <string>();

            string rootMusicDir = dddtbMusicDir.ItemText;
            int    rootPos      = -1;
            string archosVer    = string.Empty;


            foreach (string song in me.M3USongList)
            {
                archosVer = song;
                rootPos   = archosVer.IndexOf(rootMusicDir, StringComparison.CurrentCultureIgnoreCase);

                if (rootPos > -1)
                {
                    list.Add(archosVer.Substring(rootPos).Replace("\\", "/"));
                }
                else
                {
                    op.AddError("One or more songs do not contain " + rootMusicDir + " in it's path");
                    return;
                }
            }

            me.SetM3USongs(list, false, ref op);
        }
Beispiel #12
0
        public OperationResult Validate(string?data)
        {
            var result = new OperationResult();

            if (ValidationData.Mandatory && data == null)
            {
                result.AddError(
                    new Error(
                        (int)ErrorCodesEnum.IsMandatory,
                        $"{ValidationData.Name.UppercaseFirst()} is mandatory, so it cannot be null."
                        )
                    );
            }
            if (data == null)
            {
                return(result);
            }
            if (data.Length < ValidationData.MinLength)
            {
                result.AddError(
                    new Error <Dictionary <string, string> >(
                        (int)ErrorCodesEnum.IsTooShort,
                        $"Value '{data}' is too short, it can't have less chars than {ValidationData.MinLength}.",
                        new Dictionary <string, string>()
                {
                    { "Name", ValidationData.Name }, { "Value", data }
                }
                        )
                    );
            }
            if (data.Length > ValidationData.MaxLength)
            {
                result.AddError(
                    new Error <Dictionary <string, string> >(
                        (int)ErrorCodesEnum.IsTooLong,
                        $"Value '{data}' is too long, it can't have more chars than {ValidationData.MaxLength}.",
                        new Dictionary <string, string>()
                {
                    { "Name", ValidationData.Name }, { "Value", data }
                }
                        )
                    );
            }

            return(result);
        }
Beispiel #13
0
        public void InsertMP3FileInfo(MP3FileDataType mp3, ref OperationResult op)
        {
            if (this.DataStore == null)
            {
                op.AddError("DataStore not set!");
                return;
            }

            SetConnection(ref op);

            if (!op.Success)
            {
                return;
            }

            DataStore ds = this.DataStore;

            Dictionary <string, string> parms = new Dictionary <string, string>();

            parms.Add(ds.GetSqlScriptParam(SqlParamScriptEnum.GetFileInfo_File), mp3.FileName);
            parms.Add(ds.GetSqlScriptParam(SqlParamScriptEnum.GetFileInfo_Path), mp3.FilePath);

            DataTable dt = ds.ExecuteSql(ds.Conn, SqlScriptEnum.GetFileInfo, parms, ref op);

            if (!op.Success)
            {
                return;
            }

            if (dt.Rows.Count > 0)
            {
                op.AddError(mp3.FileNamePath + " mp3 already exists!");
                return;
            }

            parms = new Dictionary <string, string>();
            parms.Add(ds.GetSqlScriptParam(SqlParamScriptEnum.InsertFileInfo_File), mp3.FileName);
            parms.Add(ds.GetSqlScriptParam(SqlParamScriptEnum.InsertFileInfo_Path), mp3.FilePath);

            ds.ExecuteSql(ds.Conn, SqlScriptEnum.InsertFileInfo, parms, ref op);
            if (!op.Success)
            {
                return;
            }
        }
Beispiel #14
0
        public OperationResult <AudioMetaData> MetaDataForFile(string fileName, bool returnEvenIfInvalid = false)
        {
            var r      = new OperationResult <AudioMetaData>();
            var result = MetaDataForFileFromIdSharp(fileName);

            if (result.Messages?.Any() == true)
            {
                foreach (var m in result.Messages)
                {
                    r.AddMessage(m);
                }
            }
            if (result.Errors?.Any() == true)
            {
                foreach (var e in result.Errors)
                {
                    r.AddError(e);
                }
            }
            if (!result.IsSuccess)
            {
                result = MetaDataForFileFromATL(fileName);
                if (result.Messages?.Any() == true)
                {
                    foreach (var m in result.Messages)
                    {
                        r.AddMessage(m);
                    }
                }
                if (result.Errors?.Any() == true)
                {
                    foreach (var e in result.Errors)
                    {
                        r.AddError(e);
                    }
                }
            }
            if (!result.IsSuccess)
            {
                r.AddMessage($"Missing Data `[{DetermineMissingRequiredMetaData(result.Data)}]`");
            }
            r.Data      = result.Data;
            r.IsSuccess = result.IsSuccess;
            return(r);
        }
Beispiel #15
0
        public override void OnException(HttpActionExecutedContext actionExecutedContext)
        {
            // Exit early for non OperationResult action results
            if (actionExecutedContext.ActionContext.ActionDescriptor.ReturnType != typeof(OperationResult))
            {
                base.OnException(actionExecutedContext);
                return;
            }

            OperationResult result = new OperationResult()
            {
                Success = false
            };

            // Add error for specific exception types
            Type exceptionType = actionExecutedContext.Exception.GetType();

            if (ExceptionType != null)
            {
                if (exceptionType == ExceptionType)
                {
                    result.AddError(ErrorMessage);
                }
                else
                {
                    // Fall through
                    base.OnException(actionExecutedContext);
                    return;
                }
            }
            else if (ErrorMessage != null)
            {
                result.AddError(ErrorMessage);
            }

            // TODO: Log exception, generate correlation ID, etc.

            // Set new result
            actionExecutedContext.Response =
                actionExecutedContext.Request.CreateResponse(HttpStatusCode.InternalServerError, result);

            base.OnException(actionExecutedContext);
        }
Beispiel #16
0
        public Common.OperationResults.OperationResult FederarPaciente(int pacienteId)
        {
            var op = new OperationResult();

            try
            {
                var entity = CurrentContext.DataContext.Pacientes.Find(pacienteId);

                var request = new Fhir.Model.Request.FederarPacienteRequest
                {
                    DNI = entity.NroDocumento,
                    FechaNacimiento = entity.FechaNacimiento,
                    Sexo = entity.Sexo == "M" ? Sexo.Masculino : Sexo.Femenido,
                    LocalId = entity.Id.ToString(),
                    PrimerNombre = entity.PrimerNombre,
                    PrimerApellido = entity.PrimerApellido,
                    OtrosNombres = entity.OtrosNombres
                };

                var resp = _patientManager.FederarPaciente(request);
                if (resp.Id.HasValue)
                {
                    entity.FederadoDateTime = DateTime.Now;
                    entity.FederadorId = resp.Id.Value;
                    CurrentContext.DataContext.SaveChanges();

                    op.Id = resp.Id.Value;
                }
                else
                {
                    op.AddError("El Federador no ha devuelto resultados.");
                }

            }
            catch (Exception ex)
            {
                var strError = $"Error registrando Paciente en el BUS: {ex.Message}";
                op.AddError(strError);
                Logger.LogError(ex, strError);
            }

            return op;
        }
Beispiel #17
0
        public void InsertMp3(MP3FileDataType mP3FileDataType, ref OperationResult op)
        {
            if (!mP3FileDataType.FileName.EndsWith("mp3", StringComparison.InvariantCultureIgnoreCase))
            {
                return;
            }
            using (DbContextTransaction transaction = _mp3Context.Database.BeginTransaction())
            {
                try
                {
                    var tbFileInfo = new tbFileInfo
                    {
                        File_Name = mP3FileDataType.FileName,
                        Path      = mP3FileDataType.FilePath
                    };
                    _mp3Context.FileInfo.Add(tbFileInfo);
                    _mp3Context.SaveChanges();
                    var fiId = tbFileInfo.FileInfo_Id;

                    tbMp3Info tbMp3Info = new tbMp3Info
                    {
                        Album          = mP3FileDataType.Album,
                        Comments       = mP3FileDataType.Comments,
                        FileInfo_Id    = fiId,
                        Genre          = mP3FileDataType.Genre,
                        Song_Numeraton = mP3FileDataType.SongNumeration,
                        Song_Title     = mP3FileDataType.SongTitle,
                        Track          = mP3FileDataType.Track
                    };
                    _mp3Context.Mp3Info.Add(tbMp3Info);
                    _mp3Context.SaveChanges();
                    var miId = tbMp3Info.Mp3Info_Id;

                    foreach (var artist in mP3FileDataType.Artists)
                    {
                        tbArtist tbArtist = new tbArtist
                        {
                            Artist_Name = artist,
                            Mp3Info_Id  = miId
                        };
                        _mp3Context.Artist.Add(tbArtist);
                        _mp3Context.SaveChanges();
                    }
                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    op.AddError($"Error inserting mp3 file: {mP3FileDataType.FilePath}");
                    op.AddException(ex);
                }
            }
        }
Beispiel #18
0
        public void TruncateTable(string tableName, string idName, ref OperationResult op)
        {
            if (this.DataStore == null)
            {
                op.AddError("DataStore not set!");
                return;
            }

            DataStore ds = this.DataStore;

            ds.TruncateTable(tableName, idName, ref op);
        }
Beispiel #19
0
        public void AddError_Should_AddErrorToList()
        {
            //Arrange
            var sut      = new OperationResult();
            var expected = Guid.NewGuid().ToString();

            // Act
            sut.AddError(expected);

            // Assert
            sut.Errors.First().Should().Be(expected);
        }
Beispiel #20
0
        public void CompactRepareDB(ref OperationResult op)
        {
            if (this.DataStore == null)
            {
                op.AddError("DataStore not set!");
                return;
            }

            DataStore ds = this.DataStore;

            ds.CompactJetDatabase(ref op);
        }
Beispiel #21
0
        private void SetConnection(ref OperationResult op)
        {
            if (this.DataStore == null)
            {
                op.AddError("DataStore not set!");
                return;
            }

            if (this.DataStore.Conn == null)
            {
                this.DataStore.Conn = new System.Data.OleDb.OleDbConnection(this.DataStore.ConnectionString);
            }
        }
Beispiel #22
0
        private void CreateMp3Repository(string dbName, ref OperationResult op)
        {
            try
            {
                if (!dbName.EndsWith(".db", StringComparison.InvariantCultureIgnoreCase))
                {
                    op.AddError($"{dbName} is not a Sqlite fil.  Must end with \".db\".");
                    return;
                }
                if (!File.Exists(dbName))
                {
                    op.AddError($"{dbName} does not exist.");
                    return;
                }

                _mp3Repository = new Mp3Repository(dbName, ref op);
            }
            catch (Exception ex)
            {
                op.AddException(ex);
            }
        }
Beispiel #23
0
        public void SetConnectionStringForAccessDB(string dbFileAndPath, ref OperationResult op)
        {
            if (!File.Exists(dbFileAndPath))
            {
                op.AddError(dbFileAndPath + " db file does not exist.");
                return;
            }

            this.DatabaseName = dbFileAndPath;

            this.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +
                                    @"Data source= " + dbFileAndPath;
        }
        public User Login(string username, string password, ref OperationResult op)
        {
            var user = (from u in _adminContext.User
                        where username.Trim().Equals(u.UserName, StringComparison.InvariantCultureIgnoreCase) &&
                        password.Equals(u.Password)
                        select u).FirstOrDefault();

            if (user == null)
            {
                op.AddError("Incorrect username or password.");
            }
            return(user);
        }
Beispiel #25
0
        public void CreateM3U(ref OperationResult op)
        {
            if (!IsSet)
            {
                op.AddError("M3U object not set.  You must call the \"SetM3U(string fileNameAndPath, " +
                            "ref OperationResult op)\" successfully before you can create an M3U file");
                return;
            }

            if (this.M3USongList.Count < 1)
            {
                op.AddError("There are no songs in the M3U list.  You must call the \"SetM3USongs(List<string> list, bool" +
                            "addOrReplace, ref OperationResult op)\" successfully before you can create an M3U file");
                return;
            }

            List <string> mList = new List <string>();

            //mList.Add("#EXTM3U - Created by Barry Hill's M3U Editor");
            //mList.Add("#EXTINF - ");

            mList.AddRange(this.M3USongList);

            string fname = this.M3UFileNameAndPath;

            if (!fname.EndsWith(".m3u", StringComparison.CurrentCultureIgnoreCase))
            {
                fname = fname + ".m3u";
            }

            BCHFileIO.WriteFullFile(fname, mList, ref op);

            if (!op.Success)
            {
                return;
            }

            op.AddInformation("M3U file created successfully.");
        }
Beispiel #26
0
        public void DeleteallMP3s(ref OperationResult op)
        {
            if (this.DataStore == null)
            {
                op.AddError("DataStore not set!");
                return;
            }

            DataStore ds = this.DataStore;

            Dictionary <string, string> parms = new Dictionary <string, string>();


            DataTable dt = ds.ExecuteSql(SqlScriptEnum.DeleteAllArtists, parms, ref op);

            if (!op.Success)
            {
                return;
            }

            ds.TruncateTable("tbArtist", "Artist_Id", ref op);
            if (!op.Success)
            {
                return;
            }

            dt = ds.ExecuteSql(SqlScriptEnum.DeleteAllMp3s, parms, ref op);
            if (!op.Success)
            {
                return;
            }

            ds.TruncateTable("tbMp3Info", "Mp3Info_Id", ref op);
            if (!op.Success)
            {
                return;
            }

            dt = ds.ExecuteSql(SqlScriptEnum.DeleteAllFiles, parms, ref op);
            if (!op.Success)
            {
                return;
            }

            ds.TruncateTable("tbFileInfo", "FileInfo_Id", ref op);
            if (!op.Success)
            {
                return;
            }
        }
Beispiel #27
0
        public void Load(string xmlFileName, ref OperationResult op)
        {
            try
            {
                this.XmlDoc = new XmlDocument();
                this.XmlDoc.Load(xmlFileName);
                XmlNodeList scriptList = XmlDoc.SelectNodes("/SqlScripts/SqlScript");

                foreach (XmlElement script in scriptList)
                {
                    string           name      = script.SelectSingleNode("Name").InnerText.Trim();
                    string           sql       = script.SelectSingleNode("Sql").InnerText;
                    string           type      = script.SelectSingleNode("Type").InnerText;
                    XmlNodeList      paramList = script.SelectNodes("Parameters/Parameter");
                    SqlScriptMembers sm        = new SqlScriptMembers();
                    sm.Parameters = new Dictionary <string, SqlScriptParameter>();
                    foreach (XmlElement param in paramList)
                    {
                        string             pName   = param.GetAttribute("name").Trim();
                        string             pType   = param.GetAttribute("type").Trim();
                        string             pMarker = param.InnerText;
                        SqlScriptParameter ssp     = new SqlScriptParameter();

                        ssp.Type   = GetParamType(pType);
                        ssp.Marker = pMarker;

                        sm.Parameters.Add(pName, ssp);
                    }
                    sm.Sql = sql;
                    if (sm.Sql.Trim().Length > 1 && name.Trim().Length > 1)
                    {
                        this.SqlScriptDict.Add(name, sm);
                    }
                    sm.Type = type;
                }
                if (SqlScriptDict == null || SqlScriptDict.Count < 1)
                {
                    op.AddError("Sql Scripts not set.  Make sure there are valid scripts.");
                    this.IsSet = false;
                    return;
                }

                this.IsSet = true;
            }
            catch (Exception ex)
            {
                op.AddException(ex);
            }
        }
        public async Task <OperationResult> Delete(string id)
        {
            var result = new OperationResult();

            var user = await _userManager.FindByIdAsync(id);

            if (user != null)
            {
                var deletingResult = await _userManager.DeleteAsync(user);

                if (!deletingResult.Succeeded)
                {
                    result.Success = false;
                    result.AddError(deletingResult.Errors.Select(e => e.Description));
                }
            }
            else
            {
                result.Success = false;
                result.AddError(Errors.UserNotFound);
            }

            return(result);
        }
Beispiel #29
0
        public DataTable RunSqlScript(ref Dictionary <string, string> parms, SqlScriptEnum sqlScriptEnum, ref OperationResult op)
        {
            if (this.DataStore == null)
            {
                op.AddError("DataStore not set!");
                return(null);
            }


            DataStore ds = this.DataStore;

            DataTable dt = ds.ExecuteSql(sqlScriptEnum, parms, ref op);

            return(dt);
        }
Beispiel #30
0
        public DataTable GetDbTableColumns(string tableName, ref OperationResult op)
        {
            if (this.DataStore == null)
            {
                op.AddError("DataStore not set!");
                return(null);
            }


            DataStore ds = this.DataStore;

            DataTable dt = ds.GetDbTableColumns(tableName, ref op);

            return(dt);
        }