// 上报 private FuelDataService.OperateResult applyParam() { try { List <VehicleBasicInfo> lbiList = new List <VehicleBasicInfo>(); VehicleBasicInfo lbi = new VehicleBasicInfo() { V_Id = "", User_Id = Utils.userId, Qcscqy = tbqcscqy.Text.Trim(), Jkqczjxs = this.tbjkqczjxs.Text.Trim(), Vin = this.tbbah.Text.Trim().ToUpper(), Hgspbm = this.tbHgspbm.Text.Trim().ToUpper(), Clxh = this.tbclxh.Text.Trim(), Clzl = this.cbclzl.Text.Trim(), Rllx = this.cbrllx.Text.Trim(), Zczbzl = this.tbzczbzl.Text.Trim(), Zgcs = this.tbzgcs.Text.Trim(), Ltgg = this.tbltgg.Text.Trim(), Zj = this.tbzj.Text.Trim(), Clzzrq = DateTime.Parse(this.dtclzzrq.Text), Tymc = this.tbtymc.Text.Trim(), Yyc = this.cbyyc.Text.Trim(), Zwps = this.tbzwps.Text.Trim(), Zdsjzzl = this.tbzdsjzzl.Text.Trim(), Edzk = this.tbedzk.Text.Trim(), Lj = this.tblj.Text.Trim(), Qdxs = this.cbqdxs.Text.Trim(), Jyjgmc = this.tbjcjgmc.Text.Trim(), Jybgbh = this.tbbgbh.Text.Trim(), Qtxx = this.tbQtxx.Text.Trim(), CreateTime = DateTime.Now, UpdateTime = DateTime.Now, Status = "0" }; List <RllxParamEntity> listParam = new List <RllxParamEntity>(); foreach (Control c in this.tlp.Controls) { if (c is TextEdit || c is DevExpress.XtraEditors.ComboBoxEdit) { RllxParamEntity pe = new RllxParamEntity() { V_Id = "", Param_Code = c.Name, Vin = this.tbbah.Text.Trim().ToUpper(), Param_Value = c.Text }; listParam.Add(pe); } } lbi.EntityList = listParam.ToArray(); lbiList.Add(lbi); // 上报 FuelDataService.OperateResult result = new FuelDataService.OperateResult(); return(result = Utils.service.UploadInsertFuelDataList(Utils.userId, Utils.password, Utils.FuelInfoC2S(lbiList).ToArray(), "CATARC_CUSTOM_2012")); } catch (Exception ex) { throw ex; } }
// 将client端的VehicleBasicInfo array对象转换为web service端对象 public static List <VehicleBasicInfo> FuelInfoS2C(FuelDataService.VehicleBasicInfo[] serviceBasicList) { List <VehicleBasicInfo> clientBasicList = new List <VehicleBasicInfo>(); foreach (FuelDataService.VehicleBasicInfo serviceBasic in serviceBasicList) { List <RllxParamEntity> clientEntityList = new List <RllxParamEntity>(); foreach (FuelDataService.RllxParamEntity serviceEntity in serviceBasic.EntityList) { RllxParamEntity clientEntity = new RllxParamEntity(); ConvertObj <FuelDataService.RllxParamEntity, RllxParamEntity>(serviceEntity, clientEntity); clientEntityList.Add(clientEntity); } VehicleBasicInfo clientBasic = new VehicleBasicInfo(); Utils.BasicInfoW2C(serviceBasic, clientBasic); clientBasic.EntityList = clientEntityList.ToArray(); clientBasicList.Add(clientBasic); } return(clientBasicList); }
// 上报 private FuelDataService.OperateResult applyParam() { //bool AppFlg = false; try { List <VehicleBasicInfo> lbiList = new List <VehicleBasicInfo>(); VehicleBasicInfo lbi = new VehicleBasicInfo(); //VehicleBasicInfo[] lbiList = new VehicleBasicInfo[1] { new VehicleBasicInfo() }; lbi.V_Id = ""; lbi.User_Id = Utils.userId; lbi.Qcscqy = tbqcscqy.Text.Trim(); lbi.Jkqczjxs = this.tbjkqczjxs.Text.Trim(); lbi.Vin = this.tbbah.Text.Trim().ToUpper(); lbi.Hgspbm = this.tbHgspbm.Text.Trim().ToUpper(); lbi.Clxh = this.tbclxh.Text.Trim(); lbi.Clzl = this.cbclzl.Text.Trim(); lbi.Rllx = this.cbrllx.Text.Trim(); lbi.Zczbzl = this.tbzczbzl.Text.Trim(); lbi.Zgcs = this.tbzgcs.Text.Trim(); lbi.Ltgg = this.tbltgg.Text.Trim(); lbi.Zj = this.tbzj.Text.Trim(); lbi.Clzzrq = DateTime.Parse(this.dtclzzrq.Text); lbi.Tymc = this.tbtymc.Text.Trim(); lbi.Yyc = this.cbyyc.Text.Trim(); lbi.Zwps = this.tbzwps.Text.Trim(); lbi.Zdsjzzl = this.tbzdsjzzl.Text.Trim(); lbi.Edzk = this.tbedzk.Text.Trim(); lbi.Lj = this.tblj.Text.Trim(); lbi.Qdxs = this.cbqdxs.Text.Trim(); lbi.Jyjgmc = this.tbjcjgmc.Text.Trim(); lbi.Jybgbh = this.tbbgbh.Text.Trim(); lbi.Qtxx = this.tbQtxx.Text.Trim(); lbi.CreateTime = DateTime.Now; lbi.UpdateTime = DateTime.Now; lbi.Status = "0"; List <RllxParamEntity> listParam = new List <RllxParamEntity>(); foreach (Control c in this.tlp.Controls) { if (c is TextEdit || c is DevExpress.XtraEditors.ComboBoxEdit) { RllxParamEntity pe = new RllxParamEntity(); string strLabName = "lbl" + c.Name; Control[] lblc = this.Controls.Find(strLabName, true); string paramCode = c.Name; string paramValue = c.Text; //string paramName = lblc[0].Text; pe.V_Id = ""; pe.Param_Code = paramCode; pe.Vin = this.tbbah.Text.Trim().ToUpper(); //pe.Param_Name = paramName; pe.Param_Value = c.Text; listParam.Add(pe); } } lbi.EntityList = listParam.ToArray(); lbiList.Add(lbi); // 上报 FuelDataService.OperateResult result = new FuelDataService.OperateResult(); return(result = service.UploadInsertFuelDataList(Utils.userId, Utils.password, Utils.FuelInfoC2S(lbiList).ToArray(), "CATARC_CUSTOM_2012")); //// 判断是否上报成功 //int count = Utils.ApplyFlg(result).Count; //if (count > 0) //{ // AppFlg = false; // this.btnPrint.Visible = false; //} //else //{ // Utils.UpdataState(result); // setEnable(); // AppFlg = true; //} //return AppFlg; } catch (Exception ex) { throw ex; return(null); } }
public void UploadData(object objCon) { GridView dgv = objCon as GridView; try { // 取list列表选中的VIN ArrayList al = new ArrayList(); dgv.PostEditor(); string value = ""; for (int i = 0; i < dgv.RowCount; i++) { value = dgv.GetDataRow(i)["check"].ToString(); if (value == "True") { al.Add(dgv.GetRowCellValue(i, "VIN")); } } List <VehicleBasicInfo> lbiList = new List <VehicleBasicInfo>(); if (al.Count > 0) { foreach (string strVin in al) { #region 基本信息 VehicleBasicInfo lbi = new VehicleBasicInfo(); string strJbSql = "SELECT * FROM FC_CLJBXX WHERE VIN = '" + strVin + "'"; //string stringSql = "SELECT * FROM FC_CLJBXX A JOIN RLLX_PARAM_ENTITY B ON A.V_ID = B.V_ID WHERE A.VIN = '" + strVin + "'"; Object obj = AccessHelper.ExecuteDataSet(AccessHelper.conn, strJbSql, null); DataSet ds = (DataSet)obj; lbi.User_Id = Utils.userId; lbi.Qcscqy = ds.Tables[0].Rows[0]["QCSCQY"].ToString(); lbi.Jkqczjxs = ds.Tables[0].Rows[0]["JKQCZJXS"].ToString(); lbi.Vin = ds.Tables[0].Rows[0]["VIN"].ToString(); lbi.Clxh = ds.Tables[0].Rows[0]["CLXH"].ToString(); lbi.Clzl = ds.Tables[0].Rows[0]["CLZL"].ToString(); lbi.Rllx = ds.Tables[0].Rows[0]["RLLX"].ToString(); lbi.Zczbzl = ds.Tables[0].Rows[0]["ZCZBZL"].ToString(); lbi.Zgcs = ds.Tables[0].Rows[0]["ZGCS"].ToString(); lbi.Ltgg = ds.Tables[0].Rows[0]["LTGG"].ToString(); lbi.Zj = ds.Tables[0].Rows[0]["ZJ"].ToString(); lbi.Clzzrq = DateTime.Parse(ds.Tables[0].Rows[0]["CLZZRQ"].ToString()); lbi.Tymc = ds.Tables[0].Rows[0]["TYMC"].ToString(); lbi.Yyc = ds.Tables[0].Rows[0]["YYC"].ToString(); lbi.Zwps = ds.Tables[0].Rows[0]["ZWPS"].ToString(); lbi.Zdsjzzl = ds.Tables[0].Rows[0]["ZDSJZZL"].ToString(); lbi.Edzk = ds.Tables[0].Rows[0]["EDZK"].ToString(); lbi.Lj = ds.Tables[0].Rows[0]["LJ"].ToString(); lbi.Qdxs = ds.Tables[0].Rows[0]["QDXS"].ToString(); lbi.Jyjgmc = ds.Tables[0].Rows[0]["JYJGMC"].ToString(); lbi.Jybgbh = ds.Tables[0].Rows[0]["JYBGBH"].ToString(); lbi.CreateTime = DateTime.Now; lbi.UpdateTime = DateTime.Now; lbi.Status = "1"; #endregion #region //string strParamSql = "SELECT A.VIN,A.PARAM_NAME,A.PARAM_VALUE,B.PARAM_CODE FROM RLLX_PARAM_ENTITY A JOIN RLLX_PARAM B ON A.PARAM_ID = B.PARAM_ID WHERE A.VIN = '" + strVin + "'"; string strParamSql = "SELECT A.VIN,A.PARAM_NAME,A.PARAM_VALUE FROM RLLX_PARAM_ENTITY A WHERE A.VIN = '" + strVin + "'"; Object objParam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strParamSql, null); DataSet dsParam = (DataSet)objParam; DataTable dt = dsParam.Tables[0]; List <RllxParamEntity> listParam = new List <RllxParamEntity>(); foreach (DataRow dr in dt.Rows) { RllxParamEntity rpe = new RllxParamEntity(); // rpe.Param_Code = dr[""].ToString(); rpe.Vin = dr["VIN"].ToString(); //rpe.Param_Name = dr["PARAM_NAME"].ToString(); rpe.Param_Value = dr["PARAM_VALUE"].ToString(); listParam.Add(rpe); } lbi.EntityList = listParam.ToArray(); lbiList.Add(lbi); FuelDataService.OperateResult result = new FuelDataService.OperateResult(); result = service.UploadInsertFuelDataList(Utils.userId, Utils.password, Utils.FuelInfoC2S(lbiList).ToArray(), "CATARC_CUSTOM_2012"); Utils.UpdataState(result); #endregion } } else { MessageBox.Show("没有选中可上报数据!"); } } catch { MessageBox.Show("上报出错!"); } }