Exemplo n.º 1
0
        private async Task <Aatf> CreateAatf(DatabaseWrapper database, FacilityType facilityType, DateTime date, short year, string approvalNumber = null, string name = null)
        {
            var country = database.WeeeContext.Countries.First();
            var competentAuthorityDataAccess = new CommonDataAccess(database.WeeeContext);
            var competentAuthority           = await competentAuthorityDataAccess.FetchCompetentAuthority(CompetentAuthority.England);

            var organisation = Organisation.CreatePartnership("Dummy");
            var contact      = new AatfContact("First Name", "Last Name", "Manager", "1 Address Lane", "Address Ward", "Town", "County", "Postcode", country, "01234 567890", "*****@*****.**");

            if (approvalNumber == null)
            {
                approvalNumber = "12345678";
            }

            if (name == null)
            {
                name = "name";
            }

            return(new Aatf(name,
                            competentAuthority,
                            approvalNumber,
                            AatfStatus.Approved,
                            organisation,
                            AddressHelper.GetAatfAddress(database),
                            A.Fake <AatfSize>(),
                            date,
                            contact,
                            facilityType,
                            year,
                            database.WeeeContext.LocalAreas.First(),
                            database.WeeeContext.PanAreas.First()));
        }
Exemplo n.º 2
0
        public async Task GetAatfsDataAccess_ReturnsAatfsList()
        {
            using (var database = new DatabaseWrapper())
            {
                var helper                       = new ModelHelper(database.Model);
                var dataAccess                   = new GetAatfsDataAccess(database.WeeeContext);
                var genericDataAccess            = new GenericDataAccess(database.WeeeContext);
                var competentAuthorityDataAccess = new CommonDataAccess(database.WeeeContext);
                var competentAuthority           = await competentAuthorityDataAccess.FetchCompetentAuthority(CompetentAuthority.England);

                var country = await database.WeeeContext.Countries.SingleAsync(c => c.Name == "UK - England");

                var aatfContact  = new AatfContact("first", "last", "position", "address1", "address2", "town", "county", "postcode", country, "telephone", "email");
                var organisation = Organisation.CreatePartnership("Koalas");
                var aatfAddress  = AddressHelper.GetAatfAddress(database);
                var aatfSize     = AatfSize.Large;

                var aatf = ObligatedWeeeIntegrationCommon.CreateAatf(database, organisation);

                await genericDataAccess.Add <Aatf>(aatf);

                var aatfList = await dataAccess.GetAatfs();

                aatfList.Should().Contain(aatf);
            }
        }
Exemplo n.º 3
0
 public IEnumerable <SelectListItem> GetMedioSelectionList()
 {
     using (var context = new CCEntities()) {
         var commonDA = new CommonDataAccess(context);
         return(commonDA.GetMedioSelectionList());
     }
 }
 public ProjectHandler(ProjectDataAccess projectDataAccess, CommonDataAccess commonDataAccess)
 {
     _projectDataAccess = projectDataAccess;
     _commonDataAccess = commonDataAccess;
     _statusDictionary = _commonDataAccess.GetConstant("Status");
     _roleDictionary = _commonDataAccess.GetConstant("Role");
 }
Exemplo n.º 5
0
 public IEnumerable <SelectListItem> GetSubcategoriaSelectionListByIdCategoria(int idCategoria)
 {
     using (var context = new CCEntities()) {
         var commonDA = new CommonDataAccess(context);
         return(commonDA.GetSubcategoriaSelectionListByIdCategoria(idCategoria));
     }
 }
Exemplo n.º 6
0
        public async Task GetAatfsDataAccess_ReturnsLatestAesList()
        {
            using (var database = new DatabaseWrapper())
            {
                var helper                       = new ModelHelper(database.Model);
                var dataAccess                   = new GetAatfsDataAccess(database.WeeeContext);
                var genericDataAccess            = new GenericDataAccess(database.WeeeContext);
                var competentAuthorityDataAccess = new CommonDataAccess(database.WeeeContext);
                var competentAuthority           = await competentAuthorityDataAccess.FetchCompetentAuthority(CompetentAuthority.England);

                var country = await database.WeeeContext.Countries.SingleAsync(c => c.Name == "UK - England");

                var aatfContact  = new AatfContact("first", "last", "position", "address1", "address2", "town", "county", "postcode", country, "telephone", "email");
                var organisation = Organisation.CreatePartnership("Koalas");
                var aatfAddress  = AddressHelper.GetAatfAddress(database);
                var aatfSize     = AatfSize.Large;

                var aatfId = Guid.NewGuid();

                var aatf  = new Aatf("KoalaBears", competentAuthority, "WEE/AB1289YZ/ATF", AatfStatus.Approved, organisation, aatfAddress, aatfSize, DateTime.Now, aatfContact, FacilityType.Ae, 2019, database.WeeeContext.LocalAreas.First(), database.WeeeContext.PanAreas.First(), aatfId);
                var aatf1 = new Aatf("KoalaBears", competentAuthority, "WEE/AB1289YZ/ATF", AatfStatus.Approved, organisation, aatfAddress, aatfSize, Convert.ToDateTime("20/01/2020"), aatfContact, FacilityType.Ae, 2020, database.WeeeContext.LocalAreas.First(), database.WeeeContext.PanAreas.First(), aatfId);

                await genericDataAccess.AddMany <Aatf>(new List <Aatf>() { aatf1, aatf });

                var aatfList = await dataAccess.GetLatestAatfs();

                aatfList.Should().Contain(aatf1);
                aatfList.Should().NotContain(aatf);
            }
        }
Exemplo n.º 7
0
        public async Task GetFilteredAatfsDataAccess_ByName_ReturnsFilteredAatfsList()
        {
            using (var database = new DatabaseWrapper())
            {
                var helper                       = new ModelHelper(database.Model);
                var dataAccess                   = new GetAatfsDataAccess(database.WeeeContext);
                var genericDataAccess            = new GenericDataAccess(database.WeeeContext);
                var competentAuthorityDataAccess = new CommonDataAccess(database.WeeeContext);
                var competentAuthority           = await competentAuthorityDataAccess.FetchCompetentAuthority(CompetentAuthority.England);

                var country = await database.WeeeContext.Countries.SingleAsync(c => c.Name == "UK - England");

                var aatfContact  = new AatfContact("first", "last", "position", "address1", "address2", "town", "county", "postcode", country, "telephone", "email");
                var organisation = Organisation.CreatePartnership("Koalas");
                var aatfAddress  = AddressHelper.GetAatfAddress(database);
                var aatfSize     = AatfSize.Large;

                var aatf = new Aatf("KoalaBears", competentAuthority, "WEE/AB1289YZ/ATF", AatfStatus.Approved, organisation, aatfAddress, aatfSize, DateTime.Now, aatfContact, FacilityType.Aatf, 2019, database.WeeeContext.LocalAreas.First(), database.WeeeContext.PanAreas.First());

                await genericDataAccess.Add <Aatf>(aatf);

                var filteredListWithAatf = await dataAccess.GetFilteredAatfs(new Core.AatfReturn.AatfFilter {
                    Name = "k"
                });

                var filteredListWithoutAatf = await dataAccess.GetFilteredAatfs(new Core.AatfReturn.AatfFilter {
                    Name = "z"
                });

                filteredListWithAatf.Should().Contain(aatf);
                filteredListWithoutAatf.Should().NotContain(aatf);
            }
        }
Exemplo n.º 8
0
        public void GetDataforEmployeecard()
        {
            LogManager.WriteLog("[GetDataforEmployeecard]- Start", LogManager.enumLogLevel.Info);

            DataTable dtEMPCard;
            int       Message_ID = 0;

            try
            {
                dtEMPCard = CommonDataAccess.GetEmployeeCardPollingData();

                LogManager.WriteLog("[GetDataforEmployeecard] | Number of Employeecards to Process: " +
                                    dtEMPCard.Rows.Count.ToString(), LogManager.enumLogLevel.Info);

                if ((dtEMPCard == null) || (dtEMPCard.Rows.Count == 0))
                {
                    LogManager.WriteLog("No cards to be broadcasted", LogManager.enumLogLevel.Info);
                    return;
                }

                foreach (DataRow row in dtEMPCard.Rows)
                {
                    EmployeeMasterCardThreadData threadData = new EmployeeMasterCardThreadData()
                    {
                        EmployeeCardNo = row["EmployeeCard"].ToString(),
                        EmployeeFlags  = row["EmployeeFlags"].ToString(),
                        InstallationNo = Convert.ToInt32(row["Installation_No"])
                    };

                    bool canAdd = true;


                    Message_ID = EmployeecardSend(threadData.EmployeeCardNo, threadData.EmployeeFlags, threadData.InstallationNo);
                    LogManager.WriteLog("GetDataforEmployeecard | Master card Information " + threadData.EmployeeCardNo.ToString()
                                        + "sent to Installation: " + threadData.InstallationNo.ToString()
                                        + ", MessageID: " + Message_ID.ToString()
                                        , LogManager.enumLogLevel.Info);


                    if (canAdd)
                    {
                        threadData.MessageID = Message_ID;
                        if (!_requestCollection.ContainsKey(Message_ID))
                        {
                            _requestCollection.Add(Message_ID, threadData);
                        }
                    }
                }
                LogManager.WriteLog("[GetDataforEmployeecard]- End", LogManager.enumLogLevel.Info);
            }
            catch (Exception Ex)

            {
                ExceptionManager.Publish(Ex);
            }
        }
Exemplo n.º 9
0
        //public List<DocumentTypeEntity> GetActiveDocumentTypes(int documentCategory)
        //{
        //    _commonDataAccess = new CommonDataAccess(_context);
        //    return _commonDataAccess.GetActiveDocumentTypes(documentCategory);
        //}

        //public List<DocumentTypeEntity> GetDocumentTypeList(List<AttachmentTypeEntity> attachTypes, int documentCategory)
        //{
        //    _commonDataAccess = new CommonDataAccess(_context);
        //    return _commonDataAccess.GetDocumentTypeList(attachTypes, documentCategory);
        //}

        //public IEnumerable<BranchEntity> GetBranchList(BranchSearchFilter searchFilter)
        //{
        //    _commonDataAccess = new CommonDataAccess(_context);
        //    return _commonDataAccess.GetBranchList(searchFilter);
        //}

        //public List<BranchEntity> GetBranchesByName(string searchTerm, int pageSize, int pageNum)
        //{
        //    _commonDataAccess = new CommonDataAccess(_context);
        //    return _commonDataAccess.GetBranchesByName(searchTerm, pageSize, pageNum);
        //}

        //public int GetBranchCountByName(string searchTerm, int pageSize, int pageNum)
        //{
        //    _commonDataAccess = new CommonDataAccess(_context);
        //    return _commonDataAccess.GetBranchCountByName(searchTerm, pageSize, pageNum);
        //}

        //public List<BranchEntity> GetBranchesByName(string searchTerm, int pageSize, int pageNum, int? userId)
        //{
        //    _commonDataAccess = new CommonDataAccess(_context);
        //    return _commonDataAccess.GetBranchesByName(searchTerm, pageSize, pageNum, userId);
        //}

        //public int GetBranchCountByName(string searchTerm, int pageSize, int pageNum, int? userId)
        //{
        //    _commonDataAccess = new CommonDataAccess(_context);
        //    return _commonDataAccess.GetBranchCountByName(searchTerm, pageSize, pageNum, userId);
        //}

        //public ParameterEntity GetCacheParamByName(string paramName)
        //{
        //    List<ParameterEntity> parameters = this.GetCacheParameters();
        //    return parameters.FirstOrDefault(x => x.ParamName.ToUpper(CultureInfo.InvariantCulture).Equals(paramName.ToUpper(CultureInfo.InvariantCulture)));
        //}

        //public ParameterEntity GetParamByName(string paramName)
        //{
        //    _commonDataAccess = new CommonDataAccess(_context);
        //    return _commonDataAccess.GetParamByName(paramName);
        //}

        //public string GetValueParamByName(string paramName)
        //{
        //    var parameter = GetCacheParamByName(paramName);
        //    return parameter != null ? parameter.ParamValue : string.Empty;
        //}

        //public string GetDescParamByName(string paramName)
        //{
        //    var parameter = GetCacheParamByName(paramName);
        //    return parameter != null ? parameter.ParamDesc : string.Empty;
        //}

        //public IDictionary<string, string> GetCustomerProductSelectList()
        //{
        //    return this.GetCustomerProductSelectList(null);
        //}

        //public IDictionary<string, string> GetCustomerProductSelectList(string textName, int? textValue = null)
        //{
        //    IDictionary<string, string> dic = new Dictionary<string, string>();

        //    if (!string.IsNullOrWhiteSpace(textName))
        //    {
        //        dic.Add(textValue.ConvertToString(), textName);
        //    }

        //    dic.Add(Constants.CustomerProduct.Loan, Resource.Ddl_CustomerProduct_Loan);
        //    dic.Add(Constants.CustomerProduct.Funding, Resource.Ddl_CustomerProduct_Funding);
        //    dic.Add(Constants.CustomerProduct.HP, Resource.Ddl_CustomerProduct_HP);
        //    dic.Add(Constants.CustomerProduct.Insurance, Resource.Ddl_CustomerProduct_Insurance);
        //    return dic;
        //}

        //public IDictionary<string, string> GetCustomerTypeSelectList()
        //{
        //    return this.GetCustomerTypeSelectList(null);
        //}

        //public IDictionary<string, string> GetCustomerTypeSelectList(string textName, int? textValue = null)
        //{
        //    IDictionary<string, string> dic = new Dictionary<string, string>();

        //    if (!string.IsNullOrWhiteSpace(textName))
        //    {
        //        dic.Add(textValue.ConvertToString(), textName);
        //    }

        //    dic.Add(Constants.CustomerType.Customer.ToString(CultureInfo.InvariantCulture), Resource.Ddl_CustomerType_Customer);
        //    dic.Add(Constants.CustomerType.Prospect.ToString(CultureInfo.InvariantCulture), Resource.Ddl_CustomerType_Prospect);
        //    dic.Add(Constants.CustomerType.Employee.ToString(CultureInfo.InvariantCulture), Resource.Ddl_CustomerType_Employee);
        //    return dic;
        //}

        public IDictionary <string, string> GetPrefixNameSelectList()
        {
            _commonDataAccess = new CommonDataAccess(_context);
            var lst = _commonDataAccess.GetPrefixNameActive();

            return((from x in lst
                    select new
            {
                key = x.PrefixNameId.ToString(),
                value = x.PrefixName
            }).ToDictionary(t => t.key, t => t.value));
        }
Exemplo n.º 10
0
        public async Task GetCompetentAuthorityById_AuthorityShouldBeReturned(Guid id, string abbreviation)
        {
            using (var database = new DatabaseWrapper())
            {
                var helper = new ModelHelper(database.Model);

                var dataAccess = new CommonDataAccess(database.WeeeContext);

                var result = await dataAccess.FetchCompetentAuthorityById(id);

                result.Abbreviation.Should().Be(abbreviation);
            }
        }
Exemplo n.º 11
0
        public async Task FetchnvoicedMemberUploadsAsync_WithSpecifiedAuthority_OOnlyReturnsInvoicedMemberUploadsForTheSpecifiedAuthority()
        {
            using (DatabaseWrapper wrapper = new DatabaseWrapper())
            {
                // Arrange
                ModelHelper helper = new ModelHelper(wrapper.Model);
                AspNetUser  user   = helper.GetOrCreateUser("TestUser");

                Weee.Tests.Core.Model.Country country = new Weee.Tests.Core.Model.Country();
                country.Id   = new Guid("FA20ED45-5488-491D-A117-DFC09C9C1BA2");
                country.Name = "Test Country";

                CompetentAuthority databaseAuthority1 = new CompetentAuthority();
                databaseAuthority1.Id                 = new Guid("DDE398F6-809E-416D-B70D-B36606F221FC");
                databaseAuthority1.Name               = "Test Authority 1";
                databaseAuthority1.Abbreviation       = "T1";
                databaseAuthority1.Country            = country;
                databaseAuthority1.Email              = "TestEmailAddress";
                databaseAuthority1.AnnualChargeAmount = 0;
                wrapper.Model.CompetentAuthorities.Add(databaseAuthority1);

                InvoiceRun invoiceRunForAuthority1 = new InvoiceRun();
                invoiceRunForAuthority1.Id = new Guid("CE7A2617-AE16-403E-A7BF-BF01AD223872");
                invoiceRunForAuthority1.CompetentAuthority = databaseAuthority1;
                invoiceRunForAuthority1.IssuedByUserId     = user.Id;
                invoiceRunForAuthority1.IssuedDate         = new DateTime(2015, 1, 1);
                wrapper.Model.InvoiceRuns.Add(invoiceRunForAuthority1);

                var scheme = helper.CreateScheme();
                scheme.CompetentAuthorityId = databaseAuthority1.Id;
                var memberUpload = helper.CreateSubmittedMemberUpload(scheme, invoiceRunForAuthority1);

                wrapper.Model.SaveChanges();

                UKCompetentAuthority domainAuthority1 = wrapper.WeeeContext.UKCompetentAuthorities.Find(databaseAuthority1.Id);

                CommonDataAccess dataAccess = new CommonDataAccess(wrapper.WeeeContext);

                // Act
                IReadOnlyList <Domain.Scheme.MemberUpload> results = await dataAccess.FetchInvoicedMemberUploadsAsync(domainAuthority1);

                // Assert
                Assert.NotNull(results);
                Assert.Equal(1, results.Count);
                Assert.Equal(memberUpload.Id, results[0].Id);
            }
        }
Exemplo n.º 12
0
        public static List <Employeecarddata> GetEmployeeCardPollingData()
        {
            DataTable dtEmpcard = CommonDataAccess.GetEmployeeCardPollingData();
            List <Employeecarddata> empcardData = new List <Employeecarddata>();

            foreach (DataRow row in dtEmpcard.Rows)
            {
                empcardData.Add(new Employeecarddata {
                    EmployeeCard = row["EmployeeCard"].ToString(),
                    //EMPCardEDType=Convert.ToInt32( row["EMPCard_ED_Type"]),
                    EmployeeFlags   = row["EmployeeFlags"].ToString(),
                    Installation_No = Convert.ToInt32(row["Installation_No"])
                });
                //PollingStatus =Convert.ToBoolean(row["Polling_Status"])
            }
            return(empcardData);
        }
Exemplo n.º 13
0
        public List <PrefixNameEntity> AutoCompleteSearchPrefixName(string keyword, int limit)
        {
            _commonDataAccess = new CommonDataAccess(_context);
            var query = _context.MS_PREFIX_NAME.AsQueryable();

            query = query.Where(q => q.active_status == Constants.ApplicationStatus.Active);
            if (!string.IsNullOrEmpty(keyword))
            {
                query = query.Where(q => q.prefix_name.Contains(keyword));
            }

            query = query.OrderBy(q => q.prefix_name);

            return(query.Take(limit).Select(item => new PrefixNameEntity {
                PrefixNameId = item.prefix_name_id,
                PrefixName = item.prefix_name
            }).ToList());
        }
Exemplo n.º 14
0
        public async Task Remove_GivenNullEntity_EntityStateShouldNotBeUpdated()
        {
            using (var database = new DatabaseWrapper())
            {
                var dataAccess = new GenericDataAccess(database.WeeeContext);
                var competentAuthorityDataAccess = new CommonDataAccess(database.WeeeContext);
                var organisation = Organisation.CreateSoleTrader("Test Organisation");
                var aatf         = ObligatedWeeeIntegrationCommon.CreateAatf(database, organisation);

                database.WeeeContext.Aatfs.Add(ObligatedWeeeIntegrationCommon.CreateAatf(database, organisation));

                await database.WeeeContext.SaveChangesAsync();

                dataAccess.Remove <Aatf>(null);

                database.WeeeContext.ChangeTracker.Entries().Count(e => e.State == EntityState.Deleted).Should().Be(0);
            }
        }
Exemplo n.º 15
0
        public bool Parse(int formId, int formNo)
        {
            string tableName = string.Format("tb_{0}", formId);
            Object obj       = CommonDataAccess.GetColomnValue(ConditionSubField, tableName, formNo);;

            if (obj != null)
            {
                string columnType = CommonDataAccess.GetColumnType(tableName, ConditionSubField);

                Compare compare = (Compare)Assembly.Load("SimpleFlow.BusinessRules").CreateInstance("SimpleFlow.BusinessRules.Compare" + columnType.ToUpper());

                compare.VariableA = obj;
                compare.VariableB = ConditionSubValue;
                compare.Operator  = ConditionSubOperator;

                return(compare.GetResult());
            }

            return(false);
        }
Exemplo n.º 16
0
        private async Task <Aatf> CreateAatf(DatabaseWrapper database, Organisation organisation, DateTime?approvalDate)
        {
            var competentAuthorityDataAccess = new CommonDataAccess(database.WeeeContext);
            var country = await database.WeeeContext.Countries.SingleAsync(c => c.Name == "France");

            var competentAuthority = await competentAuthorityDataAccess.FetchCompetentAuthority(CompetentAuthority.England);

            var aatf = ObligatedWeeeIntegrationCommon.CreateAatf(database, organisation);

            if (!approvalDate.HasValue)
            {
                aatf.UpdateDetails("name", competentAuthority, "12345678", AatfStatus.Approved, organisation, AatfSize.Large, null, aatf.LocalArea, aatf.PanArea);
            }

            database.WeeeContext.Aatfs.Add(aatf);

            await database.WeeeContext.SaveChangesAsync();

            return(aatf);
        }
Exemplo n.º 17
0
        protected virtual void Dispose(bool disposing)
        {
            if (this.disposed)
            {
                return;
            }

            if (disposing)
            {
                if (this.instance != null)
                {
                    this.instance.Dispose();
                    this.instance = null;
                }

                ////Clean all memeber and release resource.
            }

            // Free any unmanaged objects here.
            disposed = true;
        }
Exemplo n.º 18
0
        private async Task <List <Aatf> > CreateMultipleAatf(DatabaseWrapper database, FacilityType facilityType, DateTime date, short year)
        {
            var country = database.WeeeContext.Countries.First();
            var competentAuthorityDataAccess = new CommonDataAccess(database.WeeeContext);
            var competentAuthority           = await competentAuthorityDataAccess.FetchCompetentAuthority(CompetentAuthority.England);

            var organisation = Organisation.CreatePartnership("Dummy");
            var contact      = new AatfContact("First Name", "Last Name", "Manager", "1 Address Lane", "Address Ward", "Town", "County", "Postcode", country, "01234 567890", "*****@*****.**");
            var aatfList     = new List <Aatf>();

            aatfList.Add(new Aatf("B",
                                  competentAuthority,
                                  "12345678",
                                  AatfStatus.Approved,
                                  organisation,
                                  AddressHelper.GetAatfAddress(database),
                                  A.Fake <AatfSize>(),
                                  date,
                                  contact,
                                  facilityType,
                                  year,
                                  database.WeeeContext.LocalAreas.First(),
                                  database.WeeeContext.PanAreas.First()));

            aatfList.Add(new Aatf("A",
                                  competentAuthority,
                                  "12345679",
                                  AatfStatus.Approved,
                                  organisation,
                                  AddressHelper.GetAatfAddress(database),
                                  A.Fake <AatfSize>(),
                                  date,
                                  contact,
                                  facilityType,
                                  year,
                                  database.WeeeContext.LocalAreas.First(),
                                  database.WeeeContext.PanAreas.First()));

            return(aatfList);
        }
Exemplo n.º 19
0
        public void ProcessResponse(EmployeeMasterCardThreadDataResponse threadData)
        {
            if (_requestCollection.Count <= 0)
            {
                return;
            }

            lock (_lockRes)
            {
                if (_requestCollection.ContainsKey(threadData.MessageID))
                {
                    EmployeeMasterCardThreadData Requestitem = _requestCollection[threadData.MessageID];

                    if (threadData.Ack)
                    {
                        CommonDataAccess.UpdateEmployeeCardPolling(Requestitem.EmployeeCardNo, Requestitem.InstallationNo);
                        LogManager.WriteLog("ProcessResponse_EmployeeMasterCard  |   ACK Updated for EmployeeCard:"
                                            + Requestitem.EmployeeCardNo.ToString()
                                            + "| in Installation No " + Requestitem.InstallationNo.ToString()
                                            , LogManager.enumLogLevel.Info);
                    }
                    else
                    {
                        LogManager.WriteLog("ProcessResponse_EmployeeMasterCard  |   NACK received for EmployeeCard:"
                                            + Requestitem.EmployeeCardNo.ToString()
                                            + "| in Installation No " + Requestitem.InstallationNo.ToString()
                                            , LogManager.enumLogLevel.Info);
                    }
                    _emppollingCollection.Add(new Employeecarddata
                    {
                        EmployeeCard    = Requestitem.EmployeeCardNo,
                        Installation_No = Requestitem.InstallationNo,
                        PollingStatus   = threadData.Ack
                    });

                    _requestCollection.Remove(threadData.MessageID);
                }
            }
        }
Exemplo n.º 20
0
        public async Task FetchLookup_GivenId_ObjectIsRetrieved(string objectType, string id, string name)
        {
            using (var database = new DatabaseWrapper())
            {
                var helper = new ModelHelper(database.Model);

                var dataAccess = new CommonDataAccess(database.WeeeContext);

                if (objectType == "LocalArea")
                {
                    var result = await dataAccess.FetchLookup <LocalArea>(Guid.Parse(id));

                    result.Name.Should().Be(name);
                }
                else if (objectType == "PanArea")
                {
                    var result = await dataAccess.FetchLookup <PanArea>(Guid.Parse(id));

                    result.Name.Should().Be(name);
                }
            }
        }
        private void LoadFilterData()
        {
            LogManager.WriteLog("UCAnalysisDetails:GetActiveZones", LogManager.enumLogLevel.Info);
            DataTable dt_zones = new CommonDataAccess().GetActiveZones();
            DataRow   drMc     = dt_zones.NewRow();

            drMc["Zone_No"]   = -1;
            drMc["Zone_Name"] = "-- All Machines --";
            dt_zones.Rows.InsertAt(drMc, 0);
            if (dt_zones.Rows.Count > 0)
            {
                dt_zones.DefaultView.Sort = "Zone_Name";
                cmbFilter.ItemsSource     = ((System.ComponentModel.IListSource)dt_zones).GetList();
            }
            cmbFilter.DataContext       = dt_zones;
            cmbFilter.DisplayMemberPath = "Zone_Name";
            cmbFilter.SelectedValuePath = "Zone_No";
            cmbFilter.SelectedIndex     = 0;
            cmbView.Items.Add("Position");
            cmbView.Items.Add("Zone");
            cmbView.SelectedIndex = 0;
        }
        public async Task FetchSubmittedNonInvoicedMemberUploadsAsync_WithSpecifiedAuthority_OnlyReturnsNonInvoicedMemberUploadsForTheSpecifiedAuthority()
        {
            using (DatabaseWrapper wrapper = new DatabaseWrapper())
            {
                // Arrange
                ModelHelper helper = new ModelHelper(wrapper.Model);
              
                Weee.Tests.Core.Model.Country country = new Weee.Tests.Core.Model.Country();
                country.Id = new Guid("FA20ED45-5488-491D-A117-DFC09C9C1BA2");
                country.Name = "Test Country";

                CompetentAuthority databaseAuthority1 = new CompetentAuthority();
                databaseAuthority1.Id = new Guid("DDE398F6-809E-416D-B70D-B36606F221FC");
                databaseAuthority1.Name = "Test Authority 1";
                databaseAuthority1.Abbreviation = "T1";
                databaseAuthority1.Country = country;
                databaseAuthority1.Email = "TestEmailAddress";
                wrapper.Model.CompetentAuthorities.Add(databaseAuthority1);
                
                var scheme = helper.CreateScheme();
                
                scheme.CompetentAuthorityId = databaseAuthority1.Id;             
                var memberUpload = helper.CreateSubmittedMemberUpload(scheme);              
                wrapper.Model.SaveChanges();

                UKCompetentAuthority domainAuthority1 = wrapper.WeeeContext.UKCompetentAuthorities.Find(databaseAuthority1.Id);
                CommonDataAccess dataAccess = new CommonDataAccess(wrapper.WeeeContext);

                // Act
                IReadOnlyList<Domain.Scheme.MemberUpload> results = await dataAccess.FetchSubmittedNonInvoicedMemberUploadsAsync(domainAuthority1);

                // Assert
                Assert.NotNull(results);
                Assert.Equal(1, results.Count);
                Assert.Equal(memberUpload.Id, results[0].Id);
            }
        }
Exemplo n.º 23
0
        public DataTable GetWeekCollectionSummary()
        {
            DataTable dtWeekSummary = new DataTable();
            string    SiteCode      = CommonDataAccess.GetSettingValue("TICKET_LOCATION_CODE");
            string    EnterpriseURL = GetEnterpriseURL();
            int       NoOfRecords   = int.Parse(ConfigManager.Read("NoOfRecords"));
            Proxy     WebProxy      = new Proxy(SiteCode);

            try
            {
                dtWeekSummary = WebProxy.GetWeeklyCollectionDetails(SiteCode, 0, NoOfRecords);

                foreach (DataRow dr in dtWeekSummary.Rows)
                {
                    dr["StartDate"] += " - " + dr["EndDate"].ToString();
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                dtWeekSummary = new DataTable();
            }
            return(dtWeekSummary);
        }
Exemplo n.º 24
0
 public static int CreateId(string type)
 {
     return(CommonDataAccess.CreateId(type));
 }
        public async Task FetchnvoicedMemberUploadsAsync_WithSpecifiedAuthority_OOnlyReturnsInvoicedMemberUploadsForTheSpecifiedAuthority()
        {
            using (DatabaseWrapper wrapper = new DatabaseWrapper())
            {
                // Arrange
                ModelHelper helper = new ModelHelper(wrapper.Model);
                AspNetUser user = helper.GetOrCreateUser("TestUser");

                Weee.Tests.Core.Model.Country country = new Weee.Tests.Core.Model.Country();
                country.Id = new Guid("FA20ED45-5488-491D-A117-DFC09C9C1BA2");
                country.Name = "Test Country";

                CompetentAuthority databaseAuthority1 = new CompetentAuthority();
                databaseAuthority1.Id = new Guid("DDE398F6-809E-416D-B70D-B36606F221FC");
                databaseAuthority1.Name = "Test Authority 1";
                databaseAuthority1.Abbreviation = "T1";
                databaseAuthority1.Country = country;
                databaseAuthority1.Email = "TestEmailAddress";
                wrapper.Model.CompetentAuthorities.Add(databaseAuthority1);

                InvoiceRun invoiceRunForAuthority1 = new InvoiceRun();
                invoiceRunForAuthority1.Id = new Guid("CE7A2617-AE16-403E-A7BF-BF01AD223872");
                invoiceRunForAuthority1.CompetentAuthority = databaseAuthority1;
                invoiceRunForAuthority1.IssuedByUserId = user.Id;
                invoiceRunForAuthority1.IssuedDate = new DateTime(2015, 1, 1);
                wrapper.Model.InvoiceRuns.Add(invoiceRunForAuthority1);

                var scheme = helper.CreateScheme();
                scheme.CompetentAuthorityId = databaseAuthority1.Id;
                var memberUpload = helper.CreateSubmittedMemberUpload(scheme, invoiceRunForAuthority1);

                wrapper.Model.SaveChanges();

                UKCompetentAuthority domainAuthority1 = wrapper.WeeeContext.UKCompetentAuthorities.Find(databaseAuthority1.Id);

                CommonDataAccess dataAccess = new CommonDataAccess(wrapper.WeeeContext);

                // Act
                IReadOnlyList<Domain.Scheme.MemberUpload> results = await dataAccess.FetchInvoicedMemberUploadsAsync(domainAuthority1);

                // Assert
                Assert.NotNull(results);
                Assert.Equal(1, results.Count);
                Assert.Equal(memberUpload.Id, results[0].Id);
            }
        }
Exemplo n.º 26
0
		private void btnTosRun_Click(object sender, EventArgs e)
		{
			var ret = MessageBox.Show(ConfigurationManager.ConnectionStrings["OracleConnection"].ToString(), "确认数据库连接", MessageBoxButtons.YesNo);
			if (ret != System.Windows.Forms.DialogResult.Yes) return;
			try
			{
				CM.TOS.V4.Common.TOSFramework.Start();
				Thread.GetDomain().SetData(".appPath", @"c:\Test");
				Thread.GetDomain().SetData(".appVPath", "/");
				TextWriter tw = new StringWriter();
				string address = "http://www.cmhit.com/";
				HttpWorkerRequest wr = new TestWorkerRequest("login.aspx", null, tw, address);
				HttpContext.Current = new HttpContext(wr);

				// 构造 HTTP 调用上下文对象
				HttpContext ctxt = new HttpContext(wr);


				using (CM.CTOS.Common.Core.TosRuntimeContext context = CM.CTOS.Common.Core.TosSessionRuntime.InitializeRuntime(
					CM.CTOS.Utility.LoginUserInfo.TicketIDInitValue,
					"SQL",
					Guid.NewGuid().ToString(),
					"127.0.0.1"))
				{
					using (CM.CTOS.Common.Data.IPsersistenceToken token = CM.CTOS.Common.Core.TosSessionRuntime.CurrentContext.PreparePersistContext())
					{
						CommonDataAccess cda = new CommonDataAccess();
						var db = cda.db;
						var cmd = db.GetSqlStringCommand(this.txtsql.Text);
						int i = cda.TosExecuteNonQuery(cmd);

						token.EndTransaction();

						MessageBox.Show("OK - 执行成功行数:" + i.ToString());
					}
				}
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
			finally
			{
				CM.TOS.V4.Common.TOSFramework.End();
			}
		}
Exemplo n.º 27
0
        public async Task <IActionResult> GetOrderDetails([FromHeader(Name = "Grid-Authorization-Token")] string token, [FromRoute] int orderID)
        {
            try
            {
                if (string.IsNullOrEmpty(token))
                {
                    return(Ok(new OperationResponse
                    {
                        HasSucceeded = false,
                        IsDomainValidationErrors = true,
                        Message = EnumExtensions.GetDescription(CommonErrors.TokenEmpty)
                    }));
                }
                AdminUsersDataAccess _adminUsersDataAccess = new AdminUsersDataAccess(_iconfiguration);

                DatabaseResponse tokenAuthResponse = await _adminUsersDataAccess.AuthenticateAdminUserToken(token);

                if (tokenAuthResponse.ResponseCode == (int)DbReturnValue.AuthSuccess)
                {
                    if (!((AuthTokenResponse)tokenAuthResponse.Results).IsExpired)
                    {
                        if (!ModelState.IsValid)
                        {
                            return(StatusCode((int)HttpStatusCode.OK,
                                              new OperationResponse
                            {
                                HasSucceeded = false,
                                IsDomainValidationErrors = true,
                                Message = string.Join("; ", ModelState.Values
                                                      .SelectMany(x => x.Errors)
                                                      .Select(x => x.ErrorMessage))
                            }));
                        }

                        CommonDataAccess commonData = new CommonDataAccess(_iconfiguration);

                        var orderList = await commonData.GetOrderDetails(orderID);

                        if (orderList == null || orderList.OrderID == 0)
                        {
                            return(Ok(new ServerResponse
                            {
                                HasSucceeded = false,
                                Message = EnumExtensions.GetDescription(DbReturnValue.NotExists)
                            }));
                        }
                        else
                        {
                            // DownloadFile


                            DatabaseResponse awsConfigResponse = await commonData.GetConfiguration(ConfiType.AWS.ToString());

                            if (awsConfigResponse != null && awsConfigResponse.ResponseCode == (int)DbReturnValue.RecordExists)
                            {
                                MiscHelper configHelper = new MiscHelper();

                                GridAWSS3Config awsConfig = configHelper.GetGridAwsConfig((List <Dictionary <string, string> >)awsConfigResponse.Results);

                                AmazonS3 s3Helper = new AmazonS3(awsConfig);


                                DownloadResponse FrontImageDownloadResponse = new DownloadResponse();

                                DownloadResponse BackImageDownloadResponse = new DownloadResponse();

                                if (!string.IsNullOrEmpty(orderList.DocumentURL))
                                {
                                    FrontImageDownloadResponse = await s3Helper.DownloadFile(orderList.DocumentURL.Remove(0, awsConfig.AWSEndPoint.Length));

                                    if (FrontImageDownloadResponse.HasSucceed)
                                    {
                                        orderList.FrontImage = FrontImageDownloadResponse.FileObject != null?configHelper.GetBase64StringFromByteArray(FrontImageDownloadResponse.FileObject, orderList.DocumentURL.Remove(0, awsConfig.AWSEndPoint.Length)) : null;

                                        orderList.DocumentURL = "";
                                    }
                                    else
                                    {
                                        orderList.DocumentURL = "";
                                        orderList.FrontImage  = "";
                                    }
                                }

                                if (!string.IsNullOrEmpty(orderList.DocumentBackURL))
                                {
                                    BackImageDownloadResponse = await s3Helper.DownloadFile(orderList.DocumentBackURL.Remove(0, awsConfig.AWSEndPoint.Length));

                                    if (BackImageDownloadResponse.HasSucceed)
                                    {
                                        orderList.BackImage = BackImageDownloadResponse.FileObject != null?configHelper.GetBase64StringFromByteArray(BackImageDownloadResponse.FileObject, orderList.DocumentBackURL.Remove(0, awsConfig.AWSEndPoint.Length)) : null;

                                        orderList.DocumentBackURL = "";
                                    }
                                    else
                                    {
                                        orderList.DocumentBackURL = "";
                                        orderList.BackImage       = "";
                                    }
                                }
                                return(Ok(new ServerResponse
                                {
                                    HasSucceeded = true,
                                    Message = StatusMessages.SuccessMessage,
                                    Result = orderList
                                }));
                            }
                            else
                            {
                                // unable to get aws config
                                LogInfo.Warning(EnumExtensions.GetDescription(CommonErrors.FailedToGetConfiguration));

                                return(Ok(new OperationResponse
                                {
                                    HasSucceeded = false,
                                    Message = EnumExtensions.GetDescription(CommonErrors.FailedToGetConfiguration)
                                }));
                            }
                        }
                    }
                    else
                    {
                        //Token expired

                        LogInfo.Warning(EnumExtensions.GetDescription(CommonErrors.ExpiredToken));

                        return(Ok(new OperationResponse
                        {
                            HasSucceeded = false,
                            Message = EnumExtensions.GetDescription(DbReturnValue.TokenExpired),
                            IsDomainValidationErrors = true
                        }));
                    }
                }

                else
                {
                    // token auth failure
                    LogInfo.Warning(EnumExtensions.GetDescription(DbReturnValue.TokenAuthFailed));

                    return(Ok(new OperationResponse
                    {
                        HasSucceeded = false,
                        Message = EnumExtensions.GetDescription(DbReturnValue.TokenAuthFailed),
                        IsDomainValidationErrors = false
                    }));
                }
            }
            catch (Exception ex)
            {
                LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical));

                return(Ok(new OperationResponse
                {
                    HasSucceeded = false,
                    Message = StatusMessages.ServerError,
                    IsDomainValidationErrors = false
                }));
            }
        }
Exemplo n.º 28
0
            public string GetSettingValue(string settingname)
            {
                string servicelist = (CommonDataAccess.GetSettingValue(settingname)) != null?CommonDataAccess.GetSettingValue("ServiceNames") : string.Empty;

                return(servicelist);
            }
Exemplo n.º 29
0
        public void PrintSlip(DataRow drFillDetails, string strFillType)
        {
            ValuetoWords objWords = new ValuetoWords();
            VaultSlipXml xml      = null;

            try
            {
                filename = "Print.txt";
                filepath = System.Windows.Forms.Application.StartupPath + "\\" + filename;
                if (File.Exists(filepath))
                {
                    File.Delete(filepath);
                }
                outputfile = new FileStream(filepath, FileMode.OpenOrCreate, FileAccess.Write);
                writer     = new StreamWriter(outputfile);
                writer.BaseStream.Seek(0, SeekOrigin.End);

                xml = new VaultSlipXml(writer);
                xml.ParseXmlFile();

                ModuleName module = ModuleName.AttendantPay;
                string     Type   = string.Empty;



                //         Header=0,
                //PrintedDate,
                //SiteName,

                //Vault_Name,
                //SerialNo,
                //Manufacturer,
                //Type,
                //Fill_User,
                //FillDate,
                //Initial_Balance,
                //Fill_Amount,
                //CurrentBalance,
                //Signature



                // required values for xml
                string sVersion = CommonDataAccess.GetVersion();
                Double dAmount  = Double.Parse(drFillDetails["FillAmount"].ToString());
                if (dAmount < 0)
                {
                    dAmount = dAmount * -1;
                }
                string AmtInWords = objWords.ConvertValueToWords(dAmount,
                                                                 CommonDataAccess.GetSettingValue("Region") == "US" ? "en-US" :
                                                                 CommonDataAccess.GetSettingValue("Region") == "UK" ? "en-GB" :
                                                                 CommonDataAccess.GetSettingValue("Region") == "IT" ? "it-IT" : "en-US");

                // fill the values
                //xml[VaultSlipXmlFields.Header].Value = "Fill slip";
                xml[VaultSlipXmlFields.PrintedDate].Value = DateTime.Now.ToString("dd-MMM-yyyy HH:mm:ss");
                xml[VaultSlipXmlFields.SiteName].Value    = Settings.SiteName;

                xml[VaultSlipXmlFields.Vault_Name].Value   = drFillDetails["Name"].ToString();
                xml[VaultSlipXmlFields.SerialNo].Value     = drFillDetails["Serial_NO"].ToString();
                xml[VaultSlipXmlFields.Manufacturer].Value = drFillDetails["Manufacturer_Name"].ToString();
                xml[VaultSlipXmlFields.Type].Value         = drFillDetails["Type_Prefix"].ToString();

                xml[VaultSlipXmlFields.Fill_User].Value   = SecurityHelper.CurrentUser.DisplayName;
                xml[VaultSlipXmlFields.FillDate].Value    = DateTime.Parse(drFillDetails["CreatedDate"].ToString()).ToString("dd-MMM-yyyy HH:mm:ss");
                xml[VaultSlipXmlFields.Fill_Amount].Value = CommonUtilities.GetCurrency(double.Parse(drFillDetails["FillAmount"].ToString()));

                if (strFillType != string.Empty)
                {
                    xml[VaultSlipXmlFields.Fill_Type].Value = strFillType;
                }

                xml[VaultSlipXmlFields.Initial_Balance].Value = CommonUtilities.GetCurrency(double.Parse(drFillDetails["TotalAmountOnFill"].ToString()));
                xml[VaultSlipXmlFields.CurrentBalance].Value  = CommonUtilities.GetCurrency(double.Parse(drFillDetails["CurrentBalance"].ToString()));
                xml[VaultSlipXmlFields.Signature].Value       = string.Empty;


                xml.Write();
                writer.Close();
                _textSettings = xml.TextSettings;
                PrintSlippage(xml.TextSettings);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            finally
            {
                if (xml != null)
                {
                    xml.Dispose();
                    xml = null;
                }
            }
        }
Exemplo n.º 30
0
 public CommonRepository()
 {
     this.instance = new CommonDataAccess();
 }
Exemplo n.º 31
0
        public DataTable GetWeekCollectionDetails(int WeekID)
        {
            DataTable dtWeeklyInvoice = new DataTable();
            string    SiteCode        = CommonDataAccess.GetSettingValue("TICKET_LOCATION_CODE");
            string    EnterpriseURL   = GetEnterpriseURL();
            string    TotalPowerCollectionDuration;

            try
            {
                Proxy WebProxy = new Proxy(SiteCode);
                dtWeeklyInvoice = WebProxy.GetWeeklyCollectionDetails(SiteCode, WeekID, 0);

                dtWeeklyInvoice.Columns.Add("Payout", System.Type.GetType("System.Decimal"));
                dtWeeklyInvoice.Columns.Add("Hold", System.Type.GetType("System.Decimal"));
                dtWeeklyInvoice.Columns.Add("Duration");

                foreach (DataRow dr in dtWeeklyInvoice.Rows)
                {
                    double DecWinOrLoss;
                    double MeterWinOrLoss;
                    TotalPowerCollectionDuration = "0";
                    DecWinOrLoss = Convert.ToDouble(dr["Declared_Notes"]) + Convert.ToDouble(dr["DecTicketBalance"]) -
                                   Convert.ToDouble(dr["DecHandpay"]) + Convert.ToDouble(dr["Net_Coin"]);
                    MeterWinOrLoss = Convert.ToDouble(dr["RDC_Notes"]) + (Convert.ToDouble(dr["DecTicketBalance"]) - Convert.ToDouble(dr["Ticket_Var"])) -
                                     Convert.ToDouble(dr["RDCHandpay"]) + Convert.ToDouble(dr["RDC_Coins"]);
                    dr["Cash_Take"]          = DecWinOrLoss;
                    dr["RDC_Take"]           = MeterWinOrLoss;
                    dr["Take_Var"]           = DecWinOrLoss - MeterWinOrLoss;
                    dr["Ticket_Balance"]     = Convert.ToDouble(dr["DecTicketBalance"]);
                    dr["RDC_Ticket_Balance"] = Convert.ToDouble(dr["DecTicketBalance"]) - Convert.ToDouble(dr["Ticket_Var"]);;
                    if (WeekID != 0)
                    {
                        if (Convert.ToDouble(dr["Handle"]) > 0)
                        {
                            dr["Payout"] = ((Convert.ToDouble(dr["Handle"]) - MeterWinOrLoss) / Convert.ToDouble(dr["Handle"])) * 100;
                            dr["Hold"]   = 100 - (((Convert.ToDouble(dr["Handle"]) - MeterWinOrLoss) / Convert.ToDouble(dr["Handle"])) * 100);
                        }
                        else
                        {
                            dr["Payout"] = "0";
                            dr["Hold"]   = "100";
                        }
                    }
                    else
                    {
                        dr["Payout"] = "0";
                        dr["Hold"]   = "100";
                    }

                    if (Convert.ToInt64(dr["Collection_Total_Power_Duration"]) / 3600 > 0)
                    {
                        TotalPowerCollectionDuration = (Convert.ToInt64(dr["Collection_Total_Power_Duration"]) / 3600).ToString();
                    }

                    if ((Convert.ToInt64(dr["Collection_Total_Power_Duration"]) % 3600) / 60 > 0)
                    {
                        TotalPowerCollectionDuration = TotalPowerCollectionDuration + "." + ((Convert.ToInt64(dr["Collection_Total_Power_Duration"]) % 3600) / 60).ToString();
                    }

                    dr["Duration"] = TotalPowerCollectionDuration;
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            return(dtWeeklyInvoice);
        }
Exemplo n.º 32
0
 public static DataTable GetColumns(string tableName)
 {
     return(CommonDataAccess.GetColumns(tableName));
 }
Exemplo n.º 33
0
 public static string CreateFormId()
 {
     return(CommonDataAccess.CreateFormId());
 }
Exemplo n.º 34
0
        public async Task <IActionResult> UpdateNRICDetails([FromHeader(Name = "Grid-Authorization-Token")] string token, [FromForm] NRICDetails request)
        {
            try
            {
                if (string.IsNullOrEmpty(token))
                {
                    return(Ok(new OperationResponse
                    {
                        HasSucceeded = false,
                        IsDomainValidationErrors = true,
                        Message = EnumExtensions.GetDescription(CommonErrors.TokenEmpty)
                    }));
                }
                AdminUsersDataAccess _adminUsersDataAccess = new AdminUsersDataAccess(_iconfiguration);

                DatabaseResponse tokenAuthResponse = await _adminUsersDataAccess.AuthenticateAdminUserToken(token);

                if (tokenAuthResponse.ResponseCode == (int)DbReturnValue.AuthSuccess)
                {
                    if (!((AuthTokenResponse)tokenAuthResponse.Results).IsExpired)
                    {
                        if (!ModelState.IsValid)
                        {
                            return(StatusCode((int)HttpStatusCode.OK,
                                              new OperationResponse
                            {
                                HasSucceeded = false,
                                IsDomainValidationErrors = true,
                                Message = string.Join("; ", ModelState.Values
                                                      .SelectMany(x => x.Errors)
                                                      .Select(x => x.ErrorMessage))
                            }));
                        }

                        if (!string.IsNullOrEmpty(request.IdentityCardNumber))
                        {
                            EmailValidationHelper _helper = new EmailValidationHelper();
                            if (!_helper.NRICValidation(null, request.IdentityCardNumber, out string _warningmsg))
                            {
                                LogInfo.Warning("NRIC Validation with type: " + _warningmsg);
                                return(Ok(new OperationResponse
                                {
                                    HasSucceeded = false,
                                    Message = "Document details are invalid",
                                    IsDomainValidationErrors = false
                                }));
                            }
                        }

                        int deliveryStatusNumber = request.IDVerificationStatus;

                        var              authToken         = (AuthTokenResponse)tokenAuthResponse.Results;
                        MiscHelper       configHelper      = new MiscHelper();
                        CommonDataAccess _commonDataAccess = new CommonDataAccess(_iconfiguration);

                        NRICDetailsRequest personalDetails = new NRICDetailsRequest
                        {
                            OrderID            = request.OrderID,
                            IdentityCardNumber = request.IdentityCardNumber,
                            IdentityCardType   = request.IdentityCardType,
                            Nationality        = request.Nationality,
                            NameInNRIC         = request.NameInNRIC,
                            DOB     = request.DOB,
                            Expiry  = request.Expiry,
                            Remarks = request.Remarks,
                            IDVerificationStatus = request.IDVerificationStatus,
                        };

                        if (request.FrontImage != null || request.BackImage != null)
                        {
                            string IDCardNumberForImage = string.Empty;

                            DatabaseResponse awsConfigResponse = await _commonDataAccess.GetConfiguration(ConfiType.AWS.ToString());

                            if (awsConfigResponse != null && awsConfigResponse.ResponseCode == (int)DbReturnValue.RecordExists)
                            {
                                GridAWSS3Config awsConfig = configHelper.GetGridAwsConfig((List <Dictionary <string, string> >)awsConfigResponse.Results);
                                // Check for IdentityCardNumber
                                //Start
                                if (string.IsNullOrEmpty(request.IdentityCardNumber))
                                {
                                    var orderDetailsForIDCard = await _commonDataAccess.GetOrderDetails(request.OrderID);

                                    IDCardNumberForImage = orderDetailsForIDCard.IdentityCardNumber;
                                }
                                else
                                {
                                    IDCardNumberForImage = request.IdentityCardNumber;
                                }
                                //End
                                AmazonS3 s3Helper = new AmazonS3(awsConfig);
                                if (request.FrontImage != null)
                                {
                                    string fileNameFront = IDCardNumberForImage.Substring(1, IDCardNumberForImage.Length - 2) +
                                                           "_Front_" + DateTime.Now.ToString("yyMMddhhmmss") + Path.GetExtension(request.FrontImage.FileName); //Grid_IDNUMBER_yyyymmddhhmmss.extension

                                    UploadResponse s3UploadResponse = await s3Helper.UploadFile(request.FrontImage, fileNameFront);

                                    if (s3UploadResponse.HasSucceed)
                                    {
                                        personalDetails.FrontImage = awsConfig.AWSEndPoint + s3UploadResponse.FileName;
                                    }
                                    else
                                    {
                                        LogInfo.Warning(EnumExtensions.GetDescription(CommonErrors.S3UploadFailed));
                                    }
                                }
                                if (request.BackImage != null)
                                {
                                    string fileNameBack = IDCardNumberForImage.Substring(1, IDCardNumberForImage.Length - 2) + "_Back_" + DateTime.Now.ToString("yyMMddhhmmss")
                                                          + Path.GetExtension(request.BackImage.FileName); //Grid_IDNUMBER_yyyymmddhhmmss.extension

                                    UploadResponse s3UploadResponse = await s3Helper.UploadFile(request.BackImage, fileNameBack);

                                    if (s3UploadResponse.HasSucceed)
                                    {
                                        personalDetails.BackImage = awsConfig.AWSEndPoint + s3UploadResponse.FileName;
                                    }
                                    else
                                    {
                                        LogInfo.Warning(EnumExtensions.GetDescription(CommonErrors.S3UploadFailed));
                                    }
                                }
                            }
                            else
                            {
                                // unable to get aws config
                                LogInfo.Warning(EnumExtensions.GetDescription(CommonErrors.FailedToGetConfiguration));
                            }
                        }

                        var returnResponse = await _commonDataAccess.UpdateNRICDetails(authToken.CustomerID, deliveryStatusNumber, personalDetails);

                        if (returnResponse.ResponseCode == (int)DbReturnValue.UpdateSuccessSendEmail)
                        {
                            var emailDetails = (EmailResponse)returnResponse.Results;
                            DatabaseResponse configResponse        = new DatabaseResponse();
                            DatabaseResponse tokenCreationResponse = new DatabaseResponse();

                            string finalURL = string.Empty;
                            // Fetch the URL
                            if (emailDetails.VerificationStatus == 2) // Rejected then token
                            {
                                configResponse        = ConfigHelper.GetValueByKey(ConfigKeys.NRICReUploadLink.GetDescription(), _iconfiguration);
                                tokenCreationResponse = await _adminOrderDataAccess.CreateTokenForVerificationRequests(request.OrderID);

                                var tokenCreation = (VerificationRequestResponse)tokenCreationResponse.Results;
                                finalURL = configResponse.Results.ToString() + tokenCreation.RequestToken;
                            }
                            else
                            {
                                var result = await _commonDataAccess.UpdateTokenForVerificationRequests(request.OrderID);
                            }

                            //Sending message start
                            // Send email to customer email                            ConfigDataAccess _configAccess = new ConfigDataAccess(_iconfiguration);
                            DatabaseResponse registrationResponse = await _adminOrderDataAccess.GetEmailNotificationTemplate(emailDetails.VerificationStatus == 2?NotificationEvent.ICValidationReject.GetDescription() : NotificationEvent.ICValidationChange.GetDescription());

                            string[] changelog = emailDetails.ChangeLog.Split(";");
                            string   finallog  = "";
                            foreach (string log in changelog)
                            {
                                if (!string.IsNullOrWhiteSpace(log))
                                {
                                    finallog = finallog + "&bull; " + log.Trim() + "<br/>";
                                }
                            }
                            var notificationMessage = MessageHelper.GetMessage(emailDetails.Email, emailDetails.Name, emailDetails.VerificationStatus == 2 ? NotificationEvent.ICValidationReject.GetDescription() : NotificationEvent.ICValidationChange.GetDescription(),
                                                                               ((EmailTemplate)registrationResponse.Results).TemplateName,
                                                                               _iconfiguration, string.IsNullOrWhiteSpace(finalURL) ? "-" : finalURL, string.IsNullOrWhiteSpace(emailDetails.Remark) ? "-" : emailDetails.Remark.Replace(";", "<br />"), string.IsNullOrWhiteSpace(emailDetails.ChangeLog) ? "-" : finallog);
                            var notificationResponse = await _adminOrderDataAccess.GetConfiguration(ConfiType.Notification.ToString());


                            MiscHelper parser             = new MiscHelper();
                            var        notificationConfig = parser.GetNotificationConfig((List <Dictionary <string, string> >)notificationResponse.Results);

                            Publisher customerNotificationPublisher = new Publisher(_iconfiguration, notificationConfig.SNSTopic);
                            await customerNotificationPublisher.PublishAsync(notificationMessage);

                            try
                            {
                                DatabaseResponse notificationLogResponse = await _adminOrderDataAccess.CreateEMailNotificationLogForDevPurpose(
                                    new NotificationLogForDevPurpose
                                {
                                    EventType = NotificationEvent.OrderSuccess.ToString(),
                                    Message   = JsonConvert.SerializeObject(notificationMessage)
                                });
                            }
                            catch (Exception ex)
                            {
                                LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical));
                            }
                            //Sending message Stop
                            return(Ok(new ServerResponse
                            {
                                HasSucceeded = true,
                                Message = StatusMessages.SuccessMessage,
                                Result = null
                            }));
                        }
                        else if (returnResponse.ResponseCode == (int)DbReturnValue.UpdateSuccess)
                        {
                            var emailDetails = (EmailResponse)returnResponse.Results;
                            DatabaseResponse configResponse        = new DatabaseResponse();
                            DatabaseResponse tokenCreationResponse = new DatabaseResponse();
                            string           finalURL = string.Empty;
                            if (emailDetails.VerificationStatus == 2) // Rejected then token
                            {
                                configResponse        = ConfigHelper.GetValueByKey(ConfigKeys.NRICReUploadLink.GetDescription(), _iconfiguration);
                                tokenCreationResponse = await _adminOrderDataAccess.CreateTokenForVerificationRequests(request.OrderID);

                                var tokenCreation = (VerificationRequestResponse)tokenCreationResponse.Results;
                                finalURL = configResponse.Results.ToString() + tokenCreation.RequestToken;

                                DatabaseResponse registrationResponse = await _adminOrderDataAccess.GetEmailNotificationTemplate(NotificationEvent.ICValidationReject.GetDescription());

                                var notificationMessage = MessageHelper.GetMessage(emailDetails.Email, emailDetails.Name, NotificationEvent.ICValidationReject.GetDescription(),
                                                                                   ((EmailTemplate)registrationResponse.Results).TemplateName,
                                                                                   _iconfiguration, string.IsNullOrWhiteSpace(finalURL) ? "-" : finalURL, string.IsNullOrWhiteSpace(emailDetails.Remark) ? "-" : emailDetails.Remark.Replace(";", "<br />"), string.IsNullOrWhiteSpace(emailDetails.ChangeLog) ? "-" : emailDetails.ChangeLog);
                                var notificationResponse = await _adminOrderDataAccess.GetConfiguration(ConfiType.Notification.ToString());


                                MiscHelper parser             = new MiscHelper();
                                var        notificationConfig = parser.GetNotificationConfig((List <Dictionary <string, string> >)notificationResponse.Results);

                                Publisher customerNotificationPublisher = new Publisher(_iconfiguration, notificationConfig.SNSTopic);
                                await customerNotificationPublisher.PublishAsync(notificationMessage);

                                try
                                {
                                    DatabaseResponse notificationLogResponse = await _adminOrderDataAccess.CreateEMailNotificationLogForDevPurpose(
                                        new NotificationLogForDevPurpose
                                    {
                                        EventType = NotificationEvent.OrderSuccess.ToString(),
                                        Message   = JsonConvert.SerializeObject(notificationMessage)
                                    });
                                }
                                catch (Exception ex)
                                {
                                    LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical));
                                }
                            }
                            else
                            {
                                var result = await _commonDataAccess.UpdateTokenForVerificationRequests(request.OrderID);
                            }

                            //Sending message start
                            // Send email to customer email                            ConfigDataAccess _configAccess = new ConfigDataAccess(_iconfiguration);


                            return(Ok(new ServerResponse
                            {
                                HasSucceeded = true,
                                Message = StatusMessages.SuccessMessage,
                                Result = null
                            }));
                        }
                        else
                        {
                            LogInfo.Error("UpdateNRICDetails failed for " + request.OrderID + " Order Id " + DbReturnValue.UpdationFailed);
                            return(Ok(new OperationResponse
                            {
                                HasSucceeded = false,
                                Message = EnumExtensions.GetDescription(DbReturnValue.UpdationFailed),
                                IsDomainValidationErrors = false
                            }));
                        }
                    }
                    else
                    {
                        //Token expired

                        LogInfo.Warning(EnumExtensions.GetDescription(CommonErrors.ExpiredToken));

                        return(Ok(new OperationResponse
                        {
                            HasSucceeded = false,
                            Message = EnumExtensions.GetDescription(DbReturnValue.TokenExpired),
                            IsDomainValidationErrors = true
                        }));
                    }
                }

                else
                {
                    // token auth failure
                    LogInfo.Warning(EnumExtensions.GetDescription(DbReturnValue.TokenAuthFailed));

                    return(Ok(new OperationResponse
                    {
                        HasSucceeded = false,
                        Message = EnumExtensions.GetDescription(DbReturnValue.TokenAuthFailed),
                        IsDomainValidationErrors = false
                    }));
                }
            }
            catch (Exception ex)
            {
                LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical));

                return(Ok(new OperationResponse
                {
                    HasSucceeded = false,
                    Message = StatusMessages.ServerError,
                    IsDomainValidationErrors = false
                }));
            }
        }