本文整理汇总了C#中System.Windows.Forms.DataGridView.Update方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridView.Update方法的具体用法?C# DataGridView.Update怎么用?C# DataGridView.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridView
的用法示例。
在下文中一共展示了DataGridView.Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: mostrarInventario
public override void mostrarInventario(DataGridView dtgrdvw)
{
dtgrdvw.DataSource = null;
dtgrdvw.Update();
BencalethDataSet dtset = new BencalethDataSet();
BencalethDataSetTableAdapters.SelectDonacionesTableAdapter tblAdptEmp = new SelectDonacionesTableAdapter();
tblAdptEmp.Fill(dtset.SelectDonaciones);
dtgrdvw.DataSource = dtset.SelectDonaciones.DefaultView;
dtgrdvw.Columns[0].HeaderText = "ID";
dtgrdvw.Columns[1].HeaderText = "Descripción";
dtgrdvw.Columns[2].HeaderText = "Cantidad";
dtgrdvw.Columns[3].HeaderText = "Donante";
dtgrdvw.Update();
}
示例2: cancelBooking
/*
* Deleting a specific record from a selected row in a datagridview
*/
public void cancelBooking(DataGridView grd_Booking_Details, TextBox txt_Booking_Id)
{
string query_String = "DELETE FROM Bookings WHERE Booking_Id = " + txt_Booking_Id.Text;
try
{
connection.Open();
cmd = connection.CreateCommand();
cmd.CommandText = query_String;
cmd.ExecuteNonQuery();
foreach (DataGridViewRow row in grd_Booking_Details.SelectedRows)
{
if (!row.IsNewRow)
grd_Booking_Details.Rows.Remove(row);
grd_Booking_Details.Update();
}
MessageBox.Show("Booking Canceled");
}
catch (Exception ex)
{
MessageBox.Show("" + ex);
}
finally
{
connection.Close();
}
}
示例3: Update_GridView
// =================================================================================
// Forcing a DataGridview display update
// Ugly hack if you ask me, but MS didn't give us any other reliable way...
private void Update_GridView(DataGridView Grid) {
Grid.Invalidate();
Grid.Update();
}
示例4: mostrarDatos
public void mostrarDatos(DataGridView dtgrdvw, TextBox txtbBuscado)
{
dtgrdvw.DataSource = null;
dtgrdvw.Update();
BencalethDataSet dtset = new BencalethDataSet();
BencalethDataSetTableAdapters.BuscarSelect_AlcanciasTableAdapter tblAdptEmp = new BuscarSelect_AlcanciasTableAdapter();
if (!(string.IsNullOrEmpty(txtbBuscado.Text)))
{
if (((RadioButton)txtbBuscado.Parent.Controls["rdbtnID"]).Checked)
{
tblAdptEmp.Fill(dtset.BuscarSelect_Alcancias, txtbBuscado.Text, null);
}
else
{
tblAdptEmp.Fill(dtset.BuscarSelect_Alcancias, null, txtbBuscado.Text);
}
}
else
{
tblAdptEmp.Fill(dtset.BuscarSelect_Alcancias, null, null);
}
dtgrdvw.DataSource = dtset.BuscarSelect_Alcancias.DefaultView;
dtgrdvw.Columns[0].HeaderText = "ID";
dtgrdvw.Columns[1].HeaderText = "Dirección";
dtgrdvw.Columns[2].HeaderText = "Local";
dtgrdvw.Columns[3].HeaderText = "Teléfono";
dtgrdvw.Columns[4].HeaderText = "Fecha";
dtgrdvw.Columns[5].HeaderText = "Recurrencia";
dtgrdvw.Update();
}
示例5: Category3Button_Click
//.........这里部分代码省略.........
if (tempSearchResult != -1)
{
int tempRowIndex = tempSearchResult;
int qty = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
tempDataGridView.Rows[tempRowIndex].Cells[1].Value = qty;
tempDataGridView.Rows[tempRowIndex].Cells[3].Value = ((double)(Double.Parse(tableTypePrice) * qty)).ToString("F02");
//update Order_details table
tempOrderDetails.OrderID = orderID;
tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[7].Value.ToString());
tempOrderDetails.ProductID = tempCategory4Button.CategoryID;
tempOrderDetails.CategoryLevel = tempCategory4Button.CategoryLevel;
tempOrderDetails.OrderQuantity = qty;
tempOrderDetails.UnitPrice = Convert.ToDouble(tableTypePrice);
tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
tempOrderDetails.OnlineItemSequenceNumber = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[6].Value.ToString());
tempOrderDetails.PrintedQuantity = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[8].Value.ToString());
if (aCOrderInfo.VatComplementory) vatRate =vatAmountRate= 0;
if (vat_included)
{
// tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * vatAmountRate;
tempOrderDetails.VatTotal = qty * vatAmountRate;
tempDataGridView.Rows[tempRowIndex].Cells[2].Value = qty * vatAmountRate;
}
else
{
tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
}
if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
{
tempOrderManager.UpdateOrderDetails(tempOrderDetails);
}
else
{
tempOrderManager.UpdateOnlineOrderDetails(tempOrderDetails);//for online orders
}
}
else
{
//Insert into Order_details table
tempOrderDetails.OrderID = orderID;
tempOrderDetails.ProductID = tempCategory4Button.CategoryID;
tempOrderDetails.CategoryLevel = tempCategory4Button.CategoryLevel;
tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
tempOrderDetails.UnitPrice = Convert.ToDouble(tableTypePrice);
// tempOrderDetails.Product_Name = temp2DataRowArray[0]["cat3_name"].ToString();
if (aCOrderInfo.VatComplementory) vatRate = 0;
if (vat_included)
{
tempOrderDetails.VatTotal = 0;
tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
// tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * vatAmountRate;
}
else
{
tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
}
tempOrderDetails.Amount_with_vat = tempOrderDetails.OrderAmount + tempOrderDetails.VatTotal;
示例6: Category3Button_Click
private void Category3Button_Click(object sender, EventArgs e)
{
try
{
CCategoryButton tempCategory3Button = (CCategoryButton)sender;
int tempCategory3ID = tempCategory3Button.CategoryID;
if (m_bItemDescriptionClicked)
{
string tempItemDescription = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3ID)[0]["description"].ToString();
CMessageBox tempMessageBox = new CMessageBox("Item Description", tempItemDescription);
tempMessageBox.ShowDialog();
m_bItemDescriptionClicked = false;
return;
}
int tempFoodType = int.Parse(Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3ID)[0].GetParentRow(Program.initDataSet.Relations["category2_to_category3"])["cat2_type"].ToString());
DataGridView tempDataGridView = new DataGridView();
tempDataGridView = g_FoodDataGridView;
DataRow[] tempDataRowArray = Program.initDataSet.Tables["Category4"].Select("cat3_id = " + tempCategory3ID.ToString());
category4ButtonList.Clear();
if (tempDataRowArray.Length != 0)
{
foreach (DataRow tempDataRow in tempDataRowArray)
{
CCategoryButton tempCategoryButton = new CCategoryButton();
tempCategoryButton.CategoryID = int.Parse(tempDataRow["cat4_id"].ToString());
tempCategoryButton.CategoryOrder = int.Parse(tempDataRow["cat4_order"].ToString());
tempCategoryButton.CategoryLevel = 4;
tempCategoryButton.Text = tempDataRow["cat4_name"].ToString();
tempCategoryButton.BackColor = tempCategory3Button.BackColor;
category4ButtonList.Add(tempCategoryButton);
}
CCategory4Form tempCategory4Form = new CCategory4Form(tempCategory3ID, category4ButtonList, tempCategory3Button.Text);
tempCategory4Form.ShowDialog();
CCategoryButton tempCategory4Button = CCategory4Form.m_cbResult;
if (tempCategory4Button == null)
return;
else //insert into table and datagridview
{
NewOrder();
DataRow[] temp2DataRowArray = Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempCategory4Button.CategoryID.ToString());
if (temp2DataRowArray.Length != 0)
{
//category4 + categpry3
string ItemName = temp2DataRowArray[0]["cat4_name"].ToString() + " " + tempCategory3Button.Text;
string tableTypePrice = string.Empty;
tableTypePrice = temp2DataRowArray[0]["bar_price"].ToString();
int tempSearchResult = DataGridViewSearch(tempDataGridView, ItemName);
COrderManager tempOrderManager = new COrderManager();
COrderDetails tempOrderDetails = new COrderDetails();
if (tempSearchResult != -1)
{
int tempRowIndex = tempSearchResult;
int qty = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
tempDataGridView.Rows[tempRowIndex].Cells[1].Value = qty;
tempDataGridView.Rows[tempRowIndex].Cells[2].Value = ((double)(Double.Parse(tableTypePrice) * qty)).ToString("F02");
//update Order_details table
tempOrderDetails.OrderID = orderID;
tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[6].Value.ToString());
tempOrderDetails.ProductID = tempCategory4Button.CategoryID;
tempOrderDetails.CategoryLevel = tempCategory4Button.CategoryLevel;
tempOrderDetails.OrderQuantity = qty;
tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
tempOrderManager.UpdateOrderDetails(tempOrderDetails);
}
else
{
//Insert into Order_details table
tempOrderDetails.OrderID = orderID;
tempOrderDetails.ProductID = tempCategory4Button.CategoryID;
tempOrderDetails.CategoryLevel = tempCategory4Button.CategoryLevel;
tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
CResult oResult = tempOrderManager.InsertOrderDetails(tempOrderDetails);
if (oResult.IsSuccess && oResult.Data != null)
{
tempOrderDetails = (COrderDetails)oResult.Data;
}
string[] tempDataGridViewRow = new string[]
{ ItemName,
m_iSavedOrderedQty.ToString(),
((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
tempCategory4Button.CategoryID.ToString(),
"4",
temp2DataRowArray[0]["cat4_rank"].ToString(),
tempOrderDetails.OrderDetailsID.ToString()
};
tempDataGridView.Rows.Add(tempDataGridViewRow);
//.........这里部分代码省略.........
示例7: LoadOrderDetails
//.........这里部分代码省略.........
tempOrderDetailsList[itemIndex].OrderDetailsID.ToString(),
tempOrderDetailsList[itemIndex].PrintedQuantity.ToString(),
tempOrderDetailsList[itemIndex].UnitPrice.ToString("F2"),
};
//not misc item... rank is specified
if (tempCategoryLevel != 0)
{
try
{
tempDataGridViewRow[6] = Program.initDataSet.Tables["Category" + tempCategoryLevel].Select("cat" + tempCategoryLevel + "_id = " + tempProductID)[0]["cat" + tempCategoryLevel + "_rank"].ToString();
}
catch { }
}
try
{
tempDataGridView.Rows.Add(tempDataGridViewRow);
}
catch (Exception ex)
{
// MessageBox.Show(ex.ToString());
}
ConvertRank();
if (tempDataGridView.Columns["Order_details_id"] !=null)
tempDataGridView.Sort(tempDataGridView.Columns["Order_details_id"], ListSortDirection.Descending);
if (tempDataGridView.Columns["dataGridViewTextBoxColumn5"] != null)
tempDataGridView.Sort(tempDataGridView.Columns["dataGridViewTextBoxColumn5"], ListSortDirection.Descending);
//this.FillCategory1OrderNumber();//New
//tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
tempDataGridView.Update();
}
//get discount
COrderDiscount tempOrderDiscount = new COrderDiscount();
oResult = tempOrderManager.OrderDiscountGetByOrderID(orderID);
if (oResult.IsSuccess && oResult.Data != null)
{
tempOrderDiscount = (COrderDiscount)oResult.Data;
m_dDiscountAmount = Convert.ToDecimal(tempOrderDiscount.Discount.ToString("F02"));
}
}
else
{
//Loading the online orders information
//g_FoodDataGridView.RowCount = 0;
COrderManager tempOrderManager = new COrderManager();
string remarks = "";
string itemName = "";
List<COrderDetails> tempOrderDetailsList = new List<COrderDetails>();
CResult oResult = tempOrderManager.GetOnlineOrderDetailsByOrderID(orderID);
if (oResult.IsSuccess && oResult.Data != null)
tempOrderDetailsList = (List<COrderDetails>)oResult.Data;
for (int counter = 0; counter < tempOrderDetailsList.Count; counter++)
{
remarks = tempOrderDetailsList[counter].OrderRemarks.ToString();
itemName = tempOrderDetailsList[counter].ItemName.ToString();
if (remarks.Length > 0)
{
itemName = itemName + "(" + remarks + ")";
}
string[] tempDataGridViewRow = {
示例8: ActualizaGridIncisos
private void ActualizaGridIncisos(DataGridView dataGridView1, IQueryable<incisos> incisos)
{
dataGridView1.Rows.Clear();
dataGridView1.Columns.Clear();
dataGridView1.Columns.Add("ID_", "ID");
dataGridView1.Columns[0].Visible = false;
dataGridView1.Columns.Add("Inciso_", "Inciso");
dataGridView1.Columns[1].Visible = true;
dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView1.Columns.Add("Tipo_", "Tipo");
dataGridView1.Columns[2].Visible = true;
dataGridView1.Columns.Add("Pregunta_", "Pregunta");
dataGridView1.Columns[3].Visible = true;
dataGridView1.Columns.Add("Catalogo_", "Catálogo");
dataGridView1.Columns[4].Visible = true;
dataGridView1.Columns.Add("Numeral_", "Numeral");
dataGridView1.Columns[5].Visible = true;
foreach (var encuesta in incisos)
{
DataGridViewRow fila = new DataGridViewRow();
fila.CreateCells(dataGridView1, "", "", "", "", "", "");
fila.Cells[0].Value = encuesta.id_inciso;
fila.Cells[1].Value = encuesta.inciso.Trim();
fila.Cells[2].Value = encuesta.tipo_inciso.tipo_inciso1;
fila.Cells[3].Value = encuesta.preguntas.pregunta;
fila.Cells[4].Value = encuesta.catalogo.catalogo1;
fila.Cells[5].Value = encuesta.numeral;
dataGridView1.Rows.Add(fila);
}
dataGridView1.Update();
}
示例9: ActualizaGridResultados
private void ActualizaGridResultados(DataGridView dataGridView1, IQueryable<resultados_encuesta> resenc)
{
dataGridView1.Rows.Clear();
foreach (var encuesta in resenc)
{
DataGridViewRow fila = new DataGridViewRow();
fila.CreateCells(dataGridView1, "", "", "", "");
fila.Cells[0].Value = encuesta.id_aplicacion_encuesta;
fila.Cells[1].Value = encuesta.resultado;
fila.Cells[2].Value = encuesta.resultado_texto;
dataGridView1.Rows.Add(fila);
}
dataGridView1.Update();
}
示例10: ActualizaGridDetalleCatalogo
private void ActualizaGridDetalleCatalogo(DataGridView dataGridView1, IQueryable<detalle_catalogo> detcatalogos)
{
dataGridView1.Rows.Clear();
dataGridView1.Columns.Clear();
dataGridView1.Columns.Add("ID_", "ID");
dataGridView1.Columns[0].Visible = false;
dataGridView1.Columns.Add("Catalogo_", "Catálogo");
dataGridView1.Columns[1].Visible = true;
dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView1.Columns.Add("Nombre_", "Nombre");
dataGridView1.Columns[2].Visible = true;
dataGridView1.Columns.Add("Peso_", "Peso");
dataGridView1.Columns[3].Visible = true;
dataGridView1.Columns.Add("Numeral_", "Numeral");
dataGridView1.Columns[4].Visible = true;
foreach (var encuesta in detcatalogos)
{
DataGridViewRow fila = new DataGridViewRow();
fila.CreateCells(dataGridView1, "", "", "");
fila.Cells[0].Value = encuesta.id;
fila.Cells[1].Value = encuesta.catalogo.catalogo1;
fila.Cells[2].Value = encuesta.nombre;
fila.Cells[3].Value = encuesta.peso;
fila.Cells[4].Value = encuesta.numeral;
dataGridView1.Rows.Add(fila);
}
dataGridView1.Update();
}
示例11: ActualizaGridEncuesta
private void ActualizaGridEncuesta(DataGridView dataGridView1, IQueryable<encuesta> encuestas)
{
dataGridView1.Rows.Clear();
dataGridView1.Columns.Clear();
dataGridView1.Columns.Add("ID_", "ID");
dataGridView1.Columns[0].Visible = false;
dataGridView1.Columns.Add("Encuesta_", "Encuesta");
dataGridView1.Columns[1].Visible = true;
dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView1.Columns.Add("Descripcion_", "Descripción");
dataGridView1.Columns[2].Visible = true;
foreach (var encuesta in encuestas)
{
DataGridViewRow fila = new DataGridViewRow();
fila.CreateCells(dataGridView1, "", "", "");
fila.Cells[0].Value = encuesta.id;
fila.Cells[1].Value = encuesta.encuesta1;
fila.Cells[2].Value = encuesta.descripción;
dataGridView1.Rows.Add(fila);
}
dataGridView1.Update();
}
示例12: ActualizaGridCatalogos
private void ActualizaGridCatalogos(DataGridView dataGridView1, catalogo catalogo)
{
int i = 0;
dataGridView1.Rows.Clear();
dataGridView1.Columns.Clear();
dataGridView1.Columns.Add("ID_", "ID");
dataGridView1.Columns[i++].Visible = false;
//dataGridView1.Columns.Add("Catalogo_", "Catálogo");
//dataGridView1.Columns[1].Visible = true;
//dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView1.Columns.Add("Nombre_", "Nombre");
dataGridView1.Columns[i++].Visible = true;
dataGridView1.Columns.Add("Peso_", "Peso");
dataGridView1.Columns[i++].Visible = true;
//dataGridView1.Columns.Add("Numeral_", "Numeral");
//dataGridView1.Columns[i++].Visible = true;
foreach (var detalle in catalogo.detalle_catalogo.OrderBy(item => item.numeral))
{
DataGridViewRow fila = new DataGridViewRow();
fila.CreateCells(dataGridView1, "", "", "");
fila.Cells[0].Value = detalle.id;
fila.Cells[1].Value = detalle.nombre;
fila.Cells[2].Value = detalle.peso;
//fila.Cells[4].Value = encuesta.numeral;
dataGridView1.Rows.Add(fila);
}
dataGridView1.Update();
}
示例13: ActualizaGridAplicaciones
private void ActualizaGridAplicaciones(DataGridView dataGridView1, IQueryable<aplicacion_encuesta> aplicaciones)
{
int i = 0;
dataGridView1.Rows.Clear();
dataGridView1.Columns.Clear();
dataGridView1.Columns.Add("ID_", "ID");
dataGridView1.Columns[i++].Visible = false;
dataGridView1.Columns.Add("Descripcion_", "Descripción");
dataGridView1.Columns[i].Visible = true;
//dataGridView1.Columns[i++].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView1.Columns.Add("Fecha_", "Fecha");
dataGridView1.Columns[i++].Visible = true;
dataGridView1.Columns.Add("Centro_", "Centro");
dataGridView1.Columns[i++].Visible = true;
dataGridView1.Columns.Add("Curso_", "Curso");
dataGridView1.Columns[i++].Visible = true;
dataGridView1.Columns.Add("Encuesta_", "Encuesta");
dataGridView1.Columns[i++].Visible = true;
dataGridView1.Columns.Add("Sujeto_", "Sujetos");
dataGridView1.Columns[i++].Visible = true;
foreach (var aplicacion in aplicaciones)
{
int j = 0;
DataGridViewRow fila = new DataGridViewRow();
fila.CreateCells(dataGridView1, "", "", "", "","","");
fila.Cells[j++].Value = aplicacion.id;
fila.Cells[j++].Value = aplicacion.descripcion;
fila.Cells[j++].Value = aplicacion.fecha.ToShortDateString();
if (aplicacion.id_centro != null)
{
fila.Cells[j++].Value = DataEmprendeconextion.centro.Where(item => item.id == aplicacion.id_centro).First().nombre;
}
else
fila.Cells[j++].Value = "";
if (aplicacion.curso != null)
{
fila.Cells[j++].Value = aplicacion.curso.descripcion;
}
else
fila.Cells[j++].Value = "";
fila.Cells[j++].Value = aplicacion.encuesta.encuesta1;
string sujetos = "";
//foreach (var resultado in aplicacion.resultados_encuesta.OrderBy(item=>item.id_sujeto).Distinct(item=>item.id_sujeto))
if (aplicacion.resultados_encuesta.Count > 0)
{
foreach (var resultado in aplicacion.resultados_encuesta.GroupBy(item=>item.id_sujeto).Select(item=>item.FirstOrDefault()))
{
if (sujetos == "")
{
sujetos += resultado.id_sujeto;
}
else
{
sujetos += " ," + resultado.id_sujeto;
}
}
fila.Cells[j++].Value = sujetos;
}
dataGridView1.Rows.Add(fila);
}
dataGridView1.Update();
}
示例14: FillNonFoods
private void FillNonFoods()
{
g_FoodDataGridView.RowCount = 0;
COrderManager tempOrderManager = new COrderManager();
List<COrderDetails> tempOrderDetailsList = new List<COrderDetails>();
CResult oResult = tempOrderManager.OrderDetailsByOrderID(orderID);
if (oResult.IsSuccess && oResult.Data != null)
{
tempOrderDetailsList = (List<COrderDetails>)oResult.Data;
}
for (int detailsCounter = 0; detailsCounter < tempOrderDetailsList.Count; detailsCounter++)
{
Int64 tempProductID = tempOrderDetailsList[detailsCounter].ProductID;
int tempCategoryLevel = tempOrderDetailsList[detailsCounter].CategoryLevel;
string tempProductName = "";
if (tempCategoryLevel == 3)
{
DataRow[] tempDataRowArr = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempProductID);
tempProductName = tempDataRowArr[0]["cat3_name"].ToString();
}
else if (tempCategoryLevel == 4)
{
//Latest name is at first
int tempCat3_id = int.Parse(Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempProductID)[0].GetParentRow(Program.initDataSet.Relations["category3_to_category4"])["cat3_id"].ToString());
tempProductName += Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempProductID)[0]["cat4_name"].ToString();
tempProductName += " " + Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCat3_id)[0]["cat3_name"].ToString();
}
else if (tempCategoryLevel == 0)
tempProductName = tempOrderDetailsList[detailsCounter].OrderRemarks;
int tempFoodType = 0;
DataGridView tempDataGridView = new DataGridView();
tempDataGridView = g_FoodDataGridView;
string[] tempDataGridViewRow = {
tempProductName,
tempOrderDetailsList[detailsCounter].OrderQuantity.ToString(),
((double)tempOrderDetailsList[detailsCounter].OrderAmount).ToString("F02"),
tempOrderDetailsList[detailsCounter].ProductID.ToString(),
tempOrderDetailsList[detailsCounter].CategoryLevel.ToString(),
(Int64.MaxValue-1)+"",//max rank
tempOrderDetailsList[detailsCounter].OrderDetailsID.ToString()
};
//not misc item... rank is specified
if (tempCategoryLevel != 0)
tempDataGridViewRow[5] = Program.initDataSet.Tables["Category" + tempCategoryLevel].Select("cat" + tempCategoryLevel + "_id = " + tempProductID)[0]["cat" + tempCategoryLevel + "_rank"].ToString();
tempDataGridView.Rows.Add(tempDataGridViewRow);
ConvertRank();
tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
tempDataGridView.Update();
g_FoodDataGridView.ClearSelection();
}
//get discount
COrderDiscount tempOrderDiscount = new COrderDiscount();
oResult = tempOrderManager.OrderDiscountGetByOrderID(orderID);
if (oResult.IsSuccess && oResult.Data != null)
{
tempOrderDiscount = (COrderDiscount)oResult.Data;
m_dDiscountAmount = tempOrderDiscount.Discount;
}
if (category2ButtonList.Count > CATEGORY2PANEL_CAPACITY)
g_NextButton.Enabled = true;
else
g_NextButton.Enabled = false;
g_PreviousButton.Enabled = false;
TotalAmountCalculation();
LoadStatusBar();
}
示例15: mostrarDatos
//para mostrar los datos en los datagridview del mantenimiento
//recibimos los parametros dtgrdvw que seria el del formulario de mantenimiento
//y txtbBuscado que seria un valor buscado
public void mostrarDatos(DataGridView dtgrdvw, TextBox txtbBuscado)
{
//despejamos el datagridview
dtgrdvw.DataSource = null;
dtgrdvw.Update();
//accedemos al dataset
BencalethDataSet dtset = new BencalethDataSet();
//accedemos a una funcion que devuelve un select de tipo de empresas
BencalethDataSetTableAdapters.BuscarSelect_TipoEmpresaTableAdapter tblAdptEmp = new BuscarSelect_TipoEmpresaTableAdapter();
//identificamos si esta buscando
if (!(string.IsNullOrEmpty(txtbBuscado.Text)))
{
//revisamos que esta buscando, el if es para si es el ID
if (((RadioButton)txtbBuscado.Parent.Controls["rdbtnID"]).Checked)
{
tblAdptEmp.Fill(dtset.BuscarSelect_TipoEmpresa, txtbBuscado.Text, null);
}
else
{
tblAdptEmp.Fill(dtset.BuscarSelect_TipoEmpresa, null, txtbBuscado.Text);
}
}
else
{
tblAdptEmp.Fill(dtset.BuscarSelect_TipoEmpresa, null, null);
}
//se lo mandamos y estilisamos las columnas a mostrar
dtgrdvw.DataSource = dtset.BuscarSelect_TipoEmpresa.DefaultView;
dtgrdvw.Columns[0].HeaderText = "Código Identificador";
dtgrdvw.Columns[1].HeaderText = "Descripción";
dtgrdvw.Update();
}