private static object InstancePartnerService()
        {
            IPartnerRepository repository = PartnerRepositoryFactory.GetRepositoryInstance <PartnerRepository>();
            IPartnerService    service    = new PartnerService(repository);

            return(service);
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Inspections"/> class.
 /// </summary>
 /// <param name="service">
 /// The service.
 /// </param>
 /// <param name="partnerService">
 /// The partner Service.
 /// </param>
 /// <param name="prefix">
 /// The prefix.
 /// </param>
 /// <param name="limits">
 /// The limits.
 /// </param>
 public Inspections(TimerService service, PartnerService partnerService, PrefixService prefix, TranslateLimitsNew limits)
 {
     timerService   = service;
     prefixService  = prefix;
     PartnerService = partnerService;
     Limits         = limits;
 }
示例#3
0
        public async Task InfoAsync()
        {
            var p = PartnerService.GetPartnerInfo(Context.Guild.Id, true);

            await SimpleEmbedAsync("**Stats**\n" + $"Users Reached: {p.Stats.UsersReached}\n" + $"Servers Reached: {p.Stats.ServersReached}\n" + "**Settings**\n" + $"Enabled: {p.Settings.Enabled}\n" + $"Channel: {Context.Guild.GetChannel(p.Settings.ChannelId)?.Name ?? "N/A"}\n" + "**Config**\n" + $"Color (RGB): [{p.Message.Color.R}, {p.Message.Color.G}, {p.Message.Color.B}]\n" + $"Using Server Thumbnail: {p.Message.UseThumb}\n" + $"Showing UserCount: {p.Message.UserCount}\n" + $"Image URL: {p.Message.ImageUrl ?? "N/A"}\n" + $"Message: (Refer to Partner Message Embed, for raw do `{PrefixService.GetPrefix(Context.Guild.Id)}partner RawMessage`)\n" + "**Partner Message Embed**\n" + "(See Next Message)");
            await ReplyAsync(PartnerHelp.GenerateMessage(p, Context.Guild));
        }
示例#4
0
        public void EndCreatePartner(IAsyncResult result)
        {
            try
            {
                int id = PartnerService.EndCreatePartner(result);
                if (id != -1)
                {
                    BusinessPartnerViewModel partner = result.AsyncState as BusinessPartnerViewModel;
                    partner.Id    = id;
                    partner.IsNew = false;
                }
                else
                {
                    ErrorMessage = ViewModelsResources.ErrorCreatingBP;
                    IsError      = true;
                }
            }
            catch (Exception ex)
            {
                ErrorMessage = ex.Message;
                IsError      = true;
            }

            InProgress = false;
        }
示例#5
0
        public void GetPartners_Success_Test()
        {
            // Arrange
            R_Partner partner = SamplePartner(1);

            IList <R_Partner> list = new List <R_Partner>();

            list.Add(partner);

            // create mock for repository
            var mock = new Mock <IPartnerRepository>();

            mock.Setup(s => s.GetPartners()).Returns(list);

            // service
            PartnerService partnerService = new PartnerService();

            PartnerService.Repository = mock.Object;

            // Act
            var        resultList = partnerService.GetPartners();
            PartnerDTO result     = resultList.FirstOrDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.PartnerId);
        }
示例#6
0
 public ProductSearchController(ProductService prodService, PartnerService partnerService)
 {
     this.prodService    = prodService;
     this.partnerService = partnerService;
     errorView           = new ProductSearchErrorView();
     resultView          = new ProductSearchResultView();
 }
示例#7
0
        public void GetPartnersPaged_Success_Test()
        {
            // Arrange
            string searchTerm = "";
            int    pageIndex  = 0;
            int    pageSize   = 10;

            // list
            IList <R_Partner> list = new List <R_Partner>();

            for (int i = 1; i <= pageSize; i++)
            {
                list.Add(SamplePartner(i));
            }

            // create mock for repository
            var mock = new Mock <IPartnerRepository>();

            mock.Setup(s => s.GetPartners(Moq.It.IsAny <string>(), Moq.It.IsAny <int>(), Moq.It.IsAny <int>())).Returns(list);

            // service
            PartnerService partnerService = new PartnerService();

            PartnerService.Repository = mock.Object;

            // Act
            var        resultList = partnerService.GetPartners(searchTerm, pageIndex, pageSize);
            PartnerDTO result     = resultList.FirstOrDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.PartnerId);
            Assert.AreEqual(10, resultList.Count);
        }
示例#8
0
        public xtraRPBaoCaoCongNo(int partnerID, int month, int year, int isPayment)
        {
            InitializeComponent();
            objService       = new BookService();
            partnerService   = new PartnerService();
            groupTourService = new GroupTourService();
            if (isPayment == 3)
            {
                this.objectDataSource1.DataSource = objService.GetListBookedDoneReport(partnerID, month, year, null, true);
            }
            else if (isPayment == 1)
            {
                this.objectDataSource1.DataSource = objService.GetListBookedDoneReport(partnerID, month, year, true, true);
            }
            else if (isPayment == 2)
            {
                this.objectDataSource1.DataSource = objService.GetListBookedDoneReport(partnerID, month, year, false, true);
            }
            //GroupTour g = groupTourService.GetByID(groupID);
            string title = "CÔNG NỢ THÁNG " + month + "/" + year;

            lblTitle.Text = title.ToUpper();
            Partner p = partnerService.GetByID(partnerID);

            lblPartnerName.Text  = p.Name;
            lblPartnerPhone.Text = p.Phone;
        }
示例#9
0
 public ActionResult Create(CreatePartnerModel model, FormCollection collection, HttpPostedFileBase Logo)
 {
     try
     {
         if (ModelState.IsValid)
         {
             Partner partner = new Partner()
             {
                 Name = model.Name,
                 Address = model.Address,
                 ContactName = model.ContactName,
                 CreatedUserID = SessionManager.UserInfo.UserID,
                 UpdatedUserID = SessionManager.UserInfo.UserID,
                 Description = model.Description,
                 PartnerType = model.PartnerType,
                 PhoneNumber1 = model.PhoneNumber1,
                 PhoneNumber2 = model.PhoneNumber2,
             };
             PartnerService service = new PartnerService();
             service.AddNew(partner, Logo);
             return RedirectToAction("Index", "Partner");
         }
         else
         {
             ModelState.AddModelError("Error", "Thông tin vừa nhập không hợp lệ , vui lòng kiểm tra lại");
             return View(model);
         }
     }
     catch
     {
         ModelState.AddModelError("Error", "Có lỗi xãy ra.");
         return View(model);
     }
 }
示例#10
0
        public async Task SetMessageAsync([Remainder] string message)
        {
            if (message.Length > 1000)
            {
                await SimpleEmbedAsync($"Partner Message must be shorter than 1000 characters. Given: {message.Length}");

                return;
            }

            if (Context.Message.MentionedRoles.Any() || Context.Message.MentionedUsers.Any() || Context.Message.MentionedChannels.Any() || Context.Message.Content.Contains("@everyone") || Context.Message.Content.Contains("@here"))
            {
                await SimpleEmbedAsync("Partner Message cannot contain role or user mentions as they cannot be referenced from external guilds");

                return;
            }

            if (Profanity.ContainsProfanity(message))
            {
                await SimpleEmbedAsync("Partner Message cannot contain profanity");

                return;
            }

            if (message.ToLower().Contains("discord.gg") || message.ToLower().Contains("discordapp.com") || message.ToLower().Contains("discord.me") || Regex.Match(message, @"(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?(d+i+s+c+o+r+d+|a+p+p)+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$").Success)
            {
                await SimpleEmbedAsync("No need to include an invite to the bot in your message. PassiveBOT will automatically generate one");

                return;

                /*
                 * var invites = Regex.Matches(message, @"(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?(d+i+s+c+o+r+d+|a+p+p)+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$").OfType<Match>().ToList();
                 * var inviteMetadata = await Context.Guild.GetInvitesAsync();
                 * var mismatch = false;
                 * foreach (var invite in invites)
                 * {
                 *  var match = inviteMetadata.Where(x => x.MaxAge == null).FirstOrDefault(x => invite.ToString().ToLower().Contains(x.Code.ToLower()));
                 *  if (match == null)
                 *  {
                 *      mismatch = true;
                 *  }
                 * }
                 *
                 * if (mismatch)
                 * {
                 *  throw new Exception("Please ensure the message passes all checks:\n" + "1.Only invites from this server are allowed in the partner message!\n" + "2.Ensure that the invite link you are using is set to never expire\n" + "3.Ensure that it does not have a use limit.\n" + "4.If your server uses 2FA please disable it while running the command then re-enable it after\n" + "If you are using an invite for your server and you are seeing this message, please generate a new invite for your server\n\n" + $"If you believe this is an error, please contact the support server: {HomeModel.Load().HomeInvite}");
                 * }
                 */
            }

            var p = PartnerService.GetPartnerInfo(Context.Guild.Id, true);

            p.Message.Content = message;
            p.Save();

            var generateMessage = PartnerHelp.GenerateMessage(p, Context.Guild);

            await ReplyAsync(generateMessage);

            await PartnerHelp.PartnerLogAsync(Context.Client, p, new EmbedFieldBuilder { Name = "Partner Message Updated", Value = $"Guild: {Context.Guild.Name} [{Context.Guild.Id}]\n" + $"Owner: {Context.Guild.Owner.Username}\n" + $"Users: {Context.Guild.MemberCount}" });
        }
示例#11
0
        public void EndUpdatePartner(IAsyncResult result)
        {
            InProgress = false;

            if (result.IsCompleted)
            {
                try
                {
                    bool success = PartnerService.EndUpdatePartner(result);
                    if (!success)
                    {
                        var partner = result.AsyncState as BusinessPartnerViewModel;
                        Partners.Remove(partner);

                        ErrorMessage = ViewModelsResources.ErrorSavingPartner;
                        IsError      = true;
                    }
                }
                catch (FaultException)
                {
                    ErrorMessage = ViewModelsResources.ErrorSavingPartner;
                    IsError      = true;
                }
            }
        }
 public PartnerReportsController(PartnerService partnerService, CurrencyService currencyService,
     PartnershipService partnershipService)
 {
     _partnerService = partnerService;
     _currencyService = currencyService;
     _partnershipService = partnershipService;
 }
示例#13
0
        public ActionResult Delete(int id)
        {
            PartnerService service = new PartnerService();
            service.Delete(id);

            return RedirectToAction("Index");
        }
示例#14
0
        public void EndGetPartners(IAsyncResult result)
        {
            var partners = new ObservableCollection <BusinessPartnerViewModel>(PartnerService.EndGetPartnersForCustomer(result).Select(x => new BusinessPartnerViewModel(x)));

            Partners         = partners;
            InProgress       = false;
            _partnersLoading = false;
        }
示例#15
0
 public PartnerExcelFileHandler(StagedPartnerService stagedPartnerService, PartnerService partnerService, ChurchService churchService, CellService cellService, PCFService pcfService)
 {
     _stagedPartnerService = stagedPartnerService;
     _partnerService = partnerService;
     _churchService = churchService;
     _cellService = cellService;
     _pcfService = pcfService;
 }
示例#16
0
        public Task RegenerateAsync()
        {
            var p = PartnerService.GetPartnerInfo(Context.Guild.Id, true);

            p.Message.Invite = Context.Guild.GetTextChannel(p.Settings.ChannelId)?.CreateInviteAsync(null).Result?.Url;
            p.Save();
            return(ReplyAsync(PartnerHelp.GenerateMessage(p, Context.Guild)));
        }
示例#17
0
 public void RemovePartner(BusinessPartnerViewModel vm)
 {
     if (!vm.IsNew)
     {
         PartnerService.BeginRemovePartner(vm.Id, Customer.Id, EndRemovePartner, vm);
         InProgress = true;
     }
 }
示例#18
0
        public Task UserCountAsync()
        {
            var p = PartnerService.GetPartnerInfo(Context.Guild.Id, true);

            p.Message.UserCount = !p.Message.UserCount;
            p.Save();
            return(ReplyAsync(PartnerHelp.GenerateMessage(p, Context.Guild)));
        }
示例#19
0
        static bool EditPartner(RpcConnection rpcConnection)
        {
            var partnerService = new PartnerService(rpcConnection);
            var partner        = partnerService.Get(46);

            partner.Email     = "*****@*****.**";
            partner.CountryId = 61;
            return(partnerService.Write(46, partner));
        }
示例#20
0
        private void loadDataPartner()
        {
            pnService = new PartnerService();
            string content = txtFindPartner.Text.Trim();

            cbbPartnerID.DataSource    = pnService.GetListCobobox(content);
            cbbPartnerID.ValueMember   = "PartnerID";
            cbbPartnerID.DisplayMember = "Address";
        }
        private void loadDataGroup()
        {
            objService = new PartnerService();
            var data = objService.GetList();

            gridControlData.DataSource = data;
            gridControlData.Update();
            gridControlData.Refresh();
        }
示例#22
0
 public PCFSetupController(IUnitOfWork unitOfWork, StagedPCFService stagedPcfService, PCFService pcfService, ChurchService churchService, PartnerService partnerService, PCFExcelFileHandler pcfExcelFileHandler)
     : base(unitOfWork)
 {
     _stagedPCFService = stagedPcfService;
     _pcfService = pcfService;
     _churchService = churchService;
     _partnerService = partnerService;
     _pcfExcelFileHandler = pcfExcelFileHandler;
 }
 public PartnershipLogExcelFileHandler(ChurchService churchService, PartnerService partnerService,
     StagedPartnershipService stagedPartnershipService, PartnershipArmService partnershipArmService,
     CurrencyService currency)
 {
     _churchService = churchService;
     _partnerService = partnerService;
     _stagedPartnershipService = stagedPartnershipService;
     _partnershipArmService = partnershipArmService;
     _currency = currency;
 }
示例#24
0
 public PartnerController(IUnitOfWork unitOfWork, ChurchService churchService, StagedPartnerService stagedPartnerService, PartnerService partnerService, PartnerExcelFileHandler fileHandler, CellService cellService, PCFService pcfService)
     : base(unitOfWork)
 {
     _churchService = churchService;
     _stagedPartnerService = stagedPartnerService;
     _partnerService = partnerService;
     _fileHandler = fileHandler;
     _cellService = cellService;
     _pcfService = pcfService;
 }
示例#25
0
 public IAsyncResult LoadPartners()
 {
     if (Customer != null && !_partnersLoading)
     {
         InProgress       = true;
         _partnersLoading = true;
         return(PartnerService.BeginGetPartnersForCustomer(Customer.Id, EndGetPartners, null));
     }
     return(null);
 }
示例#26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Developer"/> class.
 /// </summary>
 /// <param name="service">
 /// The service.
 /// </param>
 /// <param name="partnerService">
 /// The partner Service.
 /// </param>
 /// <param name="prefix">
 /// The prefix.
 /// </param>
 /// <param name="httpClient">
 /// The http Client.
 /// </param>
 /// <param name="limits">
 /// The limits.
 /// </param>
 public Developer(TimerService service, PartnerService partnerService, PartnerHelper pHelper, IDocumentStore store, PrefixService prefix, HttpClient httpClient, TranslateLimitsNew limits, DBLApiService dblApi)
 {
     timerService   = service;
     prefixService  = prefix;
     PartnerService = partnerService;
     docStore       = store;
     client         = httpClient;
     Limits         = limits;
     PartnerHelper  = pHelper;
     DblApi         = dblApi;
 }
示例#27
0
        public async Task ToggleAsync()
        {
            var p = PartnerService.GetPartnerInfo(Context.Guild.Id, true);

            p.Settings.Enabled = !p.Settings.Enabled;
            p.Save();

            await PartnerHelp.PartnerLogAsync(Context.Client, p, new EmbedFieldBuilder { Name = "Partner Toggled", Value = $"Enabled: {p.Settings.Enabled}" });

            await SimpleEmbedAsync($"Partner Program Enabled: {p.Settings.Enabled}");
        }
示例#28
0
        public Task ColorAsync(string color)
        {
            var color_response = ColorManagement.GetColor(color);

            var p = PartnerService.GetPartnerInfo(Context.Guild.Id, true);

            p.Message.Color = new PartnerService.PartnerInfo.PartnerMessage.RGB {
                R = color_response.R, G = color_response.G, B = color_response.B
            };
            p.Save();
            return(ReplyAsync(PartnerHelp.GenerateMessage(p, Context.Guild)));
        }
示例#29
0
 public MobileClientController(IPhoneNumberFormatter phoneNumberFormatter, PartnershipArmService partnershipArmService,
     PartnerService partnerService, NonValidatedRecordsPersistenceService recordsPersistenceService, CurrencyService currencyService,
     PartnershipService partnershipService, IUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
     _phoneNumberFormatter = phoneNumberFormatter;
     _partnershipArmService = partnershipArmService;
     _partnerService = partnerService;
     _recordsPersistenceService = recordsPersistenceService;
     _currencyService = currencyService;
     _partnershipService = partnershipService;
 }
示例#30
0
        public PagedResponse <Partner> Get([FromQuery] PartnerSearchParams searchParams)
        {
            var partners = PartnerService
                           .List(searchParams.ToModel())
                           .ToArray();

            return(new PagedResponse <Partner>
            {
                Values = partners.Take(Utils.PageSize),
                MorePages = partners.Count() > Utils.PageSize
            });
        }
示例#31
0
        public Task BanPartnerAsync(ulong guildId)
        {
            PartnerService.PartnerInfo match = PartnerService.GetPartnerInfo(guildId, true);
            if (match == null)
            {
                return(SimpleEmbedAsync("Partner not found"));
            }

            match.Settings.Banned  = true;
            match.Settings.Enabled = false;
            PartnerService.OverWrite(match);
            return(SimpleEmbedAsync("Partner has been banned"));
        }
示例#32
0
        static int CreatePartnerService(RpcConnection rpcConnection)
        {
            var leslie = new Partner
            {
                Name   = "Leslie Morel",
                Active = true,
                Street = "Calle Rafael",
            };
            var partnerService = new PartnerService(rpcConnection);
            var result         = partnerService.Create(leslie);

            return(result);
        }
示例#33
0
        public MiniErpTests()
        {
            IServiceCollection services = new ServiceCollection();

            services.AddTransient <PartnerRepository>();
            services.AddTransient <PartnerService>();
            services.AddScoped <MySqlContext>();
            services.Configure <AppConnectionSettings>(options => Configuration.GetSection(AppSettings.MySqlConnection).Bind(options));

            var serviceProvider = services.BuildServiceProvider();

            Service    = (PartnerService)serviceProvider.GetService(typeof(PartnerService));
            Repository = (PartnerRepository)serviceProvider.GetService(typeof(PartnerRepository));
        }
示例#34
0
        public async Task <ActionResult> Index()
        {
            var model = new IndexModel
            {
                Speakers = new SpeakersModel
                {
                    SpeakersCollections = new List <List <Speaker> >()
                },
                Partners = new PartnersModel
                {
                    PartnersCollection = new Dictionary <PartnerType, List <Partner> >()
                }
            };

            var speakers = new SpeakerService().GetSpeakers();
            var i        = 0;

            foreach (var speaker in speakers)
            {
                List <Speaker> list;
                if (i == 0)
                {
                    list = new List <Speaker>();
                    model.Speakers.SpeakersCollections.Add(list);
                }
                else
                {
                    list = model.Speakers.SpeakersCollections.Last();
                }

                list.Add(speaker);

                if (i == 3)
                {
                    i = 0;
                }
                else
                {
                    i++;
                }
            }

            var partners = new PartnerService().GetPartners();

            model.Partners.PartnersCollection = partners
                                                .GroupBy(p => p.PartnerType)
                                                .ToDictionary(p => p.Key, group => group.OrderBy(p => p.OrderN).ToList());

            return(View(model));
        }
        private void loadDataGroup()
        {
            partnerService = new PartnerService();
            var data = partnerService.GetList();

            gridControlData.DataSource = data;
            gridControlData.Update();
            gridControlData.Refresh();

            userService = new ApplicationUserService();
            gridControlAccount.DataSource = userService.GetList();
            gridControlAccount.Update();
            gridControlAccount.Refresh();
        }
示例#36
0
        public xtraRPBaoCaoCongNoDoiTac(int partnerID, int month, int year)
        {
            InitializeComponent();
            objService       = new BookService();
            partnerService   = new PartnerService();
            groupTourService = new GroupTourService();
            this.objectDataSource2.DataSource = objService.GetListBookedDoneReportPartner(partnerID, month, year, true);
            string title = "CÔNG NỢ THÁNG " + month + "/" + year;

            lblTitle.Text = title.ToUpper();
            Partner p = partnerService.GetByID(partnerID);

            lblPartnerName.Text  = p.Name;
            lblPartnerPhone.Text = p.Phone;
        }
示例#37
0
 public bool IsUniqueEmail(string accessId, string Email, int Id)
 {
     try
     {
         return(PartnerService.IsUniqueEmail(Email, Id));
     }
     catch (Exception)
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
         {
             Content      = new StringContent("An error occurred, please try again or contact the administrator."),
             ReasonPhrase = "Critical Exception"
         });
     }
 }
示例#38
0
 public bool ForgotPassword(string Email)
 {
     try
     {
         return(PartnerService.ForgotPassword(Email));
     }
     catch (Exception)
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
         {
             Content      = new StringContent("An error occurred, please try again or contact the administrator."),
             ReasonPhrase = "Critical Exception"
         });
     }
 }
示例#39
0
 public MobilePartnerController(PartnerService partnerService, ChurchService churchService, IUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
     _partnerService = partnerService;
     _churchService = churchService;
 }
示例#40
0
        public ActionResult Edit(int id)
        {
            PartnerService service = new PartnerService();
            var item = service.FirstOrDefault(p => p.PartnerID == id);

            if (item != null)
            {
                EditPartnerModel model = new EditPartnerModel()
                {
                    Id = id,
                    Address = item.Address,
                    ContactName = item.ContactName,
                    Description = item.Description,
                    LogoPath = item.LogoPath,
                    Name = item.Name,
                    PartnerType = item.PartnerType,
                    PhoneNumber1 = item.PhoneNumber1,
                    PhoneNumber2 = item.PhoneNumber2
                };
                return View(model);
            }
            return View();
        }
示例#41
0
 public PartnerLookUpController(PartnerService partnerService)
 {
     _partnerService = partnerService;
 }
示例#42
0
        public ActionResult Edit(EditPartnerModel model, int id, HttpPostedFileBase Logo)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Partner partner = new Partner()
                    {
                        PartnerID = id,
                        Name = model.Name,
                        Address = model.Address,
                        ContactName = model.ContactName,

                        UpdatedUserID = SessionManager.UserInfo.UserID,
                        Description = model.Description,
                        PartnerType = model.PartnerType,
                        PhoneNumber1 = model.PhoneNumber1,
                        PhoneNumber2 = model.PhoneNumber2,
                        LogoPath = model.LogoPath,
                    };
                    PartnerService service = new PartnerService();
                    service.Edit(partner, Logo);
                    return RedirectToAction("Index", "Partner");
                }
                // TODO: Add update logic here

            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error500", ex.Message);
            }
            return View(model);
        }
示例#43
0
 public PartnerGridController(PartnerService partnerService)
 {
     _partnerService = partnerService;
 }
示例#44
0
 public ActionResult Index()
 {
     PartnerService service = new PartnerService();
     string status = EntityStates.Activated.ToString();
     PartnerIndexModel model = new PartnerIndexModel()
     {
         Partners = service.GetPaged(p => p.Status == status,
             new IOrderByClause<Partner>[] { new OrderByClause<Partner, int>(p => p.PartnerID, SortDirection.Decending) },
             1,
             100)
     };
     return View(model);
 }