// 将Service端VehicleBasicInfo类型转换为Client端类型 public static void BasicInfoW2C(FuelDataService.VehicleBasicInfo src, FuelDataModel.VehicleBasicInfo des) { Type typeSrc = src.GetType(); Type typeDes = des.GetType(); PropertyInfo[] properties = typeDes.GetProperties(); foreach (PropertyInfo pf in properties) { PropertyInfo ps = typeSrc.GetProperty(pf.Name); if (ps != null) { try { pf.SetValue(des, ps.GetValue(src, null), null); } catch { } } } }
// 上报 private FuelDataService.OperateResult applyParam(string uploadType) { try { List <FuelDataModel.VehicleBasicInfo> lbiList = new List <FuelDataModel.VehicleBasicInfo>(); FuelDataModel.VehicleBasicInfo lbi = new FuelDataModel.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.tbvin.Text.Trim().ToUpper(); lbi.Hgspbm = this.tbHgspbm.Text.Trim().ToUpper(); lbi.Clxh = this.tbclxh.Text.Trim(); lbi.Clzl = this.tbclzl.Text.Trim(); lbi.Rllx = this.tbrllx.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.tbclzzrq.Text); lbi.Tymc = this.tbtymc.Text.Trim(); lbi.Yyc = this.tbyyc.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.tbqdxs.Text.Trim(); lbi.Jyjgmc = this.tbjyjgmc.Text.Trim(); lbi.Jybgbh = this.tbjybgbh.Text.Trim(); lbi.Qtxx = this.tbQtxx.Text.Trim(); lbi.CreateTime = DateTime.Now; lbi.UpdateTime = DateTime.Now; List <FuelDataModel.RllxParamEntity> listParam = new List <FuelDataModel.RllxParamEntity>(); foreach (Control c in this.tlp.Controls) { if (c is TextEdit || c is DevExpress.XtraEditors.ComboBoxEdit) { FuelDataModel.RllxParamEntity pe = new FuelDataModel.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.tbvin.Text.Trim(); //pe.Param_Name = paramName; pe.Param_Value = c.Text; listParam.Add(pe); } } lbi.EntityList = listParam.ToArray(); lbiList.Add(lbi); // 上报 if (uploadType == "UPLOADOT") { string delReason = string.Empty; ReasonForm rf = new ReasonForm(); Utils.SetFormMid(rf); rf.Text = "补传原因"; rf.ShowDialog(); if (rf.DialogResult == DialogResult.OK) { foreach (VehicleBasicInfo vInfo in lbiList) { vInfo.Reason = rf.Reason; } return(service.UploadOverTime(Utils.userId, Utils.password, Utils.FuelInfoC2S(lbiList).ToArray(), "CATARC_CUSTOM_2012")); } return(null); } else { return(service.UploadInsertFuelDataList(Utils.userId, Utils.password, Utils.FuelInfoC2S(lbiList).ToArray(), "CATARC_CUSTOM_2012")); } } catch (Exception ex) { throw ex; } }