private void newButton_Click(object sender, EventArgs e) { clsLog_info item = new clsLog_info(); item.Input_Date = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); item.xinzeng = "true"; this.bindingSource1.Add(item); this.dataGridView1.Refresh(); }
private clsLog_info GetSelectedSchedule() { clsLog_info schedule = null; var row = this.dataGridView1.CurrentRow; if (row != null) { schedule = row.DataBoundItem as clsLog_info; } return(schedule); }
public List <clsLog_info> findLog(string findtext) { MySql.Data.MySqlClient.MySqlDataReader reader = MySqlHelper.ExecuteReader(findtext); List <clsLog_info> ClaimReport_Server = new List <clsLog_info>(); while (reader.Read()) { clsLog_info item = new clsLog_info(); item.Log_id = reader.GetInt32(0); item.product_no = reader.GetString(1); item.indent = reader.GetString(2); item.indent_date = reader.GetString(3); item.end_user = reader.GetString(4); if (reader.GetValue(5) != null && Convert.ToString(reader.GetValue(5)) != "") { item.Input_Date = Convert.ToDateTime(reader.GetString(5)); } item.vendor = reader.GetString(6); if (reader.GetValue(7) != null && Convert.ToString(reader.GetValue(7)) != "") { item.daohuoshijian = reader.GetString(7); } 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 clsLog_info; clsLog_info item = new clsLog_info(); item.product_no = Convert.ToString(dataGridView1.Rows[i].Cells["product_no"].EditedFormattedValue.ToString()); item.indent = Convert.ToString(dataGridView1.Rows[i].Cells["indent"].EditedFormattedValue.ToString()); item.indent_date = Convert.ToString(dataGridView1.Rows[i].Cells["indent_date"].EditedFormattedValue.ToString()); item.end_user = Convert.ToString(dataGridView1.Rows[i].Cells["end_user"].EditedFormattedValue.ToString()); item.vendor = Convert.ToString(dataGridView1.Rows[i].Cells["vendor"].EditedFormattedValue.ToString()); item.daohuoshijian = Convert.ToString(dataGridView1.Rows[i].Cells["daohuoshijian"].EditedFormattedValue.ToString()); item.xinzeng = Convert.ToString(dataGridView1.Rows[i].Cells["xinzeng"].EditedFormattedValue.ToString()); item.Input_Date = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); item.Log_id = model.Log_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.indent != null) { conditions += " ,indent ='" + item.indent + "'"; } if (item.indent_date != null) { conditions += " ,indent_date ='" + item.indent_date + "'"; } if (item.end_user != null) { conditions += " ,end_user ='******'"; } if (item.vendor != null) { conditions += " ,vendor ='" + item.vendor + "'"; } if (item.daohuoshijian != null) { conditions += " ,daohuoshijian ='" + item.daohuoshijian + "'"; } if (item.Input_Date != null) { conditions += " ,Input_Date ='" + item.Input_Date.ToString("yyyy/MM/dd") + "'"; } if (item.xinzeng == "true") { conditions = "insert into JNOrder_log(product_no,indent,indent_date,end_user,vendor,Input_Date) values ('" + item.product_no + "','" + item.indent + "','" + item.indent_date + "','" + item.end_user + "','" + item.vendor + "','" + item.Input_Date.ToString("yyyy/MM/dd") + "')"; } else { conditions = "update JNOrder_log set " + conditions + " where Log_id = " + item.Log_id + " "; } #endregion #endregion int isrun = BusinessHelp.updateLog_Server(conditions); if (item.xinzeng == "true" && isrun == 1) { item.xinzeng = ""; } 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); }