Example #1
0
        public DE.ICustomer AddNew(out string CustId, out string CustName, out string CustCurrency)
        {
            DE.ICustomer customer = null;
            DE.IAddress  address  = null;

            if (Application != null)
            {
                CustomerData custData = new CustomerData(Application.Settings.Database.Connection, Application.Settings.Database.DataAreaID);
            }
            else
            {
                CustomerData custData = new CustomerData(LSRetailPosis.Settings.ApplicationSettings.Database.LocalConnection, LSRetailPosis.Settings.ApplicationSettings.Database.DATAAREAID);
            }

            //CustomerData custData = new CustomerData(Application.Settings.Database.Connection, Application.Settings.Database.DataAreaID);

            customer = GetNewCustomerDefaults();
            address  = GetNewAddressDefaults(customer);
            using (frmNewCustomer newCustDialog = new frmNewCustomer(customer, address))
            {
                if (Application != null)
                {
                    this.Application.ApplicationFramework.POSShowForm(newCustDialog);
                    // customer = newCustDialog.Customer;
                    //address = newCustDialog.Address;
                }
                else
                {
                    Customer.InternalApplication.ApplicationFramework.POSShowForm(newCustDialog);

                    customer     = newCustDialog.Customer;
                    CustId       = customer.CustomerId;
                    CustName     = customer.Name;
                    CustCurrency = customer.Currency;
                    address      = newCustDialog.Address;
                }

                // this.Application.ApplicationFramework.POSShowForm(newCustDialog);

                if (newCustDialog.DialogResult == DialogResult.OK)
                {
                    customer     = newCustDialog.Customer;
                    CustId       = customer.CustomerId;
                    CustName     = customer.Name;
                    CustCurrency = customer.Currency;
                    address      = newCustDialog.Address;
                }
            }
            CustName     = customer.Name;
            CustId       = customer.CustomerId;
            CustCurrency = customer.Currency;
            return(customer);
        }
Example #2
0
        /// <summary>
        /// Updates the customer information in the database
        /// </summary>
        /// <param name="customerId">The customer id</param>
        /// <returns>Returns the updated customer if succeded, null otherwise</returns>
        public DE.ICustomer UpdateCustomer(string customerId)
        {
            DM.CustomerDataManager customerDataManager = new DM.CustomerDataManager(
                ApplicationSettings.Database.LocalConnection, ApplicationSettings.Database.DATAAREAID);

            DE.ICustomer customer = customerDataManager.GetTransactionalCustomer(customerId);
            DE.IAddress  address  = customerDataManager.GetAddress(customer.PrimaryAddress.Id);

            using (frmNewCustomer newCustDialog = new frmNewCustomer(customer, address))
            {
                this.Application.ApplicationFramework.POSShowForm(newCustDialog);

                if (newCustDialog.DialogResult == DialogResult.OK)
                {
                    return(customer);
                }
            }

            return(null);
        }
Example #3
0
        /// <summary>
        /// Register information about a new customer into the database
        /// </summary>
        /// <returns>Returns new customer of successful, null otherwise</returns>
        public DE.ICustomer AddNew()
        {
            DE.ICustomer customer = null;
            DE.IAddress  address  = null;

            CustomerData custData = new CustomerData(Application.Settings.Database.Connection, Application.Settings.Database.DataAreaID);

            customer = GetNewCustomerDefaults();
            address  = GetNewAddressDefaults(customer);
            using (frmNewCustomer newCustDialog = new frmNewCustomer(customer, address))
            {
                this.Application.ApplicationFramework.POSShowForm(newCustDialog);

                if (newCustDialog.DialogResult == DialogResult.OK)
                {
                    customer = newCustDialog.Customer;
                    address  = newCustDialog.Address;
                }
            }

            return(customer);
        }