//public DelegateCommand SaveClickCommand
        //{
        //    get
        //    {
        //        return (this.saveClickCommand ?? new DelegateCommand(this.OnSaveSupplier));
        //    }
        //}

        //public DelegateCommand SameAsBillingAddressCommand
        //{
        //    get
        //    {
        //        return (this.sameAsBillingAddressCommand ?? new DelegateCommand(OnSameAsBillAddress));
        //    }
        //}

        //private void OnSameAsBillAddress()
        //{
        //    //var shippingAddress = new ShippingAddress();
        //    this.ShipCity = this.Cus_Bill_to_city;
        //    this.ShipAddressLine1 = this.Cus_Bill_to_line1;
        //    this.ShipAddressLine2 = this.Cus_Bill_to_line2;
        //    this.ShipState = this.Cus_Bill_to_state;
        //    this.ShipPostalCode = this.Cus_Bill_to_post_code;
        //    this.ShipCountry = this.Cus_Bill_to_country;

        //}

        //public DelegateCommand NewShippingClickCommand
        //{
        //    get
        //    {
        //        return (this.newShippingClickCommand ?? new DelegateCommand(this.OnNewShippingAddress));
        //    }
        //}

        //public DelegateCommand PreviousCommand
        //{
        //    get
        //    {
        //        return (this.previousCommand ?? new DelegateCommand(this.OnPreviouClick));
        //    }
        //}

        //public DelegateCommand NextCommand
        //{
        //    get
        //    {
        //        return (this.nextCommand ?? new DelegateCommand(this.OnNextClick));
        //    }
        //}

        //public DelegateCommand NewCustomerClickCommand
        //{
        //    get
        //    {
        //        return (this.newCustomerClickCommand ?? new DelegateCommand(this.OnNewCustomer));
        //    }
        //}
        //public DelegateCommand CancelClickCommand
        //{
        //    get
        //    {
        //        return (this.cancelClickCommand ?? new DelegateCommand(this.OnCancelClick));
        //    }
        //}

        //private void OnCancelClick()
        //{
        //    RefreshData();
        //}

        ////public DelegateCommand DeleteCustomerClickCommand
        ////{
        ////    get
        ////    {
        ////        return (this.deleteCustomerClickCommand ?? new DelegateCommand(this.OnDeleteCustomer));
        ////    }
        ////}
        //private void OnDeleteCustomer(object param)
        //{
        //    IsNew = false;
        //    int custId = this.SelectedSearchCustmer;
        //    bool canDelete = false;
        //    ICustomerRepository repo = new CustomerRepository();
        //    canDelete = repo.CanDeleteCustomer(custId);
        //    if (canDelete)
        //    {
        //        MessageBoxResult result = MessageBox.Show("Do you want to delete customer?", "Delete Customer", MessageBoxButton.YesNo, MessageBoxImage.Question);
        //        if (result == MessageBoxResult.Yes)
        //        {
        //            canDelete = repo.DeleteCustomer(custId);
        //            if (canDelete)
        //            {
        //                RefreshData();
        //            }
        //        }
        //    }

        //}
        //private void OnNewShippingAddress()
        //{
        //    this.ClearShippingAddress();
        //    var address = new ShippingAddress();

        //}

        //private void OnSaveCustomer(object param)
        //{
        //    CustomerErrors = ValidateCustomer();
        //    if (CustomerErrors != string.Empty)
        //    {
        //        return;
        //    }
        //    MessageBoxResult result = System.Windows.MessageBox.Show("Do you want to save changes?", "Save Content", MessageBoxButton.YesNo);
        //    if (result == MessageBoxResult.Yes)
        //    {
        //        ICustomerRepository repo = new CustomerRepository();
        //        var customer = repo.GetAllCustomers().FirstOrDefault(x => x.ID == this.ID & x.IsDeleted != true);

        //        if (customer == null)
        //        {
        //            customer = new Customer();
        //            customer.ID = -1;
        //            customer.CreatedBy = loginId;
        //            customer.CreatedDate = System.DateTime.UtcNow;
        //        }
        //        else
        //        {
        //            customer.ModifiedBy = loginId;
        //            customer.ModifiedDate = System.DateTime.UtcNow;
        //        }

        //        customer.Cus_Name = CustomerName;
        //        customer.Cus_Email = Email;
        //        customer.Cus_Fax = Fax;
        //        customer.Cus_Discount = SelectedDiscount;
        //        customer.Cus_Company_Reg_no = Comp_Reg_No;
        //        customer.Cus_Bill_to_city = Cus_Bill_to_city;
        //        customer.Cus_Bill_to_country = Cus_Bill_to_country;
        //        customer.Cus_Bill_to_line1 = Cus_Bill_to_line1;
        //        customer.Cus_Bill_to_line2 = Cus_Bill_to_line2;
        //        customer.Cus_Bill_to_post_code = Cus_Bill_to_post_code;
        //        customer.Cus_Bill_to_state = Cus_Bill_to_state;
        //        customer.Cus_Ship_to_line1 = ShipAddressLine1;
        //        customer.Cus_Ship_to_line2 = ShipAddressLine2;
        //        customer.Cus_Ship_to_city = ShipCity;
        //        customer.Cus_Ship_to_state = ShipState;
        //        customer.Cus_Ship_to_country = ShipCountry;
        //        customer.Cus_Ship_to_post_code = ShipPostalCode;
        //        customer.Cus_Charge_GST = ChangeCustomerGST;
        //        customer.Cus_Salesman = SelectedSalesman;
        //        customer.Cus_Telephone = Telephone;
        //        customer.Cus_Type = SelectedCustomerType;
        //        customer.Cus_Credit_Limit_Days = SelectedCreditLimitDays;

        //        customer.Cus_Credit_Limit_Amount = SelectedCreditLimitAmount;
        //        customer.Cus_Contact_Person = ContactPerson;
        //        customer.Cus_GST_Reg_No = GstRegistrationNo;
        //        customer.Cus_Inactive = IsInActive;
        //        customer.Cus_Remarks = Remarks;

        //        repo.CreateCustomer(customer);

        //        IsNew = false;
        //    }
        //    else
        //    {
        //        IsNew = true;
        //    }
        //}

        //private void OnNextClick()
        //{
        //    var current = SearchCustomer.FirstOrDefault(x => x.ID == SelectedSearchCustmer);

        //    int index = SearchCustomer.IndexOf(current);

        //    if (index < SearchCustomer.Count - 1)
        //    {
        //        var next = SearchCustomer.ElementAt(index + 1);
        //        this.SelectedSearchCustmer = next.ID;

        //    }

        //}

        //private void OnPreviouClick()
        //{
        //    var current = SearchCustomer.FirstOrDefault(x => x.ID == SelectedSearchCustmer);

        //    int index = SearchCustomer.IndexOf(current);

        //    if (index > 0)
        //    {
        //        var next = SearchCustomer.ElementAt(index - 1);
        //        this.SelectedSearchCustmer = next.ID;
        //    }
        //}
        //private string ValidateCustomer()
        //{
        //    string EmailPattern = "^([0-9a-zA-Z]([-\\.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$";
        //    string PhonePattern = @"\+?\d[\d -]{8,15}\d";

        //    StringBuilder msg = new StringBuilder();
        //    if (CustomerName == null || CustomerName.Trim() == string.Empty)
        //    {
        //        msg.Append("Customer Name is Required.\n");
        //    }

        //    if (!String.IsNullOrEmpty(Email))
        //    {
        //        if (!Regex.IsMatch(Email, EmailPattern))
        //        {
        //            msg.Append("Invalid Email Address.\n");
        //        }
        //    }

        //    if (!String.IsNullOrEmpty(Telephone))
        //    {
        //        if (!Regex.IsMatch(Telephone, PhonePattern))
        //        {
        //            msg.Append("Invalid Phone No.\n");
        //        }
        //    }
        //    return msg.ToString();
        //}
        //private void ClearShippingAddress()
        //{
        //    this.ShipAddressLine1 = string.Empty;
        //    this.ShipAddressLine2 = string.Empty;
        //    this.ShipCity = string.Empty;
        //    this.ShipCountry = string.Empty;
        //    this.ShipState = string.Empty;
        //    this.ShipPostalCode = string.Empty;
        //}

        //private void OnNewCustomer()
        //{
        //    this.ID = -1;
        //    this.CustomerName = string.Empty;
        //    this.Email = string.Empty;
        //    this.Fax = string.Empty;
        //    this.SelectedSalesman = null;
        //    this.SelectedCustomerType = "-1";
        //    this.SelectedCreditLimitDays = null;
        //    this.SelectedCreditLimitAmount = null;
        //    this.Telephone = string.Empty;
        //    this.SelectedDiscount = null;
        //    this.Comp_Reg_No = string.Empty;
        //    this.Cus_Bill_to_city = string.Empty;
        //    this.Cus_Bill_to_country = string.Empty;
        //    this.Cus_Bill_to_line1 = string.Empty;
        //    this.Cus_Bill_to_line2 = string.Empty;
        //    this.Cus_Bill_to_post_code = string.Empty;
        //    this.Cus_Bill_to_state = string.Empty;
        //    this.ShipAddressLine1 = string.Empty;
        //    this.ShipAddressLine2 = string.Empty;
        //    this.ShipCity = string.Empty;
        //    this.ShipCountry = string.Empty;
        //    this.ShipState = string.Empty;
        //    this.ShipPostalCode = string.Empty;
        //    this.ContactPerson = string.Empty;
        //    this.GstRegistrationNo = string.Empty;
        //    this.ChangeCustomerGST = false;
        //    this.Balance = null;

        //    this.IsInActive = "N";
        //    this.Remarks = string.Empty;
        //    IsNew = true;
        //    GetCustomerCreditLimit();
        //}

        //#endregion Background Worker

        #endregion

        #region AutoFill
        public List <Country> AutoFillCountry()
        {
            ISupplierRepository repo = new SupplierRepository();

            return(repo.AutoFillCountry());
        }