Пример #1
0
        public IHttpActionResult Get(int id)
        {
            LeadService leadService = CreateLeadService();
            var         lead        = leadService.GetLeadByID(id);

            return(Ok(lead));
        }
Пример #2
0
        public LeadService CreateLeadService()
        {
            var LeadId  = Guid.Parse(User.Identity.GetUserId());
            var service = new LeadService(LeadId);

            return(service);
        }
Пример #3
0
        public ActionResult LeadEdit(int id, LeadEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.LeadID != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }

            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new LeadService(userId);

            if (service.UpdateLead(model))
            {
                TempData["SaveResult"] = "Your Lead was updated.";
                return(RedirectToAction("LeadIndex"));
            }

            ModelState.AddModelError("", "Your Lead could not be updated.");
            return(View(model));
        }
Пример #4
0
        private LeadService CreateLeadService()
        {
            //var userId = Guid.Parse(User.Identity.GetUserId()); Not sure what this is used for, copied from elevenNote
            var leadService = new LeadService();//NoteService(userId);

            return(leadService);
        }
Пример #5
0
        public ActionResult Index()
        {
            var service = new LeadService();
            var model   = service.GetLeads();

            return(View(model));
        }
Пример #6
0
        public SearchLeadDataDialog(StateAccessors accessors, ILoggerFactory loggerFactory, BotServices botServices, IServiceProvider serviceProvider) : base(nameof(SearchLeadDataDialog))
        {
            _accessors       = accessors;
            _loggerFactory   = loggerFactory;
            _botServices     = botServices;
            _serviceProvider = serviceProvider;

            _leadService = (LeadService)_serviceProvider.GetService(typeof(LeadService));

            var waterfallSteps = new WaterfallStep[]
            {
                InitializeStateStepAsync,
                AskForLeadFullNameStepAsync,
                SearchLeadStepAsync,
                ResultHandlerStepAsync,
                EndSearchDialogStepAsync
            };

            var culture = CulturedBot.Culture?.Name;

            AddDialog(new WaterfallDialog(_searchLeadDataWaterfall, waterfallSteps));
            AddDialog(new TextPrompt(_leadFullNamePrompt));
            AddDialog(new TextPrompt(_retryFetchingMinimumDataFromUserPrompt /*, defaultLocale: culture*/));
            AddDialog(new TextPrompt(_confirmForwardingPrompt /*, defaultLocale: culture*/));
        }
Пример #7
0
        public IHttpActionResult Get()
        {
            LeadService leadService = CreateLeadService();
            var         leads       = leadService.GetLeads();

            return(Ok(leads));
        }
Пример #8
0
        public ActionResult Delete(int id)
        {
            var service = new LeadService();
            var model   = service.GetLeadByID(id);

            return(View(model));
        }
Пример #9
0
        /// <summary>
        /// Create a Service Lead
        /// </summary>
        /// <param name="ownerPartyId"></param>
        /// <param name="orgExternalRef"></param>
        /// <param name="contactExternalRef"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public long?CreateServiceLead(long?ownerPartyId, long?orgExternalRef, long?contactExternalRef, string name)
        {
            ILeadService service = LeadService.GetService();
            LeadModel    model   = new LeadModel();

            model.Name = name;

            if (orgExternalRef != null)
            {
                model.CustomerId          = (long)orgExternalRef;
                model.CustomerIdSpecified = true;
            }

            model.OwnerId                   = (long)ownerPartyId;
            model.OwnerIdSpecified          = true;
            model.PrimaryContactId          = (long)contactExternalRef;
            model.PrimaryContactIdSpecified = true;

            LeadModel result = service.CreateServiceLead(model);

            if (result != null && result.LeadId != null)
            {
                return(result.LeadId);
            }
            return(null);
        }
Пример #10
0
        public ActionResult Delete(int id)
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new LeadService(userId);
            var model   = service.GetLeadById(id);

            return(View(model));
        }
Пример #11
0
 public CrmService(TokenService tokenService, LeadService leadService, ChatLogService chatlogService, CrmSession session)
 {
     _tokenService   = tokenService;
     _chatLogService = chatlogService;
     _leadService    = leadService;
     _session        = session;
     _session.AuthenticationResult = Connect();
 }
Пример #12
0
        // GET: Lead
        public ActionResult LeadIndex()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new LeadService(userId);
            var model   = service.GetLead();

            return(View(model));
        }
Пример #13
0
        public virtual Task <IAppLead> Create()
        {
            var             crmService     = StartupHelper.CreateCrmService();
            ILeadRepository leadrepository = new LeadRepository();
            ILeadService    leadservice    = new LeadService(crmService, leadrepository);
            IAppLead        app            = new AppLead(leadservice);

            return(Task.FromResult(app));;
        }
Пример #14
0
        public ActionResult DeletePost(int id)
        {
            var service = new LeadService();

            service.DeleteLead(id);

            TempData["SaveResult"] = "Your lead was deleted";

            return(RedirectToAction("Index"));
        }
 public ActionResult CreateLeadService(LeadService objLeadService)
 {
     if (objLeadService.LeadId != null && objLeadService.ServiceId != null)
     {
         db.LeadService.Add(objLeadService);
         db.SaveChanges();
         return(View());
     }
     ViewBag.ThongBao = "Vui lòng chọn khách hàng, dịch vụ";
     return(View());
 }
Пример #16
0
        public async Task GetLeadsReturnsExpectedExceptionMessage()
        {
            //Arrange

            var entity = new SFSimpleLeadResults()
            {
                LeadGuid      = new Guid(),
                CustomerGuid  = Guid.NewGuid(),
                CAPTier       = "CAP",
                BillAccount   = "123456789",
                CMCCustomerID = 1,
                CustomerName  = "Test Customer",
                PhoneNumber   = "9999999999",
                Email         = "*****@*****.**",
                County        = "TestCounty",
                STAddress     = "999 Test st.",
                ZipCode       = "99999"
            };

            List <SFSimpleLeadResults> entityList = new List <SFSimpleLeadResults> {
                entity
            };

            MoqLeadRepository.Setup(s => s.GetSfLeads(It.IsAny <SearchLeadSimple>(), It.IsAny <LogCommand>())).ThrowsAsync(new Exception("Lead Repository Exception"));

            var leadService = new LeadService(MoqLeadRepository.Object
                                              , MoqERMSCustomer.Object
                                              , MoqcontactRepository.Object
                                              //, MoqphoneRepository.Object
                                              //, MoqemailRepository.Object
                                              , MoqaddressRepository.Object
                                              , MoqusageRepository.Object
                                              , MoqprogramRepository.Object
                                              , MoqcustomerRepository.Object
                                              , MoqcdcRepository.Object
                                              , MoqLogInstance.Object
                                              , MoqLogCommandHandlerDecorator.Object);

            //Act
            GenericServiceResponse serviceResponse = await leadService.GetLead(new SearchLeadSimple()
            {
                CustomerName = "Test Customer"
            }, LogCommand);

            UnitTestHelpers.AddTestContextFromServiceResponse(entityList, serviceResponse, TestContext, false, "Lead Repository Exception");

            //Verify services repo is called one time
            MoqLeadRepository.Verify(s => s.GetSfLeads(It.IsAny <SearchLeadSimple>(), It.IsAny <LogCommand>()), Times.AtLeastOnce);

            Assert.IsFalse(serviceResponse.Success);
            Assert.IsNotNull(serviceResponse.OperationException);
            Assert.AreEqual("Lead Repository Exception", serviceResponse.OperationException.Message);
            Assert.IsNull(serviceResponse.Entity);
        }
Пример #17
0
        public ActionResult LeadDelete(int id)
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new LeadService(userId);

            service.DeleteLead(id);

            TempData["SaveResult"] = "Your Lead was deleted";

            return(RedirectToAction("LeadIndex"));
        }
Пример #18
0
        public CreateOpportunityDialog(StateAccessors accessors, ILoggerFactory loggerFactory,
                                       BotServices botServices, IServiceProvider serviceProvider) : base(nameof(CreateOpportunityDialog))
        {
            _accessors       = accessors;
            _loggerFactory   = loggerFactory;
            _botServices     = botServices;
            _serviceProvider = serviceProvider;

            _leadService        = (LeadService)_serviceProvider.GetService(typeof(LeadService));
            _opportunityService = (OpportunityService)_serviceProvider.GetService(typeof(OpportunityService));
            _productService     = (ProductService)_serviceProvider.GetService(typeof(ProductService));

            var waterfallSteps = new WaterfallStep[]
            {
                //Start of dialog
                InitializeStateStepAsync,
                //Searching for lead
                AskForLeadFullNameStepAsync,
                SearchLeadStepAsync,
                LeadResultHandlerStepAsync,
                //Searching for product
                AskForProductNameStepAsync,
                SearchProductStepAsync,
                ProductResultHandlerStepAsync,
                //Checking the closing date
                AskForClosingDateStepAsync,
                SearchClosingDateStepAsync,
                ClosingDateResultHandlerStepAsync,
                //Checking for comment
                AskIfUserWantsToCommentStepAsync,
                AskToCommentStepAsync,
                FetchingCommentFromUserStepAsync,
                //End of Dialog
                EndSearchDialogStepAsync
            };

            var culture = CulturedBot.Culture?.Name;

            AddDialog(new WaterfallDialog(_createOpportunityDataWaterfall, waterfallSteps));
            //Searching for lead
            AddDialog(new TextPrompt(_leadFullNamePrompt));
            AddDialog(new TextPrompt(_retryFetchingLeadFromUserPrompt /*, defaultLocale: culture*/));
            //Searching for product
            AddDialog(new TextPrompt(_productNamePrompt));
            AddDialog(new TextPrompt(_retryFetchingProductFromUserPrompt /*, defaultLocale: culture*/));
            //Checking the closing date
            AddDialog(new TextPrompt(_closingDatePrompt));
            AddDialog(new TextPrompt(_retryFetchingClosingDateFromUserPrompt /*, defaultLocale: culture*/));
            //Checking for comment
            AddDialog(new TextPrompt(_commentPrompt /*, defaultLocale: culture*/));
            AddDialog(new TextPrompt(_fetchingCommentFromUserPrompt));
        }
Пример #19
0
        public void _01_ShouldGetLeads()
        {
            var session    = CrmSession.CreateDefault();
            var service    = new TokenService();
            var authResult = service.GetAccessToken(session);

            Assert.IsFalse(string.IsNullOrEmpty(authResult.AccessToken));

            var leadService = new LeadService();
            var leads       = leadService.GetLeads(session);

            Assert.IsTrue(leads.Count() > 0);
        }
        public ActionResult ModifyLeadService(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }
            LeadService objLeadService = db.LeadService.FirstOrDefault(x => x.Id == id);

            if (objLeadService == null)
            {
                return(HttpNotFound());
            }
            return(View(objLeadService));
        }
Пример #21
0
        public ActionResult LeadCreate(LeadCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new LeadService(userId);

            service.CreateLead(model);

            return(RedirectToAction("LeadIndex"));
        }
Пример #22
0
        public ActionResult Create(LeadCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }


            var service = new LeadService();

            service.CreateLead(model);

            return(RedirectToAction("Index"));
        }
        public ActionResult LeadServiceDelete(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }
            LeadService objLeadService = db.LeadService.FirstOrDefault(x => x.Id == id);

            if (objLeadService == null)
            {
                return(HttpNotFound());
            }
            db.Entry(objLeadService).State = System.Data.Entity.EntityState.Deleted;
            db.SaveChanges();
            return(RedirectToAction("Index", "LeadService"));
        }
Пример #24
0
        public ActionResult Edit(int id)

        {
            var service = new LeadService();
            var detail  = service.GetLeadByID(id);
            var model   =
                new LeadEdit
            {
                ID        = detail.ID,
                Name      = detail.Name,
                Company   = detail.Company,
                Phone     = detail.Phone,
                Email     = detail.Email,
                Converted = detail.Converted
            };

            return(View(model));
        }
Пример #25
0
        public ActionResult LeadEdit(int id)
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new LeadService(userId);
            var detail  = service.GetLeadById(id);
            var model   =
                new LeadEdit
            {
                LeadID             = detail.LeadID,
                Role               = detail.Role,
                Company            = detail.Company,
                StatusID           = detail.StatusID,
                SourceID           = detail.SourceID,
                JobDescriptionLink = detail.JobDescriptionLink,
                ResumeID           = detail.ResumeID,
                CoverID            = detail.CoverID,
                OtherArtifactID    = detail.OtherArtifactID,
                CreatedUtc         = DateTimeOffset.Now
            };

            return(View(model));
        }
Пример #26
0
        public void _02_CreateLeads()
        {
            var session    = CrmSession.CreateDefault();
            var service    = new TokenService();
            var authResult = service.GetAccessToken(session);

            Assert.IsFalse(string.IsNullOrEmpty(authResult.AccessToken));

            var lead = new LeadModel
            {
                Firstname     = "Morten",
                Lastname      = "Stanley",
                Emailaddress1 = "*****@*****.**",
                Mobilephone   = "13917163120",
                Telephone1    = "8485000"
            };

            var leadService = new LeadService();

            leadService.CreateLead(lead, session);
            Assert.IsFalse(string.IsNullOrEmpty(lead.CreatedLeadGuid));
        }
Пример #27
0
        static void Main(string[] args)
        {
            try
            {
                LeadService service = new LeadService();


                using (IDbConnection connection = new SqlConnection("Server=.;Database=MasterDb;User ID=sa;Password=123;"))
                {
                    connection.Open();
                    var multi     = connection.QueryMultiple("select * from SysAccounts;select COUNT(*) from SysAccounts");
                    var accounts  = multi.Read <SysAccount>(false).ToList();
                    var account2s = multi.Read <int>().First();
                };
            }
            catch (Exception ex)
            {
                throw ex;
            }

            Console.WriteLine("Hello World!");
            Console.ReadLine();
        }
Пример #28
0
        public ActionResult Edit(int id, LeadEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.ID != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }

            var service = new LeadService();

            if (service.UpdateLead(model))
            {
                TempData["SaveResult"] = "Lead Details Successfully Updated";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Failed to Update Lead");
            return(View(model));
        }
Пример #29
0
        public DataWrapper GetInventory([FromBody] string jsonString)
        {
            Query query;

            try { query = JsonConvert.DeserializeObject <Query>(jsonString); }
            catch { throw new HttpResponseException(HttpStatusCode.NotFound); }


            #region - STEP 1: Create search-criteria model

            var searchCriteria = new SearchCriteria
            {
                Zipcode     = query.Zipcode,
                MaxPrice    = query.MaxPrice,
                MaxMileage  = query.MaxMileage,
                RadiusMiles = query.RadiusMiles,
                Skip        = query.Page.Skip,
                Take        = query.Page.Take,
                Sort        = new SearchCriteria.Dto.Sort(query.Sort.By, query.Sort.Direction),

                MakeModelComboFilter    = new MakeModelComboFilter(query.Filters.MakeIds, query.Filters.MakeIdModels),
                CategoryMakeComboFilter = new CategoryMakeComboFilter(query.Filters.CategoryIds, query.Filters.CategoryIdMakes),
                PriceRangeFilter        = new PriceRangeFilter(query.Filters.PriceRange),
                MileageRangeFilter      = new MileageRangeFilter(query.Filters.MileageRange),
                YearRangeFilter         = new YearRangeFilter(query.Filters.YearRange),
                FuelTypeFilter          = new FuelTypeFilter(query.Filters.FuelTypeIds),
                OptionBitsFilter        = new OptionBitsFilter(query.Filters.OptionIds)
            };

            #endregion


            #region - STEP 2: Query service and create response model

            var searchResults = CarsForSaleService.SearchAsync(searchCriteria).Result;

            // if we have a page requested that no longer has any inventory,
            // we will reset the page to 1, requery, and return page number one's results.
            if (!searchResults.CarsForSale.Any() && query.Page.Current > 1)
            {
                query.Page.Current  = 1;
                searchCriteria.Skip = query.Page.Skip;
                searchResults       = CarsForSaleService.SearchAsync(searchCriteria).Result;
            }

            List <int> autonationDealers = LeadService.GetLeadAutonationUsedCarDealers();

            var response = new Response
            {
                Zipcode                = query.Zipcode,
                InventoryCount         = searchResults.InventoryCount,
                MaxPrice               = searchResults.MaxPrice,
                MaxMileage             = searchResults.MaxMileage,
                MinPrice               = searchResults.MinPrice,
                MinMileage             = searchResults.MinMileage,
                PriceGroupQuantities   = searchResults.PriceGroupQuantities,
                MileageGroupQuantities = searchResults.MileageGroupQuantities,
                Page = new Page
                {
                    Current      = searchResults.Page.Current,
                    ItemsPerPage = searchResults.Page.ItemsPerPage,
                    TotalPages   = searchResults.Page.TotalPages
                },
                CarsForSale = searchResults.CarsForSale
                              .Select(c => new CarForSale
                {
                    Id                = c.Id,
                    Vin               = c.Vin,
                    MakeId            = c.MakeId,
                    Make              = c.Make,
                    Model             = c.Model,
                    Year              = c.Year,
                    IsNewStatus       = c.IsNewStatus,
                    CityMpg           = c.CityMpg,
                    HighwayMpg        = c.HighwayMpg,
                    Mileage           = c.Mileage.ToString("#,###"),
                    HasMissingMileage = c.Mileage <= 0,
                    AskingPrice       = c.HasValidAskingPrice ? c.AskingPrice.ToString("#,###") : String.Empty,
                    HasMissingPrice   = !c.HasValidAskingPrice,
                    Cylinders         = c.Cylinders.ToString(CultureInfo.InvariantCulture),
                    ExteriorColor     = c.ExteriorColor,
                    InteriorColor     = c.InteriorColor,
                    DriveType         = c.DriveType,
                    TransmissionType  = c.TransmissionType,
                    Distance          = c.DistanceInMiles,
                    PrimaryImageUrl   = c.PrimaryImage.IsNotNullOrEmpty() ? c.PrimaryImage : String.Empty,
                    Details           = (query.IsDetailPage ? c.VehicleDetails : null),
                    Dealer            = new Dealer
                    {
                        Id               = c.Dealer.Id,
                        Name             = c.Dealer.Name,
                        Phone            = c.Dealer.Phone,
                        City             = c.Dealer.City,
                        State            = c.Dealer.State,
                        IsTrusted        = c.Dealer.IsPremiumPlacement,
                        Message          = (query.IsDetailPage ? c.Dealer.Message : null),
                        Latitude         = c.Dealer.Latitude,
                        Longitude        = c.Dealer.Longitude,
                        AutonationDealer = autonationDealers.Contains(c.Dealer.Id)
                    },
                    DealerHours = new DealerHours
                    {
                        SalesMonOpen  = GetDealerHour(c.Dealer.Id, "SalesMonOpen"),
                        SalesMonClose = GetDealerHour(c.Dealer.Id, "SalesMonClose"),
                        SalesTueOpen  = GetDealerHour(c.Dealer.Id, "SalesTueOpen"),
                        SalesTueClose = GetDealerHour(c.Dealer.Id, "SalesTueClose"),
                        SalesWedOpen  = GetDealerHour(c.Dealer.Id, "SalesWedOpen"),
                        SalesWedClose = GetDealerHour(c.Dealer.Id, "SalesWedClose"),
                        SalesThrOpen  = GetDealerHour(c.Dealer.Id, "SalesThrOpen"),
                        SalesThrClose = GetDealerHour(c.Dealer.Id, "SalesThrClose"),
                        SalesFriOpen  = GetDealerHour(c.Dealer.Id, "SalesFriOpen"),
                        SalesFriClose = GetDealerHour(c.Dealer.Id, "SalesFriClose"),
                        SalesSatOpen  = GetDealerHour(c.Dealer.Id, "SalesSatOpen"),
                        SalesSatClose = GetDealerHour(c.Dealer.Id, "SalesSatClose"),
                        SalesSunOpen  = GetDealerHour(c.Dealer.Id, "SalesSunOpen"),
                        SalesSunClose = GetDealerHour(c.Dealer.Id, "SalesSunClose")
                    }
                })
            };

            #endregion


            #region - Handle additional data for the vehicle detail page (singles)

            if (query.IsDetailPage && response.CarsForSale.Any())
            {
                var car            = response.CarsForSale.ToList()[0];
                var additionalData = CarsForSaleService.GetCarForSaleByDealerIdByInventoryId(car.Dealer.Id, car.Id);

                if (additionalData != null)
                {
                    car.SellerNotes    = additionalData.SellerNotes;
                    car.ImageUrls      = additionalData.ImageUrls;
                    car.Details        = additionalData.VehicleDetails;
                    car.Dealer.Message = additionalData.Dealer.Message;
                }

                response.CarsForSale = new List <CarForSale> {
                    car
                };
            }

            #endregion


            return(DataWrapper(response, response.CarsForSale.Count()));
        }
Пример #30
0
        public PdfManager GenerateLeadsReport()
        {
            LeadService _leadService    = new LeadService();
            FileInfo    file            = new FileInfo(pdfDestination);
            var         fontDestination = System.IO.Path.Combine(targetFolder, "times.ttf");

            //document settings
            pdfDoc = new PdfDocument(new PdfWriter(pdfDestination));
            pdfDoc.SetDefaultPageSize(PageSize.A4);
            document = new Document(pdfDoc, PageSize.A4, false).SetFontSize(12);
            //set header
            PdfFont font = PdfFontFactory.CreateFont(fontDestination, PdfEncodings.IDENTITY_H, true);
            PdfFont bold = PdfFontFactory.CreateFont(StandardFonts.TIMES_BOLD);

            Paragraph docHeader = new Paragraph("Potential Customers (Leads) Report").SetTextAlignment(TextAlignment.CENTER)
                                  .SetFontSize(headerFontSize).SetFont(bold);
            //set logo
            Image logo = new Image(ImageDataFactory
                                   .Create(logoFile))
                         .SetTextAlignment(TextAlignment.LEFT).SetHeight(60).SetWidth(60);

            document.Add(logo);
            document.Add(docHeader);

            var   currentItem = 1;
            Table table       = new Table(UnitValue.CreatePercentArray(7), false).SetFont(font);

            table.SetWidth(UnitValue.CreatePercentValue(100));
            table.SetFixedLayout();

            Cell c11 = new Cell(1, 1).SetTextAlignment(TextAlignment.CENTER).SetFontSize(fontSize).SetTextRenderingMode(PdfCanvasConstants.TextRenderingMode.FILL_STROKE).SetStrokeWidth(0.3f).SetStrokeColor(DeviceGray.BLACK).Add(new Paragraph("No."));
            Cell c12 = new Cell(1, 1).SetTextAlignment(TextAlignment.CENTER).SetFontSize(fontSize).SetTextRenderingMode(PdfCanvasConstants.TextRenderingMode.FILL_STROKE).SetStrokeWidth(0.3f).SetStrokeColor(DeviceGray.BLACK).Add(new Paragraph("Lead's name"));
            Cell c13 = new Cell(1, 1).SetTextAlignment(TextAlignment.CENTER).SetFontSize(fontSize).SetTextRenderingMode(PdfCanvasConstants.TextRenderingMode.FILL_STROKE).SetStrokeWidth(0.3f).SetStrokeColor(DeviceGray.BLACK).Add(new Paragraph("Company"));
            Cell c14 = new Cell(1, 1).SetTextAlignment(TextAlignment.CENTER).SetFontSize(fontSize).SetTextRenderingMode(PdfCanvasConstants.TextRenderingMode.FILL_STROKE).SetStrokeWidth(0.3f).SetStrokeColor(DeviceGray.BLACK).Add(new Paragraph("Email Address"));
            Cell c15 = new Cell(1, 1).SetTextAlignment(TextAlignment.CENTER).SetFontSize(fontSize).SetTextRenderingMode(PdfCanvasConstants.TextRenderingMode.FILL_STROKE).SetStrokeWidth(0.3f).SetStrokeColor(DeviceGray.BLACK).Add(new Paragraph("Phone Number"));
            Cell c16 = new Cell(1, 1).SetTextAlignment(TextAlignment.CENTER).SetFontSize(fontSize).SetTextRenderingMode(PdfCanvasConstants.TextRenderingMode.FILL_STROKE).SetStrokeWidth(0.3f).SetStrokeColor(DeviceGray.BLACK).Add(new Paragraph("Lead Owner"));
            Cell c17 = new Cell(1, 1).SetTextAlignment(TextAlignment.CENTER).SetFontSize(fontSize).SetTextRenderingMode(PdfCanvasConstants.TextRenderingMode.FILL_STROKE).SetStrokeWidth(0.3f).SetStrokeColor(DeviceGray.BLACK).Add(new Paragraph("Source"));

            table.AddHeaderCell(c11);
            table.AddHeaderCell(c12);
            table.AddHeaderCell(c13);
            table.AddHeaderCell(c14);
            table.AddHeaderCell(c15);
            table.AddHeaderCell(c16);
            table.AddHeaderCell(c17);

            var leadList = _leadService.GetLeadList(pageSize: 99999, currentPage: 1, sort: new List <string> {
                "asc.name"
            });

            foreach (var lead in leadList.leads)
            {
                table.AddCell(new Cell(1, 1).SetTextAlignment(TextAlignment.CENTER).SetFontSize(fontSize).Add(new Paragraph(currentItem.ToString())));
                table.AddCell(new Cell(1, 1).SetTextAlignment(TextAlignment.CENTER).SetFontSize(fontSize).Add(new Paragraph(lead.name ?? "")));
                table.AddCell(new Cell(1, 1).SetTextAlignment(TextAlignment.CENTER).SetFontSize(fontSize).Add(new Paragraph(lead.companyName ?? "")));
                table.AddCell(new Cell(1, 1).SetTextAlignment(TextAlignment.CENTER).SetFontSize(fontSize).Add(new Paragraph(lead.email ?? "")));
                table.AddCell(new Cell(1, 1).SetTextAlignment(TextAlignment.CENTER).SetFontSize(fontSize).Add(new Paragraph(lead.phone ?? "")));
                table.AddCell(new Cell(1, 1).SetTextAlignment(TextAlignment.CENTER).SetFontSize(fontSize).Add(new Paragraph(lead.leadOwner ?? "")));
                table.AddCell(new Cell(1, 1).SetTextAlignment(TextAlignment.CENTER).SetFontSize(fontSize).Add(new Paragraph(lead.leadSource ?? "")));
                currentItem++;
            }

            document.Add(table);

            document.Add(new Paragraph(new Text("\n")));

            var dateSignature = new Paragraph("Hanoi, " + DateTime.Now.ToString("D")).SetTextAlignment(TextAlignment.RIGHT).SetMarginRight(30);

            //.SetFixedPosition(PageSize.A4.GetRight() - 170, PageSize.A4.GetBottom() + 80, 150);
            document.Add(dateSignature);
            document.Add(new Paragraph(new Text("\n\n")));
            document.Add(new Paragraph(new Text("Signature: ________________________")).SetTextAlignment(TextAlignment.RIGHT).SetMarginRight(0));


            int numberOfPages = pdfDoc.GetNumberOfPages();

            for (int i = 1; i <= numberOfPages; i++)
            {
                document.ShowTextAligned(new Paragraph(String
                                                       .Format(i.ToString())),
                                         559, PageSize.A4.GetBottom() + 20, i, TextAlignment.RIGHT,//806
                                         VerticalAlignment.BOTTOM, 0);
            }
            document.Close();
            return(this);
        }