private void read() { userlist_Server = new List <clsProductinfo>(); clsProductinfo item = new clsProductinfo(); item.Product_no = txproductno.Text; item.Product_name = txproductname.Text; item.Product_salse = txsales.Text; item.Product_address = txaddress.Text; item.Input_Date = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); userlist_Server.Add(item); }
public List <clsProductinfo> findProductr(string findtext) { MySql.Data.MySqlClient.MySqlDataReader reader = MySqlHelper.ExecuteReader(findtext); List <clsProductinfo> ClaimReport_Server = new List <clsProductinfo>(); while (reader.Read()) { clsProductinfo item = new clsProductinfo(); item.Product_id = reader.GetInt32(0); if (reader.GetValue(1) != null && Convert.ToString(reader.GetValue(1)) != "") { item.Product_no = reader.GetString(1); } if (reader.GetValue(2) != null && Convert.ToString(reader.GetValue(2)) != "") { item.Product_name = reader.GetString(2); } if (reader.GetValue(3) != null && Convert.ToString(reader.GetValue(3)) != "") { item.Product_salse = reader.GetString(3); } if (reader.GetValue(4) != null && Convert.ToString(reader.GetValue(4)) != "") { item.Product_address = reader.GetString(4); } if (reader.GetString(5) != null && reader.GetString(5) != "") { item.Input_Date = Convert.ToDateTime(reader.GetString(5)); } ClaimReport_Server.Add(item); //这里做数据处理.... } return(ClaimReport_Server); }
private bool dailysaveList(BackgroundWorker worker, DoWorkEventArgs e) { WorkerArgument arg = e.Argument as WorkerArgument; clsAllnew BusinessHelp = new clsAllnew(); bool success = true; try { int rowCount = changeindex.Count; arg.OrderCount = rowCount; int j = 1; int progress = 0; #region MyRegion for (int ik = 0; ik < changeindex.Count; ik++) { j = ik; arg.CurrentIndex = j + 1; progress = Convert.ToInt16(((j + 1) * 1.0 / rowCount) * 100); int i = changeindex[ik]; var row = dataGridView1.Rows[i]; var model = row.DataBoundItem as clsProductinfo; clsProductinfo item = new clsProductinfo(); item.Product_no = Convert.ToString(dataGridView1.Rows[i].Cells["Product_no"].EditedFormattedValue.ToString()); item.Product_name = Convert.ToString(dataGridView1.Rows[i].Cells["Product_name"].EditedFormattedValue.ToString()); item.Product_salse = Convert.ToString(dataGridView1.Rows[i].Cells["Product_salse"].EditedFormattedValue.ToString()); item.Product_address = Convert.ToString(dataGridView1.Rows[i].Cells["Product_address"].EditedFormattedValue.ToString()); item.Input_Date = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); item.Product_id = model.Product_id; #endregion #region MyRegion var startAt = this.stockOutDateTimePicker.Value.AddDays(0).Date; string conditions = ""; #region 构造查询条件 if (item.Product_no != null) { conditions += " Product_no ='" + item.Product_no + "'"; } if (item.Product_name != null) { conditions += " ,Product_name ='" + item.Product_name + "'"; } if (item.Product_salse != null) { conditions += " ,Product_salse ='" + item.Product_salse + "'"; } if (item.Product_address != null) { conditions += " ,Product_address ='" + item.Product_address + "'"; } if (item.Input_Date != null) { conditions += " ,Input_Date ='" + item.Input_Date.ToString("yyyy/MM/dd") + "'"; } conditions = "update JNOrder_product set " + conditions + " where Product_id = " + item.Product_id + " "; // conditions += " order by Id desc"; #endregion #endregion int isrun = BusinessHelp.updateProduct_Server(conditions); if (arg.CurrentIndex % 5 == 0) { backgroundWorker2.ReportProgress(progress, arg); } } backgroundWorker2.ReportProgress(100, arg); e.Result = string.Format("{0} 已保存 !", changeindex.Count); } catch (Exception ex) { if (!e.Cancel) { e.Result = ex.Message + ""; } success = false; } return(success); }