/// <summary> /// 增加一条数据 /// </summary> public int Add(FishEntity.QuoteEntity model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into t_quote("); strSql.Append("companyid,companycode,customerid, customercode, productid,quotedollars,quotedate,quotetime,quoteman,createman,createtime,modifyman,modifytime,isdelete,no,company,customer,weight,quantity,quotermb,rate)"); strSql.Append(" values ("); strSql.Append("@companyid,@companycode ,@customerid,@customercode,@productid,@quotedollars,@quotedate,@quotetime,@quoteman,@createman,@createtime,@modifyman,@modifytime,@isdelete,@no,@company,@customer,@weight,@quantity,@quotermb,@rate);"); strSql.Append("select LAST_INSERT_ID();"); MySqlParameter[] parameters = { new MySqlParameter("@companyid", MySqlDbType.Int32, 11), new MySqlParameter("@companycode", MySqlDbType.VarChar, 45), new MySqlParameter("@customerid", MySqlDbType.Int32, 11), new MySqlParameter("@customercode", MySqlDbType.VarChar, 45), new MySqlParameter("@productid", MySqlDbType.Int32, 11), new MySqlParameter("@quotedollars", MySqlDbType.Decimal, 12), new MySqlParameter("@quotedate", MySqlDbType.Date), new MySqlParameter("@quotetime", MySqlDbType.Time), new MySqlParameter("@quoteman", MySqlDbType.VarChar, 45), new MySqlParameter("@createman", MySqlDbType.VarChar, 45), new MySqlParameter("@createtime", MySqlDbType.Timestamp), new MySqlParameter("@modifyman", MySqlDbType.VarChar, 45), new MySqlParameter("@modifytime", MySqlDbType.Timestamp), new MySqlParameter("@isdelete", MySqlDbType.Int16, 2), new MySqlParameter("@no", MySqlDbType.Int16, 2), new MySqlParameter("@company", MySqlDbType.VarChar, 225), new MySqlParameter("@customer", MySqlDbType.VarChar, 225), new MySqlParameter("@weight", MySqlDbType.Decimal, 12), new MySqlParameter("@quantity", MySqlDbType.Int32, 6), new MySqlParameter("@quotermb", MySqlDbType.Decimal, 12), new MySqlParameter("@rate", MySqlDbType.Decimal, 12) }; parameters[0].Value = model.companyid; parameters[1].Value = model.companycode; parameters[2].Value = model.customerid; parameters[3].Value = model.customercode; parameters[4].Value = model.productid; parameters[5].Value = model.quotedollars; parameters[6].Value = model.quotedate.Value.ToString("yyyy-MM-dd"); parameters[7].Value = new TimeSpan(model.quotetime.Value.Hour, model.quotetime.Value.Minute, model.quotetime.Value.Second);// model.quotetime.Value.ToString("HH:mm:ss"); parameters[8].Value = model.quoteman; parameters[9].Value = model.createman; parameters[10].Value = model.createtime; parameters[11].Value = model.modifyman; parameters[12].Value = model.modifytime; parameters[13].Value = model.isdelete; parameters[14].Value = model.no; parameters[15].Value = model.company; parameters[16].Value = model.customer; parameters[17].Value = model.weight; parameters[18].Value = model.quantity; parameters[19].Value = model.quotermb; parameters[20].Value = model.rate; int id = MySqlHelper.ExecuteSqlReturnId(strSql.ToString(), parameters); return(id); }
/// <summary> /// 得到一个对象实体 /// </summary> public FishEntity.QuoteEntity GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,companyid,companycode,customerid,customercode,productid,quotedollars,quotedate,quotetime,quoteman,createman,createtime,modifyman,modifytime,isdelete, no ,company,customer,weight,quantity,quotermb,rate from t_quote "); strSql.Append(" where id=@id"); MySqlParameter[] parameters = { new MySqlParameter("@id", MySqlDbType.Int32) }; parameters[0].Value = id; FishEntity.QuoteEntity model = new FishEntity.QuoteEntity(); DataSet ds = MySqlHelper.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(FishEntity.QuoteEntity model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(FishEntity.QuoteEntity model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(FishEntity.QuoteEntity model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update t_quote set "); strSql.Append("companyid=@companyid,"); strSql.Append("customerid=@customerid,"); strSql.Append("productid=@productid,"); strSql.Append("quotedollars=@quotedollars,"); strSql.Append("quotedate=@quotedate,"); strSql.Append("quotetime=@quotetime,"); strSql.Append("quoteman=@quoteman,"); strSql.Append("createman=@createman,"); strSql.Append("modifyman=@modifyman,"); strSql.Append("isdelete=@isdelete,"); strSql.Append("companycode=@companycode,"); strSql.Append("customercode=@customercode,"); strSql.Append("company=@company,"); strSql.Append("customer=@customer,"); strSql.Append("weight=@weight,"); strSql.Append("quantity=@quantity,"); strSql.Append("quotermb=@quotermb,"); strSql.Append("rate=@rate"); strSql.Append(" where id=@id"); MySqlParameter[] parameters = { new MySqlParameter("@companyid", MySqlDbType.Int32, 11), new MySqlParameter("@customerid", MySqlDbType.Int32, 11), new MySqlParameter("@productid", MySqlDbType.Int32, 11), new MySqlParameter("@quotedollars", MySqlDbType.Decimal, 12), new MySqlParameter("@quotedate", MySqlDbType.Date), new MySqlParameter("@quotetime", MySqlDbType.Time), new MySqlParameter("@quoteman", MySqlDbType.VarChar, 45), new MySqlParameter("@createman", MySqlDbType.VarChar, 45), new MySqlParameter("@modifyman", MySqlDbType.VarChar, 45), new MySqlParameter("@isdelete", MySqlDbType.Int16, 2), new MySqlParameter("@companycode", MySqlDbType.VarChar, 45), new MySqlParameter("@customercode", MySqlDbType.VarChar, 45), new MySqlParameter("@no", MySqlDbType.Int16, 2), new MySqlParameter("@company", MySqlDbType.VarChar, 225), new MySqlParameter("@customer", MySqlDbType.VarChar, 225), new MySqlParameter("@weight", MySqlDbType.Decimal, 12), new MySqlParameter("@quantity", MySqlDbType.Int32, 6), new MySqlParameter("@quotermb", MySqlDbType.Decimal, 12), new MySqlParameter("@rate", MySqlDbType.Decimal, 12), new MySqlParameter("@id", MySqlDbType.Int32, 11) }; parameters[0].Value = model.companyid; parameters[1].Value = model.customerid; parameters[2].Value = model.productid; parameters[3].Value = model.quotedollars; parameters[4].Value = model.quotedate.Value.ToString("yyyy-MM-dd"); parameters[5].Value = new TimeSpan(model.quotetime.Value.Hour, model.quotetime.Value.Minute, model.quotetime.Value.Second); parameters[6].Value = model.quoteman; parameters[7].Value = model.createman; parameters[8].Value = model.modifyman; parameters[9].Value = model.isdelete; parameters[10].Value = model.companycode; parameters[11].Value = model.customercode; parameters[12].Value = model.no; parameters[13].Value = model.company; parameters[14].Value = model.customer; parameters[15].Value = model.weight; parameters[16].Value = model.quantity; parameters[17].Value = model.quotermb; parameters[18].Value = model.rate; parameters[19].Value = model.id; int rows = MySqlHelper.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public FishEntity.QuoteEntity DataRowToModel(DataRow row) { FishEntity.QuoteEntity model = new FishEntity.QuoteEntity(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["companyid"] != null && row["companyid"].ToString() != "") { model.companyid = int.Parse(row["companyid"].ToString()); } if (row["customerid"] != null && row["customerid"].ToString() != "") { model.customerid = int.Parse(row["customerid"].ToString()); } if (row["productid"] != null && row["productid"].ToString() != "") { model.productid = int.Parse(row["productid"].ToString()); } if (row["quotedollars"] != null && row["quotedollars"].ToString() != "") { model.quotedollars = decimal.Parse(row["quotedollars"].ToString()); } if (row["quotedate"] != null && row["quotedate"].ToString() != "") { model.quotedate = DateTime.Parse(row["quotedate"].ToString()); } if (row["quotetime"] != null && row["quotetime"].ToString() != "") { model.quotetime = DateTime.Parse(row["quotetime"].ToString()); } if (row["quoteman"] != null) { model.quoteman = row["quoteman"].ToString(); } if (row["createman"] != null) { model.createman = row["createman"].ToString(); } if (row["createtime"] != null && row["createtime"].ToString() != "") { model.createtime = DateTime.Parse(row["createtime"].ToString()); } if (row["modifyman"] != null) { model.modifyman = row["modifyman"].ToString(); } if (row["modifytime"] != null && row["modifytime"].ToString() != "") { model.modifytime = DateTime.Parse(row["modifytime"].ToString()); } if (row["isdelete"] != null && row["isdelete"].ToString() != "") { model.isdelete = int.Parse(row["isdelete"].ToString()); } if (row["companycode"] != null) { model.companycode = row["companycode"].ToString(); } if (row["customercode"] != null) { model.customercode = row["customercode"].ToString(); } if (row["company"] != null) { model.company = row["company"].ToString(); } if (row["customer"] != null) { model.customer = row["customer"].ToString(); } if (row["no"] != null && row["no"].ToString() != "") { model.no = int.Parse(row["no"].ToString()); } if (row["weight"] != null && row["weight"].ToString() != "") { model.weight = decimal.Parse(row["weight"].ToString()); } if (row["quantity"] != null && row["quantity"].ToString() != "") { model.quantity = int.Parse(row["quantity"].ToString()); } if (row["quotermb"] != null && row["quotermb"].ToString() != "") { model.quotermb = decimal.Parse(row["quotermb"].ToString()); } if (row["rate"] != null && row["rate"].ToString() != "") { model.rate = decimal.Parse(row["rate"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public FishEntity.QuoteEntity DataRowToModel(DataRow row) { FishEntity.QuoteEntity model = new FishEntity.QuoteEntity(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["companyid"] != null && row["companyid"].ToString() != "") { model.companyid = int.Parse(row["companyid"].ToString()); } if (row["customerid"] != null && row["customerid"].ToString() != "") { model.customerid = int.Parse(row["customerid"].ToString()); } if (row["productid"] != null && row["productid"].ToString() != "") { model.productid = int.Parse(row["productid"].ToString()); } if (row["quotedollars"] != null && row["quotedollars"].ToString() != "") { model.quotedollars = decimal.Parse(row["quotedollars"].ToString()); } if (row["quotedate"] != null && row["quotedate"].ToString() != "") { model.quotedate = DateTime.Parse(row["quotedate"].ToString()); } if (row["quotetime"] != null && row["quotetime"].ToString() != "") { model.quotetime = DateTime.Parse(row["quotetime"].ToString()); } if (row["quoteman"] != null) { model.quoteman = row["quoteman"].ToString(); } if (row["createman"] != null) { model.createman = row["createman"].ToString(); } if (row["createtime"] != null && row["createtime"].ToString() != "") { model.createtime = DateTime.Parse(row["createtime"].ToString()); } if (row["modifyman"] != null) { model.modifyman = row["modifyman"].ToString(); } if (row["modifytime"] != null && row["modifytime"].ToString() != "") { model.modifytime = DateTime.Parse(row["modifytime"].ToString()); } if (row["isdelete"] != null && row["isdelete"].ToString() != "") { model.isdelete = int.Parse(row["isdelete"].ToString()); } if (row["companycode"] != null) { model.companycode = row["companycode"].ToString(); } if (row["customercode"] != null) { model.customercode = row["customercode"].ToString(); } if (row["company"] != null) { model.company = row["company"].ToString(); } if (row["customer"] != null) { model.customer = row["customer"].ToString(); } if (row["no"] != null && row["no"].ToString() != "") { model.no = int.Parse(row["no"].ToString()); } if (row["weight"] != null && row["weight"].ToString() != "") { model.weight = decimal.Parse(row["weight"].ToString()); } if (row["quantity"] != null && row["quantity"].ToString() != "") { model.quantity = int.Parse(row["quantity"].ToString()); } if (row["quotermb"] != null && row["quotermb"].ToString() != "") { model.quotermb = decimal.Parse(row["quotermb"].ToString()); } if (row["rate"] != null && row["rate"].ToString() != "") { model.rate = decimal.Parse(row["rate"].ToString()); } //,Counter_offer_companyid,Counter_offer_companycode,Counter_offer_customerid,Counter_offer_customercode,Counter_offer_date,Counter_offer_time,Counter_offer_Company,Counter_offer_Contacts,Counter_offer_weight,Counter_offer_Number,Counter_offer_HuiLv,Counter_offer_Dollar,Counter_offer_RMB if (row["Counter_offer_companyid"] != null && row["Counter_offer_companyid"].ToString() != "") { model.Counter_offer_companyid = int.Parse(row["Counter_offer_companyid"].ToString()); } if (row["Counter_offer_companycode"] != null) { model.Counter_offer_companycode = row["Counter_offer_companycode"].ToString(); } if (row["Counter_offer_customerid"] != null && row["Counter_offer_customerid"].ToString() != "") { model.Counter_offer_customerid = int.Parse(row["Counter_offer_customerid"].ToString()); } if (row["Counter_offer_customercode"] != null) { model.Counter_offer_customercode = row["Counter_offer_customercode"].ToString(); } if (row["Counter_offer_date"] != null && row["Counter_offer_date"].ToString() != "") { model.Counter_offer_date = DateTime.Parse(row["Counter_offer_date"].ToString()); } if (row["Counter_offer_time"] != null && row["Counter_offer_time"].ToString() != "") { model.Counter_offer_time = DateTime.Parse(row["Counter_offer_time"].ToString()); } if (row["Counter_offer_Company"] != null) { model.Counter_offer_Company = row["Counter_offer_Company"].ToString(); } if (row["Counter_offer_Contacts"] != null) { model.Counter_offer_Contacts = row["Counter_offer_Contacts"].ToString(); } if (row["Counter_offer_weight"] != null && row["Counter_offer_weight"].ToString() != "") { model.Counter_offer_weight = decimal.Parse(row["Counter_offer_weight"].ToString()); } if (row["Counter_offer_Number"] != null) { model.Counter_offer_Number = row["Counter_offer_Number"].ToString(); } if (row["Counter_offer_HuiLv"] != null && row["Counter_offer_HuiLv"].ToString() != "") { model.Counter_offer_HuiLv = decimal.Parse(row["Counter_offer_HuiLv"].ToString()); } if (row["Counter_offer_Dollar"] != null && row["Counter_offer_Dollar"].ToString() != "") { model.Counter_offer_Dollar = decimal.Parse(row["Counter_offer_Dollar"].ToString()); } if (row["Counter_offer_RMB"] != null && row["Counter_offer_RMB"].ToString() != "") { model.Counter_offer_RMB = decimal.Parse(row["Counter_offer_RMB"].ToString()); } } return(model); }