/// <summary> /// 自动保存 用户离开单元格时 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgv1_CellParsing(object sender, DataGridViewCellParsingEventArgs e) { try { //int i = dgv_title.CurrentCell.ColumnIndex; string colname = dgv1.Columns[dgv1.CurrentCell.ColumnIndex].Name; if (colname.Equals("col_phone") || colname.Equals("col_orderid") || colname.Equals("col_wuliu") || colname.Equals("col_vpn") || colname.Equals("col_address") || colname.Equals("col_remark")) { shuadan_records og = (shuadan_records)dgv1.CurrentRow.DataBoundItem; if (og != null) { string phone = dgv1["col_phone", e.RowIndex].EditedFormattedValue == null ? "" : dgv1["col_phone", e.RowIndex].EditedFormattedValue.ToString(); string wuliu = dgv1["col_wuliu", e.RowIndex].EditedFormattedValue == null ? "" : dgv1["col_wuliu", e.RowIndex].EditedFormattedValue.ToString(); string address = dgv1["col_address", e.RowIndex].EditedFormattedValue == null ? "" : dgv1["col_address", e.RowIndex].EditedFormattedValue.ToString(); og.sdaddress = address; og.sdphone = phone; og.sdwuliu = wuliu; //BLL2.shuadan_recordsManager.Update(og); } } } catch (Exception ex) { Debug.WriteLine("修改信息失败 " + ex.Message); } }
/// <summary> /// 根据表,获取一个SqlParameter数组 /// </summary> /// <returns>SqlParameter[]</returns> public static SqlParameter[] GetSqlParameters(shuadan_records shuadan_recordsExample) { List <SqlParameter> list_param = new List <SqlParameter>(); if (!string.IsNullOrEmpty(shuadan_recordsExample.sdgoodsname)) { list_param.Add(new SqlParameter("@sdgoodsname", shuadan_recordsExample.sdgoodsname)); } else { list_param.Add(new SqlParameter("@sdgoodsname", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdgoodsurl)) { list_param.Add(new SqlParameter("@sdgoodsurl", shuadan_recordsExample.sdgoodsurl)); } else { list_param.Add(new SqlParameter("@sdgoodsurl", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sddptype)) { list_param.Add(new SqlParameter("@sddptype", shuadan_recordsExample.sddptype)); } else { list_param.Add(new SqlParameter("@sddptype", DBNull.Value)); } if (shuadan_recordsExample.sddate != new DateTime() && shuadan_recordsExample.sddate != null) { list_param.Add(new SqlParameter("@sddate", shuadan_recordsExample.sddate.ToString("yyyy-MM-dd HH:mm:ss"))); } else { list_param.Add(new SqlParameter("@sddate", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdorderid)) { list_param.Add(new SqlParameter("@sdorderid", shuadan_recordsExample.sdorderid)); } else { list_param.Add(new SqlParameter("@sdorderid", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdphone)) { list_param.Add(new SqlParameter("@sdphone", shuadan_recordsExample.sdphone)); } else { list_param.Add(new SqlParameter("@sdphone", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdvpn)) { list_param.Add(new SqlParameter("@sdvpn", shuadan_recordsExample.sdvpn)); } else { list_param.Add(new SqlParameter("@sdvpn", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdaddress)) { list_param.Add(new SqlParameter("@sdaddress", shuadan_recordsExample.sdaddress)); } else { list_param.Add(new SqlParameter("@sdaddress", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdwuliu)) { list_param.Add(new SqlParameter("@sdwuliu", shuadan_recordsExample.sdwuliu)); } else { list_param.Add(new SqlParameter("@sdwuliu", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdremark1)) { list_param.Add(new SqlParameter("@sdremark1", shuadan_recordsExample.sdremark1)); } else { list_param.Add(new SqlParameter("@sdremark1", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdremark3)) { list_param.Add(new SqlParameter("@sdremark3", shuadan_recordsExample.sdremark3)); } else { list_param.Add(new SqlParameter("@sdremark3", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdremark2)) { list_param.Add(new SqlParameter("@sdremark2", shuadan_recordsExample.sdremark2)); } else { list_param.Add(new SqlParameter("@sdremark2", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdremark4)) { list_param.Add(new SqlParameter("@sdremark4", shuadan_recordsExample.sdremark4)); } else { list_param.Add(new SqlParameter("@sdremark4", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdremark5)) { list_param.Add(new SqlParameter("@sdremark5", shuadan_recordsExample.sdremark5)); } else { list_param.Add(new SqlParameter("@sdremark5", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdremark6)) { list_param.Add(new SqlParameter("@sdremark6", shuadan_recordsExample.sdremark6)); } else { list_param.Add(new SqlParameter("@sdremark6", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdstatepay)) { list_param.Add(new SqlParameter("@sdstatepay", shuadan_recordsExample.sdstatepay)); } else { list_param.Add(new SqlParameter("@sdstatepay", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdremark7)) { list_param.Add(new SqlParameter("@sdremark7", shuadan_recordsExample.sdremark7)); } else { list_param.Add(new SqlParameter("@sdremark7", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdremark8)) { list_param.Add(new SqlParameter("@sdremark8", shuadan_recordsExample.sdremark8)); } else { list_param.Add(new SqlParameter("@sdremark8", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdremark9)) { list_param.Add(new SqlParameter("@sdremark9", shuadan_recordsExample.sdremark9)); } else { list_param.Add(new SqlParameter("@sdremark9", DBNull.Value)); } if (!string.IsNullOrEmpty(shuadan_recordsExample.sdremark10)) { list_param.Add(new SqlParameter("@sdremark10", shuadan_recordsExample.sdremark10)); } else { list_param.Add(new SqlParameter("@sdremark10", DBNull.Value)); } SqlParameter[] param = new SqlParameter[list_param.Count]; int index = 0; foreach (SqlParameter p in list_param) { param[index] = p; index++; } return(param); }
partial void Updateshuadan_records(shuadan_records instance);
partial void Deleteshuadan_records(shuadan_records instance);
partial void Insertshuadan_records(shuadan_records instance);