private void repositoryItemGridLookUpEdit1_EditValueChanged(object sender, EventArgs e) { GridLookUpEdit LookupEdit = sender as GridLookUpEdit; DataRowView SelectedDataRow = (DataRowView)LookupEdit.GetSelectedDataRow(); getget = LookupEdit.EditValue.ToString(); TXE_Gettype.Text = ""; object obj = LookupEdit.EditValue.ToString(); string obj2 = obj.ToString(); TXE_Gettype.Text = obj.ToString(); MessageBox.Show(obj2, "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); gridView1.SetFocusedRowCellValue("Description", SelectedDataRow["Description"]); gridView1.SetFocusedRowCellValue("UoM", SelectedDataRow["UoM"]); gridView1.SetFocusedRowCellValue("Quantity", SelectedDataRow["Quantity"]); gridView1.SetFocusedRowCellValue("Each", SelectedDataRow["Each"]); //gridView1.SetRowCellValue(textEdit1.Text, SelectedDataRow["Each"]); string sss="Discount"; if (obj2 != sss) { object eachprice = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns["Each"]); // Get the price of product from previous row //decimal pricedecimal = Convert.ToDecimal(eachprice); textEdit1.Text = eachprice.ToString(); MessageBox.Show("product price " + textEdit1.Text, "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { //textEdit1.Text = ""; } gridView1.SetFocusedRowCellValue("TaxPercentage", SelectedDataRow["TaxPercentage"]); int rownumber = gridView1.RowCount; if ((obj2 == sss) && (rownumber >= 1)) { //object eachprice = gridView1.GetRowCellValue(rownumber - 1, gridView1.Columns["Each"]); // Get the price of product from previous row if (!(textEdit1.Text == string.Empty)) { decimal pricedecimal = Convert.ToDecimal(textEdit1.Text); object eachdiscount = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns["Each"]); decimal eachdisdecimal = Convert.ToDecimal(eachdiscount); decimal tempdiscountprice = pricedecimal * (eachdisdecimal / 100); textEdit2.Text = tempdiscountprice.ToString(); } } else { // textEdit2.Text = " "; } } private void gridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e) { string str = "0"; // MessageBox.Show("Info be4 "+textEdit2.Text.ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //if ((TXE_Gettype.Text == "Discount") && (e.Column.FieldName == "PriceQuantity") && (e.IsGetData) && (str=="0")) if ((getget == "Discount") && (e.Column.FieldName == "PriceQuantity") && (e.IsGetData) && (str == "0")) { e.Value = textEdit2.Text; str = "1"; int s; } else { //textEdit2.Text = ""; str = "0"; e.Value = "1212"; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)