Ejemplo n.º 1
0
        private bool IsSearchCriteriaMatched(InvoiceEntity currentRow)
        {
            return currentRow.InvoiceNumber.ToString()
                                              .ToLower()
                                              .Contains(txtSearch.Text
                                                                .ToLower()) ||
                                        currentRow.QuoteNumber.ToString()
                                              .ToLower()
                                              .Contains(txtSearch.Text
                                                                .ToLower()) ||
                                    currentRow.FullName.ToString()
                                              .ToLower()
                                              .Contains(txtSearch.Text
                                                                .ToLower()) ||

                                    currentRow.Total.ToString()
                                              .ToLower()
                                              .Contains(txtSearch.Text
                                                                .ToLower()) ||
                                    currentRow.CompletedDate.ToString()
                                              .ToLower()
                                              .Contains(txtSearch.Text
                                                                .ToLower()) ||
                                    currentRow.BalanceDue.ToString()
                                              .ToLower()
                                              .Contains(txtSearch.Text
                                                                .ToLower()) ||
                                    currentRow.PaymentMode.ToString()
                                              .ToLower()
                                              .Contains(txtSearch.Text
                                                                .ToLower());
        }
Ejemplo n.º 2
0
        internal static ObservableCollection<InvoiceEntity> GetInvoiceMasterData()
        {
            ObservableCollection<InvoiceEntity> invoiceMasterData = null;
            try
            {
                var result = SQLHelper.ExecuteStoredProcedure(StoredProcedures.GetInvoiceMasterData, null);

                if (result == null || result.Tables == null || result.Tables.Count == 0)
                { return invoiceMasterData; }

                invoiceMasterData = new ObservableCollection<InvoiceEntity>();
                InvoiceEntity invoice = null;
                object dbValue = null;

                for (int rowIndex = 0; rowIndex < result.Tables[0].Rows.Count; rowIndex++)
                {
                    invoice = new InvoiceEntity();

                    dbValue = result.Tables[0].Rows[rowIndex][ColumnNames.InvoiceNumber];
                    invoice.InvoiceNumber = dbValue == DBNull.Value ? string.Empty : dbValue.ToString();

                    dbValue = result.Tables[0].Rows[rowIndex][ColumnNames.QuoteNumber];
                    invoice.QuoteNumber = dbValue == DBNull.Value ? string.Empty : dbValue.ToString();

                    dbValue = result.Tables[0].Rows[rowIndex][ColumnNames.FullName];
                    invoice.FullName = dbValue == DBNull.Value ? string.Empty : dbValue.ToString();

                    dbValue = result.Tables[0].Rows[rowIndex][ColumnNames.Total];
                    invoice.Total = dbValue == DBNull.Value ? string.Empty : double.Parse(dbValue.ToString()).ToString("0.00");

                    dbValue = result.Tables[0].Rows[rowIndex][ColumnNames.CompletedDate];
                    invoice.CompletedDate = dbValue == DBNull.Value ? string.Empty : dbValue.ToString();

                    dbValue = result.Tables[0].Rows[rowIndex][ColumnNames.BalanceDue];
                    invoice.BalanceDue = dbValue == DBNull.Value ? string.Empty : double.Parse(dbValue.ToString()).ToString("0.00");

                    dbValue = result.Tables[0].Rows[rowIndex][ColumnNames.PaymentType];
                    invoice.PaymentMode = dbValue == DBNull.Value ? string.Empty : dbValue.ToString();

                    dbValue = result.Tables[0].Rows[rowIndex][ColumnNames.CustomerPO];
                    invoice.CustomerPO = dbValue == DBNull.Value ? string.Empty : dbValue.ToString();

                    dbValue = result.Tables[0].Rows[rowIndex][ColumnNames.InvoiceStatus];
                    invoice.InvoiceStatus = dbValue == DBNull.Value ? string.Empty : dbValue.ToString();

                    dbValue = result.Tables[0].Rows[rowIndex][ColumnNames.SONumber];
                    invoice.SONumber = dbValue == DBNull.Value ? string.Empty : dbValue.ToString();

                    invoiceMasterData.Add(invoice);
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
            return invoiceMasterData;
        }