/// <summary> /// 增加一条数据 /// </summary> public bool Add(AuxiliaryFasiaResultMDL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into AuxiliaryFasiaResult("); strSql.Append("barcode,productcode,userid,stationid,linecode,completed,createtime,completetime,repairstate"); strSql.Append(") values ("); strSql.Append("@barcode,@productcode,@userid,@stationid,@linecode,@completed,@createtime,@completetime,@repairstate"); strSql.Append(") "); SQLiteParameter[] parameters = { 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("@linecode", model.linecode) }; int rows = SQLiteHelper.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(AuxiliaryFasiaResultMDL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update AuxiliaryFasiaResult set "); strSql.Append(" barcode = @barcode , "); strSql.Append(" productcode = @productcode , "); strSql.Append(" userid = @userid , "); strSql.Append(" stationid = @stationid , "); strSql.Append(" linecode = @linecode , "); strSql.Append(" completed = @completed , "); strSql.Append(" createtime = @createtime , "); strSql.Append(" completetime = @completetime , "); strSql.Append(" repairstate = @repairstate "); strSql.Append(" where tid=@tid "); SQLiteParameter[] parameters = { new SQLiteParameter("@tid", model.tid), new SQLiteParameter("@linecode", model.linecode), 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) }; int rows = SQLiteHelper.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public AuxiliaryFasiaResultMDL DataRowToModel(DataRow row) { AuxiliaryFasiaResultMDL model = new AuxiliaryFasiaResultMDL(); if (row != null) { if (row["tid"].ToString() != "") { model.tid = long.Parse(row["tid"].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.linecode = row["linecode"].ToString(); } return(model); }