示例#1
0
        public PkoBpCreditClearedParser(
            ParseHelper parseHelper,
            IRepositoryHelper repositoryHelper,
            PdfReader pdfReader,
            CreditCardPagesExtractor pagesExtractor,
            CreditCardTextParsing ccTextParsing,
            CreditCardClearedTextParsing clearedTextParsing)
        {
            if (parseHelper == null)
                throw new ArgumentNullException("parseHelper");
            if (repositoryHelper == null)
                throw new ArgumentNullException("repositoryHelper");
            if (pdfReader == null)
                throw new ArgumentNullException("pdfReader");
            if (pagesExtractor == null)
                throw new ArgumentNullException("pagesExtractor");
            if (ccTextParsing == null)
                throw new ArgumentNullException("ccTextParsing");
            if (clearedTextParsing == null)
                throw new ArgumentNullException("clearedTextParsing");

            _parseHelper = parseHelper;
            _repositoryHelper = repositoryHelper;
            _pdfReader = pdfReader;
            _pagesExtractor = pagesExtractor;
            _ccTextParsing = ccTextParsing;
            _clearedTextParsing = clearedTextParsing;
        }
        private static void AddDbParameter(IRepositoryHelper repositoryHelper, List <DbParameter> dbParameters, string paramName, object value)
        {
            var dbParameter = repositoryHelper.CreateDbParmeter(paramName, value); //dbCommand.CreateParameter();

            //dbParameter.ParameterName = paramName;
            //dbParameter.Value = value;
            dbParameters.Add(dbParameter);
        }
示例#3
0
 public PkoBpParser(ParseHelper parseHelper, IRepositoryHelper repositoryHelper)
 {
     if (parseHelper == null)
         throw new ArgumentNullException("parseHelper");
     _parseHelper = parseHelper;
     if (repositoryHelper == null)
         throw new ArgumentNullException("repositoryHelper");
     _repositoryHelper = repositoryHelper;
 }
        public static string ConverNameToDb(this IRepository repository, string name)
        {
            IRepositoryHelper helper = repository.RepositoryContext as IRepositoryHelper;

            if (helper != null)
            {
                return(RDFacadeExtensions.ConvertName(helper.ProviderName, name));
            }
            return(name);
        }
示例#5
0
 public Przelew(
     IRepositoryHelper repositoryHelper,
     IFillOperationFromDescriptionChain next)
 {
     if (next == null)
         throw new ArgumentNullException("next");
     if (repositoryHelper == null)
         throw new ArgumentNullException("repositoryHelper");
     _next = next;
     _repositoryHelper = repositoryHelper;
 }
        private static void AddDbParameter(IRepositoryHelper repositoryHelper, List <DbParameter> dbParameters, SqlWithParameters sqlParameter)
        {
            if (sqlParameter.Parameters != null && sqlParameter.Parameters.Count() > 0)
            {
                foreach (var kvParamter in sqlParameter.Parameters)
                {
                    var dbParameter = repositoryHelper.CreateDbParmeter(kvParamter.Key, kvParamter.Value);

                    dbParameters.Add(dbParameter);
                }
            }
        }
示例#7
0
 public BgzBnpParibasParser(ParseHelper parseHelper, IRepositoryHelper repositoryHelper, IFillOperationFromDescriptionChain fillDescription)
 {
     if (parseHelper == null)
         throw new ArgumentNullException("parseHelper");
     if (repositoryHelper == null)
         throw new ArgumentNullException("repositoryHelper");
     if (fillDescription == null)
         throw new ArgumentNullException("fillDescription");
     _parseHelper = parseHelper;
     _repositoryHelper = repositoryHelper;
     _fillDescription = fillDescription;
 }
示例#8
0
        public InstanceManager(WorkflowInstance instance, Workflow workflow, StateMachine <State, string> stateMachine, InstanceStatePersistence statePersistance, IRepositoryHelper repositoryHelper)
        {
            Enforce.ArgumentNotNull(instance, "instance");
            Enforce.ArgumentNotNull(workflow, "workflow");
            Enforce.ArgumentNotNull(stateMachine, "stateMachine");
            Enforce.ArgumentNotNull(statePersistance, "statePersistance");
            Enforce.ArgumentNotNull(repositoryHelper, "repositoryHelper");

            InstanceId       = instance.Id;
            StatePersistance = statePersistance;
            Workflow         = workflow;
            RepositoryHelper = repositoryHelper;
            StateMachine     = stateMachine;
        }
示例#9
0
 public UnitOfWork(ICustomerRepository CustomerRepository, IManagerRepository ManagerRepository,
                   IMapper Mapper, IMailService MailService, IRepositoryHelper RepositoryHelper,
                   IServiceRepository ServiceRepository, IEmployeeRepository EmployeeRepository,
                   ILaundryRepository LaundryRepository, IInvoiceRepository InvoiceRepository,
                   IJwtAuthenticationManager JwtAuthenticationManager,
                   IDashboardRepo DashboardRepo)
 {
     this.CustomerRepository       = CustomerRepository;
     this.EmployeeRepository       = EmployeeRepository;
     this.ManagerRepository        = ManagerRepository;
     this.MailService              = MailService;
     this.Mapper                   = Mapper;
     this.InvoiceRepository        = InvoiceRepository;
     this.ServiceRepository        = ServiceRepository;
     this.InvoiceRepository        = InvoiceRepository;
     this.JwtAuthenticationManager = JwtAuthenticationManager;
     this.LaundryRepository        = LaundryRepository;
     this.DashboardRepo            = DashboardRepo;
 }
示例#10
0
        public static InstanceManager CreateWorkflowManager(Workflow workflow, IRepositoryHelper repoHelper)
        {
            Enforce.ArgumentNotNull(workflow, nameof(workflow));
            Enforce.ArgumentNotNull(repoHelper, nameof(repoHelper));

            var instance = new WorkflowInstance {
                WorkflowId = workflow.Id, CurrentStateId = workflow.StartState
            };
            var repo = repoHelper.GetWorkflowInstanceRepository(repoHelper.GetUnitOfWork());
            var id   = repo.Insert(instance);

            if (!string.IsNullOrWhiteSpace(id))
            {
                repoHelper.GetUnitOfWork().SaveChanges();
                var statePersistance = new InstanceStatePersistence(instance.Id, repoHelper);
                var stateMachine     = ConfigureStateMachine(workflow, statePersistance, repoHelper);
                return(new InstanceManager(instance, workflow, stateMachine, statePersistance, repoHelper));
            }
            return(null);
        }
示例#11
0
        public PkoBpCreditCardUnclearedParser(
            ParseHelper parseHelper,
            IRepositoryHelper repositoryHelper,
            CreditCardTextParsing ccTextParsing,
            CreditCardUnclearedTextParsing unclearedParsing)
        {
            if (parseHelper == null)
                throw new ArgumentNullException("parseHelper");
            if (repositoryHelper == null)
                throw new ArgumentNullException("repositoryHelper");
            if (ccTextParsing == null)
                throw new ArgumentNullException("ccTextParsing");
            if (unclearedParsing == null)
                throw new ArgumentNullException("unclearedParsing");

            _parseHelper = parseHelper;
            _repositoryHelper = repositoryHelper;
            _ccTextParsing = ccTextParsing;
            _unclearedParsing = unclearedParsing;
        }
示例#12
0
 public CustomerService(IRepositoryHelper repositoryHelper, IMapper mapper)
 {
     this._mapper           = mapper;
     this._repositoryHelper = repositoryHelper;
 }
 public TherapistService(IRepositoryHelper repositoryHelper, IMapper mapper)
 {
     this._mapper           = mapper;
     this._repositoryHelper = repositoryHelper;
 }
示例#14
0
 public ClientRepository(IRepositoryHelper helper)
 {
     _helper = helper;
 }
        public static IQueryable <TResult> TreeQuery <TEntity, TKey, TResult>(IRepositoryHelper repositoryHelper, IQueryable <TEntity> query, IEntityType entityType, Expression <Func <TEntity, bool> > startQuery, Expression <Func <TEntity, TResult> > selector, Expression <Func <TEntity, bool> > whereQuery = null, bool upSearch = false, string orderByProperty = null, int level = 0, bool distinct = false)
            where TEntity : class, IEntity <TKey> //ITreeEntity<TKey>
            where TResult : class
        //where TKey : struct, IEquatable<TKey>
        {
            var    tableAnnn       = entityType.FindAnnotation("Relational:TableName");
            string tableName       = tableAnnn?.Value.ToString();
            var    anno            = entityType.FindProperty(nameof(ITreeEntity.Pid)).FindAnnotation("Relational:ColumnName");
            string parentFieldName = anno != null?anno.Value.ToString() : nameof(ITreeEntity <int> .Pid);

            var    idAnno    = entityType.FindProperty(nameof(ITreeEntity.Id)).FindAnnotation("Relational:ColumnName");
            string fieldName = idAnno != null?idAnno.Value.ToString() : nameof(ITreeEntity <int> .Id);

            List <DbParameter> dbParameters = new List <DbParameter>();
            SqlWithParameters  firstSqls    = query.Where(startQuery).Select(selector).GetSqlTextWithParement();;

            AddDbParameter(repositoryHelper, dbParameters, firstSqls);


            string firstQuery         = firstSqls.Sql.Replace(Environment.NewLine, " ");
            string startQueryParament = startQuery.Parameters[0].Name;

            bool   forNpgsql        = IsNpgSql(repositoryHelper?.ProviderName);
            string orderByFieldName = null;

            if (!string.IsNullOrEmpty(orderByProperty))
            {
                var orderByAnno = entityType.FindProperty(orderByProperty).FindAnnotation("Relational:ColumnName");
                orderByFieldName = orderByAnno != null?orderByAnno.Value.ToString() : string.Format("\"{0}\"", orderByProperty);

                //forNpgsql = repositoryHelper.ProviderName == "Npgsql.EntityFrameworkCore.PostgreSQL";
            }

            if (forNpgsql && !string.IsNullOrEmpty(orderByFieldName))
            {
                firstQuery = firstQuery.Insert(firstQuery.IndexOf(" FROM", StringComparison.CurrentCultureIgnoreCase), string.Format(", 0 As level, array[\"{0}\".\"{1}\"] as sorder", startQueryParament, orderByFieldName));
            }
            else
            {
                firstQuery = firstQuery.Insert(firstQuery.IndexOf(" FROM", StringComparison.CurrentCultureIgnoreCase), ", 0 As level");
            }

            //with recursive mytree as (
            //select "t"."id", "t"."createtime", "t"."creator", "t"."customdata", "t"."displayname", "t"."group", "t"."icon", "t"."isenabled", "t"."isvisible", "t"."lastmodifytime", "t"."modifier", "t"."name", "t"."pid", "t"."platsupport", "t"."requiredpermissionname", "t"."requiresauthentication", "t"."sindex", "t"."target", "t"."url", 0 as level, ARRAY[t.sindex] as sorder from "menus" as "t" where "t"."pid" is null
            //union all
            //select "tt"."id", "tt"."createtime", "tt"."creator", "tt"."customdata", "tt"."displayname", "tt"."group", "tt"."icon", "tt"."isenabled", "tt"."isvisible", "tt"."lastmodifytime", "tt"."modifier", "tt"."name", "tt"."pid", "tt"."platsupport", "tt"."requiredpermissionname", "tt"."requiresauthentication", "tt"."sindex", "tt"."target", "tt"."url", mytree.level + 1, sorder || tt.sindex as sorder from "menus" as "tt" join mytree on "tt"."pid" = "mytree"."id"  where "tt"."group" = 0
            //)
            //select * from "mytree" as "t" where "t"."group" = 0 ORDER BY SORDER

            string secondQuery        = null;
            string thirdQuery         = null;
            string whereQueryParament = tableName.Substring(0, 1).ToLower();

            if (whereQuery == null)
            {
                secondQuery        = query.Select(selector).ToSql().Replace(Environment.NewLine, " ");
                whereQueryParament = selector.Parameters[0].Name;

                thirdQuery = secondQuery;
                if (forNpgsql && !string.IsNullOrEmpty(orderByFieldName))
                {
                    secondQuery = secondQuery.Insert(secondQuery.IndexOf(" FROM", StringComparison.CurrentCultureIgnoreCase), string.Format(", mytree.level + 1, sorder || \"{0}\".\"{1}\" as sorder", whereQueryParament, orderByFieldName));
                }
                else
                {
                    secondQuery = secondQuery.Insert(secondQuery.IndexOf(" FROM", StringComparison.CurrentCultureIgnoreCase), ", mytree.level + 1");
                }
                if (upSearch)
                {
                    secondQuery += string.Format(" join mytree on \"{0}\".\"{1}\" = \"mytree\".\"{2}\" ", whereQueryParament, fieldName, parentFieldName);
                }
                else
                {
                    secondQuery += string.Format(" join mytree on \"{0}\".\"{1}\" = \"mytree\".\"{2}\" ", whereQueryParament, parentFieldName, fieldName);
                }
            }
            else
            {
                SqlWithParameters secondSqls = secondSqls = query.Where(whereQuery).Select(selector).GetSqlTextWithParement();
                AddDbParameter(repositoryHelper, dbParameters, secondSqls);

                secondQuery        = secondSqls.Sql.Replace(Environment.NewLine, " ");
                thirdQuery         = secondQuery;
                whereQueryParament = whereQuery.Parameters[0].Name;
                if (whereQueryParament == startQueryParament)
                {
                    if (forNpgsql)
                    {
                        string forReplace = startQueryParament + ".";
                        whereQueryParament += startQueryParament;
                        string toReplace = whereQueryParament + ".";
                        secondQuery = secondQuery.Replace(forReplace, toReplace);
                        secondQuery = secondQuery.Replace("AS " + startQueryParament, "AS " + whereQueryParament);
                    }
                    else
                    {
                        string forReplace = "\"" + startQueryParament + "\"";
                        whereQueryParament += startQueryParament;
                        string toReplace = "\"" + whereQueryParament + "\"";
                        secondQuery = secondQuery.Replace(forReplace, toReplace);
                    }
                }
                if (forNpgsql)
                {
                    secondQuery = secondQuery.Insert(secondQuery.IndexOf(" FROM", StringComparison.CurrentCultureIgnoreCase), string.Format(", mytree.level + 1, sorder || \"{0}\".\"{1}\" as sorder", whereQueryParament, orderByFieldName));
                }
                else
                {
                    secondQuery = secondQuery.Insert(secondQuery.IndexOf(" FROM", StringComparison.CurrentCultureIgnoreCase), ", mytree.level + 1");
                }
                if (upSearch)
                {
                    secondQuery = secondQuery.Insert(secondQuery.IndexOf(" WHERE", StringComparison.CurrentCultureIgnoreCase), string.Format(" join mytree on \"{0}\".\"{1}\" = \"mytree\".\"{2}\" ", whereQueryParament, fieldName, parentFieldName));
                }
                else
                {
                    secondQuery = secondQuery.Insert(secondQuery.IndexOf(" WHERE", StringComparison.CurrentCultureIgnoreCase), string.Format(" join mytree on \"{0}\".\"{1}\" = \"mytree\".\"{2}\" ", whereQueryParament, parentFieldName, fieldName));
                }
            }

            StringBuilder sqlBuilder = new StringBuilder();

            sqlBuilder.Append("with recursive mytree as ( ");
            sqlBuilder.Append(firstQuery);
            sqlBuilder.Append(" union all ");
            sqlBuilder.Append(secondQuery);
            if (!forNpgsql)
            {
                sqlBuilder.Append(" order by level desc");
                if (!string.IsNullOrEmpty(orderByFieldName))
                {
                    //var orderByAnno = entityType.FindProperty(orderByProperty).FindAnnotation("Relational:ColumnName");
                    //string orderByFieldName = orderByAnno!=null? orderByAnno.Value.ToString() : string.Format("\"{0}\"", orderByProperty);
                    sqlBuilder.Append(string.Format(", {0}", orderByFieldName));
                }
            }
            sqlBuilder.Append(") ");

            if (distinct)
            {
                thirdQuery = thirdQuery.Replace("SELECT", "SELECT DISTINCT");
            }
            thirdQuery = thirdQuery.Replace(tableName, "mytree");
            sqlBuilder.Append(thirdQuery);
            if (level > 0)
            {
                if (whereQuery == null)
                {
                    sqlBuilder.Append(" where ");
                }
                else
                {
                    sqlBuilder.Append(" and ");
                }
                sqlBuilder.Append(string.Format("level = {0}", repositoryHelper.CreateParameterName("level")));
                AddDbParameter(repositoryHelper, dbParameters, "level", level);
            }

            if (forNpgsql && !string.IsNullOrEmpty(orderByFieldName))
            {
                sqlBuilder.Append(" order by sorder");
            }

            //外部where
            //   var pp = db.Database.GetDbConnection().CreateCommand().CreateParameter();
            //    pp.ParameterName ="tid";
            //    pp.Value = 1;

            return(query.Select(selector).FromSql(sqlBuilder.ToString(), dbParameters.ToArray()));
        }
 public CourseController(IRepositoryHelper repo)
 {
     repositoryHelper     = repo;
     courseResponseHelper = new CourseResponseHelper(repositoryHelper);
 }
示例#17
0
 public AuthorizedService()
 {
     this._repositoryHelper = new RepositoryHelper();
 }
示例#18
0
 public EmployeeController(IManagerRepository managerRepository, IEmployeeRepository employeeRepository, IRepositoryHelper repositoryHelper)
 {
     this.managerRepository  = managerRepository;
     this.employeeRepository = employeeRepository;
     this.repositoryHelper   = repositoryHelper;
 }
 public FeedbackService(IRepositoryHelper repositoryHelper)
 {
     RepositoryHelper = repositoryHelper;
     UnitOfWork       = RepositoryHelper.GetUnitOfWork();
 }
 public SupplyService(IRepositoryHelper repositoryHelper)
 {
     RepositoryHelper = repositoryHelper;
     UnitOfWork       = RepositoryHelper.GetUnitOfWork();
 }
示例#21
0
        public static StateMachine <State, string> ConfigureStateMachine(Workflow workflow, InstanceStatePersistence statePersistance, IRepositoryHelper repoHelper)
        {
            Enforce.ArgumentNotNull(workflow, nameof(workflow));
            Enforce.ArgumentNotNull(statePersistance, nameof(statePersistance));
            Enforce.ArgumentNotNull(repoHelper, nameof(repoHelper));

            var stateMachine = new StateMachine <State, string>(statePersistance.GetCurrentState, statePersistance.SetCurrentState);

            //  Get a distinct list of states with a trigger from state configuration
            //  "State => Trigger => TargetState
            var stateRepo      = repoHelper.GetStateRepository(repoHelper.GetUnitOfWork());
            var transitionRepo = new StateTransitionRepository(repoHelper.GetUnitOfWork());

            var states = transitionRepo.Where(t => t.WorkflowId == workflow.Id).Select(t => stateRepo.Get(t.StateId)).Distinct().ToList();

            //var transitions = transitionRepo.Where(s => s.WorkflowId == workflow.Id).ToList();

            //  Assigning triggers to states
            foreach (var state in states)
            {
                var transitions = transitionRepo.Where(t => t.StateId == state.Id).Select(t => new { Trigger = t.Trigger, TargetState = stateRepo.Get(t.TargetStateId) }).ToList();

                foreach (var tran in transitions)
                {
                    if (tran.TargetState != null)
                    {
                        stateMachine.Configure(state).Permit(tran.Trigger, tran.TargetState);
                    }
                }
            }

            return(stateMachine);
        }
示例#22
0
 public MainController(IRepositoryHelper repository)
 {
     _repository    = repository;
     _foodCalculate = new FoodCalculate(_repository);
     _pdfHelper     = new PdfHelper();
 }
 public ExportPaperService(IRepositoryHelper repositoryHelper)
 {
     RepositoryHelper = repositoryHelper;
     UnitOfWork       = RepositoryHelper.GetUnitOfWork();
 }
示例#24
0
 public AssetRepository(IRepositoryHelper helper)
 {
     this.helper = helper;
 }
 public StudentController(IRepositoryHelper repo)
 {
     repositoryHelper      = repo;
     studentResponseHelper = new StudentResponseHelper(repositoryHelper);
 }
示例#26
0
 public AppointmentService(IRepositoryHelper repositoryHelper)
 {
     RepositoryHelper = repositoryHelper;
     UnitOfWork       = RepositoryHelper.GetUnitOfWork();
 }
示例#27
0
 public ReceptionistService(IRepositoryHelper repositoryHelper)
 {
     RepositoryHelper = repositoryHelper;
     UnitOfWork       = RepositoryHelper.GetUnitOfWork();
 }
示例#28
0
 public MeasurementRepository(IRepositoryHelper helper)
 {
     _helper = helper;
 }
 public StudentResponseHelper(IRepositoryHelper repoHelper)
 {
     repositoryHelper = repoHelper;
 }
示例#30
0
 public DeviceRepository(IRepositoryHelper helper)
 {
     _helper = helper;
 }
示例#31
0
 public RoomService(IRepositoryHelper repositoryHelper, IMapper mapper)
 {
     this._mapper           = mapper;
     this._repositoryHelper = repositoryHelper;
 }
 public LabTestResultService(IRepositoryHelper repositoryHelper)
 {
     RepositoryHelper = repositoryHelper;
     UnitOfWork       = RepositoryHelper.GetUnitOfWork();
 }
 public LabTestingIndexService(IRepositoryHelper repositoryHelper)
 {
     RepositoryHelper = repositoryHelper;
     UnitOfWork       = RepositoryHelper.GetUnitOfWork();
 }
 public SampleGettingService(IRepositoryHelper repositoryHelper)
 {
     RepositoryHelper = repositoryHelper;
     UnitOfWork       = RepositoryHelper.GetUnitOfWork();
 }
示例#35
0
 public FoodCalculate(IRepositoryHelper repository)
 {
     _repository = repository;
 }
示例#36
0
 public InnaOperacja(IRepositoryHelper repositoryHelper)
 {
     if (repositoryHelper == null)
         throw new ArgumentNullException("repositoryHelper");
     _repositoryHelper = repositoryHelper;
 }