// public dynamic GetModel(int Id) { try { dynamic model = null; StringBuilder strSql = new StringBuilder(); strSql.Append(" select Id,FK_BidId,ScanName,ScanUrl,Editor,CreateDate from T_BidClinchScan "); 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 BidClinchScan(); model.Id = int.Parse(read["Id"].ToString()); model.FK_BidId = int.Parse(read["FK_BidId"].ToString()); model.ScanName = read["ScanName"].ToString(); model.ScanUrl = read["ScanUrl"].ToString(); model.Editor = read["Editor"].ToString(); model.CreateDate = DateTime.Parse(read["CreateDate"].ToString()); } read.Dispose(); } return(model); } catch { throw; } }
private dynamic GetModels(HttpContext context) { dynamic model = new BidClinchScan(); try { model.Id = int.Parse(context.Request.Form["Id"].ToString()); } catch { } model.FK_BidId = int.Parse(context.Request.Form["FK_BidId"].ToString()); model.ScanName = context.Request.Form["ScanName"].ToString(); string ImgName = new UpLoadImgPlug().UploadImg("~/Super/Scan/biscan/" + model.FK_BidId + "/", 0); if (!string.IsNullOrEmpty(ImgName)) { string imgUrl = HttpContext.Current.Server.MapPath("~/Super/Scan/biscan/" + model.FK_BidId + "/" + ImgName); string pdfUrl = "~/Super/Scan/biscan/" + model.FK_BidId + "/"; new ProducePdfPlug().CreatePdf(imgUrl, pdfUrl, ImgName.Split('.')[0] + ".pdf"); model.ScanUrl = ImgName.Split('.')[0] + ".pdf"; } else { model.ScanUrl = context.Request.Form["ScanUrl"].ToString(); } model.Editor = adminUser.AdminName; model.CreateDate = DateTime.Now; return(model); }
// public bool Create(BidClinchScan model) { try { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_BidClinchScan("); strSql.Append("FK_BidId,ScanName,ScanUrl,Editor,CreateDate)"); strSql.Append(" values ("); strSql.Append("@FK_BidId,@ScanName,@ScanUrl,@Editor,@CreateDate)"); if (DbHelperSQL.ExecuteSql(strSql.ToString(), GetSqlParameter(model)) > 0) { return(true); } else { return(false); } } catch { throw; } }
// public bool Update(BidClinchScan model) { try { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_BidClinchScan set "); strSql.Append("FK_BidId=@FK_BidId,"); strSql.Append("ScanName=@ScanName,"); strSql.Append("ScanUrl=@ScanUrl,"); strSql.Append("Editor=@Editor,"); strSql.Append("CreateDate=@CreateDate"); strSql.Append(" where Id=@Id"); if (DbHelperSQL.ExecuteSql(strSql.ToString(), GetSqlParameter(model)) > 0) { return(true); } else { return(false); } } catch { throw; } }