// public dynamic GetModel(int Id) { try { dynamic model = null; StringBuilder strSql = new StringBuilder(); strSql.Append(" select Id,FK_BidId,PrintNum,PrintName,Reason,PrintDate from T_BidPrintGrounds "); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = Id; using (dynamic read = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters)) { if (read.Read()) { model = new BidPrintGrounds(); model.Id = int.Parse(read["Id"].ToString()); model.FK_BidId = int.Parse(read["FK_BidId"].ToString()); model.PrintNum = int.Parse(read["PrintNum"].ToString()); model.PrintName = read["PrintName"].ToString(); model.Reason = read["Reason"].ToString(); model.PrintDate = DateTime.Parse(read["PrintDate"].ToString()); } read.Dispose(); } return(model); } catch { throw; } }
// private dynamic GetModels(HttpContext context) { dynamic model = new BidPrintGrounds(); model.FK_BidId = int.Parse(context.Request.Form["FK_BidId"].ToString()); model.PrintNum = (dal.SumCount(model.FK_BidId) + 1); model.PrintName = adminUser.AdminName; model.Reason = context.Request.Form["Reason"].ToString(); model.PrintDate = DateTime.Now; try { model.Id = int.Parse(context.Request.Form["Id"].ToString()); } catch { model.Id = 0; } return(model); }
// public bool Create(BidPrintGrounds model) { try { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_BidPrintGrounds("); strSql.Append("FK_BidId,PrintNum,PrintName,Reason,PrintDate)"); strSql.Append(" values ("); strSql.Append("@FK_BidId,@PrintNum,@PrintName,@Reason,@PrintDate)"); if (DbHelperSQL.ExecuteSql(strSql.ToString(), GetSqlParameter(model)) > 0) { return(true); } else { return(false); } } catch { throw; } }
// public bool Update(BidPrintGrounds model) { try { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_BidPrintGrounds set "); strSql.Append("FK_BidId=@FK_BidId,"); strSql.Append("PrintNum=@PrintNum,"); strSql.Append("PrintName=@PrintName,"); strSql.Append("Reason=@Reason,"); strSql.Append("PrintDate=@PrintDate"); strSql.Append(" where Id=@Id"); if (DbHelperSQL.ExecuteSql(strSql.ToString(), GetSqlParameter(model)) > 0) { return(true); } else { return(false); } } catch { throw; } }