public ActionResult SaveTemplateDownload(TemplateDownloadInfo templateDownloadInfo) { TemplateDownloadBLL templateDownloadBLL = new TemplateDownloadBLL(); bool b = templateDownloadBLL.SaveTemplate(templateDownloadInfo); return(Json(new { success = b }, JsonRequestBehavior.AllowGet)); }
public TemplateDownload getTemplateDownloadList(TemplateDownloadInfo templateDownloadInfo) { TemplateDownload templateDownload = new TemplateDownload(); DataTable dt = templateDownloadDAL.getTemplateList(templateDownloadInfo); templateDownload.rows = dt.toList <TemplateDownloadInfo>(); templateDownload.total = templateDownloadDAL.getTemplateDownloadCount(templateDownloadInfo); return(templateDownload); }
public ActionResult SearchTemplate(TemplateDownloadInfo templateDownloadInfo) { templateDownloadInfo.page = int.Parse(Request["page"]); templateDownloadInfo.rows = int.Parse(Request["rows"]); TemplateDownload templateDownload = new TemplateDownload(); TemplateDownloadBLL templateDownloadBLL = new TemplateDownloadBLL(); templateDownload = templateDownloadBLL.getTemplateDownloadList(templateDownloadInfo); return(Json(templateDownload, JsonRequestBehavior.AllowGet)); }
public bool SaveTemplate(TemplateDownloadInfo templateDownloadInfo) { bool b = false; if (templateDownloadInfo.Id > 0) { b = templateDownloadDAL.UpdateTemplateDownload(templateDownloadInfo); } else { b = templateDownloadDAL.InputTemplateDownload(templateDownloadInfo); } return(b); }
public int getTemplateDownloadCount(TemplateDownloadInfo templateDownloadInfo) { StringBuilder sbSI = new StringBuilder(); sbSI.AppendFormat("select A.*,B.TemplateType as Type from templatedownload as A LEFT JOIN templatetype as B ON A.TypeId=B.Id Where 1=1 "); if (!string.IsNullOrEmpty(templateDownloadInfo.Title)) { sbSI.AppendFormat("AND A.TITLE LIKE '%{0}%'", templateDownloadInfo.Title); } if (templateDownloadInfo.TypeId != 0) { sbSI.AppendFormat("AND A.TypeId='{0}'", templateDownloadInfo.TypeId); } DataTable dtBusiness = DBHelper.SearchSql(sbSI.ToString()); return(dtBusiness.Rows.Count); }
public bool UpdateTemplateDownload(TemplateDownloadInfo templateDownloadInfo) { StringBuilder sbAddUser = new StringBuilder(); string GetSessionWithDsmId = string.Format(@"update templatedownload set Title='{0}',TemplateFile ='{1}',TypeId ='{2}', Content ='{3}',Picture='{4}',DownloadNum ='{5}',CreateDate ='{6}' where id='{7}'", templateDownloadInfo.Title, templateDownloadInfo.TemplateFile, templateDownloadInfo.TypeId, templateDownloadInfo.Content, templateDownloadInfo.Picture, templateDownloadInfo.DownloadNum, templateDownloadInfo.CreateDate, templateDownloadInfo.Id); int iResult = DBHelper.ExcuteNoQuerySql(GetSessionWithDsmId); if (iResult == 1) { return(true); } else { return(false); } }
public DataTable getTemplateList(TemplateDownloadInfo templateDownloadInfo) { StringBuilder sbSI = new StringBuilder(); sbSI.AppendFormat("select A.*,B.TemplateType as Type from templatedownload as A LEFT JOIN templatetype as B ON A.TypeId=B.Id Where 1=1 "); if (!string.IsNullOrEmpty(templateDownloadInfo.Title)) { sbSI.AppendFormat("AND A.TITLE LIKE '%{0}%'", templateDownloadInfo.Title); } if (templateDownloadInfo.TypeId != 0) { sbSI.AppendFormat("AND A.TypeId='{0}'", templateDownloadInfo.TypeId); } sbSI.Append(" ORDER BY CreateDate DESC"); sbSI.AppendFormat(" limit {0},{1};", (templateDownloadInfo.page - 1) * templateDownloadInfo.rows, templateDownloadInfo.rows); DataTable dtBusiness = DBHelper.SearchSql(sbSI.ToString()); return(dtBusiness); }
public bool InputTemplateDownload(TemplateDownloadInfo templateDownloadInfo) { StringBuilder sbAddUser = new StringBuilder(); string GetSessionWithDsmId = string.Format(@"INSERT INTO templatedownload (title,TemplateFile,content,picture,downloadNum,TypeId,CreateDate) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", templateDownloadInfo.Title, templateDownloadInfo.TemplateFile, templateDownloadInfo.Content, templateDownloadInfo.Picture, templateDownloadInfo.DownloadNum, templateDownloadInfo.TypeId, templateDownloadInfo.CreateDate); int iResult = DBHelper.ExcuteNoQuerySql(GetSessionWithDsmId); if (iResult == 1) { return(true); } else { return(false); } }