/// <summary> /// 新增一条质检记录 /// </summary> /// <param name="qcRecord">质检实体</param> /// <returns></returns> public static bool InsertOneQCRecord(FVNInfo eh_Fvn) { bool rbool = true; using (DCCarManagementDataContext db = new DCCarManagementDataContext()) { try { rbool = LinQBaseDao.InsertOne(db, eh_Fvn); } catch { rbool = false; } finally { db.Connection.Close(); } } return(rbool); }
/// <summary> /// “保存” 按钮的单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { try { if (this.txtFVN_Name.Text == "") { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "地感名称不能为空!", txtFVN_Name, this); return; } if (this.txtFVN_Value.Text == "") { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "地感PLC值不能为空!", txtFVN_Value, this); return; } string PositionName = this.cbxPositionName.Text.ToString(); int lenth = cbxDrivewayName.Text.Trim().Length; string DrivewayName = cbxDrivewayName.Text.Trim().Substring(0, 4); string DrivewayType = cbxDrivewayName.Text.Trim().Substring(lenth - 1, 1); int DrivewayID = 0; var p = DrivewayDAL.GetViewDrivewayName(String.Format("select Driveway_ID from View_DrivewayPosition where Position_Name='{0}' and Driveway_Name= '{1}' and Driveway_Type= '{2}'", PositionName, DrivewayName, DrivewayType)); if (p != null) { foreach (var n in p) { if (n.Driveway_ID > 0) { DrivewayID = n.Driveway_ID; } break; } } if (!btnCheck()) { return; // 去重复 } var FVNadd = new FVNInfo { FVN_Driveway_ID = DrivewayID, FVN_Value = int.Parse(this.txtFVN_Value.Text), FVN_Name = this.txtFVN_Name.Text.Trim(), FVN_State = this.cbxFVN_State.Text, FVN_Remark = this.txtFVN_Remark.Text.Trim(), FVN_Type = this.cbxFVN_Type.Text }; if (FVNDAL.InsertOneQCRecord(FVNadd)) { MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); string strContent1 = "地感名称为:" + this.txtFVN_Name.Text.Trim(); CommonalityEntity.WriteLogData("新增", "新增 " + strContent1 + " 的信息", common.NAME);//添加日志 } else { MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch { CommonalityEntity.WriteTextLog("地感管理 btnSave_Click()"); } finally { LogInfoLoad(""); } }