private void lbCustId_TextChanged(object sender, EventArgs e) { int custId; if (int.TryParse(lbCustId.Text, out custId)) { dataGridView1.DataSource = rewardPointsByCustIdTableAdapter.GetRewardPointsHistoryByCustomerId(custId); } }
private void BindDataToEdit(DataGridViewCellEventArgs e) { DataGridViewRow row = grvCustomer.Rows[e.RowIndex]; if (row.IsNewRow) { return; } int custID = int.Parse(row.Cells[0].Value.ToString()); JSManagementDataSet.CustomerDataTable custData = customerTableAdapter.GetDataByCustomerId(custID); string custName = custData[0].CustomerName; string custAddress = custData[0].Address; string custPhone = custData[0].Telephone; string custNote = custData[0].Note; lbCustId.Text = custID.ToString(); txtCustName.Text = custName; txtCustAddress.Text = custAddress; txtPhone.Text = custPhone; txtNote.Text = custNote; comboBoxCustomerType.SelectedValue = custData[0].CustTypeId; cboxIsContact.Checked = custData[0].IsContact; checkBoxIsAttendRewardPointProgram.Checked = custData[0].IsAttendRewardPointProgram; lbHeader.Text = string.Format("Sửa thông tin khách hàng").ToUpper(); grvTransactionHistory.DataSource = getProductInOutDetailTableAdapter.GetProductInOutDetailByCustomerId(custID); //foreach(DataGridViewRow r in grvTransactionHistory.Rows) //{ // if (!Setting.GetBoolSetting("AllowUserViewAllCost") && !LoginInfor.IsAdmin) // { // if (r.Cells["Action"].Value != null) // { // if (r.Cells["IsReturnSupplier"].Selected && r.Cells["Action"].Value.ToString() == "xuất") // { // r.Cells["Price"].Value = 0; // //r.Cells["ClosingBalance"].Value = 0; // } // } // } //} grvRewardPointHistory.DataSource = rewardPointsByCustIdTableAdapter.GetRewardPointsHistoryByCustomerId(custID); if (!Setting.GetBoolSetting("AllowUserViewAllCost") && !LoginInfor.IsAdmin) { foreach (DataGridViewRow r in grvTransactionHistory.Rows) { if (r.Cells["Action"].Value != null) { if (((bool.Parse(r.Cells["IsReturnSupplier"].Value.ToString())) && r.Cells["Action"].Value.ToString().Trim().ToLower() == "xuất") || r.Cells["Action"].Value.ToString() == "nhập") { r.Cells["Price"].Value = 0; //r.Cells["Amount"].Value = 0; //r.Cells["ClosingBalanceAmount"].Value = 0; //r.Cells["ClosingBalance"].Value = 0; } } } } }