internal void setRowsCountSelling()
 {
     try {
         DataSet dataSet = CommonManagerImpl.getStockBeforeSaleForFilter(
             (!String.IsNullOrWhiteSpace(oldStockBySellingInvoice.textBox_itemId.Text) ? Convert.ToInt32(oldStockBySellingInvoice.textBox_itemId.Text) : 0),
             (oldStockBySellingInvoice.datePicker_dateFrom_filter.SelectedDate != null ? Convert.ToDateTime(oldStockBySellingInvoice.datePicker_dateFrom_filter.SelectedDate).ToString("yyyy-MM-dd") : null),
             (oldStockBySellingInvoice.datePicker_dateTo_filter.SelectedDate != null ? Convert.ToDateTime(oldStockBySellingInvoice.datePicker_dateTo_filter.SelectedDate).ToString("yyyy-MM-dd") : null),
             true, oldStockBySellingInvoice.Pagination.LimitStart, oldStockBySellingInvoice.Pagination.LimitCount);
         oldStockBySellingInvoice.Pagination.RowsCount = Convert.ToInt32(dataSet.Tables[0].Rows[0][0]);
     } catch (Exception) {
     }
 }
 internal void setCompanyReturnRowsCount()
 {
     try {
         DataSet dataSet = CommonManagerImpl.getCompanyReturnForFilter(companyReturnHistory.textBox_itemName.Text, companyReturnHistory.textBox_itemCode.Text,
                                                                       companyReturnHistory.textBox_barcode.Text, Convert.ToInt32(companyReturnHistory.comboBox_vendor.SelectedValue),
                                                                       companyReturnHistory.textBox_invoice.Text, companyReturnHistory.textBox_grn.Text,
                                                                       (companyReturnHistory.datePicker_from.SelectedDate != null ? Convert.ToDateTime(companyReturnHistory.datePicker_from.SelectedDate).ToString("yyyy-MM-dd") : null),
                                                                       (companyReturnHistory.datePicker_to.SelectedDate != null ? Convert.ToDateTime(companyReturnHistory.datePicker_to.SelectedDate).ToString("yyyy-MM-dd") : null),
                                                                       true, companyReturnHistory.Pagination.LimitStart, companyReturnHistory.Pagination.LimitCount);
         companyReturnHistory.Pagination.RowsCount = Convert.ToInt32(dataSet.Tables[0].Rows[0][0]);
     } catch (Exception) {
     }
 }
        internal void setRowsCount()
        {
            try {
                DataSet dataSet = CommonManagerImpl.getStockForFilter(Convert.ToInt32(stockManager.comboBox_stockLocation.SelectedValue),
                                                                      (stockManager.textBox_itemName.IsNull() ? null : stockManager.textBox_itemName.Text), (stockManager.textBox_itemCode.IsNull() ? null : stockManager.textBox_itemCode.Text), (stockManager.textBox_barcode.IsNull() ? null : stockManager.textBox_barcode.Text),
                                                                      Convert.ToInt32(stockManager.comboBox_category.SelectedValue), Convert.ToInt32(stockManager.comboBox_company.SelectedValue),
                                                                      (stockManager.checkBox_belowReorderLevel.IsChecked == true ? true : false), true, stockManager.Pagination.LimitStart,
                                                                      stockManager.Pagination.LimitCount);

                /*DataSet dataSet = CommonManagerImpl.getStockForFilter(Convert.ToInt32(stockManager.comboBox_stockLocation.SelectedValue),
                 *      stockManager.textBox_itemName.Text, stockManager.textBox_itemCode.Text, stockManager.textBox_barcode.Text,
                 *      Convert.ToInt32(stockManager.comboBox_category.SelectedValue), Convert.ToInt32(stockManager.comboBox_company.SelectedValue),
                 *      (stockManager.checkBox_belowReorderLevel.IsChecked == true ? true : false), true, stockManager.Pagination.LimitStart,
                 *      stockManager.Pagination.LimitCount);*/
                stockManager.Pagination.RowsCount = Convert.ToInt32(dataSet.Tables[0].Rows[0][0]);
            } catch (Exception) {
            }
        }
 internal void filterSelling()
 {
     try {
         DataSet dataSet = CommonManagerImpl.getStockBeforeSaleForFilter(
             (!String.IsNullOrWhiteSpace(oldStockBySellingInvoice.textBox_itemId.Text) ? Convert.ToInt32(oldStockBySellingInvoice.textBox_itemId.Text) : 0),
             (oldStockBySellingInvoice.datePicker_dateFrom_filter.SelectedDate != null ? Convert.ToDateTime(oldStockBySellingInvoice.datePicker_dateFrom_filter.SelectedDate).ToString("yyyy-MM-dd") : null),
             (oldStockBySellingInvoice.datePicker_dateTo_filter.SelectedDate != null ? Convert.ToDateTime(oldStockBySellingInvoice.datePicker_dateTo_filter.SelectedDate).ToString("yyyy-MM-dd") : null),
             false, oldStockBySellingInvoice.Pagination.LimitStart, oldStockBySellingInvoice.Pagination.LimitCount);
         oldStockBySellingInvoice.DataTable.Rows.Clear();
         //Convert.ToDouble(row[6]).ToString("#,##0.00")
         foreach (DataRow row in dataSet.Tables[0].Rows)
         {
             oldStockBySellingInvoice.DataTable.Rows.Add(row[0], row[1], row[2], Convert.ToDateTime(row[3]).ToString("yyyy-MM-dd"),
                                                         row[4], Convert.ToDouble(row[5]).ToString("#,##0.00"), Convert.ToDouble(row[6]).ToString("#,##0.00"), Convert.ToDouble(row[7]).ToString("#,##0.00"),
                                                         Convert.ToDouble(row[8]).ToString("#,##0.00"), Convert.ToDouble(row[9]).ToString("#,##0.00"));
         }
     } catch (Exception) {
     }
 }
        internal void filterCompanyReturn()
        {
            try {
                DataSet dataSet = CommonManagerImpl.getCompanyReturnForFilter(companyReturnHistory.textBox_itemName.Text, companyReturnHistory.textBox_itemCode.Text,
                                                                              companyReturnHistory.textBox_barcode.Text, Convert.ToInt32(companyReturnHistory.comboBox_vendor.SelectedValue),
                                                                              companyReturnHistory.textBox_invoice.Text, companyReturnHistory.textBox_grn.Text,
                                                                              (companyReturnHistory.datePicker_from.SelectedDate != null ? Convert.ToDateTime(companyReturnHistory.datePicker_from.SelectedDate).ToString("yyyy-MM-dd") : null),
                                                                              (companyReturnHistory.datePicker_to.SelectedDate != null ? Convert.ToDateTime(companyReturnHistory.datePicker_to.SelectedDate).ToString("yyyy-MM-dd") : null),
                                                                              false, companyReturnHistory.Pagination.LimitStart, companyReturnHistory.Pagination.LimitCount);

                companyReturnHistory.DataTable.Rows.Clear();
                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    companyReturnHistory.DataTable.Rows.Add(row[0], row[1], row[2], row[3], row[4], Convert.ToDateTime(row[5]).ToString("yyyy-MM-dd"),
                                                            Convert.ToDouble(row[6]).ToString("#,##0.00"), Convert.ToDouble(row[7]).ToString("#,##0.00"), Convert.ToDouble(row[8]).ToString("#,##0.00"));
                }
            } catch (Exception) {
            }
        }
        internal void filter()
        {
            try {
                DataSet dataSet = CommonManagerImpl.getStockForFilter(Convert.ToInt32(stockManager.comboBox_stockLocation.SelectedValue),
                                                                      (stockManager.textBox_itemName.IsNull() ? null : stockManager.textBox_itemName.Text), (stockManager.textBox_itemCode.IsNull() ? null : stockManager.textBox_itemCode.Text), (stockManager.textBox_barcode.IsNull() ? null : stockManager.textBox_barcode.Text),
                                                                      Convert.ToInt32(stockManager.comboBox_category.SelectedValue), Convert.ToInt32(stockManager.comboBox_company.SelectedValue),
                                                                      (stockManager.checkBox_belowReorderLevel.IsChecked == true ? true : false), false, stockManager.Pagination.LimitStart,
                                                                      stockManager.Pagination.LimitCount);

                stockManager.DataTable.Rows.Clear();
                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    stockManager.DataTable.Rows.Add(row[0], (Convert.ToInt32(stockManager.comboBox_stockLocation.SelectedValue) > 0 ? row[1] : "All"),
                                                    row[3], row[4], row[2], Convert.ToDouble(row[5]), row[6],
                                                    (
                                                        Convert.ToInt32(stockManager.comboBox_stockLocation.SelectedValue) > 0 ? Convert.ToDouble(row[7]) :
                                                        calculateValue(Convert.ToInt32(row[8]), Convert.ToDouble(row[5]))
                                                    ).ToString("#,##0.00"));
                }
            } catch (Exception) {
            }
        }