Example #1
0
 private void dg_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dg.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != DBNull.Value && !String.IsNullOrEmpty(dg.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()))
     {
         CustomerEntry ent = customerEntryBindingSource.List[e.RowIndex] as CustomerEntry;
         Display(ent);
     }
 }
Example #2
0
 /// <summary>
 /// Validates the amount of the current entry
 /// </summary>
 /// <param name="entry">Current entry</param>
 /// <param name="validationErrors">Validation error text</param>
 /// <returns></returns>
 public bool ValidateEntry(CustomerEntry entry, out IList <string> validationErrors)
 {
     validationErrors = new List <string>();
     if (entry.Amount < 0)
     {
         validationErrors.Add("Importing amount must be positive");
         return(false);
     }
     return(true);
 }
Example #3
0
 private void Display(CustomerEntry entry)
 {
     Customer.Text        = entry.CustomerName;
     Phone.Text           = entry.Phone;
     Email.Text           = entry.Email;
     Query.Text           = entry.Query;
     OrderDate.Text       = entry.OrderDate;
     Product.Text         = entry.Product;
     Marketplace.Text     = entry.MarketPlace;
     OrderNumber.Text     = entry.OrderNumber;
     Action.Text          = entry.Action;
     WhatsappMessage.Text = entry.WhatsappMessage;
     selectedId           = entry.Id;
 }
        public async Task TestCreateTransWithTemplate()
        {
            Assert.IsTrue(_coreDriver.IsInitialize);
            MasterDataCreater.CreateMasterData(_coreDriver);

            await TemplateCreater.CreateTemplate(_coreDriver, _coreDriver.TmMgmt);

            // create transaction data
            DateTime date = DateTime.Parse("2012.07.02");

            VendorEntry vendor = (VendorEntry)_coreDriver.TmMgmt.GetEntryTemplate(1)
                                 .GenerateEntry();

            vendor.SetValue(EntryTemplate.POSTING_DATE, date);
            await vendor.SaveAsync(true);

            CustomerEntry customer = (CustomerEntry)_coreDriver.TmMgmt.GetEntryTemplate(3)
                                     .GenerateEntry();

            customer.SetValue(EntryTemplate.POSTING_DATE, date);
            customer.SetValue(EntryTemplate.AMOUNT, TestData.AMOUNT_CUSTOMER);
            await customer.SaveAsync(true);

            GLAccountEntry glEntry = (GLAccountEntry)_coreDriver.TmMgmt.GetEntryTemplate(2)
                                     .GenerateEntry();

            glEntry.SetValue(EntryTemplate.POSTING_DATE, date);
            glEntry.SetValue(EntryTemplate.AMOUNT, TestData.AMOUNT_GL);
            await glEntry.SaveAsync(true);

            TransactionDataManagement transManagement = _coreDriver.TransMgmt;

            // month 08
            date = DateTime.Parse("2012.08.02");
            HeadEntity headEntity = await DocumentCreater.CreateVendorDoc(_coreDriver,
                                                                          date);

            DocumentIdentity docId = headEntity.DocIdentity;

            transManagement.ReverseDocument(docId);

            // check
            TransactionDataChecker.CheckTransactionData(_coreDriver);

            // reload
            await _coreDriver.RestartAsync();

            TransactionDataChecker.CheckTransactionData(_coreDriver);
        }
Example #5
0
        /// <summary>
        /// Saves entry to the DB
        /// </summary>
        /// <param name="entry"></param>
        protected void SaveEntry(CustomerEntry entry)
        {
            IList <string> validationMessages;

            if (ValidateEntry(entry, out validationMessages))
            {
                Repository.Add(entry);
            }
            else
            {
                foreach (var validationMessage in validationMessages)
                {
                    RaiseLogEvent(validationMessage);
                }
            }
        }
        public static void InsertNewCustomerEntry(CustomerEntry si)
        {
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@name", si.CustomerName),
                new SqlParameter("@phone", si.Phone),
                new SqlParameter("@email", si.Email),
                new SqlParameter("@market", si.MarketPlace),
                new SqlParameter("@order", si.OrderNumber),
                new SqlParameter("@date", si.OrderDate),
                new SqlParameter("@product", si.Product),
                new SqlParameter("@query", si.Query),
                new SqlParameter("@action", si.Action),
                new SqlParameter("@message", si.WhatsappMessage),
                new SqlParameter("@status", si.Status),
                new SqlParameter("@type", si.Type),
            };

            Access.ExecuteProcedure("[dbo].[InsertCustomerEntry]", parameters.ToArray());
        }
Example #7
0
        public async static Task CreateTemplate(CoreDriver coreDriver,
                                                EntryTemplatesManagement tempMgmt)
        {
            // vendor
            VendorEntry vendorEntry = new VendorEntry(coreDriver, coreDriver.MdMgmt);

            vendorEntry.SetValue(EntryTemplate.AMOUNT, TestData.AMOUNT_VENDOR);
            vendorEntry.SetValue(VendorEntry.VENDOR, new MasterDataIdentity(
                                     TestData.VENDOR_BUS));
            vendorEntry.SetValue(EntryTemplate.TEXT, TestData.TEXT_VENDOR_DOC);
            vendorEntry.SetValue(VendorEntry.REC_ACC,
                                 new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_CASH));
            vendorEntry.SetValue(VendorEntry.GL_ACCOUNT,
                                 new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_COST));
            vendorEntry.SetValue(VendorEntry.BUSINESS_AREA, new MasterDataIdentity(
                                     TestData.BUSINESS_AREA_WORK));
            await tempMgmt.SaveAsTemplate(vendorEntry, TestData.TEXT_VENDOR_DOC);

            // GL
            GLAccountEntry glEntry = new GLAccountEntry(coreDriver, coreDriver.MdMgmt);

            glEntry.SetValue(EntryTemplate.TEXT, TestData.TEXT_GL_DOC);
            glEntry.SetValue(GLAccountEntry.SRC_ACCOUNT,
                             new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_BANK));
            glEntry.SetValue(GLAccountEntry.DST_ACCOUNT,
                             new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_CASH));
            await tempMgmt.SaveAsTemplate(glEntry, TestData.TEXT_GL_DOC);

            // customer
            CustomerEntry customerEntry = new CustomerEntry(coreDriver, coreDriver.MdMgmt);

            customerEntry.SetValue(EntryTemplate.TEXT, TestData.TEXT_CUSTOMER_DOC);
            customerEntry.SetValue(CustomerEntry.CUSTOMER, new MasterDataIdentity(
                                       TestData.CUSTOMER1));
            customerEntry.SetValue(CustomerEntry.REC_ACC,
                                   new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_BANK));
            customerEntry.SetValue(CustomerEntry.GL_ACCOUNT,
                                   new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_REV));
            await tempMgmt.SaveAsTemplate(customerEntry, TestData.TEXT_CUSTOMER_DOC);
        }
        public static async Task <CustomerEntry[]> GetCustomerEntriesAsync(string command, SqlParameter[] parameters = null)
        {
            List <CustomerEntry> col = new List <CustomerEntry>();

            using (SqlConnection cnn = await DB.GetSqlConnectionAsync())
            {
                SqlCommand cmd = new SqlCommand(command, cnn);
                if (parameters != null)
                {
                    cmd.Parameters.AddRange(parameters);
                }
                SqlDataReader reader = await cmd.ExecuteReaderAsync();

                if (reader.HasRows)
                {
                    while (await reader.ReadAsync())
                    {
                        CustomerEntry item = new CustomerEntry()
                        {
                            Id              = (int)reader["Id"],
                            CustomerName    = (string)reader["CustomerName"],
                            Phone           = (string)reader["Phone"],
                            Email           = (string)reader["Email"],
                            Action          = (string)reader["Action"],
                            MarketPlace     = (string)reader["MarketPlace"],
                            OrderDate       = (string)reader["OrderDate"],
                            OrderNumber     = (string)reader["OrderNumber"],
                            Product         = (string)reader["Product"],
                            Query           = (string)reader["Query"],
                            Status          = (string)reader["Status"],
                            Type            = (string)reader["Type"],
                            WhatsappMessage = (string)reader["WhatsappMessage"]
                        };
                        col.Add(item);
                    }
                }
            }
            return(col.ToArray());
        }
Example #9
0
        public async Task TestCreateTransDataWithEntry()
        {
            Assert.IsTrue(_coreDriver.IsInitialize);
            MasterDataCreater.CreateMasterData(_coreDriver);

            // month 08, reverse document
            DateTime date = DateTime.Parse("2012.07.02");
            // ledger
            VendorEntry vendorEntry = new VendorEntry(_coreDriver, _coreDriver.MdMgmt);

            vendorEntry.SetValue(EntryTemplate.POSTING_DATE, date);
            vendorEntry.SetValue(EntryTemplate.TEXT, TestData.TEXT_VENDOR_DOC);
            vendorEntry.SetValue(VendorEntry.VENDOR, new MasterDataIdentity(
                                     TestData.VENDOR_BUS));
            vendorEntry.SetValue(VendorEntry.REC_ACC,
                                 new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_CASH));
            vendorEntry.SetValue(VendorEntry.GL_ACCOUNT,
                                 new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_COST));
            vendorEntry.SetValue(VendorEntry.BUSINESS_AREA, new MasterDataIdentity(
                                     TestData.BUSINESS_AREA_WORK));
            vendorEntry.SetValue(EntryTemplate.AMOUNT, TestData.AMOUNT_VENDOR);
            await vendorEntry.SaveAsync(true);

            // customer
            CustomerEntry customerEntry = new CustomerEntry(_coreDriver, _coreDriver.MdMgmt);

            customerEntry.SetValue(EntryTemplate.POSTING_DATE, date);
            customerEntry.SetValue(EntryTemplate.TEXT, TestData.TEXT_CUSTOMER_DOC);
            customerEntry.SetValue(CustomerEntry.CUSTOMER, new MasterDataIdentity(
                                       TestData.CUSTOMER1));
            customerEntry.SetValue(CustomerEntry.REC_ACC,
                                   new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_BANK));
            customerEntry.SetValue(CustomerEntry.GL_ACCOUNT,
                                   new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_REV));
            customerEntry.SetValue(EntryTemplate.AMOUNT, TestData.AMOUNT_CUSTOMER);
            await customerEntry.SaveAsync(true);

            // GL
            GLAccountEntry glAccEntry = new GLAccountEntry(_coreDriver, _coreDriver.MdMgmt);

            glAccEntry.SetValue(EntryTemplate.POSTING_DATE, date);
            glAccEntry.SetValue(EntryTemplate.TEXT, TestData.TEXT_GL_DOC);
            glAccEntry.SetValue(GLAccountEntry.SRC_ACCOUNT,
                                new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_BANK));
            glAccEntry.SetValue(GLAccountEntry.DST_ACCOUNT,
                                new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_CASH));
            glAccEntry.SetValue(EntryTemplate.AMOUNT, TestData.AMOUNT_GL);
            await glAccEntry.SaveAsync(true);

            TransactionDataManagement transManagement = _coreDriver.TransMgmt;

            date = DateTime.Parse("2012.08.02");
            HeadEntity headEntity = await DocumentCreater.CreateVendorDoc(_coreDriver,
                                                                          date);

            DocumentIdentity docId = headEntity.DocIdentity;

            transManagement.ReverseDocument(docId);

            // check
            TransactionDataChecker.CheckTransactionData(_coreDriver);

            // reload
            await _coreDriver.RestartAsync();

            TransactionDataChecker.CheckTransactionData(_coreDriver);
        }
 public static void Delete(CustomerEntry customer)
 {
     custEntries.Remove(customer);
 }
 public static void Add(CustomerEntry customer)
 {
     custEntries.Add(customer);
 }
 // CRUD
 // Create
 public static CustomerEntry Create()
 {
     CustomerEntry customer = new CustomerEntry();
     custEntries.Add(customer);
     return customer;
 }