[Test] //ExSkip
        public void CustomDataSource()
        {
            // Create a destination document for the mail merge
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            builder.InsertField(" MERGEFIELD FullName ");
            builder.InsertParagraph();
            builder.InsertField(" MERGEFIELD Address ");

            // Create some data that we will use in the mail merge
            CustomerList customers = new CustomerList();

            customers.Add(new Customer("Thomas Hardy", "120 Hanover Sq., London"));
            customers.Add(new Customer("Paolo Accorti", "Via Monte Bianco 34, Torino"));

            // To be able to mail merge from your own data source, it must be wrapped
            // into an object that implements the IMailMergeDataSource interface
            CustomerMailMergeDataSource dataSource = new CustomerMailMergeDataSource(customers);

            // Now you can pass your data source into Aspose.Words
            doc.MailMerge.Execute(dataSource);

            doc.Save(ArtifactsDir + "MailMergeCustom.CustomDataSource.docx");
            TestCustomDataSource(customers, new Document(ArtifactsDir + "MailMergeCustom.CustomDataSource.docx")); //ExSkip
        }
Exemplo n.º 2
0
        public void MailMergeCustomDataSource()
        {
            // Create some data that we will use in the mail merge.
            CustomerList customers = new CustomerList();

            customers.Add(new Customer("Thomas Hardy", "120 Hanover Sq., London"));
            customers.Add(new Customer("Paolo Accorti", "Via Monte Bianco 34, Torino"));

            // Create some data for nesting in the mail merge.
            customers[0].Orders.Add(new Order("Rugby World Cup Cap", 2));
            customers[0].Orders.Add(new Order("Rugby World Cup Ball", 1));
            customers[1].Orders.Add(new Order("Rugby World Cup Guide", 1));

            // Open the template document.
            Document doc = new Document(MyDir + "NestedMailMerge.CustomDataSource.doc");

            // To be able to mail merge from your own data source, it must be wrapped
            // into an object that implements the IMailMergeDataSource interface.
            CustomerMailMergeDataSource customersDataSource = new CustomerMailMergeDataSource(customers);

            // Now you can pass your data source into Aspose.Words.
            doc.MailMerge.ExecuteWithRegions(customersDataSource);

            doc.Save(MyDir + @"\Artifacts\NestedMailMerge.CustomDataSource.doc");
        }
        public static void Run()
        {
            //ExStart:NestedMailMergeCustom
            // The path to the documents directory.
            string dataDir  = RunExamples.GetDataDir_MailMergeAndReporting();
            string fileName = "NestedMailMerge.CustomDataSource.doc";
            // Create some data that we will use in the mail merge.
            CustomerList customers = new CustomerList();

            customers.Add(new Customer("Thomas Hardy", "120 Hanover Sq., London"));
            customers.Add(new Customer("Paolo Accorti", "Via Monte Bianco 34, Torino"));

            // Create some data for nesting in the mail merge.
            customers[0].Orders.Add(new Order("Rugby World Cup Cap", 2));
            customers[0].Orders.Add(new Order("Rugby World Cup Ball", 1));
            customers[1].Orders.Add(new Order("Rugby World Cup Guide", 1));

            // Open the template document.
            Document doc = new Document(dataDir + fileName);

            // To be able to mail merge from your own data source, it must be wrapped
            // into an object that implements the IMailMergeDataSource interface.
            CustomerMailMergeDataSource customersDataSource = new CustomerMailMergeDataSource(customers);

            // Now you can pass your data source into Aspose.Words.
            doc.MailMerge.ExecuteWithRegions(customersDataSource);

            dataDir = dataDir + RunExamples.GetOutputFilePath(fileName);
            doc.Save(dataDir);
            //ExEnd:NestedMailMergeCustom

            Console.WriteLine("\nMail merge performed with nested custom data successfully.\nFile saved at " + dataDir);
        }
        public static void Run()
        {
            // ExStart:NestedMailMergeCustom
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_MailMergeAndReporting();
            string fileName = "NestedMailMerge.CustomDataSource.doc";
            // Create some data that we will use in the mail merge.
            CustomerList customers = new CustomerList();
            customers.Add(new Customer("Thomas Hardy", "120 Hanover Sq., London"));
            customers.Add(new Customer("Paolo Accorti", "Via Monte Bianco 34, Torino"));

            // Create some data for nesting in the mail merge.
            customers[0].Orders.Add(new Order("Rugby World Cup Cap", 2));
            customers[0].Orders.Add(new Order("Rugby World Cup Ball", 1));
            customers[1].Orders.Add(new Order("Rugby World Cup Guide", 1));

            // Open the template document.
            Document doc = new Document(dataDir + fileName);

            // To be able to mail merge from your own data source, it must be wrapped
            // Into an object that implements the IMailMergeDataSource interface.
            CustomerMailMergeDataSource customersDataSource = new CustomerMailMergeDataSource(customers);

            // Now you can pass your data source into Aspose.Words.
            doc.MailMerge.ExecuteWithRegions(customersDataSource);          

            dataDir = dataDir + RunExamples.GetOutputFilePath(fileName);
            doc.Save(dataDir);
            // ExEnd:NestedMailMergeCustom

            Console.WriteLine("\nMail merge performed with nested custom data successfully.\nFile saved at " + dataDir);
        }
Exemplo n.º 5
0
        static void TestCustomerListIndexers()
        {
            CustomerList cList = new CustomerList();
            Customer     c1    = new Customer(
                "Mickey", "Mouse", "*****@*****.**");
            Customer c3 = new Customer(
                "Minnie", "Mouse", "*****@*****.**");

            cList.Add(c1);
            cList.Add("Donald", "Duck", "*****@*****.**");
            cList += c3;

            Console.WriteLine("Testing indexer");
            Console.WriteLine("Get Customer with index 0");
            Customer c4 = cList[0];

            Console.WriteLine("Expecting Mickey. " + c4);
            Console.WriteLine("Shouldn't alter the list. Expecting count of 3 " + cList.Count);
            Console.WriteLine("Expecting list of 3 Customers.  Mickey is the first element in list:\n" + cList);

            Console.WriteLine("Get Customer with email of [email protected]");
            Customer c5 = cList["*****@*****.**"];

            Console.WriteLine("Expecting Minnie " + c5);
            Console.WriteLine("Shouldn't alter the list. Expecting count of 3 " + cList.Count);
            Console.WriteLine("Expecting list of 3 Customers.  Minnie is the third element in list:\n" + cList);

            Console.WriteLine("Set Customer with index 0");
            cList[0] = c3;
            Console.WriteLine("Shouldn't alter the length of the list. Expecting count of 3 " + cList.Count);
            Console.WriteLine("Expecting list of 3 Customers.  Minie is the first element in list as well as the last:\n" + cList);

            // I didn't test the indexer with a number < 0 or > the length of the list, but I should have
            // I didn't test the indexer with a Customer code that's not in the list, but I should have.
        }
        public void MailMergeCustomDataSource()
        {
            //ExStart
            //ExFor:IMailMergeDataSource
            //ExFor:IMailMergeDataSource.TableName
            //ExFor:IMailMergeDataSource.MoveNext
            //ExFor:IMailMergeDataSource.GetValue
            //ExFor:IMailMergeDataSource.GetChildDataSource
            //ExFor:MailMerge.Execute(IMailMergeDataSource)
            //ExSummary:Performs mail merge from a custom data source.
            // Create some data that we will use in the mail merge.
            CustomerList customers = new CustomerList();

            customers.Add(new Customer("Thomas Hardy", "120 Hanover Sq., London"));
            customers.Add(new Customer("Paolo Accorti", "Via Monte Bianco 34, Torino"));

            // Open the template document.
            Document doc = new Document(MyDir + "MailMerge.CustomDataSource.doc");

            // To be able to mail merge from your own data source, it must be wrapped
            // into an object that implements the IMailMergeDataSource interface.
            CustomerMailMergeDataSource customersDataSource = new CustomerMailMergeDataSource(customers);

            // Now you can pass your data source into Aspose.Words.
            doc.MailMerge.Execute(customersDataSource);

            doc.Save(MyDir + @"\Artifacts\MailMerge.CustomDataSource.doc");
        }
Exemplo n.º 7
0
        static void TestCustomerListIndexers()
        {
            Console.WriteLine("Testing Indexers...");

            // make a CustomerList and two Customers
            CustomerList cList = new CustomerList();
            Customer     c1    = new Customer("Simon", "Wiggle", "*****@*****.**");
            Customer     c2    = new Customer("Emma", "Wiggle", "*****@*****.**");

            // add the customers to the customerlist
            cList.Add(c1);
            cList += c2;
            cList.Add("Anton", "Wiggle", "*****@*****.**");

            Console.WriteLine("Testing indexer...");
            Console.WriteLine("Getting customer with index 0");
            Customer c4 = cList[0];

            Console.WriteLine("Expecting Simon Wiggle\n" + c4);
            Console.WriteLine("Shouldn't alter the list. Expecting list of 3:\n" + cList);
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
            // Although I didn't, I ought to test for an index < 0, and > the length of the cList.
        }
Exemplo n.º 8
0
        static void TestCustomerListIndex()
        {
            CustomerList cl = new CustomerList();
            Customer     c  = new Customer();
            Customer     c2 = new Customer("Nohm", "Chomskey", "*****@*****.**");

            for (int i = 0; i < 4; i++)
            {
                cl.Add(c);
            }
            cl.Add(c2);
            for (int i = 0; i < 10; i++)
            {
                cl.Add(c);
            }

            Console.WriteLine("Testing indexer getter. Placing 15 items in the list.");
            Console.WriteLine("Expecting the customer at index 4 to be Nohm Chomskey.");
            Console.WriteLine("The customer at index 4 is " + cl[4].FirstName + " " + cl[4].LastName);
            Console.WriteLine("Testing indexer setter.");
            cl[5] = c2;
            Console.WriteLine("Expecting the customer at index 4 to be Nohm Chomskey.");
            Console.WriteLine("The customer at index 4 is " + cl[5].FirstName + " " + cl[5].LastName);
            Console.WriteLine();
        }
Exemplo n.º 9
0
        static void TestCustomerListRemove()
        {
            CustomerList cList = new CustomerList();
            Customer     c1    = new Customer(
                "Mickey", "Mouse", "*****@*****.**");
            Customer c3 = new Customer(
                "Minnie", "Mouse", "*****@*****.**");

            cList.Add(c1);
            cList.Add("Donald", "Duck", "*****@*****.**");
            cList += c3;

            Console.WriteLine("Testing Remove");
            Console.WriteLine("Remove with same object");
            cList.Remove(c1);
            Console.WriteLine("Expecting count of 2 " + cList.Count);
            Console.WriteLine("Expecting list of 2 Customers.  Mickey is not in the list:\n" + cList);
            cList -= c3;
            Console.WriteLine("- operator");
            Console.WriteLine("Expecting count of 1 " + cList.Count);
            Console.WriteLine("Expecting list of 1 Customers.  Minnie is not in the list:\n" + cList);
            Console.WriteLine();
            cList.Remove(new Customer("Donald", "Duck", "*****@*****.**"));
            Console.WriteLine("Remove with object that has the same attributes but NOT the same object.\n" +
                              "WON'T WORK AT THIS POINT.  CHAPTER 14 will talk about the method Equals.");
            Console.WriteLine("Expecting count of 0 " + cList.Count);
            Console.WriteLine("Expecting list of 0 Customers.  Donald should not be in the list:\n" + cList);
        }
Exemplo n.º 10
0
 public void Initialize()
 {
     ListCustomer = new CustomerList();
     ListCustomer.Add(new Customer("Jürgen", "Buchner", "*****@*****.**", 20));
     ListCustomer.Add(new Customer("Bernd", "Harrer", "*****@*****.**", 50));
     ListCustomer.Add(new Customer("Arnold", "Mair", "*****@*****.**", 30));
     ListCustomer.Add(new Customer("Bernhard", "Mair", "*****@*****.**", 10));
 }
Exemplo n.º 11
0
 public ServiceResult<CustomerList> GetCustomers()
 {
     GetClient();
     CustomerList cl = new CustomerList();
     cl.Add(new Customer { id = 1, name="steve" });
     cl.Add(new Customer { id = 2, name = "jane" });
     ServiceResult<CustomerList> r = new ServiceResult<CustomerList>(true,cl,"");
     return r;
 }
Exemplo n.º 12
0
        public static void TestCustomerAdd()
        {
            CustomerList list = new CustomerList();
            Customer     c1   = new Customer("Mickey", "Mouse", "*****@*****.**");
            Customer     c2   = new Customer("Donald", "Trump", "*****@*****.**");

            list.Add(c1);
            list.Add(c2);

            Console.WriteLine("Testing Add");
            Console.WriteLine("Count. Expect 2 " + list.Count);
            Console.WriteLine("ToString. Expect mickey and donald " + list);
        }
Exemplo n.º 13
0
        [Test] //ExSkip
        public void CustomDataSource()
        {
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Normally, MERGEFIELDs contain the name of a column of a mail merge data source.
            // Instead, we can use "TableStart:" and "TableEnd:" prefixes to begin/end a mail merge region.
            // Each region will belong to a table with a name that matches the string immediately after the prefix's colon.
            builder.InsertField(" MERGEFIELD TableStart:Customers");

            // These MERGEFIELDs are inside the mail merge region of the "Customers" table.
            // When we execute the mail merge, this field will receive data from rows in a data source named "Customers".
            builder.Write("Full name:\t");
            builder.InsertField(" MERGEFIELD FullName ");
            builder.Write("\nAddress:\t");
            builder.InsertField(" MERGEFIELD Address ");
            builder.Write("\nOrders:\n");

            // Create a second mail merge region inside the outer region for a data source named "Orders".
            // The "Orders" data entries have a many-to-one relationship with the "Customers" data source.
            builder.InsertField(" MERGEFIELD TableStart:Orders");

            builder.Write("\tItem name:\t");
            builder.InsertField(" MERGEFIELD Name ");
            builder.Write("\n\tQuantity:\t");
            builder.InsertField(" MERGEFIELD Quantity ");
            builder.InsertParagraph();

            builder.InsertField(" MERGEFIELD TableEnd:Orders");
            builder.InsertField(" MERGEFIELD TableEnd:Customers");

            // Create related data with names that match those of our mail merge regions.
            CustomerList customers = new CustomerList();

            customers.Add(new Customer("Thomas Hardy", "120 Hanover Sq., London"));
            customers.Add(new Customer("Paolo Accorti", "Via Monte Bianco 34, Torino"));

            customers[0].Orders.Add(new Order("Rugby World Cup Cap", 2));
            customers[0].Orders.Add(new Order("Rugby World Cup Ball", 1));
            customers[1].Orders.Add(new Order("Rugby World Cup Guide", 1));

            // To mail merge from your data source, we must wrap it into an object that implements the IMailMergeDataSource interface.
            CustomerMailMergeDataSource customersDataSource = new CustomerMailMergeDataSource(customers);

            doc.MailMerge.ExecuteWithRegions(customersDataSource);

            doc.Save(ArtifactsDir + "NestedMailMergeCustom.CustomDataSource.docx");
            TestCustomDataSource(customers, new Document(ArtifactsDir + "NestedMailMergeCustom.CustomDataSource.docx")); //ExSkip
        }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            CustomerList list = new CustomerList();
            SerializeList.Save(list);
            list.Add("Jack", 25);
            list.Add("Mamba", 14);
            list.Add("Kaka", 0);
            list.PrintList();
            list = SerializeList.Load();

            list.PrintList();

            Console.WriteLine(new string('-', 50));
            Console.ReadKey();
        }
Exemplo n.º 15
0
        static void TestForEach()
        {
            CustomerList cL = new CustomerList();
            Customer     c1 = new Customer(
                "Mickey", "Mouse", "*****@*****.**");
            Customer c2 = new Customer(
                "Minnie", "Mouse", "*****@*****.**");

            cL.Add(c1);
            cL.Add(c2);
            foreach (Customer c in cL)
            {
                Console.WriteLine(c);
            }
        }
Exemplo n.º 16
0
        static void TestCustomerListSave()
        {
            CustomerList    cl = new CustomerList();
            List <Customer> customers;

            Console.WriteLine("Testing CustomerList save.");
            Console.Write("Expecting ");
            customers = CustomerDB.GetCustomers();

            for (int i = 0; i < customers.Count; i++)
            {
                Console.WriteLine(customers[i].GetDisplayText());
            }

            for (int i = 0; i < customers.Count; i++)
            {
                cl.Add(customers[i]);
            }

            Console.Write("Getting ");
            cl.Save();
            customers = CustomerDB.GetCustomers();
            for (int i = 0; i < customers.Count; i++)
            {
                Console.WriteLine(customers[i].GetDisplayText());
            }
            Console.WriteLine();
        }
Exemplo n.º 17
0
        public CustomerList GetAllCustomers()
        {
            CustomerList customers = new CustomerList();
            DbCommand    command   = m_CustomerDb.GetStoredProcCommand("usp_Customer_List");

            using (IDataReader reader = m_CustomerDb.ExecuteReader(command))
            {
                Customer customer;
                while (reader.Read())
                {
                    customer             = new Customer();
                    customer.CustomerId  = (int)reader["CustomerId"];
                    customer.FirstName   = (string)reader["FirstName"];
                    customer.LastName    = (string)reader["LastName"];
                    customer.BirthDate   = (DateTime)reader["BirthDate"];
                    customer.MemberSince = (DateTime)reader["MemberSince"];
                    customer.IsActive    = true;

                    customer.Addresses      = GetAddressList(customer.CustomerId);
                    customer.BillingMethods = GetBillingMethodList(customer.CustomerId);

                    customers.Add(customer);
                }
            }
            return(customers);
        }
Exemplo n.º 18
0
        private async void LoadInitialCustomersAsync()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                ActualPage = 1;
                CustomerList.Clear();

                var items = await GetCustomersAsync(ActualPage);

                foreach (var item in items)
                {
                    CustomerList.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        public void SaveCustomerTest()
        {
            CustomerList list     = new CustomerList();
            Customer     customer = new Customer();

            customer.FirstName   = "Test";
            customer.LastName    = "Test";
            customer.MemberSince = DateTime.Now;
            customer.CustomerId  = 0;
            customer.BirthDate   = DateTime.Now;
            customer.IsActive    = true;
            customer.IsModified  = true;

            //Adding address so it is logged
            customer.Addresses = new AddressList();
            customer.Addresses.Add(new Address("0000 Some St.", 0, "A City", 0, true, true, "IL", "00000"));

            //Adding Billing Methos so it logged
            customer.BillingMethods = new BillingMethodList();
            customer.BillingMethods.Add(new BillingMethod(0, null, null, String.Empty, 0, true, 30, 2));

            list.Add(customer);

            list.EmployeeId = Environment.UserName;

            BusinessRules rules = new BusinessRules();

            rules.SaveCustomerData(list);

            //Using business rules now
            //CustomerDAL dal = new CustomerDAL();
            //dal.SaveCustomers(list);
        }
Exemplo n.º 20
0
        private CustomerList CreateCustomerList()
        {
            dynamic data = System.Web.HttpContext.Current.Session["purchasedata"];
            CustomerList custobj = new CustomerList();
            int i = 0;

            foreach (var item in data)
            {
                custobj.Add(new Customer
                {
                    sno = ++i,
                    billno = item.billno,
                    Validity = item.Validity,
                    itemtype = item.itemtype,
                    simno = item.simno,
                    country = item.country,
                    PhoneNo = item.PhoneNo,
                    apn = item.apn,
                    simcode = item.simcode,
                    puk = item.puk,
                    challanno = item.challanno
                });
            }
            return custobj;
        }
Exemplo n.º 21
0
        private async Task ItemsTresholdReached()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                if (!(ActualPage >= LastPage))
                {
                    var items = await GetCustomersAsync(ActualPage + 1);

                    foreach (var item in items)
                    {
                        CustomerList.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        public static CustomerList CustomerTranslate(DataTypes.Customer[] customers)
        {
            CustomerList list = new CustomerList();

            Domain.Entity.Customer customer;

            for (int i = 0; i < customers.Length; i++)
            {
                customer             = new Domain.Entity.Customer();
                customer.CustomerId  = customers[i].CustomerId;
                customer.FirstName   = customers[i].FirstName;
                customer.LastName    = customers[i].LastName;
                customer.BirthDate   = customers[i].BirthDate;
                customer.MemberSince = customers[i].MemberSince;
                customer.IsModified  = customers[i].IsModified;
                customer.IsActive    = customers[i].IsActive;
                if (customers[i] != null)
                {
                    customer.Addresses = DataTypeToBusinessEntity.AddressTranslate(customers[i].Addresses);
                }
                if (customers[i] != null)
                {
                    customer.BillingMethods =
                        DataTypeToBusinessEntity.BillingMethodTranslate(customers[i].BillingMethods);
                }

                list.Add(customer);
            }

            return(list);
        }
        private CustomerList CreateCustomerList()
        {
            dynamic data = System.Web.HttpContext.Current.Session["challandata"];
            CustomerList custobj = new CustomerList();
            int i = 0;

            foreach (var item in data)
            {
                stval = item.challanno;
             BusinessAccessLeyer.BAL.StaticVariables.selectuser   = item.executivenameto;
                custobj.Add(new Customer
                {
                    sno = ++i,
                    billno = item.challanno,
                    itemtype = item.itemtype,
                    simno = item.others,
                    country = item.country,
                    PhoneNo = item.PhoneNo,
                    simcode = item.simcode,
                    puk = item.puk ,

                });
            }
            return custobj;
        }
Exemplo n.º 24
0
 public void AddSearchToList(string search)
 {
     if (search == "")
     {
         customerList.Clear();
         foreach (Customer customer in cr.Customers)
         {
             cvm = new CustomerViewModel(customer);
             CustomerList.Add(cvm);
         }
     }
     else
     {
         CustomerList.Clear();
         foreach (Customer customer in cr.Customers)
         {
             string numberSearch = customer.TelephoneNumber.ToString();
             if (numberSearch.Contains(search))
             {
                 cvm = new CustomerViewModel(customer);
                 CustomerList.Add(cvm);
             }
         }
     }
 }
Exemplo n.º 25
0
        public void CreateCustomer(string newName, string newPhone, string newMail)
        {
            Customer newCustomer = cr.CreateCustomer(newName, newPhone, newMail);

            cvm = new CustomerViewModel(newCustomer);
            CustomerList.Add(cvm);
        }
        [Test] //ExSkip
        public void CustomDataSource()
        {
            // Create a destination document for the mail merge
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            builder.InsertField(" MERGEFIELD TableStart:Customer");

            builder.Write("Full name:\t");
            builder.InsertField(" MERGEFIELD FullName ");
            builder.Write("\nAddress:\t");
            builder.InsertField(" MERGEFIELD Address ");
            builder.Write("\nOrders:\n");

            builder.InsertField(" MERGEFIELD TableStart:Order");

            builder.Write("\tItem name:\t");
            builder.InsertField(" MERGEFIELD Name ");
            builder.Write("\n\tQuantity:\t");
            builder.InsertField(" MERGEFIELD Quantity ");
            builder.InsertParagraph();

            builder.InsertField(" MERGEFIELD TableEnd:Order");

            builder.InsertField(" MERGEFIELD TableEnd:Customer");

            // Create some data that we will use in the mail merge
            CustomerList customers = new CustomerList();

            customers.Add(new Customer("Thomas Hardy", "120 Hanover Sq., London"));
            customers.Add(new Customer("Paolo Accorti", "Via Monte Bianco 34, Torino"));

            // Create some data for nesting in the mail merge
            customers[0].Orders.Add(new Order("Rugby World Cup Cap", 2));
            customers[0].Orders.Add(new Order("Rugby World Cup Ball", 1));
            customers[1].Orders.Add(new Order("Rugby World Cup Guide", 1));

            // To be able to mail merge from your own data source, it must be wrapped
            // into an object that implements the IMailMergeDataSource interface
            CustomerMailMergeDataSource customersDataSource = new CustomerMailMergeDataSource(customers);

            // Now you can pass your data source into Aspose.Words
            doc.MailMerge.ExecuteWithRegions(customersDataSource);

            doc.Save(ArtifactsDir + "NestedMailMergeCustom.CustomDataSource.docx");
            TestCustomDataSource(customers, new Document(ArtifactsDir + "NestedMailMergeCustom.CustomDataSource.docx")); //ExSkip
        }
Exemplo n.º 27
0
 /// <summary>
 /// Updates customer's grid view.
 /// </summary>
 private void UpdateCustomerGridView()
 {
     CustomerList.Clear();
     foreach (var item in _customerService.GetAll().Result)
     {
         CustomerList.Add(item);
     }
 }
Exemplo n.º 28
0
        static void TestCustomerListIndexers()
        {
            CustomerList cList = new CustomerList();
            Customer     c1    = new Customer("Trevor", "Rogers", "*****@*****.**");
            Customer     c3    = new Customer("Trevor", "Rogers", "*****@*****.**");

            cList.Add(c1);
            cList.Add("Trevor", "Rogers", "*****@*****.**");
            cList += c3;

            Console.WriteLine("Testing indexer");
            Console.WriteLine("Get customer with index 0");
            Customer c4 = cList[0];

            Console.WriteLine("Expecting Trevor with lane email address. " + c4.GetDisplayText());
            Console.WriteLine("Should not change list. Expecting count of 3 " + cList.Count);
            Console.WriteLine("Expecting list of 3 customers.  Trevor with lane email address is the first element in list:\n" + cList);
        }
Exemplo n.º 29
0
        static void TestCustomerListIndexers()
        {
            CustomerList cList = new CustomerList();
            Customer     c1    = new Customer("John", "Smith", "*****@*****.**");
            Customer     c3    = new Customer("Jake", "Andrews", "*****@*****.**");

            cList.Add(c1);
            cList.Add("Elsa", "Jacobs", "*****@*****.**");
            cList += c3;

            Console.WriteLine("Testing indexer");
            Console.WriteLine("Get product with index 0");
            Customer c4 = cList[0];

            Console.WriteLine("Expecting John. " + c4);
            Console.WriteLine("Should not change list. Expecting count of 3 " + cList.Count);
            Console.WriteLine("Expecting list of 3 customers.  John is the first element in list:\n" + cList);
        }
Exemplo n.º 30
0
        private void SearchCustomers()
        {
            var customers = UnitOfWork.Customers.Find(c => c.FirstName.Contains(SearchTerm) || c.LastName.Contains(SearchTerm));

            CustomerList.Clear();
            foreach (var item in customers)
            {
                CustomerList.Add(item);
            }
        }
        //ExStart
        //ExFor:IMailMergeDataSource
        //ExFor:IMailMergeDataSource.TableName
        //ExFor:IMailMergeDataSource.MoveNext
        //ExFor:IMailMergeDataSource.GetValue
        //ExFor:IMailMergeDataSource.GetChildDataSource
        //ExFor:MailMerge.Execute(IMailMergeDataSource)
        //ExSummary:Performs mail merge from a custom data source.
        public void MailMergeCustomDataSource()
        {
            // Create some data that we will use in the mail merge.
            CustomerList customers = new CustomerList();
            customers.Add(new Customer("Thomas Hardy", "120 Hanover Sq., London"));
            customers.Add(new Customer("Paolo Accorti", "Via Monte Bianco 34, Torino"));

            // Open the template document.
            Document doc = new Document(MyDir + "MailMerge.CustomDataSource.doc");

            // To be able to mail merge from your own data source, it must be wrapped
            // into an object that implements the IMailMergeDataSource interface.
            CustomerMailMergeDataSource customersDataSource = new CustomerMailMergeDataSource(customers);

            // Now you can pass your data source into Aspose.Words.
            doc.MailMerge.Execute(customersDataSource);

            doc.Save(MyDir + @"\Artifacts\MailMerge.CustomDataSource.doc");
        }
Exemplo n.º 32
0
        private static void TestOverloadOperators()
        {
            Console.WriteLine();
            Console.WriteLine("testing overloaded operators");
            Console.WriteLine("testing +");
            CustomerList customers = new CustomerList();
            Customer     c1        = new Customer("Michael", "Michaelerson", "*****@*****.**");
            Customer     c2        = new Customer("will", "schultz", "*****@*****.**");
            Customer     c3        = new Customer("jim", "jimmerson", "*****@*****.**");

            customers.Add(c1);
            customers.Add(c3);
            customers = customers + c2;
            Console.WriteLine("expecting customers[0]:   " + customers[0].ToString());
            Console.WriteLine("expecting customers[1]:   " + customers[1].ToString());
            Console.WriteLine("expecting customers[2]:   " + customers[2].ToString());
            Console.WriteLine("testing -   removing customer c1 michael");
            customers = customers - c1;
            Console.WriteLine(customers[1].ToString());
        }
        internal void GetAllCustomers()
        {
            var list = repository.GetAllCustomers();

            foreach (var customer in list)
            {
                CustomerList.Add(customer);
            }

            CustomerListToShow = CustomerList;
        }
Exemplo n.º 34
0
        //ExStart
        //ExFor:IMailMergeDataSource
        //ExFor:IMailMergeDataSource.TableName
        //ExFor:IMailMergeDataSource.MoveNext
        //ExFor:IMailMergeDataSource.GetValue
        //ExFor:IMailMergeDataSource.GetChildDataSource
        //ExFor:MailMerge.Execute(IMailMergeDataSource)
        //ExSummary:Performs mail merge from a custom data source.
        public void MailMergeCustomDataSource()
        {
            // Create some data that we will use in the mail merge.
            CustomerList customers = new CustomerList();

            customers.Add(new Customer("Thomas Hardy", "120 Hanover Sq., London"));
            customers.Add(new Customer("Paolo Accorti", "Via Monte Bianco 34, Torino"));

            // Open the template document.
            Aspose.Words.Document doc = new Aspose.Words.Document(MyDir + "MailMerge.CustomDataSource.doc");

            // To be able to mail merge from your own data source, it must be wrapped
            // into an object that implements the IMailMergeDataSource interface.
            CustomerMailMergeDataSource customersDataSource = new CustomerMailMergeDataSource(customers);

            // Now you can pass your data source into Aspose.Words.
            doc.MailMerge.Execute(customersDataSource);

            doc.Save(MyDir + "MailMerge.CustomDataSource Out.doc");
        }
Exemplo n.º 35
0
        static public void SearchCustomer(ComboBox box, TextBox search, HairSpaContext context)
        {
            IQueryable <Customer> list = null;

            CustomerList.Clear();

            switch (box.SelectedItem)
            {
            case "Id":
                list = context.Customers.Where(cu => cu.Id.ToString().Contains(search.Text));
                break;

            case "First Name":
                list = context.Customers.Where(cu => cu.FirstName.Contains(search.Text));
                break;

            case "Last Name":
                list = context.Customers.Where(cu => cu.LastName.Contains(search.Text));
                break;

            case "Address":
                list = context.Customers.Where(cu => cu.Address.Contains(search.Text));
                break;

            case "City":
                list = context.Customers.Where(cu => cu.City.Contains(search.Text));
                break;

            case "State":
                list = context.Customers.Where(cu => cu.State.Contains(search.Text));
                break;

            default:
                break;
            }

            try
            {
                if (list.ToList().Count <= 0)
                {
                    MessageBox.Show("No records were found", "No Results");
                    return;
                }
                else
                {
                    list.ToList().ForEach(cu => CustomerList.Add(cu));
                }
            }
            catch (Exception)
            {
                MessageBox.Show("No records were found", "No Results");
                return;
            }
        }
Exemplo n.º 36
0
        static void TestCustomerListRemove()
        {
            CustomerList cList = new CustomerList();
            Customer     c1    = new Customer("Trevor", "Rogers", "*****@*****.**");
            Customer     c3    = new Customer("Trevor", "Rogers", "*****@*****.**");

            cList.Add(c1);
            cList.Add("Trevor", "Rogers", "*****@*****.**");
            cList += c3;

            Console.WriteLine("Testing Remove method");
            cList.Remove(c1);
            Console.WriteLine("Expecting count of 2 " + cList.Count);
            Console.WriteLine("Expecting list of 2 customers: \n" + cList);

            cList -= c3;
            Console.WriteLine("Testing overloaded - operator");
            Console.WriteLine("Expecting count of 1 " + cList.Count);
            Console.WriteLine("Expecting list of 1 customer: \n" + cList);
            Console.WriteLine();
        }
        public void MailMergeCustomDataSource()
        {
            // Create some data that we will use in the mail merge.
            CustomerList customers = new CustomerList();
            customers.Add(new Customer("Thomas Hardy", "120 Hanover Sq., London"));
            customers.Add(new Customer("Paolo Accorti", "Via Monte Bianco 34, Torino"));

            // Create some data for nesting in the mail merge.
            customers[0].Orders.Add(new Order("Rugby World Cup Cap", 2));
            customers[0].Orders.Add(new Order("Rugby World Cup Ball", 1));
            customers[1].Orders.Add(new Order("Rugby World Cup Guide", 1));

            // Open the template document.
            Document doc = new Document(MyDir + "NestedMailMerge.CustomDataSource.doc");

            // To be able to mail merge from your own data source, it must be wrapped
            // into an object that implements the IMailMergeDataSource interface.
            CustomerMailMergeDataSource customersDataSource = new CustomerMailMergeDataSource(customers);

            // Now you can pass your data source into Aspose.Words.
            doc.MailMerge.ExecuteWithRegions(customersDataSource);

            doc.Save(MyDir + "NestedMailMerge.CustomDataSource Out.doc");
        }
Exemplo n.º 38
0
        public static CustomerList GetAllCustomers()
        {
            SqlParamsColl paramList = new SqlParamsColl();
            CustomerList list = new CustomerList();

            SqlTools.ExecuteReader("dbo.Admin_LoadCustomers", paramList, reader =>
                {
                    while (reader.Read())
                    {
                        Customer cust = new Customer();
                        PopulateObjectFromReader(reader, cust);
                        list.Add(cust);
                    }
                });

            return list;
        }
Exemplo n.º 39
0
        //public void abc(List<object> dataaa, string caf) datapaeruser
        public void abc(string caf, string phone, string user, string address, string yoStayconnectno, string country, string agreementno, string billno, string billDate, string paymentmode, string billPeyiod, string seviceTaxno, string[] dataaa, string fixdcharges, string rental, string otherchg, string total, string servicet, string totalamtt,string from,string to , string currate ,string symbol)
        {
            CustomerList custobj = new CustomerList();
            string[] spt = { caf, phone, user, address, yoStayconnectno, country, agreementno, billno, billDate, paymentmode, billPeyiod, seviceTaxno, fixdcharges, rental, otherchg, total, servicet, totalamtt,from,to,currate,symbol };

            // sno = ++i1,
            custobj.a = spt[0]; custobj.b = spt[1]; custobj.c = spt[2];
            custobj.d = spt[3]; custobj.e = spt[4]; custobj.f = spt[5];
            custobj.g = spt[6]; custobj.h = spt[7]; custobj.i = spt[8];
            custobj.j = spt[9]; custobj.k = spt[10] == "NaN" ? "" : spt[10]; custobj.l = spt[11] == "NaN" ? "" : spt[11];
            custobj.m = spt[12] == "NaN" ? "" : spt[12];

              //  custobj.n = (((Convert.ToDecimal(System.Web.HttpContext.Current.Session["grandt_val"])*Convert.ToDecimal( currate)) - (Convert.ToDecimal(System.Web.HttpContext.Current.Session["Free_Value"]) ))) > 0 ? "0" :

            custobj.n =     Convert.ToString(System.Web.HttpContext.Current.Session["rntl"]);

            custobj.o = Convert.ToString(System.Web.HttpContext.Current.Session["datavalue"]) == "" ? "0" : Convert.ToString(Convert.ToDecimal(System.Web.HttpContext.Current.Session["datavalue"]) * Convert.ToDecimal(currate));
            custobj.p = spt[15] == "NaN" ? "" : spt[15]; custobj.q = spt[16] == "NaN" ? "" : spt[16]; custobj.u = spt[17] == "NaN" ? "" : spt[17];
            custobj.s = spt[18]; custobj.t = spt[19]; custobj.w = spt[20]; custobj.z = spt[21];

            dynamic d = System.Web.HttpContext.Current.Session["grd"];
            foreach (var  item in d)
            {
                 custobj.Add(new Customer
                {
                    // sno = ++i1,
                    DATETIME = item.DATETIME,  //spt[0],
                    NUMBER = item.NUMBER,
                    TYPE = item.TYPE,
                    DURATION = item.DURATION,
                    UNITS = item.UNITS,
                    RATE = item.RATE,
                    COST = item.COST,

                });
                 //if (Information.IsNumeric(item.COST) ==true)
                 //{
                 //    custobj.m = item.COST == "NaN" ? "" : item.COST;
                 //}
            }

              //  custobj.m = Convert.ToString(Convert.ToDecimal(currate) *   Convert.ToDecimal( System.Web.HttpContext.Current.Session["grandt_val"]));
            custobj.m = (((Convert.ToDecimal(System.Web.HttpContext.Current.Session["grandt_val"]) * Convert.ToDecimal(currate)) -  (Convert.ToDecimal(System.Web.HttpContext.Current.Session["Free_Value"])))) < 0 ? "0" :
                Convert.ToString((((Convert.ToDecimal(System.Web.HttpContext.Current.Session["grandt_val"]) * Convert.ToDecimal(currate)) - (Convert.ToDecimal(System.Web.HttpContext.Current.Session["Free_Value"])))));

            //List<string[]> lst = new List<string[]>();
            //lst.Add(spt);

            //for (int i = 0; i < dataaa.Length; i++)
            //{
            //    spt = dataaa[i].Split(',');
            //    custobj.Add(new Customer
            //    {
            //        // sno = ++i1,
            //        billno = spt[0],
            //        Validity = spt[1],
            //        itemtype = spt[2],
            //        simno = spt[3],
            //        country = spt[4],
            //        apn = spt[5],
            //        puk = spt[6],
            //    });
            //    lst.Add(spt);
            //}

            System.Web.HttpContext.Current.Session["excel"] = custobj;
            System.Web.HttpContext.Current.Session["fname"] = "";
        }