/// <summary> /// 更新一条数据 /// </summary> public bool Update(FrontAxleResultMDL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update frontaxleresult set "); strSql.Append(" leftfrontcaliperbatchno = @leftfrontcaliperbatchno , "); strSql.Append(" rightfrontcaliperbatchno = @rightfrontcaliperbatchno , "); strSql.Append(" caliperboltbatchno = @caliperboltbatchno , "); strSql.Append(" lowerballpinbatchno = @lowerballpinbatchno , "); strSql.Append(" completed = @completed , "); strSql.Append(" createtime = @createtime , "); strSql.Append(" completetime = @completetime , "); strSql.Append(" repairstate = @repairstate , "); strSql.Append(" barcode = @barcode , "); strSql.Append(" productcode = @productcode , "); strSql.Append(" userid = @userid , "); strSql.Append(" stationid = @stationid , "); strSql.Append(" leftsteeringbatchno = @leftsteeringbatchno , "); strSql.Append(" rightsteeringbatchno = @rightsteeringbatchno , "); strSql.Append(" bearingbatchno = @bearingbatchno , "); strSql.Append(" frontbrakediscbatchno = @frontbrakediscbatchno "); strSql.Append(" where tid=@tid "); SQLiteParameter[] parameters = { new SQLiteParameter("@tid", model.tid), new SQLiteParameter("@leftfrontcaliperbatchno", model.leftfrontcaliperbatchno), new SQLiteParameter("@rightfrontcaliperbatchno", model.rightfrontcaliperbatchno), new SQLiteParameter("@caliperboltbatchno", model.caliperboltbatchno), new SQLiteParameter("@lowerballpinbatchno", model.lowerballpinbatchno), new SQLiteParameter("@completed", model.completed), new SQLiteParameter("@createtime", model.createtime), new SQLiteParameter("@completetime", model.completetime), new SQLiteParameter("@repairstate", model.repairstate), new SQLiteParameter("@barcode", model.barcode), new SQLiteParameter("@productcode", model.productcode), new SQLiteParameter("@userid", model.userid), new SQLiteParameter("@stationid", model.stationid), new SQLiteParameter("@leftsteeringbatchno", model.leftsteeringbatchno), new SQLiteParameter("@rightsteeringbatchno", model.rightsteeringbatchno), new SQLiteParameter("@bearingbatchno", model.bearingbatchno), new SQLiteParameter("@frontbrakediscbatchno", model.frontbrakediscbatchno) }; int rows = SQLiteHelper.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public FrontAxleResultMDL DataRowToModel(DataRow row) { FrontAxleResultMDL model = new FrontAxleResultMDL(); if (row != null) { if (row["tid"].ToString() != "") { model.tid = long.Parse(row["tid"].ToString()); } model.leftfrontcaliperbatchno = row["leftfrontcaliperbatchno"].ToString(); model.rightfrontcaliperbatchno = row["rightfrontcaliperbatchno"].ToString(); model.caliperboltbatchno = row["caliperboltbatchno"].ToString(); model.lowerballpinbatchno = row["lowerballpinbatchno"].ToString(); if (row["completed"].ToString() != "") { if ((row["completed"].ToString() == "1") || (row["completed"].ToString().ToLower() == "true")) { model.completed = true; } else { model.completed = false; } } if (row["createtime"].ToString() != "") { model.createtime = DateTime.Parse(row["createtime"].ToString()); } if (row["completetime"].ToString() != "") { model.completetime = DateTime.Parse(row["completetime"].ToString()); } if (row["repairstate"].ToString() != "") { model.repairstate = int.Parse(row["repairstate"].ToString()); } model.barcode = row["barcode"].ToString(); model.productcode = row["productcode"].ToString(); model.userid = row["userid"].ToString(); model.stationid = row["stationid"].ToString(); model.leftsteeringbatchno = row["leftsteeringbatchno"].ToString(); model.rightsteeringbatchno = row["rightsteeringbatchno"].ToString(); model.bearingbatchno = row["bearingbatchno"].ToString(); model.frontbrakediscbatchno = row["frontbrakediscbatchno"].ToString(); } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(FrontAxleResultMDL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into frontaxleresult("); strSql.Append("leftfrontcaliperbatchno,rightfrontcaliperbatchno,caliperboltbatchno,lowerballpinbatchno,completed,createtime,completetime,repairstate,barcode,productcode,userid,stationid,leftsteeringbatchno,rightsteeringbatchno,bearingbatchno,frontbrakediscbatchno"); strSql.Append(") values ("); strSql.Append("@leftfrontcaliperbatchno,@rightfrontcaliperbatchno,@caliperboltbatchno,@lowerballpinbatchno,@completed,@createtime,@completetime,@repairstate,@barcode,@productcode,@userid,@stationid,@leftsteeringbatchno,@rightsteeringbatchno,@bearingbatchno,@frontbrakediscbatchno"); strSql.Append(") "); SQLiteParameter[] parameters = { new SQLiteParameter("@leftfrontcaliperbatchno", model.leftfrontcaliperbatchno), new SQLiteParameter("@rightfrontcaliperbatchno", model.rightfrontcaliperbatchno), new SQLiteParameter("@caliperboltbatchno", model.caliperboltbatchno), new SQLiteParameter("@lowerballpinbatchno", model.lowerballpinbatchno), new SQLiteParameter("@completed", model.completed), new SQLiteParameter("@createtime", model.createtime), new SQLiteParameter("@completetime", model.completetime), new SQLiteParameter("@repairstate", model.repairstate), new SQLiteParameter("@barcode", model.barcode), new SQLiteParameter("@productcode", model.productcode), new SQLiteParameter("@userid", model.userid), new SQLiteParameter("@stationid", model.stationid), new SQLiteParameter("@leftsteeringbatchno", model.leftsteeringbatchno), new SQLiteParameter("@rightsteeringbatchno", model.rightsteeringbatchno), new SQLiteParameter("@bearingbatchno", model.bearingbatchno), new SQLiteParameter("@frontbrakediscbatchno", model.frontbrakediscbatchno) }; int rows = SQLiteHelper.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }