/// <summary> /// 新增一条记录 /// </summary> /// <param name="qcRecord">质检实体</param> /// <returns></returns> public static bool InsertOneQCRecord(Driveway qcRecord) { bool rbool = true; using (DCCarManagementDataContext db = new DCCarManagementDataContext()) { try { rbool = LinQBaseDao.InsertOne(db, qcRecord); } catch { rbool = false; } finally { db.Connection.Close(); } } return(rbool); }
private async Task GetMethods(string parkingLotId, string frontId, string backId, string drivewayId) { WriteLine($"Testing GET '{_route}/{ParkingLotApi.Path}/{parkingLotId}'."); ParkingLot parkingLot = await _parkingLotApi.Get <ParkingLot>(parkingLotId); WriteLine($"Testing GET '{_route}/{SensorApi.Path}/{frontId}'."); Sensor frontSensor = await _sensorApi.Get <Sensor>(frontId); WriteLine($"Testing GET '{_route}/{SensorApi.Path}/{backId}'."); Sensor backSensor = await _sensorApi.Get <Sensor>(backId); WriteLine($"Testing GET '{_route}/{DrivewayApi.Path}/{drivewayId}'."); Driveway driveway = await _drivewayApi.Get <Driveway>(drivewayId); WriteLine("Objects that were just created:"); WriteLine($"--> Parking Lot {parkingLot.GetPrintString()}"); WriteLine($"--> Front Sensor {frontSensor.GetPrintString()}"); WriteLine($"--> Back Sensor {backSensor.GetPrintString()}"); WriteLine($"--> Driveway {driveway.GetPrintString()}"); WriteLine(); }
private async Task GetMethods(string parkingLotId, string frontId, string backId, string drivewayId) { WriteLine($"Testing GET \"{Route}{ParkingLots.Route}/{parkingLotId}"); ParkingLot parkingLot = await ParkingLots.Get <ParkingLot>(parkingLotId); WriteLine($"Testing GET \"{Route}{Sensors.Route}/{frontId}"); Sensor frontSensor = await Sensors.Get <Sensor>(frontId); WriteLine($"Testing GET \"{Route}{Sensors.Route}/{backId}"); Sensor backSensor = await Sensors.Get <Sensor>(backId); WriteLine($"Testing GET \"{Route}{Driveways.Route}/{drivewayId}"); Driveway driveway = await Driveways.Get <Driveway>(drivewayId); WriteLine("Objects that were just created:"); WriteLine($"--> Parking Lot {parkingLot.GetPrintString()}"); WriteLine($"--> Front Sensor {frontSensor.GetPrintString()}"); WriteLine($"--> Back Sensor {backSensor.GetPrintString()}"); WriteLine($"--> Driveway {driveway.GetPrintString()}"); WriteLine(); }
/// <summary> /// “保存” 按钮的单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { try { if (this.txtDriveway_Name.Text == "") { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "通道名称不能为空!", txtDriveway_Name, this); return; } if (this.txtDriveway_ReadCardPort.Text == "") { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "通道读卡器地址码不能为空!", txtDriveway_ReadCardPort, this); return; } //DataTable tables = LinQBaseDao.Query("select * from Driveway where Driveway_Value='" + txtDriveway_Value.Text.Trim() + "'").Tables[0]; //if (tables.Rows.Count > 0) //{ // PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "通道值重复!", txtDriveway_Name, this); // return; //} //DataTable table = LinQBaseDao.Query("select * from Driveway where Driveway_Name='" + txtDriveway_Name.Text.Trim() + "' and Driveway_Position_ID=" + cbxDriveway_PositionName.SelectedValue).Tables[0]; //if (table.Rows.Count > 0) //{ // PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "通道名称重复!", txtDriveway_Name, this); // return; //} if (!btnCheck()) { return; // 去重复 } var Drivewayadd = new Driveway(); Drivewayadd.Driveway_Name = this.txtDriveway_Name.Text.Trim(); Drivewayadd.Driveway_Value = this.txtDriveway_Value.Text.Trim(); Drivewayadd.Driveway_State = this.cbxDriveway_State.Text; Drivewayadd.Driveway_Type = this.cbxDriveway_Type.Text; Drivewayadd.Driveway_WarrantyState = this.comboxDriveway_WarrantyState.Text; if (cobReserve.SelectedIndex != 0 && cobReserve.SelectedIndex != -1) { Drivewayadd.Driveway_Remark_Driveway_ID = Convert.ToInt32((cobReserve.SelectedValue.ToString())); } Drivewayadd.Driveway_Position_ID = int.Parse(this.cbxDriveway_PositionName.SelectedValue.ToString()); Drivewayadd.Driveway_UserId = int.Parse(common.USERID); Drivewayadd.Driveway_CreatTime = Convert.ToDateTime(CommonalityEntity.GetServersTime().ToString()); Drivewayadd.Driveway_Address = this.cbodizhima.Text.Trim(); Drivewayadd.Driveway_ReadCardPort = this.txtDriveway_ReadCardPort.Text.Trim(); Drivewayadd.Driveway_Remark = this.txtDriveway_Remark.Text.Trim(); Drivewayadd.Driveway_CloseAddress = cbmcloseAdd.Text.Trim(); if (DrivewayDAL.InsertOneQCRecord(Drivewayadd)) { MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); string strContent1 = "通道名称为:" + this.cbxDriveway_PositionName.SelectedText + this.txtDriveway_Name.Text.Trim(); CommonalityEntity.WriteLogData("新增", "新增 " + strContent1 + " 的信息", common.USERNAME);//添加日志 //重新绑定通道值 tongdaoZ(); } else { MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch { CommonalityEntity.WriteTextLog("通道管理 btnSave_Click()"); } finally { LogInfoLoad(""); } }