/// <summary> /// 修改充电站 /// </summary> /// <param name="mod">旧G_ChargeStation实体</param> /// <param name="mod2">新G_ChargeStation实体</param> public bool EditChargeStation(G_ChargeStation mod, G_ChargeStation mod2) { bool b = false; OpSql.Open(); try { b = OpSql.Update(new object[] { mod }, new object[] { mod2 }); } catch { } finally { OpSql.Close(); } return(b); }
/// <summary> /// 获取G_ChargeStation实体List /// </summary> /// <param name="dt">源数据表</param> /// <returns></returns> public List <G_ChargeStation> G_ChargeStation(DataTable dt) { List <G_ChargeStation> modelList = new List <G_ChargeStation>(); G_ChargeStation model; for (int n = 0; n < dt.Rows.Count; n++) { model = new G_ChargeStation(); try{ model.cs_id = (long)dt.Rows[n]["cs_id"]; } catch { } model.cs_uname = dt.Rows[n]["cs_uname"].ToString(); model.cs_pwd = dt.Rows[n]["cs_pwd"].ToString(); model.cs_name = dt.Rows[n]["cs_name"].ToString(); model.cs_phone = dt.Rows[n]["cs_phone"].ToString(); model.cs_appfilename = dt.Rows[n]["cs_appfilename"].ToString(); try{ model.cs_lng = (double)dt.Rows[n]["cs_lng"]; } catch { } model.cs_lng_mark = dt.Rows[n]["cs_lng_mark"].ToString(); try{ model.cs_lat = (double)dt.Rows[n]["cs_lat"]; } catch { } model.cs_lat_mark = dt.Rows[n]["cs_lat_mark"].ToString(); try{ model.cs_gglng = (double)dt.Rows[n]["cs_gglng"]; } catch { } try{ model.cs_gglat = (double)dt.Rows[n]["cs_gglat"]; } catch { } try{ model.cs_bdlng = (double)dt.Rows[n]["cs_bdlng"]; } catch { } try{ model.cs_bdlat = (double)dt.Rows[n]["cs_bdlat"]; } catch { } try{ model.p_id = (int)dt.Rows[n]["p_id"]; } catch { } try{ model.c_id = (int)dt.Rows[n]["c_id"]; } catch { } try{ model.d_id = (int)dt.Rows[n]["d_id"]; } catch { } try{ model.s_id = (int)dt.Rows[n]["s_id"]; } catch { } try{ model.cm_id = (int)dt.Rows[n]["cm_id"]; } catch { } model.pcdscm_address = dt.Rows[n]["pcdscm_address"].ToString(); try{ model.cs_endtime = (DateTime)dt.Rows[n]["cs_endtime"]; } catch { } try{ model.cs_power = (double)dt.Rows[n]["cs_power"]; } catch { } try{ model.cs_operation = (int)dt.Rows[n]["cs_operation"]; } catch { } try{ model.cs_ispub = (bool)dt.Rows[n]["cs_ispub"]; } catch { } try{ model.cs_examine = (bool)dt.Rows[n]["cs_examine"]; } catch { } try{ model.cs_addtime = (DateTime)dt.Rows[n]["cs_addtime"]; } catch { } try{ model.cp_number = (int)dt.Rows[n]["cp_number"]; } catch { } try{ model.cs_isglobal = (bool)dt.Rows[n]["cs_isglobal"]; } catch { } modelList.Add(model); } return(modelList); }