public void getSupplierID() { BLSupplier objSupplierDetails = new BLSupplier(); DataTable dt = objSupplierDetails.getSupplierID(); for (int i = 0; i < dt.Rows.Count; i++) { for (int j = 0; j < dt.Columns.Count; j++) { if (string.IsNullOrEmpty(dt.Rows[i][j].ToString())) { // int a = 1; //txttransationId.Text = Convert.ToString(a); } else { //txttransationId.Text = dt.Rows[0][0].ToString(); } } } }
private void Usp_BindSupplierGrid() { try { DataTable dt = null; BLSupplier objBL = new BLSupplier(); dt = objBL.BindFullGrid(); if (dt.Rows.Count > 0) { dgvSupplier.DataSource = dt; } else { dgvSupplier.DataSource = null; } dgvSupplier.Refresh(); dgvSupplier.Show(); { dgvSupplier.DataSource = dt; dgvSupplier.Columns[0].HeaderCell.Value = "SupplierID"; dgvSupplier.Columns[0].Visible = false; dgvSupplier.Columns[1].HeaderCell.Value = "Supplier Company"; dgvSupplier.Columns[2].HeaderCell.Value = "Supplier Name"; dgvSupplier.Columns[3].HeaderCell.Value = "Contact Number"; dgvSupplier.Columns[4].HeaderCell.Value = "Country"; dgvSupplier.Columns[5].HeaderCell.Value = "State"; dgvSupplier.Columns[6].HeaderCell.Value = "City"; dgvSupplier.Columns[7].HeaderCell.Value = "Area"; dgvSupplier.Columns[8].HeaderCell.Value = "Address"; dgvSupplier.Columns[9].HeaderCell.Value = "Mode of Transport"; dgvSupplier.Columns[10].HeaderCell.Value = "Price Type"; //dgvSupplier.Columns[10].HeaderCell.Value = "opening Balance"; dgvSupplier.Columns[11].HeaderCell.Value = "IsActive"; dgvSupplier.Columns[11].Visible = false; dgvSupplier.Columns[12].HeaderCell.Value = "IsDelete"; dgvSupplier.Columns[12].Visible = false; dgvSupplier.AllowUserToAddRows = false; dgvSupplier.AllowUserToDeleteRows = false; dgvSupplier.Refresh(); dgvSupplier.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
/*rajesh * created date :- 07/08/2015 * purpose :- all kaydown Events */ ////#region------------------------------------------------------All KeyDown Events for supplier----------------------------------------- //// private void txtCompanyName_KeyDown(object sender, KeyEventArgs e) //// { //// if (e.KeyData == Keys.Enter) //// { //// txtTermsofPayment.Select(); //// } //// } //// private void txtTermsofPayment_KeyDown(object sender, KeyEventArgs e) //// { //// if (e.KeyData == Keys.Enter) //// { //// cbState.Select(); //// } //// } //// private void cbProduct_KeyDown(object sender, KeyEventArgs e) //// { //// if (e.KeyData == Keys.Enter) //// { //// dtpDate.Select(); //// } //// } //// private void dtpDate_KeyDown(object sender, KeyEventArgs e) //// { //// if (e.KeyData == Keys.Enter) //// { //// cbModeofTransport.Select(); //// } //// } //// private void cbModeofTransport_KeyDown(object sender, KeyEventArgs e) //// { //// if (e.KeyData == Keys.Enter) //// { //// txtAddress.Select(); //// } //// } //// private void txtAddress_KeyDown(object sender, KeyEventArgs e) //// { //// if (e.KeyData == Keys.Enter) //// { //// cbActive.Select(); //// } //// } //// private void cbActive_KeyDown(object sender, KeyEventArgs e) //// { //// if (e.KeyData == Keys.Enter) //// { //// btnSave.Select(); //// } //// } //// private void btnSave_KeyDown(object sender, KeyEventArgs e) //// { //// if (e.KeyData == Keys.Enter) //// { //// btnDelete.Select(); //// } //// } //// //private void btnAddNew_KeyDown(object sender, KeyEventArgs e) //// //{ //// // if (e.KeyData == Keys.Enter) //// // { //// // btnDelete.Select(); //// // } //// //} //// private void btnDelete_KeyDown(object sender, KeyEventArgs e) //// { //// if (e.KeyData == Keys.Enter) //// { //// btnClose.Select(); //// } //// } ////#endregion private void dgvSupplier_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (dgvSupplier.SelectedRows.Count > 0) { lblHideID.Text = Convert.ToString(dgvSupplier.SelectedRows[0].Cells[0].Value); txtSupplierCompany.Text = Convert.ToString(dgvSupplier.SelectedRows[0].Cells[1].Value); string SupplierCompany = txtSupplierCompany.Text; BLSupplier objSupplier = new BLSupplier(); DataTable dt = objSupplier.GetID(SupplierCompany); if (dt.Rows.Count != 0) { lblid.Text = dt.Rows[0]["SupplierID"].ToString(); } txtSuplierName.Text = Convert.ToString(dgvSupplier.SelectedRows[0].Cells[2].Value); txtContactNumber.Text = Convert.ToString(dgvSupplier.SelectedRows[0].Cells[3].Value); cbCountry.Text = Convert.ToString(dgvSupplier.SelectedRows[0].Cells[4].Value); cbState.Text = Convert.ToString(dgvSupplier.SelectedRows[0].Cells[5].Value); cbCity.Text = Convert.ToString(dgvSupplier.SelectedRows[0].Cells[6].Value); txtArea.Text = Convert.ToString(dgvSupplier.SelectedRows[0].Cells[7].Value); txtAddress.Text = Convert.ToString(dgvSupplier.SelectedRows[0].Cells[8].Value); cbModeofTransport.Text = Convert.ToString(dgvSupplier.SelectedRows[0].Cells[9].Value); txtOpeningBalance.Text = Convert.ToString(dgvSupplier.SelectedRows[0].Cells[13].Value); txtOpeningBalance.ReadOnly = true; string Type = Convert.ToString(dgvSupplier.SelectedRows[0].Cells[10].Value); if (Type == "CIF") { rdoCIF.Checked = true; } else rdoFOB.Checked = true; string Active = Convert.ToString(dgvSupplier.SelectedRows[0].Cells[11].Value); if (Active == "Yes") { cbActive.Checked = true; } else { cbActive.Checked = false; } btnSave.Text = "Update"; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }