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);
        }
        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;
        }
示例#3
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;
        }
示例#4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     custlist = CustomerList.GetCustomers();
        if (custlist != null)
        {
        Display();
        }
 }
示例#5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     contactList = CustomerList.GetCustomers();
     if (!IsPostBack)
     {
         this.DisplayContacts();
     }
 }
示例#6
0
 protected void btnAddCust_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         custList = CustomerList.GetCustomers();
         custList.AddCust(selectedCust);
         lbCustListCount.Text = custList.Count.ToString();
     }
 }
示例#7
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;
 }
示例#8
0
    /// <summary>
    ///     Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        this._customers = CustomerList.GetCustomers();

        if (IsPostBack)
        {
            return;
        }

        this.PopulateContactListBox();
    }
示例#9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.GetCustomer();
     custlist = CustomerList.GetCustomers();
     if (!IsPostBack)
     {
         ddlCustomer.AppendDataBoundItems = true;
         ddlCustomer.Items.Insert(0, new ListItem(String.Empty, String.Empty));
         ddlCustomer.SelectedIndex = 0;
     }
 }
示例#10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["AdminSession"] == null)
            {
                Response.Redirect("/Login");
            }

            if (!IsPostBack)
            {
                CustomerDataSource = CustomerManager.Admin_GetAllCustomers();
                BindList();
            }
        }
示例#11
0
    protected void btnRemove_Click(object sender, EventArgs e)
    {
        int[] a;
        a = lstContacts.GetSelectedIndices();

        int c = 0;
        foreach (int b in a)
        {
            custlist -= (b-c);
            c++;
        }

        lstContacts.Items.Clear();
        Display();
    }
示例#12
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();
        }
示例#13
0
 public static void Save(CustomerList item)
 {
     Console.WriteLine(new string('-', 50));
     try
     {
         FileStream stream = new FileStream("data.dat", FileMode.Create);
         binformat.Serialize(stream, temp);
         stream.Close();
         Console.WriteLine("CustomerList is saved");
     }
     catch (IOException ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
示例#14
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;
        }
示例#15
0
        public static CustomerList Load()
        {
            Console.WriteLine(new string('-', 50));
            try
            {
                FileStream stream = new FileStream("data.dat", FileMode.Open);
                temp = (CustomerList)binformat.Deserialize(stream);
                stream.Close();
                Console.WriteLine("CustomerList is loaded");
            }
            catch (IOException ex)
            {
                Console.WriteLine(ex.Message);
            }

            return temp;
        }
        //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");
        }
        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");
        }
示例#18
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"] = "";
        }
示例#19
0
文件: SelectedItem.cs 项目: dfr0/moon
        public void SelectedItem()
        {
            Type propertyType = typeof(object);
            bool expectGet = true;
            bool expectSet = true;
            bool hasSideEffects = true;

            DataGrid control = new DataGrid();
            Assert.IsNotNull(control);

            // Verify Dependency Property Property member
            FieldInfo fieldInfo = typeof(DataGrid).GetField("SelectedItemProperty", BindingFlags.Static | BindingFlags.Public);
            Assert.AreEqual(typeof(DependencyProperty), fieldInfo.FieldType, "DataGrid.SelectedItemProperty not expected type 'DependencyProperty'.");

            // Verify Dependency Property Property's value type
            DependencyProperty property = fieldInfo.GetValue(null) as DependencyProperty;

            Assert.IsNotNull(property);

            // 


            // Verify Dependency Property CLR property member
            PropertyInfo propertyInfo = typeof(DataGrid).GetProperty("SelectedItem", BindingFlags.Instance | BindingFlags.Public);
            Assert.IsNotNull(propertyInfo, "Expected CLR property DataGrid.SelectedItem does not exist.");
            Assert.AreEqual(propertyType, propertyInfo.PropertyType, "DataGrid.SelectedItem not expected type 'object'.");

            // Verify getter/setter access
            Assert.AreEqual(expectGet, propertyInfo.CanRead, "Unexpected value for propertyInfo.CanRead.");
            Assert.AreEqual(expectSet, propertyInfo.CanWrite, "Unexpected value for propertyInfo.CanWrite.");

            // Verify that we set what we get
            if (expectSet) // if expectSet == false, this block can be removed
            {
                CustomerList list = new CustomerList();

                Assert.IsTrue(list.Count > 3, "CustomerList has too few items for this test.");

                Common.AssertExpectedException(DataGridError.DataGrid.ItemIsNotContainedInTheItemsSource("dataItem"),
                    delegate
                    {
                        control.SelectedItems.Add(list[2]);
                    }
                );

                control.ItemsSource = list;

                // 







                control.SelectedItem = list[0];

                Assert.AreEqual(list[0], control.SelectedItem);
                Assert.AreNotEqual(list[1], control.SelectedItem);

                control.SelectedItem = list[3];

                Assert.AreEqual(list[3], control.SelectedItem);

                control.SelectedItem = list[2];

                Assert.AreEqual(list[2], control.SelectedItem);
            }

            // Verify Dependency Property callback
            if (hasSideEffects)
            {
                MethodInfo methodInfo = typeof(DataGrid).GetMethod("OnSelectedItemPropertyChanged", BindingFlags.Static | BindingFlags.NonPublic);
                Assert.IsNotNull(methodInfo, "Expected DataGrid.SelectedItem to have static, non-public side-effect callback 'OnSelectedItemPropertyChanged'.");

                // 
            }
            else
            {
                MethodInfo methodInfo = typeof(DataGrid).GetMethod("OnSelectedItemPropertyChanged", BindingFlags.Static | BindingFlags.NonPublic);
                Assert.IsNull(methodInfo, "Expected DataGrid.SelectedItem NOT to have static side-effect callback 'OnSelectedItemPropertyChanged'.");
            }
        }
        public List <Customer> AjaxMethod(CustomerModel customer)
        {
            var service = new CustomerList();

            return(service.GetCustomers(customer.Name));
        }
        public virtual void EditFirstCell(DataGridEditAction cellEditAction,
                                          DataGridEditAction?rowEditAction,
                                          DataGridDelegate subscribeToEvent,
                                          DataGridCellValidateDelegate validateEvent,
                                          DataGridDelegate unsubscribeToEvent)
        {
            // The first customer property should always be a string
            if (properties[0].PropertyType == typeof(string))
            {
                DataGrid dataGrid = new DataGrid();
                string   originalValue;
                string   updatedValue;
                dataGrid.ItemsSource = null;
                dataGrid.SelectedItems.Clear();
                rowLoaded            = false;
                dataGridRow          = null;
                isLoaded             = false;
                dataGrid.Loaded     += new RoutedEventHandler(dataGrid_Loaded);
                dataGrid.ColumnWidth = new DataGridLength(50);
                dataGrid.Width       = 650;
                dataGrid.Height      = 250;
                CustomerList customerList = new CustomerList(1);
                customerList[0].LastName = "A";
                PagedCollectionView pagedCollectionView = new PagedCollectionView(customerList);
                pagedCollectionView.SortDescriptions.Add(new System.ComponentModel.SortDescription("LastName", System.ComponentModel.ListSortDirection.Ascending));

                TestPanel.Children.Add(dataGrid);
                EnqueueConditional(delegate { return(isLoaded); });
                this.EnqueueYieldThread();
                EnqueueCallback(delegate
                {
                    dataGrid.LoadingRow += new EventHandler <DataGridRowEventArgs>(dataGrid_LoadingRowGetRow);
                    subscribeToEvent(dataGrid);

                    dataGrid.ItemsSource = pagedCollectionView;
                });
                EnqueueConditional(delegate { return(rowLoaded); });

                this.EnqueueYieldThread();
                EnqueueCallback(delegate
                {
                    dataGrid.LoadingRow -= new EventHandler <DataGridRowEventArgs>(dataGrid_LoadingRowGetRow);

                    bool success = dataGrid.BeginEdit();
                    Assert.IsTrue(success, "BeginEdit was not successful");
                });
                this.EnqueueYieldThread();
                //}
                EnqueueCallback(delegate
                {
                    //Set column to valid value
                    Assert.IsTrue(dataGrid.Columns[0].GetCellContent(customerList[0]) is TextBox, "Not a TextBox");
                    TextBox cell  = ((TextBox)dataGrid.CurrentColumn.GetCellContent(customerList[0]));
                    originalValue = cell.Text;
                    ((TextBox)dataGrid.CurrentColumn.GetCellContent(customerList[0])).Text = Common.RandomString(10);
                    updatedValue = cell.Text;

                    // Either commit or cancel the cell edit
                    if (cellEditAction == DataGridEditAction.Commit)
                    {
                        dataGrid.CommitEdit(DataGridEditingUnit.Cell, true /*exitEditing*/);
                    }
                    else
                    {
                        dataGrid.CancelEdit(DataGridEditingUnit.Cell);
                    }

                    // Either commit or cancel the row edit
                    if (rowEditAction == DataGridEditAction.Commit)
                    {
                        dataGrid.CommitEdit(DataGridEditingUnit.Row, true /*exitEditing*/);
                    }
                    else if (rowEditAction == DataGridEditAction.Cancel)
                    {
                        dataGrid.CancelEdit(DataGridEditingUnit.Row);
                    }

                    updatedValue = properties[0].GetValue(customerList[0], null) as String;
                    validateEvent(dataGrid, originalValue, updatedValue);
                    unsubscribeToEvent(dataGrid);
                });
            }
        }
        static void Main(string[] args)
        {
            var customer = new CustomerList();
            var run      = true;

            while (run)



            {
                var userInput = MainMenu(customer.CustomerId);
                switch (int.Parse(userInput))
                {
                case 1:
                    Console.Clear();



                    Console.WriteLine("You've chosen to create a new customer account.");

                    Console.WriteLine("Enter your first name");
                    var firstName = Console.ReadLine();

                    Console.WriteLine("Enter your last name");
                    var lastName = Console.ReadLine();

                    Console.WriteLine("Enter your street address");
                    var address = Console.ReadLine();

                    Console.WriteLine("Enter your city");
                    var city = Console.ReadLine();

                    Console.WriteLine("Enter your state");
                    var state = Console.ReadLine();

                    Console.WriteLine("Enter your postal code");
                    var postalCode = Console.ReadLine();

                    Console.WriteLine("Finally, enter your phone number");
                    var phone = Console.ReadLine();


                    var newCustomerInfo = new CreateCustomerAccount();
                    var newCustomer     = newCustomerInfo.AddNewCustomerInfo(firstName, lastName, address, city, state, postalCode, phone);

                    if (newCustomer)
                    {
                        Console.WriteLine("You added a customer!");
                    }
                    System.Threading.Thread.Sleep(1000);
                    break;

                case 2:
                    Console.Clear();
                    var counter             = 0;
                    var customerList        = new SelectCustomer();
                    var listOfCustomerNames = customerList.GetCustomerName();
                    Console.WriteLine("Which customer will be active?");
                    foreach (var list in listOfCustomerNames)
                    {
                        counter++;
                        Console.WriteLine($"{counter} {list.FirstName} {list.LastName}");
                    }

                    var selectedCustomer      = Console.ReadLine();
                    var selectedCustomerIndex = int.Parse(selectedCustomer.ToString());
                    customer = listOfCustomerNames[selectedCustomerIndex - 1];
                    Console.WriteLine($"the selected customer is {customer.FirstName} {customer.LastName}");
                    System.Threading.Thread.Sleep(1000);
                    break;

                case 3:
                    Console.Clear();

                    Console.WriteLine("What kind of Credit Card are you adding?");
                    var pmtType = Console.ReadLine();

                    Console.WriteLine("What is the account number?");
                    var acctNumber    = Console.ReadLine();
                    var acctNumberInt = long.Parse(acctNumber.ToString());

                    var customerId = customer.CustomerId;

                    var payment = new AddPayment();

                    payment.AddPaymentType(pmtType, customerId, acctNumberInt);

                    Console.WriteLine($"You have added {pmtType} {acctNumber} to {customer.FirstName} {customer.LastName}");
                    System.Threading.Thread.Sleep(1000);

                    break;

                case 4:
                    Console.Clear();
                    //Add product to sell
                    var productAdder = new ProductAdder();
                    Console.WriteLine("Enter the Product Name: ");
                    var productName = Console.ReadLine();
                    Console.WriteLine("Enter the Product Description: ");
                    var productDescription = Console.ReadLine();
                    Console.WriteLine("Enter the Product Price: ");
                    var productPrice = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine("Enter the Product Quantity: ");
                    var quantity  = Convert.ToInt32(Console.ReadLine());
                    var customers = productAdder.GetAllCustomers();

                    var counter4 = 0;
                    Console.WriteLine("Please select the customer whose product you are adding:");
                    foreach (var person in customers)
                    {
                        counter4++;
                        Console.WriteLine($"{counter4}. {person.FirstName} {person.LastName}");
                    }

                    var customerToAddProduct = int.Parse(Console.ReadLine());

                    var customerIdToAdd = customers[customerToAddProduct - 1];
                    var newProduct      = productAdder.AddNewProduct(productName, productDescription, productPrice, quantity, customerIdToAdd.CustomerId);
                    if (newProduct)
                    {
                        Console.WriteLine($"You added {productName} to {customerIdToAdd.FirstName} {customerIdToAdd.LastName}!");
                    }
                    System.Threading.Thread.Sleep(1000);
                    break;

                case 5:
                    Console.Clear();
                    //Add product to shopping cart
                    var productQuery  = new ProductQuery();
                    var allProducts   = productQuery.GetAllProducts();
                    var addProduct    = new AddProduct();
                    var orderModifier = new OrderModifier();

                    var order          = 0;
                    var addingProducts = true;
                    while (addingProducts)
                    {
                        Console.WriteLine("All Products");
                        var counter2 = 0;
                        foreach (var product in allProducts)
                        {
                            counter2++;
                            Console.WriteLine($"{counter2}. {product.ProductName}: {product.ProductPrice}");
                        }
                        counter2++;
                        Console.WriteLine($"{counter2}. Done adding products.");

                        Console.WriteLine("What product would you like to add to the order?");
                        var productToAdd = Console.ReadLine();
                        Console.WriteLine("");
                        var selectedProductIndex = int.Parse(productToAdd.ToString());
                        if (selectedProductIndex == counter2)
                        {
                            addingProducts = false;
                            break;
                        }
                        Console.WriteLine("How many would you like to add?");
                        var numberToAdd = Console.ReadLine();
                        var addedNumber = int.Parse(numberToAdd.ToString());
                        Console.WriteLine("");

                        var selectedProduct = allProducts[selectedProductIndex - 1];
                        if (order == 0)
                        {
                            order = orderModifier.CreateOrder(customer.CustomerId);
                        }
                        var addNewProduct = addProduct.AddProductToOrder(selectedProduct.ProductId, addedNumber, order);
                        if (addNewProduct)
                        {
                            Console.WriteLine($"You added {selectedProduct.ProductName} to your order!");
                        }
                        System.Threading.Thread.Sleep(1000);
                        Console.Clear();
                    }
                    break;

                case 6:
                    Console.Clear();
                    //Complete an order
                    break;

                case 7:
                    Console.Clear();
                    //Remove customer product
                    Console.WriteLine("Please choose product to delete:");

                    var removeCustomerProduct = new RemoveProduct();
                    removeCustomerProduct.RemoveCustomerProduct(customer);

                    break;

                case 8:
                    Console.Clear();
                    //Update product information
                    var getAllProducts   = new ProductQuery();
                    var productsToUpdate = getAllProducts.GetCustomerProducts(customer.CustomerId);
                    Console.WriteLine("All Products");
                    var counter3 = 0;
                    foreach (var product in productsToUpdate)
                    {
                        counter3++;
                        Console.WriteLine($"{counter3}. {product.ProductName}: {product.ProductPrice}");
                    }

                    Console.WriteLine("What product would you like to update?");
                    var productToUpdate = Console.ReadLine();
                    Console.WriteLine("");
                    var updateProductIndex = int.Parse(productToUpdate.ToString());
                    var updateThisProduct  = productsToUpdate[updateProductIndex - 1];
                    Console.Clear();
                    var productModifier = new AddProduct();
                    var updateProduct   = productModifier.UpdateProduct(updateThisProduct);
                    if (updateProduct)
                    {
                        Console.WriteLine("Product updated!");
                    }


                    System.Threading.Thread.Sleep(1000);
                    break;

                case 9:
                    Console.Clear();
                    //Show stale products
                    break;

                case 10:
                    Console.Clear();
                    var revenueQuery   = new RevenueQuery();
                    var listOfRevenues = revenueQuery.GetCustomerRevenue(customer.FirstName, customer.LastName);

                    var personRevenue = from personOrder in listOfRevenues
                                        group personOrder by personOrder.OrderId into g
                                        orderby g.Key
                                        select g;

                    var revenueCounter = 0.00;

                    Console.WriteLine($"This is the revenue report for {customer.FirstName} {customer.LastName}");
                    foreach (var revenueResult in personRevenue)
                    {
                        Console.WriteLine($"\nOrder #{revenueResult.Key}\n--------------------------------------");


                        foreach (var item in revenueResult)
                        {
                            revenueCounter += item.indivItemTotal;
                            Console.WriteLine($"{item.ProductName}     {item.OrderItemQuantity}   ${item.indivItemTotal} ");
                        }
                        //Console.WriteLine()
                    }
                    Console.WriteLine($"\nTotal Revenue is ${revenueCounter}");
                    Console.ReadLine();

                    break;

                case 11:
                    Console.Clear();
                    //Show overall product popularity
                    var revenueReport = new RevenueReport();
                    revenueReport.GetTop3Revenue();
                    break;

                case 12:
                    //Leave Bangazon!
                    run = false;
                    break;
                }
            }

            string MainMenu(int customerid)
            {
                View mainMenu = new View()
                                .AddMenuOption("1. Create a customer account")
                                .AddMenuOption("2. Choose active customer")
                                .AddMenuOption("4. Add product to sell")
                                .AddMenuOption("9. Show stale products")
                                .AddMenuOption("10. Show customer revenue report")
                                .AddMenuOption("11. Show overall product popularity")
                                .AddMenuOption("12. Leave Bangazon!");

                Console.Write(mainMenu.GetFullMenu());

                if (customerid > 0)
                {
                    mainMenu = new View()
                               .AddMenuOption("1. Create a customer account")
                               .AddMenuOption("2. Choose active customer")
                               .AddMenuOption("3. Create a payment option")
                               .AddMenuOption("4. Add product to sell")
                               .AddMenuOption("5. Add product to shopping cart")
                               .AddMenuOption("6. Complete an order")
                               .AddMenuOption("7. Remove customer product")
                               .AddMenuOption("8. Update product information")
                               .AddMenuOption("9. Show stale products")
                               .AddMenuOption("10. Show customer revenue report")
                               .AddMenuOption("11. Show overall product popularity")
                               .AddMenuOption("12. Leave Bangazon!");
                    Console.Write(mainMenu.GetFullMenu());
                }

                var userOption = Console.ReadLine();

                return(userOption);
            }
        }
示例#23
0
        static void Main2(string[] args)
        {
            String[]       NameList         = { "Ahmed", "Samier", "Ali", "Peter", "Salma", "Zaynab" };
            List <Product> PromotedProducts = new List <Product>();


            #region Anonymous Type
            //var X = 15.3;

            //Console.WriteLine(X.GetType());

            //Point3D P1 = new Point3D { X = 10, Y = 20, Z = 30 };

            //var P2 = new Point3D { X = 40, Y = 50, Z = 60 };

            //var Emp01 = new { ID = 101, Name = "Ahmed", Salary = 5000 };
            //var Emp02 = new { ID = 201, Name = "Samier", Salary = 2500 };
            //var Emp03 = new {  Name = "Samier", Salary = 2500 , ID = 201 };
            //var Emp04 = new { ID = 101, Name = "Ahmed", Salary = 5000 };


            ////Emp01.ID = 50;//Read Only
            //Console.WriteLine(Emp01.Name);

            //Console.WriteLine(Emp01.GetType().Name);

            //if ( Emp01.GetType() == Emp02.GetType())
            //    Console.WriteLine("Same Type");
            //else
            //    Console.WriteLine("Diff Types");

            //if (Emp01.GetType() == Emp03.GetType())
            //    Console.WriteLine("Same Type");
            //else
            //    Console.WriteLine("Diff Types");


            //if (Emp01.Equals (Emp04))
            //    Console.WriteLine("Value Equality");
            //else
            //    Console.WriteLine("Identity Equality");


            //Console.WriteLine(Emp01);
            #endregion

            #region Extention Method

            //int X = 12345;

            //Console.WriteLine(
            //    //Int32AdditionalFunctions.Mirror(X)
            //    X.Mirror()
            //    );

            //List<int> lst = new List<int>();

            #endregion

            #region Query Expression VS Fluent Syntax
            // ///Fluent Syntax
            // var Result = Enumerable.Where(ProductList, p => p.UnitsInStock == 0);

            // Result = ProductList.Where(P => P.UnitsInStock == 0);
            // if (true)
            //     Result = Result.OrderBy(p => p.UnitPrice);

            // var Result2 = ProductList.Where(P => P.UnitsInStock == 0).OrderBy(P => P.UnitPrice);


            // List<Product> prdList = ProductList.Where(P => P.UnitsInStock == 0).ToList<Product>();
            ////.ToList() LINQ Casting Operator


            // Console.WriteLine(Result2.GetType().Name);//OrderedEnumerable`2

            ///Query Expression
            ///12 Query Operator Only

            //var Result = from P in ProductList //P Range Variable : Represinting Each and Every Element in Sequence
            //             where P.UnitsInStock == 0
            //             orderby P.UnitPrice
            //             select P;

            ///Mixed
            //List<Product> Result = (from P in ProductList //P Range Variable : Represinting Each and Every Element in Sequence
            //                        where P.UnitsInStock == 0
            //                        orderby P.UnitPrice
            //                        select P).ToList();

            #endregion

            #region Deffered Excution
            // List<int> lst = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            // // Defered Excution
            // IEnumerable<int> Result = lst.Where(i => i % 2 == 0);//Result Now =>Count=0

            // // imidate Excution
            //  var Result2 = lst.Where(i => i % 2 == 0).ToList();//Result2 Now=>Count=4


            // lst.Remove(1);
            // lst.Remove(2);
            // lst.Remove(3);
            // lst.Remove(4);

            //Result= Result.ToList();//Now Compiler will run Where Operator //Count=2
            // lst.AddRange(new int[] { 10, 11, 12, 13, 14, 15, 16 });
            #endregion


            #region Transformation

            //var Result = from P in ProductList
            //             where P.UnitsInStock == 0
            //             select new { Name = P.ProductName, P.UnitPrice };
            ////select P;

            //var Result2 = NameList.Select(N => N.Substring(0, 3).ToUpper());


            //// Select Many
            //// Multiple From
            //// Transform Each Element in Input Seq To Sub Sequence
            var Result3 = (from Name in NameList
                           from Ch in Name.ToCharArray()
                           select Ch).Distinct();//.ToList();

            //Result3 = NameList.SelectMany(Name => Name.ToCharArray()).Distinct();


            //// Indexed Select
            //// Must be Fluent Syntax
            //var Result4 = ProductList.Select((P, I) => new { Index = I, Name = P.ProductName });
            //Result4 = Result4.ToList();


            #endregion

            #region Filteration

            //var Result = from c in CustomerList
            //             where c.Orders.Count() > 5
            //             select new { c.CompanyName, Count = c.Orders.Count() };

            ///Indexed Where Only Fluent Syntax

            var Result5 = CustomerList.Where((C, i) => i % 2 == 1);
            //Result5 = Result5.ToList();
            #endregion

            #region Ordering Operators

            //var Result = from P in ProductList
            //             orderby P.UnitPrice
            //             select P;

            //var Result = from P in ProductList
            //             orderby P.UnitPrice , P.UnitsInStock descending
            //             select P;


            //var Result = ProductList.OrderBy(P => P.UnitPrice)
            //    .ThenByDescending(P => P.UnitsInStock);


            #endregion

            #region Natural Ordering Operators
            //var Result = ProductList.Take(10);
            /////First 10 Elements in Input Sequence

            //Result = ProductList.Skip(10);
            ////Skip First 10 Elements in Input Sequence , Rest of Elements Go To Output Sequence

            //Result = ProductList.TakeWhile(P => P.UnitsInStock > 0);
            /////Redirect Elements to Output Sequence as long as Condition = True , Abort First Element return False
            /////

            //Result = ProductList.SkipWhile(P => P.UnitsInStock > 0).Reverse();
            /////Skip elements Till First Element return false;



            #endregion

            #region Element Operators


            //var Result2 = ProductList.First();

            ////Result2 = ProductList.Last();

            ////Result2 = ProductList.First(P => P.UnitsInStock == 0);

            ////Result2 = ProductList.Last(P => P.UnitsInStock == 0);

            ////Result2 = ProductList.First(P => P.UnitPrice > 5000);

            ////Result2 = ProductList.Last(P => P.UnitPrice > 5000);

            ////Result2 = PromotedProducts.First();

            ////Result2 = PromotedProducts.Last();

            //Result2 = ProductList.FirstOrDefault(P => P.UnitPrice > 5000);
            /////if no Element Match Predicate , return null , will not Throw Exception
            //Result2 = ProductList.LastOrDefault(P => P.UnitPrice > 5000);

            //Result2 = PromotedProducts.FirstOrDefault();

            //Result2 = PromotedProducts.LastOrDefault();

            //Result2 = ProductList.ElementAt(5);

            //Result2 = ProductList.ElementAtOrDefault(100);

            ////Result2 = ProductList.Single();
            /////return the one and only one element in this Sequence
            /////Or Throw Exception if Many Elements exists in this Sequnce


            ////Result2 = ProductList.Single(P => P.UnitsInStock >= 125);

            ////Result2 = ProductList.SingleOrDefault();
            ////Result2 = ProductList.SingleOrDefault(P=> P.UnitPrice >100);

            ////Result2 = PromotedProducts.Single(); //Throw Exception

            //Result2 = PromotedProducts.SingleOrDefault(); //Throw Exception

            //Result2 = ProductList.SingleOrDefault(P => P.UnitsInStock > 200);
            /////return One Element
            /////Throw exception if Input sequence have more than one Element
            /////return null if Input Sequnce is Empty



            //Console.WriteLine(Result2?.ToString()??"Not Found");
            #endregion

            #region Aggregation Operators

            //var Result3 = ProductList.Count();

            //Result3 = ProductList.Count(P => P.UnitsInStock > 0);


            ////Console.WriteLine(ProductList.Sum(P=>P.UnitsInStock));

            ////Console.WriteLine(ProductList.Average(P=>P.UnitsInStock));


            ////Console.WriteLine(ProductList.Min());
            ////Console.WriteLine(ProductList.Max());

            //Console.WriteLine(ProductList.Max(P=>P.UnitsInStock));
            //Console.WriteLine(ProductList.Min(P => P.UnitsInStock));


            //Console.WriteLine(Result3);


            #endregion

            #region Generation Operators

            //IEnumerable<int> Lst = Enumerable.Range(0, 100);

            //IEnumerable<Order> Result = Enumerable.Empty<Order>();

            //var Result2 = Enumerable.Repeat(ProductList.First(), 10);

            //ProductList.First().UnitPrice = 100;

            #endregion

            #region Set Operators
            //var PrdLst01 = ProductList.Take(50);
            //var PrdLst02 = ProductList.Skip(27);

            //          List<int> Lst01 = Enumerable.Range(0, 100).ToList();
            //            List<int> Lst02 = Enumerable.Range(50, 100).ToList();
            //Console.WriteLine(
            //    Lst01.SequenceEqual(Lst02)

            //    );

            //var Result = Lst01.Intersect(Lst02);

            //var Result = PrdLst01.Intersect(PrdLst02);


            //var Result = Lst01.Union(Lst02);
            ////Remove Duplicates

            //Result = Lst01.Concat(Lst02);
            /////Allow Duplicates

            //Result = Lst01.Concat(Lst02).Distinct();

            //Result = Lst01.Except(Lst02);


            //List<int> NumLst = new List<int>() { 1, 2, 3, 4, 5, 6,7,8 };

            //var Result = NumLst.Zip(NameList, (i, S) => new { Index = i, Name = S });

            //Sequence Equal operator?
            #endregion


            #region Into , Let (Introducing New Range Variable

            //var Result = from name in NameList
            //             select Regex.Replace(name.ToLower(), "[aoieu]", "");

            //Result = Result.Where(X => X.Length >= 3);

            //var Result = from name in NameList
            //             select Regex.Replace(name.ToLower(), "[aoieu]", "")
            //             into NoVolName     //Introduce New Range Variable, Restarting for Query
            //             ///After Into Old Range Variable is Not Accesable
            //             where NoVolName.Length >=3
            //             orderby NoVolName.Length descending
            //             select NoVolName;


            //var Result = from name in NameList
            //             let NoVolName = Regex.Replace(name.ToLower(), "[aoieu]", "")
            //             ///Introduce New Range Variable , Both new and Old Range Variable
            //             ///Are Accessable after let
            //             where NoVolName.Length >= 3
            //             orderby NoVolName.Length, name.Length descending
            //             select new { Original = name, NoVolName };



            #endregion


            #region Quantifiers Operators

            Console.WriteLine(
                //   //ProductList.Any(P=> P.UnitsInStock==0)
                //   //ProductList.Any() //return True if this Sequence contains al least one element
                //   //PromotedProducts.Any()
                //ProductList.All(P => P.UnitsInStock > 0)
                //   ///return true if All elements in Input Sequence Match Predicate
                //   ProductList.Contains(new Product() { ProductID = 1 }, new ProductComparer())
                );



            #endregion


            #region GroupBy

            foreach (var item in ProductList.Select(P => P.Category).Distinct())
            {
                Console.WriteLine(item);//item=Category
            }


            var Result = from P in ProductList
                         group P by P.Category
                         into PrdGroups
                         select new { PrdGroups.Key, Count = PrdGroups.Count() };


            #endregion


            foreach (var item in Result)
            {
                Console.WriteLine(item);
                //Console.Write($"{item} , ");
            }

            foreach (var item in Result)
            {
                // Console.WriteLine(item);
            }


            //foreach (var item in ProductList.OrderByDescending(P=> P.UnitsInStock))
            //{
            //    Console.WriteLine(item);
            //}
        }
示例#24
0
 public int SaveRows(DbTransaction pTran, CustomerList CustomerList)
 {
     return(SaveRows(pTran, CustomerList, true));
 }
示例#25
0
 private void FillImageUrl(CustomerList customerList, string imageName)
 {
     string url = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"));
     customerList.ImageUrl = url + "Content/" + imageName;
 }
示例#26
0
 protected override void InitObjects(bool createNew)
 {
     listObj     = list = GetList <CustomerList>(createNew);
     criteriaObj = criteria = GetCriteria <CustomerCriteria>(createNew);
 }
示例#27
0
        public int SaveRows(CustomerList CustomerList)
        {
            DbTransaction Tran = null;

            return(SaveRows(Tran, CustomerList, true));
        }
示例#28
0
        public void SelectedIndex()
        {
            Type propertyType   = typeof(int);
            bool expectGet      = true;
            bool expectSet      = true;
            bool hasSideEffects = true;

            DataGrid control = new DataGrid();

            Assert.IsNotNull(control);

            // Verify Dependency Property Property member
            FieldInfo fieldInfo = typeof(DataGrid).GetField("SelectedIndexProperty", BindingFlags.Static | BindingFlags.Public);

            Assert.AreEqual(typeof(DependencyProperty), fieldInfo.FieldType, "DataGrid.SelectedIndexProperty not expected type 'DependencyProperty'.");

            // Verify Dependency Property Property's value type
            DependencyProperty property = fieldInfo.GetValue(null) as DependencyProperty;

            Assert.IsNotNull(property);

            //


            // Verify Dependency Property CLR property member
            PropertyInfo propertyInfo = typeof(DataGrid).GetProperty("SelectedIndex", BindingFlags.Instance | BindingFlags.Public);

            Assert.IsNotNull(propertyInfo, "Expected CLR property DataGrid.SelectedIndex does not exist.");
            Assert.AreEqual(propertyType, propertyInfo.PropertyType, "DataGrid.SelectedIndex not expected type 'object'.");

            // Verify getter/setter access
            Assert.AreEqual(expectGet, propertyInfo.CanRead, "Unexpected value for propertyInfo.CanRead.");
            Assert.AreEqual(expectSet, propertyInfo.CanWrite, "Unexpected value for propertyInfo.CanWrite.");

            // Verify that we set what we get
            if (expectSet) // if expectSet == false, this block can be removed
            {
                CustomerList list = new CustomerList();

                Assert.IsTrue(list.Count > 3, "CustomerList has too few items for this test.");

                control.ItemsSource = list;

                //



                TestPanel.Children.Add(control);
                this.EnqueueYieldThread();

                EnqueueCallback(delegate
                {
                    Assert.AreEqual(list.Count, control.RowCount);

                    control.SelectedIndex = 0;

                    Assert.AreEqual(0, control.SelectedIndex);
                    Assert.AreNotEqual(1, control.SelectedIndex);

                    Assert.AreEqual(list[0], control.SelectedItem);
                    Assert.AreNotEqual(list[1], control.SelectedItem);

                    control.SelectedIndex = 3;

                    Assert.AreEqual(3, control.SelectedIndex);
                    Assert.AreEqual(list[3], control.SelectedItem);

                    control.SelectedIndex = 2;

                    Assert.AreEqual(2, control.SelectedIndex);
                    Assert.AreEqual(list[2], control.SelectedItem);

                    control.SelectedItem = list[3];

                    Assert.AreEqual(list[3], control.SelectedItem);
                    Assert.AreEqual(3, control.SelectedIndex);

                    control.SelectedIndex = -2;

                    Assert.IsNull(control.SelectedItem);
                    Assert.AreEqual(-1, control.SelectedIndex);

                    control.SelectedIndex = list.Count - 1;

                    Assert.AreEqual(list.Count - 1, control.SelectedIndex);
                    Assert.AreEqual(list[list.Count - 1], control.SelectedItem);

                    control.SelectedIndex = list.Count;

                    Assert.IsNull(control.SelectedItem);
                    Assert.AreEqual(-1, control.SelectedIndex);
                });
            }

            // Verify Dependency Property callback
            if (hasSideEffects)
            {
                MethodInfo methodInfo = typeof(DataGrid).GetMethod("OnSelectedIndexPropertyChanged", BindingFlags.Static | BindingFlags.NonPublic);
                Assert.IsNotNull(methodInfo, "Expected DataGrid.SelectedIndex to have static, non-public side-effect callback 'OnSelectedIndexPropertyChanged'.");

                //
            }
            else
            {
                MethodInfo methodInfo = typeof(DataGrid).GetMethod("OnSelectedIndexPropertyChanged", BindingFlags.Static | BindingFlags.NonPublic);
                Assert.IsNull(methodInfo, "Expected DataGrid.SelectedIndex NOT to have static side-effect callback 'OnSelectedIndexPropertyChanged'.");
            }
            EnqueueTestComplete();
        }
 protected void bindData()
 {
     CustomerList.DataSource = CustomerManager.getAllCustomers();
     CustomerList.DataBind();
 }
示例#30
0
        public void SelectedItems()
        {
            Type propertyType = typeof(IList);
            bool expectGet    = true;
            bool expectSet    = false;

            DataGrid control = new DataGrid();

            Assert.IsNotNull(control);
            TestPanel.Children.Add(control);

            this._counter             = 0;
            control.SelectionChanged += control_SelectionChanged;

            // Verify dependency property CLR property member
            PropertyInfo propertyInfo = typeof(DataGrid).GetProperty("SelectedItems", BindingFlags.Instance | BindingFlags.Public);

            Assert.IsNotNull(propertyInfo, "Expected CLR property DataGrid.SelectedItems does not exist.");
            Assert.AreEqual(propertyType, propertyInfo.PropertyType, "DataGrid.SelectedItems not expected type 'IList'.");

            // Verify getter/setter access
            Assert.AreEqual(expectGet, propertyInfo.CanRead, "Unexpected value for propertyInfo.CanRead.");
            Assert.AreEqual(expectSet, propertyInfo.CanWrite, "Unexpected value for propertyInfo.CanWrite.");

            CustomerList list = new CustomerList();

            Assert.IsTrue(list.Count > 3, "CustomerList has too few items for this test.");

            Assert.AreEqual(0, this._counter, "Wrong initial counter state.");

            Common.AssertExpectedException(DataGridError.DataGrid.ItemIsNotContainedInTheItemsSource("dataItem"),
                                           delegate
            {
                control.SelectedItems.Add(list[2]);
            }
                                           );

            Assert.AreEqual(0, this._counter, "Counter should not have changed after illegal item selection.");

            control.ItemsSource   = list;
            control.SelectionMode = DataGridSelectionMode.Extended;

            // Verify that you can modify SelectedItems while the DataGrid is loading
            control.SelectedItem = null;
            for (int i = 1; i < 4; i++)
            {
                control.SelectedItems.Add(list[i]);
            }
            control.SelectedItems.Remove(list[2]);

            //



            this.EnqueueYieldThread();

            EnqueueCallback(delegate
            {
                Assert.AreEqual(1, this._counter, "Test0: SelectionChanged should have been called once");
                Assert.AreEqual(control.SelectedItem, list[1], "Test0: wrong selected item");
                Assert.AreEqual(2, control.SelectedItems.Count, "Test0: wrong number of selected items");

                control.SelectedItem = list[0];
                control.SelectedItems.Add(list[2]);

                Assert.AreEqual(3, this._counter, "Test0: Counter should have incremented.");

                Assert.AreEqual(list[0], control.SelectedItem, "Test1: wrong selected item -- SelectedItem should have remained the same");
                Assert.AreEqual(2, control.SelectedItems.Count, "Test1: wrong selected item count");

                control.SelectedItem = list[2];

                Assert.AreEqual(4, this._counter, "Test3: Counter should have incremented.");

                Assert.AreEqual(list[2], control.SelectedItem, "Test3: wrong selected item");
                Assert.AreEqual(1, control.SelectedItems.Count, "Test3: wrong selected item count");

                control.SelectedItems.Clear();

                Assert.AreEqual(5, this._counter, "Test4: Counter should have incremented.");

                Assert.IsNull(control.SelectedItem, "Test4: selected item not null");
                Assert.AreEqual(0, control.SelectedItems.Count, "Test4: wrong selected item count");
            });
            EnqueueTestComplete();
        }
        public void CollapseSingleDetailsWithoutOtherExpansionWithScrollBarVisible()
        {
            this._autoGeneratedCount = 0;
            this._isLoaded = false;
            DataGrid dataGrid = new DataGrid();
            dataGrid.RowDetailsVisibilityMode = DataGridRowDetailsVisibilityMode.VisibleWhenSelected;
            dataGrid.Width = 250;
            dataGrid.Height = 300;
            dataGrid.RowDetailsTemplate = (DataTemplate)XamlReader.Load(@"<DataTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" ><Button Height=""30"" /></DataTemplate>");
            Assert.IsNotNull(dataGrid);
            dataGrid.Loaded += this.dataGrid_Loaded;

            CustomerList customers = new CustomerList(30);
            dataGrid.ItemsSource = customers;
            dataGrid.SelectedItem = customers[0];

            TestPanel.Children.Add(dataGrid);
            this.EnqueueConditional(delegate { return this._isLoaded; });

            double verticalMax = 0;
            this.EnqueueYieldThread();
            this.EnqueueCallback(delegate
            {
                Assert.IsNotNull(dataGrid.VerticalScrollBar);
                Assert.AreEqual(Visibility.Visible, dataGrid.VerticalScrollBar.Visibility);
                Assert.AreEqual(customers[0], dataGrid.SelectedItem);

                verticalMax = dataGrid.VerticalScrollBar.Maximum;

                // Collapse details with no animation
                dataGrid.RowDetailsVisibilityMode = DataGridRowDetailsVisibilityMode.Collapsed;
            });

            this.EnqueueYieldThread();
            this.EnqueueCallback(delegate
            {
                // Check to make sure the vertical scrollbar was adjusted correctly
                Assert.IsTrue(DoubleUtil.AreClose(30, verticalMax - dataGrid.VerticalScrollBar.Maximum));

                dataGrid.RowDetailsVisibilityMode = DataGridRowDetailsVisibilityMode.VisibleWhenSelected;
            });

            this.EnqueueYieldThread();
            this.EnqueueCallback(delegate
            {
                Assert.IsTrue(DoubleUtil.AreClose(verticalMax, dataGrid.VerticalScrollBar.Maximum));

                // Collapse with the animation
                dataGrid.SelectedItem = null;
            });

            // Wait for the details animation to complete
            this.EnqueueDelay(100);
            this.EnqueueYieldThread();
            this.EnqueueCallback(delegate
            {
                // Check to make sure the vertical scrollbar was adjusted correctly
                Assert.IsTrue(DoubleUtil.AreClose(30, verticalMax - dataGrid.VerticalScrollBar.Maximum));
            });

            EnqueueTestComplete();
        }
示例#32
0
        public void SelectedItem()
        {
            Type propertyType   = typeof(object);
            bool expectGet      = true;
            bool expectSet      = true;
            bool hasSideEffects = true;

            DataGrid control = new DataGrid();

            Assert.IsNotNull(control);

            // Verify Dependency Property Property member
            FieldInfo fieldInfo = typeof(DataGrid).GetField("SelectedItemProperty", BindingFlags.Static | BindingFlags.Public);

            Assert.AreEqual(typeof(DependencyProperty), fieldInfo.FieldType, "DataGrid.SelectedItemProperty not expected type 'DependencyProperty'.");

            // Verify Dependency Property Property's value type
            DependencyProperty property = fieldInfo.GetValue(null) as DependencyProperty;

            Assert.IsNotNull(property);

            //


            // Verify Dependency Property CLR property member
            PropertyInfo propertyInfo = typeof(DataGrid).GetProperty("SelectedItem", BindingFlags.Instance | BindingFlags.Public);

            Assert.IsNotNull(propertyInfo, "Expected CLR property DataGrid.SelectedItem does not exist.");
            Assert.AreEqual(propertyType, propertyInfo.PropertyType, "DataGrid.SelectedItem not expected type 'object'.");

            // Verify getter/setter access
            Assert.AreEqual(expectGet, propertyInfo.CanRead, "Unexpected value for propertyInfo.CanRead.");
            Assert.AreEqual(expectSet, propertyInfo.CanWrite, "Unexpected value for propertyInfo.CanWrite.");

            // Verify that we set what we get
            if (expectSet) // if expectSet == false, this block can be removed
            {
                CustomerList list = new CustomerList();

                Assert.IsTrue(list.Count > 3, "CustomerList has too few items for this test.");

                Common.AssertExpectedException(DataGridError.DataGrid.ItemIsNotContainedInTheItemsSource("dataItem"),
                                               delegate
                {
                    control.SelectedItems.Add(list[2]);
                }
                                               );

                control.ItemsSource = list;

                //



                control.SelectedItem = list[0];

                Assert.AreEqual(list[0], control.SelectedItem);
                Assert.AreNotEqual(list[1], control.SelectedItem);

                control.SelectedItem = list[3];

                Assert.AreEqual(list[3], control.SelectedItem);

                control.SelectedItem = list[2];

                Assert.AreEqual(list[2], control.SelectedItem);
            }

            // Verify Dependency Property callback
            if (hasSideEffects)
            {
                MethodInfo methodInfo = typeof(DataGrid).GetMethod("OnSelectedItemPropertyChanged", BindingFlags.Static | BindingFlags.NonPublic);
                Assert.IsNotNull(methodInfo, "Expected DataGrid.SelectedItem to have static, non-public side-effect callback 'OnSelectedItemPropertyChanged'.");

                //
            }
            else
            {
                MethodInfo methodInfo = typeof(DataGrid).GetMethod("OnSelectedItemPropertyChanged", BindingFlags.Static | BindingFlags.NonPublic);
                Assert.IsNull(methodInfo, "Expected DataGrid.SelectedItem NOT to have static side-effect callback 'OnSelectedItemPropertyChanged'.");
            }
        }
            public CustomerMailMergeDataSource(CustomerList customers)
            {
                this.mCustomers = customers;

                // When the data source is initialized, it must be positioned before the first record.
                this.mRecordIndex= -1;
            }
示例#34
0
 public ContactList()
 {
     this._customerList = new CustomerList();
 }
示例#35
0
 public async System.Threading.Tasks.Task <Models.TempWorksDB.CustomerList[]> GetCustomerListAsync()
 {
     return(await CustomerList.ToArrayAsync());
 }
        public static CustomerList GetCustomerList(int maximumRows, int startRowIndex, string SortExpression)
        {
            const string query     = "Select * from Customers";
            CustomerList customers = new CustomerList();


            SqlConnection conn    = new SqlConnection("Data Source=Win2k8;Initial Catalog=NorthWind;User ID=sa;Password=XXXXX");
            SqlCommand    command = new SqlCommand(query, conn);

            conn.Open();
            SqlDataReader reader = command.ExecuteReader();

            ArrayList rows = new ArrayList();

            while (reader.Read())
            {
                object[] values = new object[reader.FieldCount];
                reader.GetValues(values);
                rows.Add(values);
            }

            conn.Close();

            int currentIndex = 0;
            int itemsRead    = 0;
            int totalRecords = rows.Count;

            foreach (object[] row in rows)
            {
                if (currentIndex >= startRowIndex && itemsRead <= maximumRows)
                {
                    customers.Add(new Customer {
                        Name = row[1].ToString(), ID = row[0].ToString(), ContactName = row[2].ToString()
                    });
                    itemsRead++;
                }
                currentIndex++;
            }


            CustomerList sortedCustomers = new CustomerList();

            string sortBy       = SortExpression;
            bool   isDescending = false;

            if (SortExpression.ToLowerInvariant().EndsWith(" desc"))
            {
                sortBy       = SortExpression.Substring(0, SortExpression.Length - 5);
                isDescending = true;
            }
            var sortedList = from customer in customers
                             select customer;

            switch (sortBy)
            {
            case "ID":
                sortedList = isDescending ? sortedList.OrderByDescending(cust => cust.ID) : sortedList.OrderBy(cust => cust.ID);
                break;

            case "Name":
                sortedList = isDescending ? sortedList.OrderByDescending(cust => cust.Name) : sortedList.OrderBy(cust => cust.Name);
                break;

            case "ContactName":
                sortedList = isDescending ? sortedList.OrderByDescending(cust => cust.ContactName) : sortedList.OrderBy(cust => cust.ContactName);
                break;
            }
            foreach (Customer x in sortedList)
            {
                sortedCustomers.Add(x);
            }
            return(sortedCustomers);
        }
示例#37
0
        public bool UpdateCustomers(DateTime?startDate, int customerLimit = 0)
        {
            int customerCount = 0;

            CustomerList customers = visma.GetCustomerList(startDate);

            Log(string.Format("\n{0} customers found in Visma database.", customers.Count));

            StatusUpdate(string.Format("Updating {0} customers.", customers.Count));


            foreach (CustomerInfo customerInfo in customers)
            {
                int customerNumber = customerInfo.Number;

                // Get full Customer object from Visma
                Customer customer = visma.GetCustomerByNumber(customerNumber);

                Customer invoiceCustomer = null;
                if (customer.InvoiceCustomerID > 0)
                {
                    invoiceCustomer = visma.GetCustomerByNumber(customer.InvoiceCustomerID);
                }

                int contactNumber = 0;

                foreach (Contact contact in customer.Contacts)
                {
                    contactNumber++;

                    Log(string.Format("- Customer {0} - {1} [{2}]", customer.FullName, contactNumber.ToString(), customer.Number));

                    // Save article as Shopify Product
                    string email = contact.Email;


                    if (!string.IsNullOrEmpty(email)) //   && (customerNumber == 28)
                    {
                        DataSet.CustomerDataTable customerDT = customerTA.GetDataByCustomerNumber(shop.ID, customerNumber, contactNumber);

                        try
                        {
                            if (customerDT.Count == 0)
                            {
                                string data = shop.GetCustomerDataFromVismaCustomer(customer, contact, invoiceCustomer, null);
                                //Log(data);
                                object response = shop.CreateCustomer(data);

                                //Log("Response " + response.ToString());
                                JObject customerResponse = JsonConvert.DeserializeObject <JObject>(response.ToString());
                                long    shopifyID        = 0;
                                long    addressID        = 0;
                                long.TryParse(customerResponse["customer"]["id"].ToString(), out shopifyID);
                                long.TryParse(customerResponse["customer"]["default_address"]["id"].ToString(), out addressID);
                                Log(string.Format(" - Shopify Customer [{0}] created.", shopifyID));

                                customerTA.InsertCustomer(shop.ID, shopifyID, customer.Number, addressID, contactNumber);
                            }
                            else
                            {
                                long   shopifyID = customerDT[0].ShopifyCustomerID;
                                long   addressID = customerDT[0].ShopifyAddressID;
                                string data      = shop.GetCustomerDataFromVismaCustomer(customer, contact, invoiceCustomer, addressID);
                                //Log(data);
                                object response = shop.UpdateCustomer(data, shopifyID);

                                Log(string.Format(" - Shopify Customer [{0}] updated.", shopifyID));
                            }
                        }
                        catch (System.Net.WebException ex)
                        {
                            LogError("Unable to create or update Customer", ex);
                        }
                    }
                    else
                    {
                        Log(" - Unable to create customer - No email value");
                    }
                }



                customerCount += 1;

                if ((customerLimit > 0) && (customerCount >= customerLimit))
                {
                    break;
                }
            }


            return(true);
        }
示例#38
0
 public void CreateCustomer()
 {
     CustomerList.Add(new Customer(ViewCompanyName, ViewPhoneNumber, ViewAdress, ViewEmail, ViewATT, ViewCVR));
     OnPropertyChanged();
 }
示例#39
0
        static void Main(string[] args)
        {
            #region 1.普通方法展示
            {
                /*
                 *  普通方法通过对象创建(NEW)
                 *  引用左边是细节,右边也是细节(属于强依赖)
                 */
                //Console.WriteLine("**********Common method开始执行***********");

                //AbstractFood hotBeefFood = new HotBeef();
                //hotBeefFood.ShowMenuInfo();
                //hotBeefFood.FoodTaste();
                //hotBeefFood.FoodComment();

                //AbstractFood eggplantFood = new Eggplant();
                //eggplantFood.ShowMenuInfo();
                //eggplantFood.FoodTaste();
                //eggplantFood.FoodComment();

                //AbstractFood toufuFood = new Toufu();
                //toufuFood.ShowMenuInfo();
                //toufuFood.FoodTaste();
                //toufuFood.FoodComment();

                //AbstractFood kungPaoChickenFood = new KungPaoChicken();
                //kungPaoChickenFood.ShowMenuInfo();
                //kungPaoChickenFood.FoodTaste();
                //kungPaoChickenFood.FoodComment();

                //Console.WriteLine("**********Common method 结束***********");
            }
            #endregion


            #region 工厂方法展示
            {
                #region 简单工厂

                /*
                 *  优点
                 *  缺点
                 */

                //使用枚举值在简单工厂里面判断枚举值来创建对象
                //AbstractFood abstractFood = SimpleFactoryCreate.CreateInstanceByNormal(SimpleFactoryCreate.SimpleFactorFoodType.Toufu);
                //abstractFood.ShowMenuInfo();
                //abstractFood.FoodTaste();
                //abstractFood.FoodComment();

                //通过配置文件的枚举值来创建对象
                //AbstractFood abstractFood = SimpleFactoryCreate.CreateTnstanceByNormalConfigure();
                //abstractFood.ShowMenuInfo();
                //abstractFood.FoodTaste();
                //abstractFood.FoodComment();

                //通过反射来创建对象
                //AbstractFood abstactFactory = SimpleFactoryCreate.CreateInstance();
                //abstactFactory.ShowMenuInfo();
                //abstactFactory.FoodTaste();
                //abstactFactory.FoodComment();
                #endregion
            }

            {
                #region 工厂模式

                /*
                 *  优点:实现了开闭原则(开放扩展,封闭修改)。
                 *  缺点:如果要新建一种类就需要新建一个工厂
                 */
                //BaseFactory baseFactory = new FactoryHotBeef();
                //AbstractFood abstractFood = baseFactory.CreateInstance();
                //abstractFood.ShowMenuInfo();
                #endregion
            }

            {
                #region 抽象工厂

                /*
                 *  优点:
                 *  缺点:
                 */
                //AbstractBaseFactory abstractBaseFactory = new SichuanCuisine();
                //AbstractFood abstractFood = abstractBaseFactory.CeateChicken();
                //abstractFood.ShowMenuInfo();
                //abstractFood.FoodTaste();
                //abstractFood.FoodComment();
                #endregion
            }
            #endregion

            #region 单人
            {
                //Console.WriteLine("*****************控制台点餐系统***********************");
                //Console.WriteLine("********下面是我们的菜单,请选择要点菜的编号***********");

                //Console.WriteLine("*************************************");
                //#region 单例 菜单
                SingleFoodMenu menu = SingleFoodMenu.CreateInstance();
                if (menu != null && menu.foodList.Count() > 0)
                {
                    foreach (var menuList in menu.foodList)
                    {
                        Console.WriteLine($"菜品编码[{menuList.FoodNo}] 菜品名称:{menuList.FoodName} 售价:{menuList.FoodPrice}");
                    }
                }

                ////string fileName = @"C:\Users\Administrator\source\repos\FoodMenuOrder\FoodMenuOrder\ConfigureFile\FoodMenu.xml";//文件名称与路径
                ////using (Stream fStream = new FileStream(fileName, FileMode.Create, FileAccess.ReadWrite))
                ////{
                ////    List<FoodModel> pList = FoodDataFactory.BuildProgrammerList();
                ////    XmlSerializer xmlFormat = new XmlSerializer(typeof(List<FoodModel>));//创建XML序列化器,需要指定对象的类型
                ////    xmlFormat.Serialize(fStream, pList);
                ////}


                ////using (Stream fStream = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite))
                ////{
                ////    XmlSerializer xmlFormat = new XmlSerializer(typeof(List<FoodModel>));//创建XML序列化器,需要指定对象的类型
                ////                                                                          //使用XML反序列化对象
                ////    fStream.Position = 0;//重置流位置
                ////    List<FoodModel> pList = pList = (List<FoodModel>)xmlFormat.Deserialize(fStream);
                ////}
                //#endregion


                //"点餐".WriteLogConsole("Please input food id  and press enter to continue...", "admin", ConsoleColor.Magenta);
                //while (true)
                //{
                //    if (!int.TryParse(Console.ReadLine(), out int input))
                //    {
                //        "识别输入:".WriteLogConsole("非数字类型,请重新输入", "admin", ConsoleColor.Red);
                //    }
                //    else
                //    {
                //        var selectFood = menu.foodList.FirstOrDefault(c => c.FoodNo == input.ToString());
                //        if (selectFood == null)
                //        {
                //            "菜品选择:".WriteLogConsole("您选择的菜本店没有", "admin", ConsoleColor.Red);
                //        }
                //        else
                //        {
                //            "正确选择:".WriteLogConsole(string.Format("您当前点了编码{0}的【{1}】,价格{2}", selectFood.FoodNo, selectFood.FoodName, selectFood.FoodPrice), "root", ConsoleColor.Gray);
                //            AbstractFood abstractFood = SimpleFactoryCreate.CreateInstanceByNormal((SimpleFactoryCreate.SimpleFactorFoodType)Enum.Parse(typeof(SimpleFactoryCreate.SimpleFactorFoodType), selectFood.FoodNo));
                //            abstractFood.ShowMenuInfo();
                //            abstractFood.FoodTaste();
                //            abstractFood.CookingFood(abstractFood.foodBaseModel.FirstOrDefault());
                //        }
                //    }
                //}

                #region 多人订购
                {
                    //Read the XML load configuration
                    //showMenu
                    CustomerList customerList = SingleCustomer.CreateInstance()._CustomerList;
                    Console.WriteLine($"{string.Join(",", customerList.name)}前来点餐");

                    List <Task> tasks = new List <Task>();
                    Dictionary <string, Dictionary <AbstractFood, int> > dicAll = new Dictionary <string, Dictionary <AbstractFood, int> >();
                    List <Dictionary <AbstractFood, int> > dicList = new List <Dictionary <AbstractFood, int> >();
                    foreach (var customerItem in customerList.name)
                    {
                        dicList.Add(new Dictionary <AbstractFood, int>());
                    }

                    int k = 0;

                    //遍历所有顾客
                    foreach (var item in customerList.name)
                    {
                        Dictionary <AbstractFood, int> foodDic = dicList[k++];
                        tasks.Add(Task.Run(() => {
                            //随机点5个菜
                            List <FoodModel> list = menu.foodList.GetFoodListByRandom();
                            "已点菜单".WriteLogConsole($"客人{item},已点{string.Join(",", list.Select(s => s.FoodName))}", "shsjj", ConsoleColor.Red);
                            foreach (var foodList in list)
                            {
                                "开始烹饪:".WriteLogConsole($"菜名:{foodList.FoodName}即将开始:", "admin", ConsoleColor.Yellow);
                                //依次做菜、尝、点评
                                AbstractFood abstractFood = SimpleFactoryCreate.CreateInstanceByAssembly(foodList.AssemblyPath);
                                abstractFood.CookingFood(foodList);
                                abstractFood.FoodTaste();
                                int score = abstractFood.FoodComment();
                                foodDic.Add(abstractFood, score);
                            }
                            dicAll.Add(item, foodDic);
                            int foodMaxScore = foodDic.Values.Max();//获取字典内的最大分数值
                            //循环 查找字典内 值为最大分数的(有可能最大分数有多个)
                            foreach (var maxScoreItem in foodDic.Where(d => d.Value == foodMaxScore))
                            {
                                Console.WriteLine($"{item}点餐中,最高分食物是{maxScoreItem.Key.foodBaseModel[0].FoodName},最高分为{maxScoreItem.Value}");
                            }
                        }));                       //可以 每个线程把最高分返回回来
                    }
                    Task.WaitAll(tasks.ToArray()); //一定要等客人都吃完

                    Console.WriteLine("*********************************");
                    int maxAll = dicList.Max(d => d.Values.Max());

                    for (int i = 0; i < customerList.name.Count; i++)
                    {
                        var dic = dicList[i];
                        foreach (var item in dic.Where(d => d.Value == maxAll))
                        {
                            Console.WriteLine($"{customerList.name[i]}最高分食物是{item.Key.foodBaseModel[0].FoodName},分数为{item.Value}");
                        }
                    }
                }
                #endregion
            }
            #endregion


            Console.Read();
        }
示例#40
0
        private void button6_Click(object sender, EventArgs e)
        {
            CustomerList cus = new CustomerList();

            cus.ShowDialog();
        }
示例#41
0
        static void Main(string[] args)
        {
            //LINQ - Restriction Operators
            //Q1
            var Result1_1 = ProductList.Where(P => P.UnitsInStock == 0);

            foreach (var item in Result1_1)
            {
                Console.WriteLine(item);
            }

            //Q2
            var Result1_2 = ProductList.Where(P => P.UnitsInStock > 0 && P.UnitPrice > 3);

            foreach (var item in Result1_2)
            {
                Console.WriteLine(item);
            }
            //Q3
            string[] Arr = { "zero",  "one",   "two",
                             "three", "four",  "five",
                             "six",   "seven", "eight", "nine" };
            var      Result1_3 = Arr.Where((s, i) => s.Length < i);

            foreach (var item in Result1_3)
            {
                Console.WriteLine(item);
            }

            //--------------------------------------------------------------

            //LINQ - Element Operators
            //Q1
            var Element = ProductList.FirstOrDefault(P => P.UnitsInStock == 0);

            Console.WriteLine(Element);
            //Q2
            var Element1 = ProductList.FirstOrDefault(P => P.UnitPrice > 1000);

            Console.WriteLine(Element1?.ProductName ?? "NULL");
            //Q3
            int[] ArrInt    = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
            var   Result2_3 = ArrInt.Where(i => i > 5);
            var   Element2  = Result2_3.ElementAt(1);

            Console.WriteLine("The Second Element : " + Element2);

            //--------------------------------------------------------------

            //Linq-Partitioning Operators
            //Q1
            var Result3_1 = CustomerList.Where(c => c.City == "London").Take(3);

            foreach (var item in Result3_1)
            {
                Console.WriteLine(item);
                Console.WriteLine("---------------");
            }
            //Q2
            var Result3_2 = CustomerList.Where(c => c.City == "London").Skip(2);

            foreach (var item in Result3_2)
            {
                Console.WriteLine(item);
                Console.WriteLine("---------------");
            }
            //Q3
            int i = 0;

            int[] numbers   = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
            var   Result3_3 = numbers.TakeWhile(num => num > i++);

            foreach (var item in Result3_3)
            {
                Console.WriteLine(item);
            }
            //Q4 --xxx
            int[] numbersDiv = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
            var   Result3_4  = numbersDiv.SkipWhile(num => num % 3 != 0);

            foreach (var item in Result3_4)
            {
                Console.WriteLine(item);
            }
            //Q5

            int j = 0;

            int[] numbersS  = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
            var   Result3_5 = numbersS.SkipWhile(num => num > j++);

            foreach (var item in Result3_5)
            {
                Console.WriteLine(item);
            }
        }
示例#42
0
        private void createNewTab(eTabType type)
        {
            switch (type)
            {
            case eTabType.MAIN_TAB:
                break;

            case eTabType.CUSTOMER_TAB:
            {
                //Hieu
                //Edit
                var newTab = isExitTabPage("Danh sách khách hàng");
                if (newTab == null)
                {
                    newTab = new TabPage("Danh sách khách hàng");
                    var customerList = new CustomerList();
                    customerList.Dock = DockStyle.Fill;
                    newTab.Controls.Add(customerList);

                    tabControl.TabPages.Add(newTab);
                }

                tabControl.SelectedTab = newTab;
                break;
            }

            case eTabType.VENDOR_TAB:
            {
                var newTab = isExitTabPage("Danh sách nhà cung cấp");
                if (newTab == null)
                {
                    newTab = new TabPage("Danh sách nhà cung cấp");
                    var vendorList = new VendorList();
                    vendorList.Dock = DockStyle.Fill;
                    newTab.Controls.Add(vendorList);

                    tabControl.TabPages.Add(newTab);
                }

                tabControl.SelectedTab = newTab;
                break;
            }

            case eTabType.ORDER_TAB:
            {
                var customerOrder = new CreateCustomerOrderForm();
                var result        = customerOrder.ShowDialog();
                if (result == DialogResult.OK)
                {
                    var newTab = isExitTabPage("Giao dịch");
                    if (newTab == null)
                    {
                        newTab            = new TabPage("Giao dịch");
                        newTab.AutoScroll = true;
                        var order = new OrderDetailForm(customerOrder.OrderId);
                        order.Dock = DockStyle.Top;
                        newTab.Controls.Add(order);

                        tabControl.TabPages.Add(newTab);
                    }

                    tabControl.SelectedTab = newTab;
                }
                else if (result == DialogResult.Retry)
                {
                    createNewTab(eTabType.CUSTOMER_TAB);
                }

                break;
            }

            case eTabType.CUSTOMER_ORDER_LIST_TAB:
            {
                var selectForm = new SelectOrderForm();
                var result     = selectForm.ShowDialog();

                if (result == DialogResult.OK)
                {
                    var text   = "Đơn hàng " + selectForm.OrderKey;
                    var newTab = isExitTabPage(text);

                    if (newTab == null)
                    {
                        newTab            = new TabPage(text);
                        newTab.AutoScroll = true;
                        var order = new CustomerOrderDetail(selectForm.OrderId);
                        order.Dock = DockStyle.Fill;
                        newTab.Controls.Add(order);

                        tabControl.TabPages.Add(newTab);
                    }

                    tabControl.SelectedTab = newTab;
                }

                break;
            }

            case eTabType.STORE_TAB:
            {
                var text   = "Danh sách kho hàng";
                var newTab = isExitTabPage(text);

                if (newTab == null)
                {
                    newTab            = new TabPage(text);
                    newTab.AutoScroll = true;
                    var store = new InventoryList();
                    store.Dock = DockStyle.Fill;
                    newTab.Controls.Add(store);

                    tabControl.TabPages.Add(newTab);
                }
                tabControl.SelectedTab = newTab;
                break;
            }

            case eTabType.PRODUCT_TAB:
            {
                var text   = "Danh sách mặt hàng";
                var newTab = isExitTabPage(text);

                if (newTab == null)
                {
                    newTab            = new TabPage(text);
                    newTab.AutoScroll = true;
                    var product = new ProductList();
                    product.Dock = DockStyle.Fill;
                    newTab.Controls.Add(product);
                    this.newProductMenuItem.Click += product.showDialogAddProduct;         //7ung
                    tabControl.TabPages.Add(newTab);
                }

                tabControl.SelectedTab = newTab;
                break;
            }

            case eTabType.STAFF_TAB:
            {
                var text   = "Danh sách nhân viên";
                var newTab = isExitTabPage(text);

                if (newTab == null)
                {
                    newTab            = new TabPage(text);
                    newTab.AutoScroll = true;
                    var staff = new StaffList();
                    staff.Dock = DockStyle.Fill;
                    newTab.Controls.Add(staff);

                    tabControl.TabPages.Add(newTab);
                }
                tabControl.SelectedTab = newTab;
                break;
            }

            case eTabType.INOUT_INVENTORY:
            {
                var text   = "Quản lý đơn hàng nhập xuất kho";
                var newTab = isExitTabPage(text);

                if (newTab == null)
                {
                    newTab            = new TabPage(text);
                    newTab.AutoScroll = true;
                    var store = new InOutInventoryList();
                    store.Dock = DockStyle.Fill;
                    newTab.Controls.Add(store);

                    tabControl.TabPages.Add(newTab);
                }
                tabControl.SelectedTab = newTab;
                break;
            }

            case eTabType.INVENTORY_LIST:
            {
                var text   = "Quản lý kho hàng";
                var newTab = isExitTabPage(text);

                if (newTab == null)
                {
                    newTab            = new TabPage(text);
                    newTab.AutoScroll = true;
                    var store = new InventoryList();
                    store.Dock = DockStyle.Fill;
                    newTab.Controls.Add(store);

                    tabControl.TabPages.Add(newTab);
                }
                tabControl.SelectedTab = newTab;
                break;
            }

            case eTabType.VENDOR_ORDER_TAB:
            {
                var vendorOrder = new CreateVendorOrderForm();
                var result      = vendorOrder.ShowDialog();
                if (result == DialogResult.OK)
                {
                    var text   = "Giao dịch đơn hàng " + vendorOrder.DocumentKey;
                    var newTab = isExitTabPage(text);

                    if (newTab == null)
                    {
                        newTab            = new TabPage(text);
                        newTab.AutoScroll = true;
                        var order = new VendorOrderDetailForm(vendorOrder.OrderId);
                        order.Dock = DockStyle.Top;
                        newTab.Controls.Add(order);

                        tabControl.TabPages.Add(newTab);
                    }
                    tabControl.SelectedTab = newTab;
                }
                else if (result == DialogResult.Retry)
                {
                    createNewTab(eTabType.VENDOR_TAB);
                }
                break;
            }

            case eTabType.VENDOR_ORDER_LIST_TAB:
            {
                var selectForm = new SelectVendorOrderForm();
                var result     = selectForm.ShowDialog();

                if (result == DialogResult.OK)
                {
                    var text   = "Đơn hàng " + selectForm.DocumentKey;
                    var newTab = isExitTabPage(text);

                    if (newTab == null)
                    {
                        newTab            = new TabPage(text);
                        newTab.AutoScroll = true;
                        var order = new VendorOrderDetail(selectForm.OrderId);
                        order.DocumentKey = selectForm.DocumentKey;
                        order.Dock        = DockStyle.Fill;
                        newTab.Controls.Add(order);

                        tabControl.TabPages.Add(newTab);
                    }
                    tabControl.SelectedTab = newTab;
                }
                break;
            }

            case eTabType.REVENUE_REPORT_TAB:
            {
                var text   = "Báo cáo doanh thu";
                var newTab = isExitTabPage(text);

                if (newTab == null)
                {
                    newTab            = new TabPage(text);
                    newTab.AutoScroll = true;
                    var report = new RevenueReport();
                    report.Dock = DockStyle.Fill;
                    newTab.Controls.Add(report);

                    tabControl.TabPages.Add(newTab);
                }
                tabControl.SelectedTab = newTab;
                break;
            }

            case eTabType.CUSTOMER_REPORT_TAB:
            {
                var text   = "Báo cáo tình hình khách hàng";
                var newTab = isExitTabPage(text);

                if (newTab == null)
                {
                    newTab            = new TabPage(text);
                    newTab.AutoScroll = true;
                    var report = new CustomerReport();
                    report.Dock = DockStyle.Top;
                    newTab.Controls.Add(report);

                    tabControl.TabPages.Add(newTab);
                }
                tabControl.SelectedTab = newTab;
                break;
            }

            case eTabType.CREATE_BUSINESS_REPORT_TAB:
            {
                var dialogCreate = new CreateReportForm();
                var r            = dialogCreate.ShowDialog();

                if (r == DialogResult.OK)
                {
                    var text   = "Báo cáo chi phí bán hàng";
                    var newTab = isExitTabPage(text);

                    if (newTab == null)
                    {
                        newTab            = new TabPage(text);
                        newTab.AutoScroll = true;
                        var report = new CreateBusinessFee(dialogCreate.DocumentId, true);
                        report.Dock = DockStyle.Top;
                        newTab.Controls.Add(report);

                        tabControl.TabPages.Add(newTab);
                    }
                    tabControl.SelectedTab = newTab;
                }
                break;
            }

            case eTabType.VIEW_BUSINESS_REPORT_TAB:
            {
                var text   = "Xem cáo chi phí bán hàng";
                var newTab = isExitTabPage(text);

                if (newTab == null)
                {
                    newTab            = new TabPage(text);
                    newTab.AutoScroll = true;
                    var report = new ViewBusinessFee();
                    report.Dock = DockStyle.Top;
                    newTab.Controls.Add(report);

                    tabControl.TabPages.Add(newTab);
                }
                tabControl.SelectedTab = newTab;
                break;
            }

            case eTabType.INVENTORY_REPORT_TAB:
            {
                var text   = "Báo cáo tồn kho";
                var newTab = isExitTabPage(text);

                if (newTab == null)
                {
                    newTab            = new TabPage(text);
                    newTab.AutoScroll = true;
                    var report = new InventoryReport();
                    report.Dock = DockStyle.Fill;
                    newTab.Controls.Add(report);

                    tabControl.TabPages.Add(newTab);
                }
                tabControl.SelectedTab = newTab;
                break;
            }

            default:
                break;
            }
        }
        public JsonResult mailattctment(string cafno)
        {
            string[] strpath = cafno.Split(',');

            cst = new CustomerList();

            pf_file = "/App_Data/Billcaf/" + strpath[0] + "/" + strpath[1];
            return Json(pf_file, JsonRequestBehavior.AllowGet);
        }
示例#44
0
        /*
         * This method will add/update a customer
         * @author nazmul hasan on 5th january 2016
         */
        private void OnAdd()
        {
            if (!ValidateCustomer())
            {
                MessageBox.Show(ErrorMessage);
                return;
            }
            ProfileInfo profileInfo = new ProfileInfo();

            profileInfo.setId(CustomerInfoNJ.ProfileInfoNJ.Id);
            profileInfo.setFirstName(CustomerInfoNJ.ProfileInfoNJ.FirstName);
            profileInfo.setLastName(CustomerInfoNJ.ProfileInfoNJ.LastName);
            profileInfo.setEmail(CustomerInfoNJ.ProfileInfoNJ.Email);
            profileInfo.setPhone(CustomerInfoNJ.ProfileInfoNJ.Phone);
            profileInfo.setFax(CustomerInfoNJ.ProfileInfoNJ.Fax);
            profileInfo.setWebsite(CustomerInfoNJ.ProfileInfoNJ.Website);
            CustomerInfo customerInfo = new CustomerInfo();

            customerInfo.setProfileInfo(profileInfo);
            CustomerManager customerManager = new CustomerManager();

            CustomerInfoNJ customerInfoNJ = new CustomerInfoNJ();

            customerInfoNJ.ProfileInfoNJ.Id        = CustomerInfoNJ.ProfileInfoNJ.Id;
            customerInfoNJ.ProfileInfoNJ.FirstName = CustomerInfoNJ.ProfileInfoNJ.FirstName;
            customerInfoNJ.ProfileInfoNJ.LastName  = CustomerInfoNJ.ProfileInfoNJ.LastName;
            customerInfoNJ.ProfileInfoNJ.Email     = CustomerInfoNJ.ProfileInfoNJ.Email;
            customerInfoNJ.ProfileInfoNJ.Phone     = CustomerInfoNJ.ProfileInfoNJ.Phone;
            customerInfoNJ.ProfileInfoNJ.Fax       = CustomerInfoNJ.ProfileInfoNJ.Fax;
            customerInfoNJ.ProfileInfoNJ.Website   = CustomerInfoNJ.ProfileInfoNJ.Website;

            ResultEvent resultEvent = new ResultEvent();

            if (CustomerInfoNJ.ProfileInfoNJ.Id > 0)
            {
                resultEvent = customerManager.updateCustomer(customerInfo);
            }
            else
            {
                resultEvent = customerManager.createCustomer(customerInfo);
            }
            if (resultEvent.getResponseCode() == Responses.RESPONSE_CODE_SUCCESS)
            {
                if (CustomerInfoNJ.ProfileInfoNJ.Id > 0)
                {
                    for (int counter = 0; counter < CustomerList.Count; counter++)
                    {
                        CustomerInfoNJ tempCustomerInfoNJ = CustomerList.ElementAt(counter);

                        if (tempCustomerInfoNJ.ProfileInfoNJ.Id == CustomerInfoNJ.ProfileInfoNJ.Id)
                        {
                            CustomerList.RemoveAt(counter);
                            CustomerList.Insert(counter, customerInfoNJ);
                        }
                    }
                }
                else
                {
                    CustomerInfo responseCustomerInfo = (CustomerInfo)resultEvent.getResult();
                    CustomerInfoNJ.ProfileInfoNJ.Id = responseCustomerInfo.getProfileInfo().getId();
                    customerInfoNJ.ProfileInfoNJ.Id = CustomerInfoNJ.ProfileInfoNJ.Id;
                    if (CustomerList.Count == 0)
                    {
                        CustomerList.Add(customerInfoNJ);
                    }
                    else
                    {
                        CustomerList.Insert(0, customerInfoNJ);
                    }
                }
            }
            MessageBox.Show(resultEvent.getMessage());
            //reset create Customer fields
            OnReset();
        }
示例#45
0
        public async Task Insert(CustomerList item)
        {
            await _context.CustomerList.AddAsync(item);

            await _context.SaveChangesAsync();
        }
示例#46
0
        public void SelectedIndex()
        {
            Type propertyType = typeof(int);
            bool expectGet = true;
            bool expectSet = true;
            bool hasSideEffects = true;

            DataGrid control = new DataGrid();
            Assert.IsNotNull(control);

            // Verify Dependency Property Property member
            FieldInfo fieldInfo = typeof(DataGrid).GetField("SelectedIndexProperty", BindingFlags.Static | BindingFlags.Public);
            Assert.AreEqual(typeof(DependencyProperty), fieldInfo.FieldType, "DataGrid.SelectedIndexProperty not expected type 'DependencyProperty'.");

            // Verify Dependency Property Property's value type
            DependencyProperty property = fieldInfo.GetValue(null) as DependencyProperty;

            Assert.IsNotNull(property);

            // 


            // Verify Dependency Property CLR property member
            PropertyInfo propertyInfo = typeof(DataGrid).GetProperty("SelectedIndex", BindingFlags.Instance | BindingFlags.Public);
            Assert.IsNotNull(propertyInfo, "Expected CLR property DataGrid.SelectedIndex does not exist.");
            Assert.AreEqual(propertyType, propertyInfo.PropertyType, "DataGrid.SelectedIndex not expected type 'object'.");

            // Verify getter/setter access
            Assert.AreEqual(expectGet, propertyInfo.CanRead, "Unexpected value for propertyInfo.CanRead.");
            Assert.AreEqual(expectSet, propertyInfo.CanWrite, "Unexpected value for propertyInfo.CanWrite.");

            // Verify that we set what we get
            if (expectSet) // if expectSet == false, this block can be removed
            {
                CustomerList list = new CustomerList();

                Assert.IsTrue(list.Count > 3, "CustomerList has too few items for this test.");

                control.ItemsSource = list;

                // 







                TestPanel.Children.Add(control);
                this.EnqueueYieldThread();

                EnqueueCallback(delegate
                {
                    Assert.AreEqual(list.Count, control.RowCount);

                    control.SelectedIndex = 0;

                    Assert.AreEqual(0, control.SelectedIndex);
                    Assert.AreNotEqual(1, control.SelectedIndex);

                    Assert.AreEqual(list[0], control.SelectedItem);
                    Assert.AreNotEqual(list[1], control.SelectedItem);

                    control.SelectedIndex = 3;

                    Assert.AreEqual(3, control.SelectedIndex);
                    Assert.AreEqual(list[3], control.SelectedItem);

                    control.SelectedIndex = 2;

                    Assert.AreEqual(2, control.SelectedIndex);
                    Assert.AreEqual(list[2], control.SelectedItem);

                    control.SelectedItem = list[3];

                    Assert.AreEqual(list[3], control.SelectedItem);
                    Assert.AreEqual(3, control.SelectedIndex);

                    control.SelectedIndex = -2;

                    Assert.IsNull(control.SelectedItem);
                    Assert.AreEqual(-1, control.SelectedIndex);

                    control.SelectedIndex = list.Count - 1;

                    Assert.AreEqual(list.Count - 1, control.SelectedIndex);
                    Assert.AreEqual(list[list.Count - 1], control.SelectedItem);

                    control.SelectedIndex = list.Count;

                    Assert.IsNull(control.SelectedItem);
                    Assert.AreEqual(-1, control.SelectedIndex);
                });
            }

            // Verify Dependency Property callback
            if (hasSideEffects)
            {
                MethodInfo methodInfo = typeof(DataGrid).GetMethod("OnSelectedIndexPropertyChanged", BindingFlags.Static | BindingFlags.NonPublic);
                Assert.IsNotNull(methodInfo, "Expected DataGrid.SelectedIndex to have static, non-public side-effect callback 'OnSelectedIndexPropertyChanged'.");

                // 
            }
            else
            {
                MethodInfo methodInfo = typeof(DataGrid).GetMethod("OnSelectedIndexPropertyChanged", BindingFlags.Static | BindingFlags.NonPublic);
                Assert.IsNull(methodInfo, "Expected DataGrid.SelectedIndex NOT to have static side-effect callback 'OnSelectedIndexPropertyChanged'.");
            }
            EnqueueTestComplete();
        }
示例#47
0
 public void ViewContactList()
 {
     CustomerList.GetCustomers();
 }
 public async Task LoadAsync(CustomersViewState state)
 {
     await CustomerList.LoadAsync(state);
 }
示例#49
0
 //default
 public CustomerListViewModel()
 {
     Customers = CustomerList.GetCustomerList();
 }
 public void Unload()
 {
     CustomerList.Unload();
 }
示例#51
0
        public void SelectedItems()
        {
            Type propertyType = typeof(IList);
            bool expectGet = true;
            bool expectSet = false;

            DataGrid control = new DataGrid();
            Assert.IsNotNull(control);
            TestPanel.Children.Add(control);

            counter = 0;
            control.SelectionChanged += control_SelectionChanged;

            // Verify Dependency Property CLR property member
            PropertyInfo propertyInfo = typeof(DataGrid).GetProperty("SelectedItems", BindingFlags.Instance | BindingFlags.Public);
            Assert.IsNotNull(propertyInfo, "Expected CLR property DataGrid.SelectedItems does not exist.");
            Assert.AreEqual(propertyType, propertyInfo.PropertyType, "DataGrid.SelectedItems not expected type 'IList'.");

            // Verify getter/setter access
            Assert.AreEqual(expectGet, propertyInfo.CanRead, "Unexpected value for propertyInfo.CanRead.");
            Assert.AreEqual(expectSet, propertyInfo.CanWrite, "Unexpected value for propertyInfo.CanWrite.");

            CustomerList list = new CustomerList();

            Assert.IsTrue(list.Count > 3, "CustomerList has too few items for this test.");

            Assert.AreEqual(0, counter, "Wrong initial counter state.");

            Common.AssertExpectedException(DataGridError.DataGrid.ItemIsNotContainedInTheItemsSource("dataItem"),
                delegate
                {
                    control.SelectedItems.Add(list[2]);
                }
            );

            Assert.AreEqual(0, counter, "Counter should not have changed after illegal item selection.");

            control.ItemsSource = list;
            control.SelectionMode = DataGridSelectionMode.Extended;

            // 







            this.EnqueueYieldThread();

            EnqueueCallback(delegate
            {

                Assert.AreEqual(1, counter, "Default selection was not set");

                Assert.AreEqual(list[0], control.SelectedItem, "Test0: wrong selected item");

                control.SelectedItems.Add(list[2]);

                Assert.AreEqual(2, counter, "Test0: Counter should have incremented.");

                Assert.AreEqual(list[0], control.SelectedItem, "Test1: wrong selected item -- SelectedItem should have remained the same");
                Assert.AreEqual(2, control.SelectedItems.Count, "Test1: wrong selected item count");

                control.SelectedItem = list[2];

                Assert.AreEqual(3, counter, "Test3: Counter should have incremented.");

                Assert.AreEqual(list[2], control.SelectedItem, "Test3: wrong selected item");
                Assert.AreEqual(1, control.SelectedItems.Count, "Test3: wrong selected item count");

                control.SelectedItems.Clear();

                Assert.AreEqual(4, counter, "Test4: Counter should have incremented.");

                Assert.IsNull(control.SelectedItem, "Test4: selected item not null");
                Assert.AreEqual(0, control.SelectedItems.Count, "Test4: wrong selected item count");
            });
            EnqueueTestComplete();
        }
 public async Task RefreshAsync()
 {
     await CustomerList.RefreshAsync();
 }
 public void ThereAreNoCustomersInTheSystem()
 {
     customers = new CustomerList();
 }
 private async void OnItemDeleted(object sender, EventArgs e)
 {
     await CustomerList.RefreshAsync();
 }
        public JsonResult show(string pdf)
        {
            string[] strpath = pdf.Split(',');

             cst = new CustomerList();
             //pf_file = "/App_Data/" + pdf;
             pf_file = "/App_Data/UserFile/" + strpath[0] + "/" + strpath[1];
             cst.ImageUrl = "/App_Data/UserFile/" + strpath[0] + "/" + strpath[1];
             return Json(cst.ImageUrl, JsonRequestBehavior.AllowGet);
        }
        public void SelectedItem()
        {
            Type propertyType = typeof(object);

            DataGrid dataGrid = new DataGrid();

            dataGrid.Height = 300;
            Assert.IsNotNull(dataGrid);

            // Verify dependency property member
            FieldInfo fieldInfo = typeof(DataGrid).GetField("SelectedItemProperty", BindingFlags.Static | BindingFlags.Public);

            Assert.AreEqual(typeof(DependencyProperty), fieldInfo.FieldType, "DataGrid.SelectedItemProperty not expected type 'DependencyProperty'.");

            // Verify dependency property's value type
            DependencyProperty property = fieldInfo.GetValue(null) as DependencyProperty;

            Assert.IsNotNull(property);

            //


            // Verify dependency property CLR property member
            PropertyInfo propertyInfo = typeof(DataGrid).GetProperty("SelectedItem", BindingFlags.Instance | BindingFlags.Public);

            Assert.IsNotNull(propertyInfo, "Expected CLR property DataGrid.SelectedItem does not exist.");
            Assert.AreEqual(propertyType, propertyInfo.PropertyType, "DataGrid.SelectedItem not expected type 'object'.");

            // Verify getter/setter access
            Assert.AreEqual(true, propertyInfo.CanRead, "Unexpected value for propertyInfo.CanRead.");
            Assert.AreEqual(true, propertyInfo.CanWrite, "Unexpected value for propertyInfo.CanWrite.");

            // Verify dependency property callback
            MethodInfo methodInfo = typeof(DataGrid).GetMethod("OnSelectedItemPropertyChanged", BindingFlags.Static | BindingFlags.NonPublic);

            Assert.IsNotNull(methodInfo, "Expected DataGrid.SelectedItem to have static, non-public side-effect callback 'OnSelectedItemPropertyChanged'.");

            // Verify that we set what we get
            CustomerList list = new CustomerList(150);

            Assert.IsTrue(list.Count > 3, "CustomerList has too few items for this test.");

            Common.AssertExpectedException(DataGridError.DataGrid.ItemIsNotContainedInTheItemsSource("dataItem"),
                                           delegate
            {
                dataGrid.SelectedItems.Add(list[2]);
            }
                                           );

            dataGrid.ItemsSource = list;

            dataGrid.SelectedItem = list[0];

            Assert.AreEqual(list[0], dataGrid.SelectedItem);
            Assert.AreNotEqual(list[1], dataGrid.SelectedItem);

            dataGrid.SelectedItem = list[3];

            Assert.AreEqual(list[3], dataGrid.SelectedItem);

            dataGrid.SelectedItem = list[2];

            Assert.AreEqual(list[2], dataGrid.SelectedItem);

            dataGrid.SelectedItem = list[list.Count - 1];
            dataGrid.LoadingRow  += new EventHandler <DataGridRowEventArgs>(DataGrid_LoadingRow);
            _rowLoaded            = false;

            TestPanel.Children.Add(dataGrid);

            EnqueueConditional(() => _rowLoaded);

            this.EnqueueYieldThread();
            this.EnqueueCallback(delegate
            {
                Assert.AreEqual(dataGrid.DisplayData.FirstScrollingSlot, 0);
            });

            EnqueueTestComplete();
        }
示例#57
0
        /// <summary>
        /// Function to Search the Customer List.
        /// </summary>
        /// <param name="objLoginProp"></param>
        /// <returns>void</returns>
        /// <createdBy></createdBy>
        /// <createdOn>May 10,2016</createdOn>
        private async void Search(object obj)
        {
            CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            try
            {
                if (obj == null)
                {
                    CurrentPageIndex = 0;
                }

                if (CurrentPageIndex == 0)
                {
                    Application.Current.Properties["FindUserGridLastScrollOffset"] = 0;
                    Application.Current.Properties["FindUserGridCurrentPageIndex"] = 0;
                }

                CustomerSearchProp objCustomerSearchProp = new CustomerSearchProp();
                objCustomerSearchProp.CustomerCode           = CustomerCode;
                objCustomerSearchProp.CustomerName           = CustomerName;
                objCustomerSearchProp.CustomerType           = CustomerType;
                objCustomerSearchProp.City                   = City;
                objCustomerSearchProp.State                  = State;
                objCustomerSearchProp.Zip                    = Zip;
                objCustomerSearchProp.DBAName                = dbaName;
                objCustomerSearchProp.ShortName              = shortName;
                objCustomerSearchProp.CurrentPageIndex       = CurrentPageIndex;
                objCustomerSearchProp.PageSize               = CurrentPageIndex > 0 ? _GridPageSizeOnScroll : _GridPageSize;;
                objCustomerSearchProp.DefaultPageSize        = _GridPageSize;
                objCustomerSearchProp.PortStorageCustomerInd = IsPortStorage;

                var data = await _serviceInstance.GetCustomerSearchDetailsAsync(objCustomerSearchProp);

                IEnumerable <CustomerInfo> customerInfo = data.Select(d => new CustomerInfo
                {
                    CustomerID                       = d.CustomerID,
                    CustomerNameInfo                 = d.CustomerName,
                    AddressLine1Info                 = d.AddressLine1,
                    CityInfo                         = d.City,
                    SatetInfo                        = d.State,
                    ZipInfo                          = d.Zip,
                    CustomerCode                     = d.CustomerCode,
                    DBAName                          = d.DBAName,
                    ShortName                        = d.ShortName,
                    CustomerType                     = d.CustomerType,
                    CustomerOf                       = d.CustomerOf,
                    BillingAddressID                 = d.BillingAddressID,
                    MainAddressID                    = d.MainAddressID,
                    VendorNumber                     = d.VendorNumber,
                    DefaultBillingMethod             = d.DefaultBillingMethod,
                    RecordStatus                     = d.RecordStatus,
                    SortOrder                        = d.SortOrder,
                    EligibleForAutoLoad              = d.EligibleForAutoLoad,
                    ALwaysVVIPInd                    = d.ALwaysVVIPInd,
                    CollectionIssueInd               = d.CollectionIssueInd,
                    AssignedToExternalCollectionsInd = d.AssignedToExternalCollectionsInd,
                    BulkBillingInd                   = d.BulkBillingInd,
                    DoNotPrintInvoiceInd             = d.DoNotPrintInvoiceInd,
                    DoNotExportInvoiceInd            = d.DoNotExportInvoiceInd,
                    HideNewFreightFromBrokerInd      = d.HideNewFreightFromBrokerInd,
                    PortStorageCustomerInd           = d.PortStorageCustomerInd,
                    AutoPortExportCustomerInd        = d.AutoPortExportCustomerInd,
                    RequiresPONumberInd              = d.RequiresPONumberInd,
                    SendEmailConfirmationsInd        = d.SendEmailConfirmationsInd,
                    STIFollowupRequiredInd           = d.STIFollowupRequiredInd,
                    DamagePhotoRequiredInd           = d.DamagePhotoRequiredInd,
                    ApplyFuelSurchargeInd            = d.ApplyFuelSurchargeInd,
                    FuelSurchargePercent             = d.FuelSurchargePercent,
                    LoadNumberPrefix                 = d.LoadNumberPrefix,
                    LoadNumberLength                 = d.LoadNumberLength,
                    NextLoadNUmber                   = d.NextLoadNUmber,
                    BookingNumberPrefix              = d.BookingNumberPrefix,
                    HandHeldScannerCustomerCode      = d.HandHeldScannerCustomerCode,
                    DriverComment                    = d.DriverComment,
                    InternalComment                  = d.InternalComment,
                    CreatedDate                      = d.CreatedDate,
                    CreatedBy                        = d.CreatedBy,
                    UpdatedDate                      = d.UpdatedDate,
                    UpdatedBy                        = d.UpdatedBy,
                    TotalPageCount                   = d.TotalPageCount,
                    EntryRate                        = d.EntryRate,
                    PerDiemGraceDays                 = d.PerDiemGraceDays
                });

                //if index is 0 need to fill the List
                if (CurrentPageIndex == 0)
                {
                    CustomerList = null;
                    CustomerList = new ObservableCollection <CustomerInfo>(customerInfo);
                }
                //otherwise add into the list
                else
                {
                    if (CustomerList != null && CustomerList.Count > 0)
                    {
                        foreach (CustomerInfo ud in new ObservableCollection <CustomerInfo>(customerInfo))
                        {
                            CustomerList.Add(ud);
                        }
                    }
                }

                Application.Current.Properties["SearchCount"] = Convert.ToInt32(Application.Current.Properties["SearchCount"]) + 1;

                //If list count is > 0
                if (CustomerList != null && CustomerList.ToList().Count > 0)
                {
                    //Update Total record count on UI
                    Count = CustomerList.ToList().Where(x => x.TotalPageCount > 0).FirstOrDefault().TotalPageCount;
                }
                else
                {
                    Count = 0;
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogErrorToDb(ex);
                bool displayErrorOnUI = false;
                CommonSettings.logger.LogError(this.GetType(), ex);
                if (displayErrorOnUI)
                {
                    throw;
                }
            }
            finally
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }
 public override void addCustomer(Customer customer)
 {
     CustomerList.Add(customer);
 }