コード例 #1
0
ファイル: Controller.cs プロジェクト: angelcolmenares/Calamar
 public Controller(RepositoryClient client, Mailer mailer,AppConfig appConfig)
 {
     Client= client;
     Mailer= mailer;
     AppConfig = appConfig;
     //LoadRules();
 }
コード例 #2
0
        public ODSCLIENTE Update(ODSCLIENTE model, EntityClient cliente)
        {
            var objRepository = new RepositoryClient();

            EntityClient data = new EntityClient()
            {
                PK_ClientID            = cliente.PK_ClientID,
                ClientID               = model.IDCliente,
                FirstName              = model.Nombrecliente,
                LastName               = model.ApellidoCliente,
                StreetAddress          = model.Calle,
                NumberExternalAddress  = model.Numero,
                NumberInternalAddress  = model.NumeroInterior,
                BoroughAddress         = model.Colonia,
                MunicipalityAddress    = model.Delegacion,
                PostalCodeAddress      = model.CodigoPosta,
                AdditionalInfoAddress1 = model.Referencia1,
                AdditionalInfoAddress2 = model.Referencia2,
                AdditionalInfoAddress3 = model.Referencia3,
                AdditionalInfoAddress4 = model.Referencia4,
                AdditionalInfoAddress5 = model.Referencia5,
                PhoneNumber1           = model.CELULAR,
                PhoneNumber2           = model.TEL_CASA,
                PhoneNumber3           = model.TEL_TRABAJO,
                PhoneExtension1        = model.EXT_TRABAJO,
                Email      = model.email,
                RCF        = model.RFCCEDULA,
                Status     = true,
                CreateDate = DateTime.UtcNow,
                ModifyDate = DateTime.UtcNow
            };

            data = objRepository.Update(data);
            return(model);
        }
コード例 #3
0
        public FrmEditSector(ModelViewSecteur secteur, bool newSecteur)
        {
            InitializeComponent();
            //DictionaryHelper.InitDictionary(spellChecker1);
            var repositoryWilaya       = new RepositoryWilaya();
            var repositoryAgentTerrain = new RepositoryAgentTerrain();
            var repositorySecteur      = new RepositorySector();
            var repositoryClient       = new RepositoryClient();

            _editSecteurPresenter = new EditSectorPresenterPage(this, repositoryWilaya, repositoryAgentTerrain, repositorySecteur, repositoryClient);
            _editSecteurPresenter.Display();

            comboBoxClients.DataSource    = Clients.OrderBy(cl => cl.Name).ToList();
            comboBoxClients.DisplayMember = "Name";
            comboBoxClients.ValueMember   = "Name";
            comboBoxWilaya.DataSource     = Wilayas.OrderBy(c => c.Code).ToList();
            comboBoxWilaya.ValueMember    = "Code";
            comboBoxCommune.DataSource    = Wilayas.First(w => w.Code == (int)comboBoxWilaya.SelectedValue).Communes.OrderBy(c => c.Name).ToList();
            comboBoxCommune.DisplayMember = "Name";
            comboBoxCommune.ValueMember   = "Name";

            if (!newSecteur)
            {
                IdSecteur = secteur.Id;
                textEditNameSector.Text       = secteur.Name;
                comboBoxWilaya.SelectedValue  = secteur.CodeWilaya;
                comboBoxCommune.SelectedValue = secteur.Commune;
            }

            _newSecteur      = newSecteur;
            IsSectorModified = false;
            SourceSecteur    = secteur;

            GCAgentTerrain.DataSource = AgentTerrains;
        }
コード例 #4
0
        public AirportManagerService()
        {
            rnd     = new Random();
            repo    = new RepositoryClient();
            airport = Airport.Instance();
            InitCallback();
            LoadFutureFlights();
            TimeSpan firstFlight = GetNextTimeSpan();

            scheduleTimer = new Timer(HandleFlightScedule, null, firstFlight, firstFlight);
        }
コード例 #5
0
        internal FrmEditBdc(ModelViewBdc bdc, bool newBdc, string caption)
        {
            InitializeComponent();
            LigneCommande = null;
            var repositoryClient = new RepositoryClient();
            var repositoryStock  = new RepositoryStock();
            var repositoryOrder  = new RepositoryOrder();

            _editBdcPresenter = new EditBdcPresenterPage(this, repositoryClient, repositoryStock, repositoryOrder, OrderLines);
            _editBdcPresenter.Display();

            comboBoxClients.DataSource    = Clients.OrderBy(cl => cl.Name).ToList();
            comboBoxClients.DisplayMember = "Name";
            comboBoxClients.ValueMember   = "Name";
            comboBoxPriorite.DataSource   = Enum.GetValues(typeof(Priorite));
            comboBoxEtat.DataSource       = Enum.GetValues(typeof(GestionCommande));

            gridViewOrderLine.Columns[0].FieldName = "Product.Name";

            if (!newBdc)
            {
                IdOrder = bdc.Id;
                textEditNumCommande.Text      = bdc.NumCommande.ToString(CultureInfo.InvariantCulture);
                comboBoxClients.SelectedValue = bdc.NameClient;
                dateEditLivraison.Text        = bdc.DateLivraison.ToShortDateString();
                memoEditAdresssLivraion.Text  = bdc.AdresseLivraison;
                comboBoxPriorite.SelectedItem = bdc.Priorite;
                comboBoxEtat.SelectedItem     = bdc.Etat;
                dateEditCommande.Text         = bdc.Datecommande.ToShortDateString();
                var orderline1 = new OrderLine();
                foreach (var lc in bdc.OrderLines)
                {
                    orderline1.id       = lc.Id;
                    orderline1.Product  = lc.Product;
                    orderline1.Quantity = lc.Quantity;
                    OrderLines.Add(new OrderLine {
                        id = lc.Id, Product = lc.Product, Quantity = lc.Quantity
                    });
                }
                radiogroupLivraisonSurPlace.EditValue = bdc.LivraisonSurPlace;
                GCOrderLine.DataSource = OrderLines;
            }
            else
            {
                GCOrderLine.DataSource = OrderLines;
            }

            IsBdcModified = false;
            _newBdc       = newBdc;
            _sourceBdc    = bdc;
        }
コード例 #6
0
ファイル: AppHost.cs プロジェクト: angelcolmenares/Calamar
        void ConfigureApp(Container container)
        {
            var appSettings = new ConfigurationResourceManager();

            double se= appSettings.Get("DefaultSessionExpiry", 480);
            AuthProvider.DefaultSessionExpiry=TimeSpan.FromMinutes(se);

            string cacheHost= appSettings.Get("REDISTOGO_URL","localhost:6379").Replace("redis://redistogo:","").Replace("/","");

            var redisClientManager = new BasicRedisClientManager(new string[]{cacheHost});

            OrmLiteConfig.DialectProvider= MySqlDialectProvider.Instance;

            IDbConnectionFactory dbFactory =
                new OrmLiteConnectionFactory(ConfigUtils.GetConnectionString("ApplicationDb"));

            string smtpServer= appSettings.Get("MAILGUN_SMTP_SERVER", "localhost");
            string smtpLogin= appSettings.Get("MAILGUN_SMTP_LOGIN", "username");
            string smtpPassword= appSettings.Get("MAILGUN_SMTP_PASSWORD", "PASSWORD");
            int smtpPort= appSettings.Get("MAILGUN_SMTP_PORT", 587);
            Mailer mailer = new Mailer(smtpServer, smtpPort, smtpLogin, smtpPassword);

            var appConfig= new AppConfig(appSettings);

            RepositoryClient rc = new RepositoryClient(dbFactory, redisClientManager);
            Controller controller = new Controller(rc,mailer,appConfig);
            container.Register<Controller>( controller );

            AuthRepoProxy arp = new AuthRepoProxy(dbFactory, redisClientManager);
            container.Register<AuthRepoProxy>( arp );

            container.Register<IRedisClientsManager>(c => redisClientManager);
            //container.Register<ICacheClient>(c => redisClientManager);

            Plugins.Add(new AuthFeature( () => new AuthUserSession(), // or Use your own typed Custom AuthUserSession type
                new IAuthProvider[]
            {
                new AuthenticationProvider(){SessionExpiry=TimeSpan.FromMinutes(se)}
            })
               {
                IncludeAssignRoleServices=false
            });

            OrmLiteAuthRepository authRepo = new OrmLiteAuthRepository(dbFactory);

            container.Register<IUserAuthRepository>(c => authRepo);

            if(appSettings.Get("EnableRegistrationFeature", false))
                Plugins.Add( new  RegistrationFeature());
        }
コード例 #7
0
        public bool CreateBankClient(ModelAddress modelAddress, ModelClient modelClient, ModelAccounts modelAccounts)
        {
            int addressId = new RepositoryAddress().AddAddress(modelAddress);

            if (addressId > 0)
            {
                int clientId = new RepositoryClient().AddClient(modelClient, addressId);
                if (clientId > 0)
                {
                    return(new RepositoryAccount().AddAccount(modelAccounts, clientId));
                }
            }
            return(false);
        }
コード例 #8
0
        private bool HasPermissionToCommentsTask(Comment item)
        {
            var task = new RepositoryClient()
                       .GetRepositoryProvider()
                       .GetTaskRepository()
                       .FirstOrDefault(where : t => t.Id == item.TaskId);
            int authenticatedId = AuthenticationManager.GetLoggedUser(HttpContext).Id;

            if (task.CreatorId == authenticatedId || task.ExecutitiveId == authenticatedId)
            {
                return(true);
            }
            ModelState.AddModelError("NoAccess", ErrorMessages.NoAccess("task"));
            return(false);
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: bcwiniger/GitHubApiLib
        static void GetPullRequestsForOrg(string org, PullRequestState state)
        {
            try
            {
                var repoClient = new RepositoryClient(_userAgent);
                var repoTask   = repoClient.GetAllRepositoriesByOwnerAsync(org);
                Task.WaitAll(repoTask);

                var pullReqClient = new PullRequestClient(_userAgent);
                var parms         = new PullRequestOptions
                {
                    State       = state,
                    PageOptions = new PaginationOptions {
                        ResultsPerPage = 100
                    }
                };

                var tasks = new List <Task <List <PullRequestResponse> > >();
                Parallel.ForEach(repoTask.Result, repo =>
                {
                    var pullReqTask = pullReqClient.GetPullRequestsAsync(org, repo.Name, parms);
                    tasks.Add(pullReqTask);
                });
                Task.WaitAll(tasks.ToArray());

                var pullRequestsForOrg = new List <PullRequestResponse>();
                foreach (var task in tasks)
                {
                    pullRequestsForOrg.AddRange(task.Result);
                }

                Console.WriteLine(pullRequestsForOrg.Count);
            }
            catch (Exception ex)
            {
                if (ex is AggregateException aggEx)
                {
                    ex = ex.InnerException;
                }
                Console.WriteLine(ex.Message, ex);
            }
            finally
            {
                Console.Read();
            }
        }
コード例 #10
0
ファイル: TaskManager.cs プロジェクト: pcloayza/sensenet
        public virtual async Task <RegisterTaskResult> RegisterTaskAsync(RegisterTaskRequest requestData, CancellationToken cancellationToken)
        {
            var taskManagementUrl = _options.UrlOrSetting;

            if (string.IsNullOrEmpty(taskManagementUrl) || requestData == null)
            {
                return(null);
            }

            while (true)
            {
                try
                {
                    return(await RepositoryClient.RegisterTaskAsync(taskManagementUrl, requestData).ConfigureAwait(false));
                }
                catch (Exception ex)
                {
                    // look for a special error message about an unknown app id
                    if (ex is TaskManagementException && string.CompareOrdinal(ex.Message, RegisterTaskRequest.ERROR_UNKNOWN_APPID) == 0)
                    {
                        // try to re-register the app
                        if (await RegisterApplicationAsync(cancellationToken))
                        {
                            // skip error logging and try to register the task again
                            continue;
                        }
                    }

                    SnLog.WriteException(ex, "Error during task registration.",
                                         EventId.TaskManagement.General,
                                         properties: new Dictionary <string, object>
                    {
                        { "TaskManagementUrl", taskManagementUrl },
                        { "Type", requestData.Type },
                        { "Title", requestData.Title },
                        { "Data", requestData.TaskData }
                    });

                    // do not retry again after a real error
                    break;
                }
            }

            // no need to throw an exception, we already logged the error
            return(null);
        }
コード例 #11
0
ファイル: TaskManager.cs プロジェクト: pcloayza/sensenet
        public virtual async Task <bool> RegisterApplicationAsync(CancellationToken cancellationToken)
        {
            var taskManagementUrl = _options.UrlOrSetting;

            if (string.IsNullOrEmpty(taskManagementUrl))
            {
                SnTrace.TaskManagement.Write("Task management url is empty, application is not registered.");
                return(false);
            }

            var requestData = new RegisterApplicationRequest
            {
                AppId          = _options.ApplicationIdOrSetting,
                ApplicationUrl = _options.ApplicationUrlOrSetting
            };

            try
            {
                await RepositoryClient.RegisterApplicationAsync(taskManagementUrl, requestData).ConfigureAwait(false);

                SnLog.WriteInformation("Task management app registration was successful.", EventId.TaskManagement.General, properties: new Dictionary <string, object>
                {
                    { "TaskManagementUrl", taskManagementUrl },
                    { "AppId", requestData.AppId }
                });

                return(true);
            }
            catch (Exception ex)
            {
                SnLog.WriteException(ex, "Error during app registration.", EventId.TaskManagement.General,
                                     properties: new Dictionary <string, object>
                {
                    { "TaskManagementUrl", taskManagementUrl },
                    { "AppId", requestData.AppId },
                    { "ApplicationUrl", requestData.ApplicationUrl }
                });
            }

            // no need to throw an exception, we already logged the error
            return(false);
        }
コード例 #12
0
		void ConfigureApp(Container container)
		{
			var appSettings = new ConfigurationResourceManager();
                    
            string smtpServer= appSettings.Get("MAILGUN_SMTP_SERVER", "localhost");
			string smtpLogin= appSettings.Get("MAILGUN_SMTP_LOGIN", "username");
			string smtpPassword= appSettings.Get("MAILGUN_SMTP_PASSWORD", "PASSWORD");
			int smtpPort= appSettings.Get("MAILGUN_SMTP_PORT", 587);

			Mailer mailer = new Mailer(smtpServer, smtpPort, smtpLogin, smtpPassword);

			IRepository rp = new MemRepo();
			RepositoryClient rc = new RepositoryClient(rp);
			Controller controller = new Controller(rc,mailer);
			controller.InitRepo();
            container.Register<Controller>( controller );
            

            
						
		}
コード例 #13
0
ファイル: TaskManager.cs プロジェクト: y1027/sensenet
        public virtual async Task <bool> RegisterApplicationAsync(string taskManagementUrl, RegisterApplicationRequest requestData)
        {
            try
            {
                await RepositoryClient.RegisterApplicationAsync(taskManagementUrl, requestData).ConfigureAwait(false);

                return(true);
            }
            catch (Exception ex)
            {
                SnLog.WriteException(ex, "Error during app registration.", EventId.TaskManagement.General,
                                     properties: new Dictionary <string, object>
                {
                    { "TaskManagementUrl", taskManagementUrl },
                    { "AppId", requestData.AppId },
                    { "ApplicationUrl", requestData.ApplicationUrl }
                });
            }

            // no need to throw an exception, we already logged the error
            return(false);
        }
コード例 #14
0
        public async Task <IRepositoryClient> GetAsync(IRepository repository)
        {
            Ensure.NotNull(repository, nameof(repository));

            if (repository.EncryptedAccessToken == null)
            {
                throw new ArgumentException("Missing accessToken", nameof(repository));
            }

            var origin = RevisionSource.Parse(repository.Origin);

            var accessTokenBytes = await dataDecryptor.DecryptAsync(repository.EncryptedAccessToken);

            var accessToken = new OAuth2Token(Encoding.UTF8.GetString(accessTokenBytes));

            var client = new RepositoryClient(
                accountName: origin.AccountName,
                repositoryName: origin.RepositoryName,
                accessToken: accessToken
                );

            return(client);
        }
コード例 #15
0
 public HomeController(RepositoryClient client)
 {
     this.repositoryClient = client;
 }
コード例 #16
0
 public RatingRepositoryCollection(User user)
 {
     this.user             = user;
     this.repositoryClient = new RepositoryClient();
 }
コード例 #17
0
 private UserRepositoryService()
 {
     this.repositoryClient             = new RepositoryClient();
     this.userRepositorySessionHandler = new UserRepositorySessionHandler();
 }
コード例 #18
0
		public Controller (RepositoryClient client, Mailer mailer)
		{
			Client= client;
			Mailer= mailer;
			LoadRules();
		}
コード例 #19
0
        public EntityClient GetByID(int FK_ClientID)
        {
            var objRepository = new RepositoryClient();

            return(objRepository.Get(FK_ClientID));
        }
コード例 #20
0
        public EntityClient GetByClientID(string ClientID)
        {
            var objRepository = new RepositoryClient();

            return(objRepository.GetByClientID(ClientID));
        }
コード例 #21
0
 public ProjectsController()
 {
     _repository = new RepositoryClient <Project>(AppSettings.Instance.RepositoryUrl);
 }
コード例 #22
0
 public PublicRepositoryCollection()
 {
     this.repositoryClient = new RepositoryClient();
 }
コード例 #23
0
 public SectionsController()
 {
     _repository = new RepositoryClient <Section>(AppSettings.Instance.RepositoryUrl);
 }