public static bool CheckExists(ZuTuo entity) { string sql = string.Empty; sql = "select * from zutuo where sn='" + entity.Sn + "'"; DataTable dt = SqliteDbFactory.GetSqliteDbOperator().SelectFromSql(sql); return dt != null && dt.Rows.Count == 1; }
private ZuTuo ComputeData() { ZuTuo zutuo = new ZuTuo(); zutuo.Tph = this.txt_TrayNo.Text.Trim(); zutuo.Xxjh = this.txt_XiaXiangJi.Text.Trim(); zutuo.Sn = this.txt_SN.Text.Trim(); zutuo.Scaner = Program.UserID; zutuo.date = System.DateTime.Now; return zutuo; }
/* create table zutuo(id integer primary key autoincrement ,tph varchar(20),sn varchar(20),xxjh varchar(20), scaner varchar(30),scantime datetime); */ public static void Save(ZuTuo entity) { string sql = string.Empty; sql = "insert into zutuo(tph,sn,xxjh,scaner,scantime) values('" + entity.Tph + "','" + entity.Sn + "','" + entity.Xxjh + "','" + entity.Scaner + "','" + entity.date.ToString("s") +"')"; SqliteDbFactory.GetSqliteDbOperator().ExecuteNonQuery(sql); }
private void RemoveData() { ZuTuo entity = this.ComputeData(); if (!ZuTuoManager.CheckExists(entity)) { MessageBox.Show("产品尚未扫描,不能撤消!"); return; } ZuTuoManager.Delete(entity); }
private ZuTuo ComputeData() { ZuTuo zutuo = new ZuTuo(); zutuo.Tph = this.txt_TrayNo.Text.Trim(); zutuo.Xxjh = this.txt_XiaXiangJi.Text.Trim(); zutuo.Sn = this.txt_SN.Text.Trim(); zutuo.Scaner = Program.UserID; zutuo.date = System.DateTime.Now; return(zutuo); }
private void SaveData() { ZuTuo entity = this.ComputeData(); if (ZuTuoManager.CheckExists(entity)) { MessageBox.Show("您已经扫描过该产品!"); } else { ZuTuoManager.Save(entity); } }
public static void Delete(ZuTuo entity) { string sql = string.Empty; sql = "delete from zutuo where sn='" + entity.Sn + "'"; SqliteDbFactory.GetSqliteDbOperator().ExecuteNonQuery(sql); }