public CustomerRewardPointsHistoryUserControl()
        {
            InitializeComponent();
            custTableAdapter            = new JSManagementDataSetTableAdapters.CustomerTableAdapter();
            custTableAdapter.Connection = CommonHelper.GetSQLConnection();

            rewardPointsByCustIdTableAdapter            = new JSManagementDataSetTableAdapters.RewardPointsHistoryByCustomerIdTableAdapter();
            rewardPointsByCustIdTableAdapter.Connection = CommonHelper.GetSQLConnection();

            rewardPointHistoryTableAdapter            = new JSManagementDataSetTableAdapters.RewardPointsHistoryTableAdapter();
            rewardPointHistoryTableAdapter.Connection = CommonHelper.GetSQLConnection();
        }
        private void ViewDetailReceivableFromCustomer(DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1 || e.RowIndex == grvReceivableFromCustomer.Rows.Count - 1)
            {
                return;
            }
            DataGridViewRow row = grvReceivableFromCustomer.Rows[e.RowIndex];

            int    purchaseOrderId = int.Parse(row.Cells["PurchaseReceiptOrderId"].Value.ToString());
            int    orderId         = row.Cells[0].Value == DBNull.Value?0: int.Parse(row.Cells[0].Value.ToString());
            string billNumber      = row.Cells[1].Value.ToString();
            string orderDate       = DateTime.Parse(row.Cells[2].Value.ToString()).ToShortDateString();
            int    storeId         = LoginInfor.StoreId;

            lbOrderDate.Text  = orderDate;
            lbBillNumber.Text = billNumber;
            lbOrder.Text      = purchaseOrderId.ToString();

            JSManagementDataSetTableAdapters.PurchaseReceiptOrderTableAdapter purchaseReceiptOrderTableAdapter = new JSManagementDataSetTableAdapters.PurchaseReceiptOrderTableAdapter();
            purchaseReceiptOrderTableAdapter.Connection = CommonHelper.GetSQLConnection();

            JSManagementDataSetTableAdapters.CustomerTableAdapter custTableAdapter = new JSManagementDataSetTableAdapters.CustomerTableAdapter();
            custTableAdapter.Connection = CommonHelper.GetSQLConnection();

            JSManagementDataSetTableAdapters.Orders_ProductTableAdapter order_ProductTableAdapter = new JSManagementDataSetTableAdapters.Orders_ProductTableAdapter();
            order_ProductTableAdapter.Connection = CommonHelper.GetSQLConnection();

            JSManagementDataSet.PurchaseReceiptOrderDataTable purchaseOrderDataTable = purchaseReceiptOrderTableAdapter.GetById(purchaseOrderId);
            if (purchaseOrderDataTable.Rows.Count > 0)
            {
                int custId = purchaseOrderDataTable[0].CustId;
                lbPurchaseReceiptOrderId.Text = purchaseOrderId.ToString();
                //int custId = int.Parse(orderRow.ItemArray[2].ToString());
                lbCustomerInfo.Text = string.Format("{0} / {1} / {2}", custTableAdapter.GetDataByCustomerId(custId)[0].CustomerName, custTableAdapter.GetDataByCustomerId(custId)[0].Address, custTableAdapter.GetDataByCustomerId(custId)[0].Telephone);
                txtNote.Text        = purchaseOrderDataTable[0].OrderNote;
                if (purchaseOrderId > 0)
                {
                    grvProductOutput.DataSource = order_ProductTableAdapter.GetOrdersByPurchaserReceivableOrderId(purchaseOrderId);
                }
                else
                {
                    grvProductOutput.DataSource = order_ProductTableAdapter.GetOrderById(orderId);
                }
            }
        }
Esempio n. 3
0
        public CustomerForm()
        {
            InitializeComponent();
            customerTableAdapter = new JSManagementDataSetTableAdapters.CustomerTableAdapter();
            this.customerTableAdapter.Connection = CommonHelper.GetSQLConnection();

            customerTypeTableAdapter            = new JSManagementDataSetTableAdapters.CustomerTypeTableAdapter();
            customerTypeTableAdapter.Connection = CommonHelper.GetSQLConnection();

            rewardPointsHistoryTableAdapter            = new JSManagementDataSetTableAdapters.RewardPointsHistoryTableAdapter();
            rewardPointsHistoryTableAdapter.Connection = CommonHelper.GetSQLConnection();

            getProductInOutDetailTableAdapter            = new JSManagementDataSetTableAdapters.GetProductInOutDetailTableAdapter();
            getProductInOutDetailTableAdapter.Connection = CommonHelper.GetSQLConnection();

            rewardPointsByCustIdTableAdapter            = new JSManagementDataSetTableAdapters.RewardPointsHistoryByCustomerIdTableAdapter();
            rewardPointsByCustIdTableAdapter.Connection = CommonHelper.GetSQLConnection();
        }
 public CustomerSelectUserControl()
 {
     InitializeComponent();
     custTableAdapter = new JSManagementDataSetTableAdapters.CustomerTableAdapter();
     //custTableAdapter.Connection = CommonHelper.GetSQLConnection();
 }