/// <summary> /// 更新一条数据 /// </summary> public bool Update(EquipmentInfoModel model, List <EquipmentaccModel> accdata) { StringBuilder strSql = new StringBuilder(); strSql.AppendFormat("update equipmentinfo set equName='{0}',equCode='{1}',equNum='{2}',", model.equName, model.equCode, model.equNum); strSql.AppendFormat("queImgPath='{0}',devhouseID={1},sysTypeID={2},", model.queImgPath, model.devhouseID, model.sysTypeID); strSql.AppendFormat("setupDate='{0}',startupDate='{1}',agelimit={2},", model.setupDate, model.startupDate, model.agelimit); strSql.AppendFormat("manufacturer='{0}',supplier='{1}',supplierContact='{2}',", model.manufacturer, model.supplier, model.supplierContact); strSql.AppendFormat("device_type_code='{0}',", model.device_type_code); strSql.AppendFormat("mDepartment='{0}',mpName='{1}',mPhoneNum='{2}' where eID={3};", model.mDepartment, model.mpName, model.mPhoneNum, model.eID); List <string> cmdstrlist = new List <string>(); cmdstrlist.Add(strSql.ToString()); cmdstrlist.AddRange(accdata.Select(s => string.Format("insert into equipmentacc(equID,accName,accNo,accParameter,other) values ({0},'{1}','{2}','{3}','{4}')", s.equID, s.accName, s.accNo, s.accParameter, s.other))); return(MySQLHelper.ExecuteSqlByTran(cmdstrlist) > 0 ? true : false); }
public ControlPoint(string[] segments, DateTime realTime) { if (segments == null || segments.Length != 4) { IsValid = false; return; } try { var pointCode = GetPointCode(segments[0]); //0 测点编号 //var pointType = (PointType)Enum.Parse(typeof(PointType), segments[6]); //1 测点值的类型编码 var pointName = segments[2]; //2 测点名称 var sensorTypeCode = segments[3]; //3 测点类型编码 ControlPointModel = new ControlPointModel() { EquipId = GetSensorEquipId(pointCode, PointTypeConverter.C), SubstationEquipId = pointCode.Replace("C", "0").ToInt(), SubstationId = pointCode.Substring(0, 3).ToInt(), PortNO = pointCode.Substring(3, 3).ToInt(), SensorId = SensorTypeHelper.GetTargetSensorId(sensorTypeCode.ToInt()), }; var sensorInfo = SensorTypeHelper.GetTargetSensorInfo(sensorTypeCode.ToInt()); EquipmentInfo = new EquipmentInfoModel() { EquipId = ControlPointModel.EquipId, PointCode = pointCode, Name = sensorInfo.SensorName, ETCode = sensorInfo.EtCode, PointId = 0, Location = "", LDate = realTime, RDate = realTime }; } catch { IsValid = false; return; } IsValid = true; }
/// <summary> /// 模型数据改变 /// </summary> /// <param name="obj"></param> private void dataChanged(EquipmentInfoModel equipmentModel) { getPageData(pageRepuestParams.PageIndex, pageRepuestParams.PageSize); this.EquipmentInfo = EquipmentInfoList.FirstOrDefault(); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(EquipmentInfoModel model, List <EquipmentaccModel> accdata) { return(equinfo_dal.Update(model, accdata)); }
/// <summary> /// 增加一条数据并返回新行号 /// </summary> public int Add(EquipmentInfoModel model, List <EquipmentaccModel> accdata) { return(equinfo_dal.Add(model, accdata)); }
public AnalogPoint(string[] segments, DateTime realTime) { if (segments == null || segments.Length != 20) { IsValid = false; return; } try { var pointCode = GetPointCode(segments[0]); //0 测点编号 var substationCode = GetPointCode(segments[1]); //1 分站号 var pointName = segments[2]; //2 测点名称 var pointLocation = segments[3]; //3 测点所属区域名称 //var unitType = (UnitType)Enum.Parse(typeof(UnitType), segments[4]); //4 所在区域类型 //var pointAreaLocation = (AreaLocation)Enum.Parse(typeof(AreaLocation), segments[5]); //5 传感器所在区域的位置编码 //var pointType = (PointType)Enum.Parse(typeof(PointType), segments[6]); //6 测点值的类型编码 var sensorTypeCode = segments[7]; //7 测点类型编码 var unitName = segments[8]; //8 工程单位 var measureHigh = segments[9].ToFloat(); //9 高量程 var measureLow = segments[10].ToFloat(); //10 低量程 var upperLimitWarning = segments[11].ToFloat(); //11 上限报警门限 var lowerLimitWarning = segments[13].ToFloat(); var upperLimitSwitchingOff = segments[15].ToFloat(); var upperLimitResume = segments[16].ToFloat(); var lowerLimitSwitchingOff = segments[17].ToFloat(); var lowerLimitResume = segments[18].ToFloat(); AnalogPointModel = new AnalogPointModel() { EquipId = GetSensorEquipId(pointCode, PointTypeConverter.A), UnitName = unitName, SubstationId = substationCode.Substring(0, 3).ToInt(), SubstationEquipId = substationCode.ToInt(), PortNO = pointCode.Substring(3, 3).ToInt(), SensorId = SensorTypeHelper.GetTargetSensorId(sensorTypeCode.ToInt()), MeasureHigh = measureHigh, MeasureLow = measureLow, UpperLimitWarning = upperLimitWarning, UpperLimitResume = upperLimitResume, UpperLimitSwitchingOff = upperLimitSwitchingOff, LowerLimitWarning = lowerLimitWarning, LowerLimitResume = lowerLimitResume, LowerLimitSwitchingOff = lowerLimitSwitchingOff }; var sensorInfo = SensorTypeHelper.GetTargetSensorInfo(sensorTypeCode.ToInt()); EquipmentInfo = new EquipmentInfoModel() { EquipId = AnalogPointModel.EquipId, PointCode = pointCode, Name = sensorInfo.SensorName, ETCode = sensorInfo.EtCode, PointId = 0, Location = pointLocation, LDate = realTime, RDate = realTime }; } catch { IsValid = false; return; } IsValid = true; }