Пример #1
0
        public async Task TestGetAccountReceivablesByCustomerId()
        {
            long customerId = 3;
            //UnitOfWork unitOfWork = new UnitOfWork();

            CustomerModule custMod = new CustomerModule();

            //IList<AccountReceiveableView> list =  custMod.GetAccountReceivablesByCustomerId(customerId);

            IList <AccountReceivableView> list = await custMod
                                                 .AccountsReceivable
                                                 .Query()
                                                 .GetAccountReceivableViewsByCustomerId(customerId);


            List <string> collection = new List <string>();

            foreach (AccountReceivableView accountReceiveableView in list)
            {
                output.WriteLine($"{accountReceiveableView.InvoiceDocument}");
                collection.Add(accountReceiveableView.InvoiceDocument.ToUpper());
            }
            bool results = collection.Any(s => s.Contains("INV-02"));

            Assert.True(results);
        }
Пример #2
0
        public async Task TestGetContractsByCustomerId()
        {
            long?customerId = 2;
            long?contractId = 1;

            //UnitOfWork unitOfWork = new UnitOfWork();

            CustomerModule custMod = new CustomerModule();

            IList <ContractView> list = await custMod
                                        .Contract
                                        .Query()
                                        .GetContractsByCustomerId(customerId ?? 0, contractId ?? 0);

            List <string> collection = new List <string>();

            foreach (var item in list)
            {
                output.WriteLine($"{item.CustomerName}");
                collection.Add(item.CustomerName.ToUpper());
            }
            bool results = collection.Any(s => s.Contains("NED SCARISBRICK"));

            Assert.True(results);
        }
Пример #3
0
        public async Task TestGetInvoicesByCustomerId()
        {
            long customerId = 2;
            long?invoiceId  = 5;
            //int? invoiceId = null;

            //UnitOfWork unitOfWork = new UnitOfWork();
            CustomerModule custMod = new CustomerModule();


            IList <InvoiceView> list = await custMod
                                       .Invoice
                                       .Query()
                                       .GetInvoiceViewsByCustomerId(customerId, invoiceId);


            List <string> collection = new List <string>();

            foreach (var item in list)
            {
                foreach (InvoiceDetailView invoiceDetailView in item.InvoiceDetailViews)
                {
                    output.WriteLine($"{invoiceDetailView.ItemDescription}");
                    collection.Add(invoiceDetailView.ItemDescription.ToUpper());
                }
            }
            bool results = collection.Any(s => s.Contains("EMPTY"));

            Assert.True(results);
        }
Пример #4
0
        public async Task TestCustomerCashPayment2()
        {
            int customerId = 2;


            GeneralLedgerView ledgerView = new GeneralLedgerView();

            CustomerModule custMod   = new CustomerModule();
            long?          addressId = await custMod.AddressBook.Query().GetAddressIdByCustomerId(customerId);

            ChartOfAccountModule coaMod = new ChartOfAccountModule();

            ChartOfAccount coa = await coaMod.ChartOfAccount.Query().GetEntity("1000", "1200", "101", "");

            ledgerView.GeneralLedgerId = -1;
            ledgerView.DocNumber       = 1;
            ledgerView.DocType         = "PV";
            ledgerView.Amount          = 250M;
            ledgerView.LedgerType      = "AA";
            ledgerView.GLDate          = DateTime.Parse("8/10/2018");
            ledgerView.AccountId       = coa.AccountId;
            ledgerView.CreatedDate     = DateTime.Parse("8/10/2018");
            ledgerView.AddressId       = addressId ?? 0;
            ledgerView.Comment         = "First installment payment for dashboard";
            ledgerView.DebitAmount     = 250;
            ledgerView.CreditAmount    = 0;
            ledgerView.FiscalPeriod    = 8;
            ledgerView.FiscalYear      = 2018;
            ledgerView.CheckNumber     = "112";

            AccountReceivableModule acctRecMod = new AccountReceivableModule();
            bool result = await acctRecMod.CreateCustomerLedger(ledgerView);

            Assert.True(result);
        }
Пример #5
0
 public NewMalFunctionViewModel()
 {
     CustomerList     = CustomerModule.GetCustomerList();
     FabricList       = FabricModule.GetFabricList();
     FactoryList      = FactoryModule.GetFactoryList();
     ProcessOrderList = ProcessModule.GetProcessOrder();
 }
Пример #6
0
        public void UpdateModules(Int32 id, Int32 moduleId)
        {
            CustomerModule query;

            try {
                using (menuzRusDataContext db = new menuzRusDataContext(base.connectionString)) {
                    // Negative - stops service by ending it as of today
                    if (moduleId < 0)
                    {
                        query = db.CustomerModules.Where(m => m.CustomerId == id && m.ModulePriceId == Math.Abs(moduleId) && m.EndDate == null).FirstOrDefault();
                        if (query != default(CustomerModule))
                        {
                            query.EndDate = DateTime.Now.Date;
                        }
                    }
                    // Positive - inserts
                    else if (moduleId > 0)
                    {
                        query               = new CustomerModule();
                        query.CustomerId    = id;
                        query.ModulePriceId = moduleId;
                        db.CustomerModules.InsertOnSubmit(query);
                    }
                    else if (moduleId == 0)
                    {
                    }
                    db.SubmitChanges();
                }
            }
            catch (Exception ex) {
                throw ex;
            }

            return;
        }
Пример #7
0
        public async Task <IActionResult> GetCustomerView(long customerId)
        {
            CustomerModule invMod = new CustomerModule();

            CustomerView view = await invMod.Customer.Query().GetViewById(customerId);

            return(Ok(view));
        }
Пример #8
0
 public ErpService()
 {
     ErpName        = "LogoGoPlus";
     CustomerModule = new CustomerModule(this);
     ProductModule  = new ProductModule();
     InvoiceModule  = null;
     DespatchModule = null;
 }
Пример #9
0
        public async Task <IActionResult> DeleteCustomer([FromBody] CustomerView view)
        {
            CustomerModule invMod   = new CustomerModule();
            Customer       customer = await invMod.Customer.Query().MapToEntity(view);

            invMod.Customer.DeleteCustomer(customer).Apply();

            return(Ok(view));
        }
Пример #10
0
        public ProcessOrderPage()
        {
            InitializeComponent();

            ComboBoxStatus.ItemsSource = Enum.GetValues(typeof(ProcessOrderColorStatus)).Cast <ProcessOrderColorStatus>();
            DisplayAllOrder();
            DataGridProcessOrder.ItemsSource       = DataGridProcessOrderCollection;
            ComboBoxCustomer.ItemsSource           = CustomerModule.GetCustomerList();
            ComboBoxCustomerNameSearch.ItemsSource = CustomerModule.GetCustomerList();
            DataGridFactoryList.ItemsSource        = FactoryModule.GetFactoryList();
        }
Пример #11
0
        public async Task <IActionResult> UpdateCustomer([FromBody] CustomerView view)
        {
            CustomerModule invMod = new CustomerModule();

            Customer customer = await invMod.Customer.Query().MapToEntity(view);


            invMod.Customer.UpdateCustomer(customer).Apply();

            CustomerView retView = await invMod.Customer.Query().GetViewById(customer.CustomerId);


            return(Ok(retView));
        }
Пример #12
0
        public void TestCreateCustomerAccount()
        {
            try
            {
                string json = "";


                json = @"{ ""CustomerName"":""David Poston"" 
                        ,""FirstName"":""David"",
                        ""LastName"":""Poston"",
                        ""CompanyName"":""DC Tech"",
                        
                        ""LocationAddress"":[{
                        ""Address_Line1"" : ""2420 12th Ave"",
                        ""City"" : ""Nampa"",
                        ""State"" : ""ID"",
                        ""Zipcode"" : ""83686"",
                        ""Country"" : ""USA"",
                        ""Type"" : ""Primary""
                        }],
                        ""AccountEmail"":{
                              ""EmailText"" : ""*****@*****.**"",
                              ""LoginEmail"" : true,
                              ""Password"" : ""12345""
                            }
                        }";


                CustomerView customerView = JsonConvert.DeserializeObject <CustomerView>(json);

                CustomerModule custMod = new CustomerModule();

                custMod
                .Customer

                .CreateAddressBook(customerView)
                .Apply()
                .CreateCustomerEmail(customerView)
                .Apply()
                .CreateCustomer(customerView)
                .Apply()
                .CreateCustomerLocationAddress(customerView)
                .Apply()
                ;

                Assert.True(true);
            }
            catch (Exception ex)
            { throw new Exception("TestCreateCustomerAccount", ex); }
        }
Пример #13
0
        public async Task <IActionResult> AddCustomer([FromBody] CustomerView view)
        {
            CustomerModule invMod = new CustomerModule();

            NextNumber nnCustomer = await invMod.Customer.Query().GetNextNumber();

            view.CustomerNumber = nnCustomer.NextNumberValue;

            Customer customer = await invMod.Customer.Query().MapToEntity(view);

            invMod.Customer.AddCustomer(customer).Apply();

            CustomerView newView = await invMod.Customer.Query().GetViewByNumber(view.CustomerNumber);


            return(Ok(newView));
        }
Пример #14
0
        public async Task TestGetCustomerLedgersByCustomerId()
        {
            long                       customerId = 9;
            CustomerModule             custMod    = new CustomerModule();
            IList <CustomerLedgerView> list       = await custMod
                                                    .CustomerLedger
                                                    .Query()
                                                    .GetViewsByCustomerId(customerId);

            foreach (var item in list)
            {
                listCheck.Add(item.DocNumber.ToString());
            }
            bool results = listCheck.Any(e => e.Contains("12"));

            Assert.True(results);
        }
Пример #15
0
        public void SaveModulesByCustomer(Int32 id, Int32[] modulesIds)
        {
            try {
                using (menuzRusDataContext db = new menuzRusDataContext(base.connectionString)) {
                    CustomerModule customerModule = new CustomerModule();
                    customerModule.CustomerId = id;

                    foreach (Int32 priceId in modulesIds)
                    {
                        customerModule.ModulePriceId = priceId;
                        db.CustomerModules.InsertOnSubmit(customerModule);
                    }
                    db.SubmitChanges();
                }
            }
            catch (Exception ex) {
                throw ex;
            }
        }
Пример #16
0
        void AddFactoryClickExecute()
        {
            if (string.IsNullOrEmpty(Name))
            {
                MessageBox.Show("請輸入客戶名稱!!");
                return;
            }
            var customer = new Customer()
            {
                Name        = Name,
                PhoneNumber = PhoneNumber,
                CellPhone   = CellPhone,
                Fax         = Fax,
                Memo        = Memo,
                Address     = Address,
                Sort        = Sort
            };

            bool isContainCustomer = CustomerModule.GetCustomerList().Select(s => s.Name).Contains(customer.Name);

            if (isContainCustomer)
            {
                MessageBox.Show("此客戶已存在清單內!!");
                return;
            }
            bool success = CustomerModule.InsertCustomer(customer);

            if (success)
            {
                MessageBox.Show("新增成功!!");
                Name        = string.Empty;
                PhoneNumber = string.Empty;
                CellPhone   = string.Empty;
                Fax         = string.Empty;
                Address     = string.Empty;
                Memo        = string.Empty;
                Sort        = 0;
            }
            else
            {
                MessageBox.Show("新增失敗!!");
            }
        }
Пример #17
0
        public void TestGetEmailByCustomerId()
        {
            int customerId = 3;

            //UnitOfWork unitOfWork = new UnitOfWork();
            CustomerModule    custMod = new CustomerModule();
            IList <EmailView> list    = custMod
                                        .Customer
                                        .Query()
                                        .GetEmails(customerId);

            List <string> collection = new List <string>();

            foreach (var item in list)
            {
                output.WriteLine($"{item.EmailText}");
                collection.Add(item.EmailText.ToUpper());
            }
            bool results = collection.Any(s => s.Contains("*****@*****.**"));

            Assert.True(results);
        }
Пример #18
0
        public async Task TestGetLocationAddressByCustomerId()
        {
            long?customerId = 3;

            // UnitOfWork unitOfWork = new UnitOfWork();
            CustomerModule custMod           = new CustomerModule();
            IList <LocationAddressView> list = await custMod
                                               .LocationAddress
                                               .Query()
                                               .GetLocationAddressViewsByCustomerId(customerId);

            List <string> collection = new List <string>();

            foreach (var item in list)
            {
                output.WriteLine($"{item.City}");
                collection.Add(item.City.ToUpper());
            }
            bool results = collection.Any(s => s.Contains("BOISE"));

            Assert.True(results);
        }
Пример #19
0
        public async Task TestGetPhoneByCustomerId()
        {
            long?customerId = 3;

            //UnitOfWork unitOfWork = new UnitOfWork();
            CustomerModule          custMod = new CustomerModule();
            IList <PhoneEntityView> list    = await custMod
                                              .Phone
                                              .Query()
                                              .GetPhoneEntityViewsByCustomerId(customerId);

            List <string> collection = new List <string>();

            foreach (var item in list)
            {
                output.WriteLine($"{item.PhoneNumber}");
                collection.Add(item.PhoneNumber.ToUpper());
            }
            bool results = collection.Any(s => s.Contains("401-4333"));

            Assert.True(results);
        }
Пример #20
0
        public async Task TestGetEmailByCustomerId()
        {
            long?customerId = 3;

            //UnitOfWork unitOfWork = new UnitOfWork();
            CustomerModule          custMod = new CustomerModule();
            IList <EmailEntityView> list    = await custMod
                                              .Email
                                              .Query()
                                              .GetEmailsViewsByCustomerId(customerId);

            List <string> collection = new List <string>();

            foreach (var item in list)
            {
                output.WriteLine($"{item.Email}");
                collection.Add(item.Email.ToUpper());
            }
            bool results = collection.Any(s => s.Contains("*****@*****.**"));

            Assert.True(results);
        }
Пример #21
0
        public async Task TestGetCustomerClaimsByCustomerId()
        {
            int customerId = 2;

            CustomerModule            custMod = new CustomerModule();
            IList <CustomerClaimView> list    = await custMod
                                                .CustomerClaim
                                                .Query()
                                                .GetCustomerClaimsByCustomerId(customerId);


            List <string> collection = new List <string>();

            foreach (CustomerClaimView customerClaimView in list)
            {
                output.WriteLine($"{customerClaimView.GroupId}");
                collection.Add(customerClaimView.GroupId.ToUpper());
            }
            bool results = collection.Any(s => s.Contains("IDAHO WEB DEVELOPMENT CUSTOMERS"));

            Assert.True(results);
        }
Пример #22
0
        public async Task TestCustomerCashPayment()
        {
            long?customerId = 9;

            GeneralLedgerView ledgerView = new GeneralLedgerView();

            CustomerModule custMod   = new CustomerModule();
            long?          addressId = await custMod.AddressBook.Query().GetAddressIdByCustomerId(customerId);

            ChartOfAccountModule coaMod = new ChartOfAccountModule();

            ChartOfAccount coa = await coaMod.ChartOfAccount.Query().GetEntity("1000", "1200", "101", "");

            ledgerView.GeneralLedgerId = -1;
            ledgerView.DocNumber       = 12;
            ledgerView.DocType         = "PV";
            ledgerView.Amount          = 189.63M;
            ledgerView.LedgerType      = "AA";
            ledgerView.GLDate          = DateTime.Parse("7/21/2018");
            ledgerView.AccountId       = coa.AccountId;
            ledgerView.CreatedDate     = DateTime.Parse("7/21/2018");
            ledgerView.AddressId       = addressId ?? 0;
            ledgerView.Comment         = "Payment in Part for 50% sharing of project income";
            ledgerView.DebitAmount     = 189.63M;
            ledgerView.CreditAmount    = 0;
            ledgerView.FiscalPeriod    = 7;
            ledgerView.FiscalYear      = 2018;
            ledgerView.CheckNumber     = "111";


            AccountReceivableModule acctRecMod = new AccountReceivableModule();

            bool result = await acctRecMod.CreateCustomerCashPayment(ledgerView);


            Assert.True(true);
        }
Пример #23
0
        public async Task TestGetScheduleEventsByCustomerId()
        {
            long customerId = 1;
            long?serviceId  = 3;
            //int? invoiceId = null;

            //UnitOfWork unitOfWork = new UnitOfWork();
            CustomerModule            custMod = new CustomerModule();
            IList <ScheduleEventView> list    = await custMod
                                                .ScheduleEvent
                                                .Query()
                                                .GetViewsByCustomerId(customerId, serviceId ?? 0);

            List <string> collection = new List <string>();

            foreach (var item in list)
            {
                output.WriteLine($"{item.CustomerName}");
                collection.Add(item.CustomerName.ToUpper());
            }
            bool results = collection.Any(s => s.Contains("PAM NISHIMOTO"));

            Assert.True(results);
        }
Пример #24
0
        private void CustomerModuleBtn_Click(object sender, EventArgs e)
        {
            CustomerModule customerModule = new CustomerModule();

            customerModule.ShowDialog();
        }
Пример #25
0
 public CustomerController(IceFactoryUnitOfWork unitOfWork) : base(unitOfWork)
 {
     _objModule = new CustomerModule(unitOfWork);
 }