private void read() { userlist_Server = new List <clscustomerinfo>(); clscustomerinfo item = new clscustomerinfo(); item.customer_name = this.txname.Text; if (item.customer_name == null || item.customer_name == "") { errorProvider1.SetError(txname, "不能为空"); return; } else { errorProvider1.SetError(txname, String.Empty); } item.customer_adress = this.txadress.Text; item.customer_shuihao = this.tshuihao.Text; item.customer_bank = this.txbank.Text; item.customer_account = txaccount.Text; item.customer_phone = txphone.Text; item.customer_contact = txcontact.Text; item.Input_Date = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); userlist_Server.Add(item); }
public List <clscustomerinfo> findcustomer(string findtext) { MySql.Data.MySqlClient.MySqlDataReader reader = MySqlHelper.ExecuteReader(findtext); List <clscustomerinfo> ClaimReport_Server = new List <clscustomerinfo>(); while (reader.Read()) { clscustomerinfo item = new clscustomerinfo(); item.customer_id = reader.GetInt32(0); if (reader.GetValue(1) != null && Convert.ToString(reader.GetValue(1)) != "") { item.customer_name = reader.GetString(1); } if (reader.GetValue(2) != null && Convert.ToString(reader.GetValue(2)) != "") { item.customer_adress = reader.GetString(2); } if (reader.GetValue(3) != null && Convert.ToString(reader.GetValue(3)) != "") { item.customer_shuihao = reader.GetString(3); } if (reader.GetValue(4) != null && Convert.ToString(reader.GetValue(4)) != "") { item.customer_bank = reader.GetString(4); } if (reader.GetValue(5) != null && Convert.ToString(reader.GetValue(5)) != "") { item.customer_account = reader.GetString(5); } if (reader.GetValue(6) != null && Convert.ToString(reader.GetValue(6)) != "") { item.customer_phone = reader.GetString(6); } if (reader.GetValue(7) != null && Convert.ToString(reader.GetValue(7)) != "") { item.customer_contact = reader.GetString(7); } if (reader.GetValue(8) != null && Convert.ToString(reader.GetValue(8)) != "") { item.Input_Date = Convert.ToDateTime(reader.GetString(8)); } 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 clscustomerinfo; clscustomerinfo item = new clscustomerinfo(); item.customer_name = Convert.ToString(dataGridView1.Rows[i].Cells["customer_name"].EditedFormattedValue.ToString()); item.customer_adress = Convert.ToString(dataGridView1.Rows[i].Cells["customer_adress"].EditedFormattedValue.ToString()); item.customer_shuihao = Convert.ToString(dataGridView1.Rows[i].Cells["customer_shuihao"].EditedFormattedValue.ToString()); item.customer_bank = Convert.ToString(dataGridView1.Rows[i].Cells["customer_bank"].EditedFormattedValue.ToString()); item.customer_account = Convert.ToString(dataGridView1.Rows[i].Cells["customer_account"].EditedFormattedValue.ToString()); item.customer_phone = Convert.ToString(dataGridView1.Rows[i].Cells["customer_phone"].EditedFormattedValue.ToString()); item.customer_contact = Convert.ToString(dataGridView1.Rows[i].Cells["customer_contact"].EditedFormattedValue.ToString()); item.Input_Date = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); item.customer_id = model.customer_id; #endregion #region MyRegion var startAt = this.stockOutDateTimePicker.Value.AddDays(0).Date; string conditions = ""; #region 构造查询条件 if (item.customer_name != null) { conditions += " customer_name ='" + item.customer_name + "'"; } if (item.customer_adress != null) { conditions += " ,customer_adress ='" + item.customer_adress + "'"; } if (item.customer_shuihao != null) { conditions += " ,customer_shuihao ='" + item.customer_shuihao + "'"; } if (item.customer_bank != null) { conditions += " ,customer_bank ='" + item.customer_bank + "'"; } if (item.customer_account != null) { conditions += " ,customer_account ='" + item.customer_account + "'"; } if (item.customer_phone != null) { conditions += " ,customer_phone ='" + item.customer_phone + "'"; } if (item.customer_contact != null) { conditions += " ,customer_contact ='" + item.customer_contact + "'"; } if (item.Input_Date != null) { conditions += " ,Input_Date ='" + item.Input_Date.ToString("yyyy/MM/dd") + "'"; } conditions = "update JNOrder_customer set " + conditions + " where customer_id = " + item.customer_id + " "; // conditions += " order by Id desc"; #endregion #endregion int isrun = BusinessHelp.updatecustomer_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); }