public ChangePassWordBO GetEmailAddress(int iUserId)
        {
            DataSet                objDataSet             = null;
            ChangePassWordBO       objChangePassWordBO    = null;
            List <ProcParameterBO> objListProcParameterBo = new List <ProcParameterBO>();

            try
            {
                ProcParameterBO objDbParameter = new ProcParameterBO();
                objDbParameter.Direction      = ParameterDirection.Input;
                objDbParameter.ParameterName  = "@iUserId";
                objDbParameter.dbType         = DbType.Int32;
                objDbParameter.ParameterValue = iUserId;
                objListProcParameterBo.Add(objDbParameter);

                objDataSet = objDBAccess.execuitDataSet(ProcGetEmailAddress, ref objListProcParameterBo);
                if (objDataSet != null && objDataSet.Tables[0].Rows.Count > 0)
                {
                    objChangePassWordBO              = new ChangePassWordBO();
                    objChangePassWordBO.UserId       = Convert.ToInt32(objDataSet.Tables[0].Rows[0][0].ToString());
                    objChangePassWordBO.EmailAddress = objDataSet.Tables[0].Rows[0][1].ToString();
                }
            }
            catch (Exception EX)
            {
                ExceptionError.Error_Log(EX, "GetEmailAddress");
                throw EX;
            }
            return(objChangePassWordBO);
        }
        public List <HRInteractionBO> getHRInteractionList()
        {
            DataSet                objDataSet             = null;
            HRInteractionBO        objHRInteractionBO     = null;
            List <HRInteractionBO> objHRInteractionBOList = new List <HRInteractionBO>();
            List <ProcParameterBO> objProcParameterBOList = new List <ProcParameterBO>();

            try
            {
                objDataSet = objDBAccess.execuitDataSet(ProcHRInteractionList, ref objProcParameterBOList);
                if (objDataSet != null && objDataSet.Tables.Count > 0)
                {
                    for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                    {
                        objHRInteractionBO               = new HRInteractionBO();
                        objHRInteractionBO.RequestId     = Convert.ToInt32(objDataSet.Tables[0].Rows[i][0].ToString());
                        objHRInteractionBO.ApplicantName = objDataSet.Tables[0].Rows[i][1].ToString();
                        objHRInteractionBO.Subject       = objDataSet.Tables[0].Rows[i][2].ToString();
                        objHRInteractionBO.RequestDate   = objDataSet.Tables[0].Rows[i][3].ToString();
                        objHRInteractionBO.ResponseDate  = objDataSet.Tables[0].Rows[i][4].ToString();
                        objHRInteractionBO.Status        = objDataSet.Tables[0].Rows[i][5].ToString();
                        objHRInteractionBO.Comments      = objDataSet.Tables[0].Rows[i][6].ToString();
                        objHRInteractionBOList.Add(objHRInteractionBO);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "getHRInteractionList");
                throw ex;
            }
            return(objHRInteractionBOList);
        }
Exemplo n.º 3
0
        private Either <DomainError, IImmutableList <string> > Mapper(IEnumerable <TitlesStorage> source)
        {
            try
            {
                if (!source.Any())
                {
                    return(ImmutableList <string> .Empty);
                }
                var item = source.Single();
                if (item == null || string.IsNullOrWhiteSpace(item.Titles))
                {
                    return(BasicError.Create(nameof(FeedTitlesRepository), "Title source contains more than one record"));
                }

                return(item
                       .Titles
                       .Split(',')
                       .Select(x => x.Trim())
                       .ToImmutableList());
            }
            catch (Exception e)
            {
                return(ExceptionError.FromException(e));
            }
        }
Exemplo n.º 4
0
        public List <JobsReportBO> getApprovedJobsReportList()
        {
            DataSet                objDataSet             = null;
            JobsReportBO           objJobsReportBO        = null;
            List <JobsReportBO>    objJobsReportBOList    = new List <JobsReportBO>();
            List <ProcParameterBO> objProcParameterBOList = new List <ProcParameterBO>();

            try
            {
                objDataSet = objDBAccess.execuitDataSet(ProcGetApprovedJobsReportList, ref objProcParameterBOList);
                if (objDataSet != null && objDataSet.Tables.Count > 0)
                {
                    for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                    {
                        objJobsReportBO                    = new JobsReportBO();
                        objJobsReportBO.JobName            = objDataSet.Tables[0].Rows[i][0].ToString();
                        objJobsReportBO.JobDescription     = objDataSet.Tables[0].Rows[i][1].ToString();
                        objJobsReportBO.NoOfPositions      = objDataSet.Tables[0].Rows[i][2].ToString();
                        objJobsReportBO.JobLocation        = objDataSet.Tables[0].Rows[i][3].ToString();
                        objJobsReportBO.DonorProgramName   = objDataSet.Tables[0].Rows[i][4].ToString();
                        objJobsReportBO.RequiredStaffLevel = objDataSet.Tables[0].Rows[i][5].ToString();
                        objJobsReportBO.CurrentStaffLevel  = objDataSet.Tables[0].Rows[i][6].ToString();
                        objJobsReportBO.Gaps               = objDataSet.Tables[0].Rows[i][7].ToString();
                        objJobsReportBO.Status             = objDataSet.Tables[0].Rows[i][8].ToString();
                        objJobsReportBOList.Add(objJobsReportBO);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "getApprovedJobsReportList");
                throw ex;
            }
            return(objJobsReportBOList);
        }
        public List <CommonDropDownBO> getDonorProgramList(int iUserId)
        {
            DataSet                 objDataSet              = null;
            CommonDropDownBO        objCommonDropDownBO     = null;
            List <CommonDropDownBO> objCommonDropDownBOList = new List <CommonDropDownBO>();
            List <ProcParameterBO>  objProcParameterBOList  = new List <ProcParameterBO>();

            try
            {
                ProcParameterBO objParameterBO = new ProcParameterBO();
                objParameterBO.Direction      = ParameterDirection.Input;
                objParameterBO.ParameterName  = "@iUserId";
                objParameterBO.dbType         = DbType.Int32;
                objParameterBO.ParameterValue = iUserId;
                objProcParameterBOList.Add(objParameterBO);

                objDataSet = objDBAccess.execuitDataSet(ProcDonorDropDown, ref objProcParameterBOList);
                if (objDataSet != null && objDataSet.Tables.Count > 0)
                {
                    for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                    {
                        objCommonDropDownBO       = new CommonDropDownBO();
                        objCommonDropDownBO.Id    = Convert.ToInt32(objDataSet.Tables[0].Rows[i][0].ToString());
                        objCommonDropDownBO.Value = objDataSet.Tables[0].Rows[i][1].ToString();
                        objCommonDropDownBOList.Add(objCommonDropDownBO);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "getDonorProgramList");
                throw ex;
            }
            return(objCommonDropDownBOList);
        }
Exemplo n.º 6
0
        public List <IdTypeMasterBO> GetIdTypeMasterList()
        {
            DataSet                objDataSet             = null;
            IdTypeMasterBO         objIdTypeMasterBO      = null;
            List <IdTypeMasterBO>  objIdTypeMasterBOList  = new List <IdTypeMasterBO>();
            List <ProcParameterBO> objProcParameterBOList = new List <ProcParameterBO>();

            try
            {
                objDataSet = objDBAccess.execuitDataSet(ProcGetIdTypeMasterList, ref objProcParameterBOList);
                if (objDataSet != null && objDataSet.Tables.Count > 0)
                {
                    for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                    {
                        objIdTypeMasterBO = new IdTypeMasterBO();
                        objIdTypeMasterBO.IdTypeMasterId = Convert.ToInt32(objDataSet.Tables[0].Rows[i][0].ToString());
                        objIdTypeMasterBO.IdType         = objDataSet.Tables[0].Rows[i][1].ToString();
                        objIdTypeMasterBO.IsActive       = Convert.ToBoolean(objDataSet.Tables[0].Rows[i][2].ToString());
                        objIdTypeMasterBOList.Add(objIdTypeMasterBO);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "GetIdTypeMasterList");
                throw ex;
            }
            return(objIdTypeMasterBOList);
        }
        public async Task WhenAnUnexpectedExceptionIsRaised_AnExceptionErrorWillBeReturned_WithInternalServerErrorHttpStatus()
        {
            // Arrange
            var            thrownException  = new Exception("Exception with a parameter: {Param1}");
            ExceptionError expectedResponse = new ExceptionError(System.Net.HttpStatusCode.InternalServerError, thrownException, string.Empty);
            var            middleware       = new ExceptionHandlerMiddleware((innerHttpContext) =>
            {
                throw thrownException;
            }, _logger);

            var context = new DefaultHttpContext();

            context.Response.Body = new MemoryStream();

            //Act
            await middleware.Invoke(context);

            context.Response.Body.Seek(0, SeekOrigin.Begin);
            var reader         = new StreamReader(context.Response.Body);
            var streamText     = reader.ReadToEnd();
            var actualResponse = JsonConvert.DeserializeObject <ExceptionError>(streamText);

            //Assert
            Assert.Equal(expectedResponse.StatusCode, actualResponse.StatusCode);
            Assert.Equal(expectedResponse.StatusCode, context.Response.StatusCode);
            Assert.Equal(expectedResponse.StatusMessage, actualResponse.StatusMessage);
            Assert.Equal(expectedResponse.ErrorMessage, actualResponse.ErrorMessage);
        }
Exemplo n.º 8
0
        public List <MenuMasterBO> getMenuList()
        {
            DataSet                objDataSet             = null;
            MenuMasterBO           objMenuMasterBO        = null;
            List <MenuMasterBO>    objMenuMasterBOList    = new List <MenuMasterBO>();
            List <ProcParameterBO> objProcParameterBOList = new List <ProcParameterBO>();

            try
            {
                objDataSet = objDbAcess.execuitDataSet(ProcGetMenuList, ref objProcParameterBOList);
                if (objDataSet != null && objDataSet.Tables.Count > 0)
                {
                    for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                    {
                        objMenuMasterBO              = new MenuMasterBO();
                        objMenuMasterBO.MenuId       = Convert.ToInt32(objDataSet.Tables[0].Rows[i][0].ToString());
                        objMenuMasterBO.MenuName     = objDataSet.Tables[0].Rows[i][1].ToString();
                        objMenuMasterBO.DisplayOrder = Convert.ToInt32(objDataSet.Tables[0].Rows[i][2].ToString());
                        objMenuMasterBO.MenuKey      = objDataSet.Tables[0].Rows[i][3].ToString();
                        objMenuMasterBO.IsActive     = Convert.ToBoolean(objDataSet.Tables[0].Rows[i][4].ToString());
                        objMenuMasterBO.CreatedOn    = objDataSet.Tables[0].Rows[i][5].ToString();
                        objMenuMasterBOList.Add(objMenuMasterBO);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "getMenuList");
                throw ex;
            }
            return(objMenuMasterBOList);
        }
Exemplo n.º 9
0
        public List <BranchMasterBO> selectBranchList()
        {
            DataSet                objDataSet             = null;
            BranchMasterBO         objBranchMasterBO      = null;
            List <BranchMasterBO>  objListBranchMasterBO  = new List <BranchMasterBO>();
            List <ProcParameterBO> objProcParameterBOList = new List <ProcParameterBO>();

            try
            {
                objDataSet = objDBAccess.execuitDataSet(ProcselectBranchList, ref objProcParameterBOList);
                if (objDataSet != null && objDataSet.Tables.Count > 0)
                {
                    for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                    {
                        objBranchMasterBO                  = new BranchMasterBO();
                        objBranchMasterBO.BranchId         = Convert.ToInt32(objDataSet.Tables[0].Rows[i][0].ToString());
                        objBranchMasterBO.OrganizationName = objDataSet.Tables[0].Rows[i][1].ToString();
                        objBranchMasterBO.BranchName       = objDataSet.Tables[0].Rows[i][2].ToString();
                        objBranchMasterBO.Details          = objDataSet.Tables[0].Rows[i][3].ToString();
                        objBranchMasterBO.Address          = objDataSet.Tables[0].Rows[i][4].ToString();
                        objBranchMasterBO.CellNumber       = objDataSet.Tables[0].Rows[i][5].ToString();
                        objBranchMasterBO.LandNumber       = objDataSet.Tables[0].Rows[i][6].ToString();
                        objBranchMasterBO.EmailId          = objDataSet.Tables[0].Rows[i][7].ToString();
                        objBranchMasterBO.Website          = objDataSet.Tables[0].Rows[i][8].ToString();
                        objListBranchMasterBO.Add(objBranchMasterBO);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "selectBranchList");
                throw ex;
            }
            return(objListBranchMasterBO);
        }
Exemplo n.º 10
0
        public List <ApplicantRegistrationBO> getApplicantsList()
        {
            DataSet objDataSet = null;
            ApplicantRegistrationBO        objApplicantRegistrationBO     = null;
            List <ApplicantRegistrationBO> objApplicantRegistrationBOList = new List <ApplicantRegistrationBO>();
            List <ProcParameterBO>         objProcParameterBOList         = new List <ProcParameterBO>();

            try
            {
                objDataSet = objDBAccess.execuitDataSet(ProcGetApplicantList, ref objProcParameterBOList);
                if (objDataSet != null && objDataSet.Tables.Count > 0)
                {
                    for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                    {
                        objApplicantRegistrationBO              = new ApplicantRegistrationBO();
                        objApplicantRegistrationBO.ApplicantId  = Convert.ToInt32(objDataSet.Tables[0].Rows[i][0].ToString());
                        objApplicantRegistrationBO.FirstName    = objDataSet.Tables[0].Rows[i][1].ToString();
                        objApplicantRegistrationBO.EmailAddress = objDataSet.Tables[0].Rows[i][2].ToString();
                        objApplicantRegistrationBO.PhoneNumber  = objDataSet.Tables[0].Rows[i][3].ToString();
                        objApplicantRegistrationBO.Address      = objDataSet.Tables[0].Rows[i][4].ToString();
                        objApplicantRegistrationBOList.Add(objApplicantRegistrationBO);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "getApplicantsList");
                throw ex;
            }
            return(objApplicantRegistrationBOList);
        }
Exemplo n.º 11
0
        public ActionResult Create([Bind(Include = "ID,CODE,DESCRIPTION")] PRODUCT pRODUCT)
        {
            if (ModelState.IsValid)
            {
                var exception = new ExceptionError();
                try
                {
                    db.PRODUCT.Add(pRODUCT);
                    db.SaveChanges();
                    exception.Result = true;
                }
                catch (DbEntityValidationException e)
                {
                    exception.Name = string.Format("Entity has the following validation errors: {0} {1}\n", e.Message, e.InnerException);

                    foreach (var x in e.EntityValidationErrors)
                    {
                        exception.Name += string.Format("Property name: {0}, Message {1}\n", x.ValidationErrors.FirstOrDefault().PropertyName, x.ValidationErrors.FirstOrDefault().ErrorMessage);
                    }
                    exception.Result = false;
                }

                if (exception.Result)
                {
                    SharedHelp.CommonFunctions.CreateLog("CREATE", "PRODUCT", db.PRODUCT.Max(x => x.ID), null, string.Concat(pRODUCT.CODE, " / ", pRODUCT.DESCRIPTION), User.Identity.Name);
                }


                return(RedirectToAction("Index"));
            }

            return(View(pRODUCT));
        }
Exemplo n.º 12
0
        public string GetPasswordData(string strEmailAddress, string strPassword)
        {
            List <ProcParameterBO> objProcParameterBOList = new List <ProcParameterBO>();
            ProcParameterBO        objDbParameter         = null;
            string strResult = "";

            try
            {
                objDbParameter                = new ProcParameterBO();
                objDbParameter.Direction      = ParameterDirection.Input;
                objDbParameter.ParameterName  = "@strEmailAddress";
                objDbParameter.dbType         = DbType.String;
                objDbParameter.ParameterValue = strEmailAddress;
                objProcParameterBOList.Add(objDbParameter);

                objDbParameter                = new ProcParameterBO();
                objDbParameter.Direction      = ParameterDirection.Input;
                objDbParameter.ParameterName  = "@strPassword";
                objDbParameter.dbType         = DbType.String;
                objDbParameter.ParameterValue = strPassword;
                objProcParameterBOList.Add(objDbParameter);


                strResult = objDBAccess.executeScalar(ProcGetPasswordData, ref objProcParameterBOList).ToString();
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "GetPasswordData");
                strResult = "FAILED";
                throw ex;
            }

            return(strResult);
        }
Exemplo n.º 13
0
        public async Task <Either <DomainError, ImmutableList <AnimeInfo> > > GetLibrary()
        {
            try
            {
                var web = new HtmlWeb();
                var doc = await web.LoadFromWebAsync(AniChartLibrary);

                var
                    seasonInfoString =
                    HttpUtility.HtmlDecode(GetInnerTextOrEmpty(doc.DocumentNode, "//h1[@class='calendar']"));

                var(season, year, yearStr) = GetSeasonInformation(seasonInfoString);
                var feeTitles = await GetFeedTitles();

                return(doc.DocumentNode
                       .SelectNodes("//div[contains(@class,'g_bubblewrap') and contains(@class,'container')]/div[contains(@class,'g_bubble') and contains(@class,'box')]")
                       .Select(n => MapFromCard(n, yearStr))
                       .Select(aic => new AnimeInfo(
                                   NonEmptyString.FromString(IdHelpers.GenerateAnimeId(season.Value, yearStr, aic.Title)),
                                   NonEmptyString.FromString(aic.Title),
                                   NonEmptyString.FromString(aic.Synopsis),
                                   NonEmptyString.FromString(Helpers.TryGetFeedTitle(feeTitles, aic.Title)),
                                   new SeasonInformation(season, year),
                                   aic.Date,
                                   false))
                       .ToImmutableList());
            }
            catch (Exception e)
            {
                return(ExceptionError.FromException(e, "AnichartLibrary"));
            }
        }
Exemplo n.º 14
0
        public string CheckApplicantExist(int iApplicantId)
        {
            List <ProcParameterBO> objProcParameterBOList = new List <ProcParameterBO>();
            ProcParameterBO        objDbParameter         = null;
            string strResult = "";

            try
            {
                objDbParameter                = new ProcParameterBO();
                objDbParameter.Direction      = ParameterDirection.Input;
                objDbParameter.ParameterName  = "@iApplicantId";
                objDbParameter.dbType         = DbType.Int32;
                objDbParameter.ParameterValue = iApplicantId;
                objProcParameterBOList.Add(objDbParameter);

                strResult = objDBAccess.executeScalar(ProcGetCheckApplicantExist, ref objProcParameterBOList).ToString();
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "CheckApplicantExist");
                strResult = "FAILED";
                throw ex;
            }
            return(strResult);
        }
        public override void OnException(ExceptionContext context)
        {
            var exc = new ExceptionError();

            exc.Error = context.Exception.GetBaseException().Message;

            context.HttpContext.Response.StatusCode = 400;

            if (context.Exception is DomainException)
            {
                var ex = context.Exception as DomainException;
                context.Exception = ex;
                exc.Message       = "Houve um erro de negócio";
            }
            else
            {
#if !DEBUG
                string stack = null;
#else
                string stack = context.Exception.StackTrace;
#endif

                exc.Message = "Erro inesperado no sistema";
                exc.Detail  = stack;

                context.HttpContext.Response.StatusCode = 500;
            }

            context.Result = new JsonResult(exc);

            base.OnException(context);
        }
Exemplo n.º 16
0
    public void ExceptionReturnsCorrectObject()
    {
        var exception = new Exception();
        var error     = new ExceptionError(exception);

        Assert.Equal(exception, error.Exception);
    }
Exemplo n.º 17
0
        public IdTypeMasterBO EditIdTypeMaster(int iIdTypeMasterId)
        {
            DataSet                objDataSet             = null;
            IdTypeMasterBO         objIdTypeMasterBO      = null;
            List <ProcParameterBO> objProcParameterBOList = new List <ProcParameterBO>();

            try
            {
                ProcParameterBO objDbParameter = new ProcParameterBO();
                objDbParameter.Direction      = ParameterDirection.Input;
                objDbParameter.ParameterName  = "@iIdTypeMasterId";
                objDbParameter.dbType         = DbType.Int32;
                objDbParameter.ParameterValue = iIdTypeMasterId;
                objProcParameterBOList.Add(objDbParameter);

                objDataSet = objDBAccess.execuitDataSet(ProcEditIdTypeMaster, ref objProcParameterBOList);
                if (objDataSet != null && objDataSet.Tables[0].Rows.Count > 0)
                {
                    objIdTypeMasterBO = new IdTypeMasterBO();
                    objIdTypeMasterBO.IdTypeMasterId = Convert.ToInt32(objDataSet.Tables[0].Rows[0][0].ToString());
                    objIdTypeMasterBO.IdType         = objDataSet.Tables[0].Rows[0][1].ToString();
                    objIdTypeMasterBO.IsActive       = Convert.ToBoolean(objDataSet.Tables[0].Rows[0][2].ToString());
                }
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "EditIdTypeMaster");
                throw ex;
            }
            return(objIdTypeMasterBO);
        }
Exemplo n.º 18
0
    public void ExceptionErrorForwardsExceptionMessageByDefault()
    {
        var exception = new Exception("Wooga");
        var error     = new ExceptionError(exception);

        Assert.Equal(exception.Message, error.Message);
    }
        public async Task WhenAnApiBaseExceptionIsRaised_AExceptionErrorWillBeReturned_WithAProvidedHttpStatus()
        {
            // Arrange
            ApiBaseException thrownException  = new ApiBaseException(System.Net.HttpStatusCode.GatewayTimeout, "A Test Exception");
            ExceptionError   expectedResponse = new ExceptionError(System.Net.HttpStatusCode.GatewayTimeout, thrownException, string.Empty);

            var middleware = new ExceptionHandlerMiddleware((innerHttpContext) =>
            {
                throw thrownException;
            }, _logger);

            var context = new DefaultHttpContext();

            context.Response.Body = new MemoryStream();

            //Act
            await middleware.Invoke(context);

            context.Response.Body.Seek(0, SeekOrigin.Begin);
            var reader         = new StreamReader(context.Response.Body);
            var streamText     = reader.ReadToEnd();
            var actualResponse = JsonConvert.DeserializeObject <ExceptionError>(streamText);

            //Assert
            Assert.Equal(expectedResponse.StatusCode, actualResponse.StatusCode);
            Assert.Equal(expectedResponse.StatusCode, context.Response.StatusCode);
            Assert.Equal(expectedResponse.StatusMessage, actualResponse.StatusMessage);
            Assert.Equal(expectedResponse.ErrorMessage, actualResponse.ErrorMessage);
        }
Exemplo n.º 20
0
    public void ExceptionErrorUsesProvidedMessageIfAvailable()
    {
        var exception = new Exception("Wooga");
        var error     = new ExceptionError(exception, "Booga");

        Assert.NotEqual(exception.Message, error.Message);
    }
Exemplo n.º 21
0
        public List <string> getHRofficeUsersList()
        {
            DataSet                objDataSet             = null;
            string                 strEmailAddress        = "";
            List <string>          objUsersList           = new List <string>();
            List <ProcParameterBO> objProcParameterBOList = new List <ProcParameterBO>();

            try
            {
                objDataSet = objDBAccess.execuitDataSet(ProcGetHRofficeUsersList, ref objProcParameterBOList);
                if (objDataSet != null && objDataSet.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                    {
                        strEmailAddress = objDataSet.Tables[0].Rows[i][0].ToString();
                        objUsersList.Add(strEmailAddress);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "getHRofficeUsersList");
                throw ex;
            }
            return(objUsersList);
        }
Exemplo n.º 22
0
        public Either <DomainError, ImmutableList <FeedInfo> > GetFeed(Resolution resolution)
        {
            try
            {
                var sources = new List <LinkType> {
                    LinkType.TorrentFile, LinkType.Magnet
                }
                .SelectMany(type => GetFeedInformation(Resolution.Hd, type))
                .Where(f => f.PublicationDate >= DateTime.Today)
                .GroupBy(i => i.AnimeTitle);

                var resultList =
                    from source in sources
                    let links = source.Select(x => new TorrentLink(x.Type, x.Link)).ToImmutableList()
                                let baseElement = source.First()
                                                  select new FeedInfo(
                        NonEmptyString.FromString(baseElement.AnimeTitle),
                        NonEmptyString.FromString(baseElement.FeedTitle),
                        baseElement.PublicationDate,
                        links,
                        baseElement.EpisodeInfo);
                return(resultList.ToImmutableList());
            }
            catch (Exception e)
            {
                return(Left <DomainError, ImmutableList <FeedInfo> >(
                           ExceptionError.FromException(e, $"Erai_Feed_Exception")));
            }
        }
        public List <UserRegistrationBO> getUsersList()
        {
            DataSet                   objDataSet                = null;
            UserRegistrationBO        objUserRegistrationBO     = null;
            List <UserRegistrationBO> objUserRegistrationBOList = new List <UserRegistrationBO>();
            List <ProcParameterBO>    objProcParameterBOList    = new List <ProcParameterBO>();

            try
            {
                objDataSet = objDBAccess.execuitDataSet(ProcGetUsersList, ref objProcParameterBOList);
                if (objDataSet != null && objDataSet.Tables.Count > 0)
                {
                    for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                    {
                        objUserRegistrationBO              = new UserRegistrationBO();
                        objUserRegistrationBO.UserId       = Convert.ToInt32(objDataSet.Tables[0].Rows[i][0].ToString());
                        objUserRegistrationBO.FirstName    = objDataSet.Tables[0].Rows[i][1].ToString();
                        objUserRegistrationBO.LastName     = objDataSet.Tables[0].Rows[i][2].ToString();
                        objUserRegistrationBO.EmailAddress = objDataSet.Tables[0].Rows[i][3].ToString();
                        objUserRegistrationBO.MobileNumber = objDataSet.Tables[0].Rows[i][4].ToString();
                        objUserRegistrationBO.Department   = objDataSet.Tables[0].Rows[i][5].ToString();
                        objUserRegistrationBO.City         = objDataSet.Tables[0].Rows[i][6].ToString();
                        objUserRegistrationBO.IsActive     = Convert.ToBoolean(objDataSet.Tables[0].Rows[i][7].ToString());
                        objUserRegistrationBOList.Add(objUserRegistrationBO);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "getUsersList");
                throw ex;
            }
            return(objUserRegistrationBOList);
        }
Exemplo n.º 24
0
        public List <OrganizationMasterBO> selectOrganisationList()
        {
            DataSet objDataSet = null;
            OrganizationMasterBO        objOrganizationMasterBO     = null;
            List <OrganizationMasterBO> objListOrganizationMasterBO = new List <OrganizationMasterBO>();
            List <ProcParameterBO>      objProcParameterBOList      = new List <ProcParameterBO>();

            try
            {
                objDataSet = objDBAccess.execuitDataSet(ProcselectOrganizationList, ref objProcParameterBOList);
                if (objDataSet != null && objDataSet.Tables.Count > 0)
                {
                    for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                    {
                        objOrganizationMasterBO = new OrganizationMasterBO();
                        objOrganizationMasterBO.OrganisationId   = Convert.ToInt32(objDataSet.Tables[0].Rows[i][0].ToString());
                        objOrganizationMasterBO.OrganisationName = objDataSet.Tables[0].Rows[i][1].ToString();
                        objOrganizationMasterBO.IsActive         = Convert.ToBoolean(objDataSet.Tables[0].Rows[0][3].ToString());
                        objListOrganizationMasterBO.Add(objOrganizationMasterBO);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "selectOrganisationList");
                throw ex;
            }
            return(objListOrganizationMasterBO);
        }
        async Task InvokeAsync(HttpContext context)
        {
            try
            {
                await request(context);
            }
            catch (Exception exception)
            {
                string traceID = Guid.NewGuid().ToString();

                ExceptionError apiException = new ExceptionError(exception, traceID);
                if (!env.IsDevelopment())
                {
                    apiException.StackTrace = string.Empty;
                }

                // Log validation errors with this specific traceID:
                logger.LogError(exception, exception.Message + " ({traceId})", traceID);

                //var httpStatusCode = ConfigurateExceptionTypes(exception);
                var httpStatusCode = apiException.StatusCode;

                // Set HTTP status code and content type
                context.Response.StatusCode  = httpStatusCode;
                context.Response.ContentType = JsonContentType;

                // Writes / Returns error model to the response (in camelCase format)
                await context.Response.WriteAsync(JsonConvert.SerializeObject(
                                                      apiException,
                                                      new JsonSerializerSettings
                {
                    ContractResolver = new CamelCasePropertyNamesContractResolver()
                }));
            }
        }
Exemplo n.º 26
0
        internal static async Task <Either <DomainError, Unit> > BatchDelete <T>(CloudTable tableClient, IImmutableList <T> entities) where T : TableEntity
        {
            try
            {
                var offset = 0;
                while (offset < entities.Count)
                {
                    var batch = new TableBatchOperation();
                    var rows  = entities.Skip(offset).Take(100).ToList();
                    foreach (var row in rows)
                    {
                        batch.Delete(row);
                    }

                    await tableClient.ExecuteBatchAsync(batch);

                    offset += rows.Count;
                }

                return(Right(unit));
            }
            catch (Exception e)
            {
                return(Left <DomainError, Unit>(ExceptionError.FromException(e, "BatchDelete")));
            }
        }
Exemplo n.º 27
0
        public List <ApprovedJobsListBO> getApprovedJobsList()
        {
            DataSet                   objDataSet             = null;
            ApprovedJobsListBO        objApprovedJobsListBO  = null;
            List <ApprovedJobsListBO> objApprovedJobsBOList  = new List <ApprovedJobsListBO>();
            List <ProcParameterBO>    objProcParameterBOList = new List <ProcParameterBO>();

            try
            {
                objDataSet = objDBAccess.execuitDataSet(ProcGetApprovedJobsList, ref objProcParameterBOList);
                if (objDataSet != null && objDataSet.Tables.Count > 0)
                {
                    for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                    {
                        objApprovedJobsListBO                = new ApprovedJobsListBO();
                        objApprovedJobsListBO.JobName        = objDataSet.Tables[0].Rows[i][0].ToString();
                        objApprovedJobsListBO.JobDescription = objDataSet.Tables[0].Rows[i][1].ToString();
                        objApprovedJobsListBO.JobLocation    = objDataSet.Tables[0].Rows[i][2].ToString();
                        objApprovedJobsListBO.NoOfPositions  = Convert.ToInt32(objDataSet.Tables[0].Rows[i][3].ToString());
                        objApprovedJobsListBO.ApprovedDate   = objDataSet.Tables[0].Rows[i][4].ToString();
                        objApprovedJobsListBO.Status         = objDataSet.Tables[0].Rows[i][5].ToString();
                        objApprovedJobsListBO.Comments       = objDataSet.Tables[0].Rows[i][6].ToString();
                        objApprovedJobsBOList.Add(objApprovedJobsListBO);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "getApprovedJobsList");
                throw ex;
            }
            return(objApprovedJobsBOList);
        }
        public string deleteUser(int iUserId)
        {
            string strResult = "";

            try
            {
                List <ProcParameterBO> objProcParameterBOList = new List <ProcParameterBO>();
                ProcParameterBO        objDbParameter         = null;

                objDbParameter                = new ProcParameterBO();
                objDbParameter.Direction      = ParameterDirection.Input;
                objDbParameter.ParameterName  = "@iUserId";
                objDbParameter.dbType         = DbType.Int32;
                objDbParameter.ParameterValue = iUserId;
                objProcParameterBOList.Add(objDbParameter);

                objDBAccess.executeNonQuery(ProcDeleteUser, ref objProcParameterBOList);
                strResult = "DELETED";
            }

            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "deleteUser");
                strResult = "FAILED";
                throw ex;
            }
            return(strResult);
        }
        public List <CommonDropDownBO> CountriesList()
        {
            DataSet                 objDataSet              = null;
            CommonDropDownBO        objCommonDropDownBO     = null;
            List <CommonDropDownBO> objCommonDropDownBOList = new List <CommonDropDownBO>();
            List <ProcParameterBO>  objProcParameterBOList  = new List <ProcParameterBO>();

            try
            {
                objDataSet = objDBAccess.execuitDataSet(ProcCountriesList, ref objProcParameterBOList);
                if (objDataSet != null && objDataSet.Tables.Count > 0)
                {
                    for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                    {
                        objCommonDropDownBO       = new CommonDropDownBO();
                        objCommonDropDownBO.Id    = Convert.ToInt32(objDataSet.Tables[0].Rows[i][0].ToString());
                        objCommonDropDownBO.Value = objDataSet.Tables[0].Rows[i][1].ToString();
                        objCommonDropDownBOList.Add(objCommonDropDownBO);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "CountriesList");
                throw ex;
            }
            return(objCommonDropDownBOList);
        }
        public UserRegistrationBO EditUserDetails(int iUserId)
        {
            DataSet                objDataSet             = null;
            UserRegistrationBO     objUserRegistrationBO  = null;
            List <ProcParameterBO> objProcParameterBOList = new List <ProcParameterBO>();

            try
            {
                ProcParameterBO objDbParameter = new ProcParameterBO();
                objDbParameter.Direction      = ParameterDirection.Input;
                objDbParameter.ParameterName  = "@iuserId";
                objDbParameter.dbType         = DbType.Int32;
                objDbParameter.ParameterValue = iUserId;
                objProcParameterBOList.Add(objDbParameter);

                objDataSet = objDBAccess.execuitDataSet(ProcEditUser, ref objProcParameterBOList);
                if (objDataSet != null && objDataSet.Tables[0].Rows.Count > 0)
                {
                    objUserRegistrationBO            = new UserRegistrationBO();
                    objUserRegistrationBO.UserId     = Convert.ToInt32(objDataSet.Tables[0].Rows[0][0].ToString());
                    objUserRegistrationBO.FirstName  = objDataSet.Tables[0].Rows[0][1].ToString();
                    objUserRegistrationBO.MiddleName = objDataSet.Tables[0].Rows[0][2].ToString();
                    objUserRegistrationBO.LastName   = objDataSet.Tables[0].Rows[0][3].ToString();
                    objUserRegistrationBO.Photo      = objDataSet.Tables[0].Rows[0][4].ToString();
                    objUserRegistrationBO.Password   = objDataSet.Tables[0].Rows[0][5].ToString();
                    //objUserRegistrationBO.ConfirmPassword = objDataSet.Tables[0].Rows[0][6].ToString();
                    objUserRegistrationBO.Gender                = objDataSet.Tables[0].Rows[0][6].ToString();
                    objUserRegistrationBO.MobileNumber          = objDataSet.Tables[0].Rows[0][7].ToString();
                    objUserRegistrationBO.AlternateMobileNumber = objDataSet.Tables[0].Rows[0][8].ToString();
                    objUserRegistrationBO.EmailAddress          = objDataSet.Tables[0].Rows[0][9].ToString();
                    objUserRegistrationBO.Language              = objDataSet.Tables[0].Rows[0][10].ToString();
                    objUserRegistrationBO.Qualification         = objDataSet.Tables[0].Rows[0][11].ToString();
                    objUserRegistrationBO.College               = objDataSet.Tables[0].Rows[0][12].ToString();
                    objUserRegistrationBO.University            = objDataSet.Tables[0].Rows[0][13].ToString();
                    objUserRegistrationBO.AggregatePercentage   = objDataSet.Tables[0].Rows[0][14].ToString();
                    objUserRegistrationBO.JoiningDate           = objDataSet.Tables[0].Rows[0][15].ToString();
                    objUserRegistrationBO.CountryId             = Convert.ToInt32(objDataSet.Tables[0].Rows[0][16].ToString());
                    objUserRegistrationBO.StateId               = Convert.ToInt32(objDataSet.Tables[0].Rows[0][17].ToString());
                    objUserRegistrationBO.City          = objDataSet.Tables[0].Rows[0][18].ToString();
                    objUserRegistrationBO.UserType      = objDataSet.Tables[0].Rows[0][19].ToString();
                    objUserRegistrationBO.UserRole      = objDataSet.Tables[0].Rows[0][20].ToString();
                    objUserRegistrationBO.DonorProgram  = objDataSet.Tables[0].Rows[0][21].ToString();
                    objUserRegistrationBO.Department    = objDataSet.Tables[0].Rows[0][22].ToString();
                    objUserRegistrationBO.Address       = objDataSet.Tables[0].Rows[0][23].ToString();
                    objUserRegistrationBO.IsActive      = Convert.ToBoolean(objDataSet.Tables[0].Rows[0][24].ToString());
                    objUserRegistrationBO.DateOfBirth   = objDataSet.Tables[0].Rows[0][25].ToString();
                    objUserRegistrationBO.FileSavedName = objDataSet.Tables[0].Rows[0][26].ToString();
                    objUserRegistrationBO.LocationId    = Convert.ToInt32(objDataSet.Tables[0].Rows[0][27].ToString());
                }
            }
            catch (Exception ex)
            {
                ExceptionError.Error_Log(ex, "EditUserDetails");
                throw ex;
            }
            return(objUserRegistrationBO);
        }