public ActionResult Index() { TemplateDownloadBLL templateDownloadBLL = new TemplateDownloadBLL(); TemplateTypeList templateTypeList = new TemplateTypeList(); TemplateTypeInfo templateTypeInfo = new TemplateTypeInfo(); templateTypeList = templateDownloadBLL.getTemplateTypeData(); List <SelectListItem> select = new List <SelectListItem>(); select.Add(new SelectListItem { Text = "--", Value = "0" }); for (int i = 0; i < templateTypeList.rows.Count; i++) { select.Add(new SelectListItem { Text = templateTypeList.rows[i].TemplateType.ToString(), Value = templateTypeList.rows[i].Id.ToString() }); } ViewData["selTmpType"] = new SelectList(select, "Value", "Text", ""); return(View()); }
public ActionResult SaveTmpType(TemplateTypeInfo templateTypeInfo) { TemplateDownloadBLL templateDownloadBLL = new TemplateDownloadBLL(); bool b = templateDownloadBLL.SaveTmpType(templateTypeInfo); return(Json(new { success = b }, JsonRequestBehavior.AllowGet)); }
public TemplateTypeList getTemplateTypeList(TemplateTypeInfo templateTypeInfo) { TemplateTypeList templateTypeList = new TemplateTypeList(); DataTable dt = templateDownloadDAL.getTmpTypeList(templateTypeInfo); templateTypeList.rows = dt.toList <TemplateTypeInfo>(); templateTypeList.total = templateDownloadDAL.getTmpTypeCount(templateTypeInfo); return(templateTypeList); }
public ActionResult SearchTmpType(TemplateTypeInfo templateTypeInfo) { templateTypeInfo.page = int.Parse(Request["page"]); templateTypeInfo.rows = int.Parse(Request["rows"]); TemplateTypeList templateTypeList = new TemplateTypeList(); TemplateDownloadBLL templateDownloadBLL = new TemplateDownloadBLL(); templateTypeList = templateDownloadBLL.getTemplateTypeList(templateTypeInfo); return(Json(templateTypeList, JsonRequestBehavior.AllowGet)); }
public bool SaveTmpType(TemplateTypeInfo templateTypeInfo) { bool b = false; if (templateTypeInfo.Id > 0) { b = templateDownloadDAL.UpdateTemplateType(templateTypeInfo); } else { b = templateDownloadDAL.InputTemplateType(templateTypeInfo); } return(b); }
public int getTmpTypeCount(TemplateTypeInfo templateTypeInfo) { StringBuilder sbSI = new StringBuilder(); sbSI.AppendFormat("select * from templatetype Where 1=1 "); if (!string.IsNullOrEmpty(templateTypeInfo.TemplateType)) { sbSI.AppendFormat("AND TemplateType LIKE '%{0}%'", templateTypeInfo.TemplateType); } DataTable dtBusiness = DBHelper.SearchSql(sbSI.ToString()); return(dtBusiness.Rows.Count); }
public DataTable getTmpTypeList(TemplateTypeInfo templateTypeInfo) { StringBuilder sbSI = new StringBuilder(); sbSI.AppendFormat("select * from templatetype Where 1=1 "); if (!string.IsNullOrEmpty(templateTypeInfo.TemplateType)) { sbSI.AppendFormat("AND TemplateType LIKE '%{0}%'", templateTypeInfo.TemplateType); } sbSI.AppendFormat(" limit {0},{1};", (templateTypeInfo.page - 1) * templateTypeInfo.rows, templateTypeInfo.rows); DataTable dtBusiness = DBHelper.SearchSql(sbSI.ToString()); return(dtBusiness); }
public bool UpdateTemplateType(TemplateTypeInfo templateTypeInfo) { StringBuilder sbAddUser = new StringBuilder(); string GetSessionWithDsmId = string.Format(@"update templatetype set TemplateType='{0}' where id='{1}'", templateTypeInfo.TemplateType, templateTypeInfo.Id); int iResult = DBHelper.ExcuteNoQuerySql(GetSessionWithDsmId); if (iResult == 1) { return(true); } else { return(false); } }
public bool InputTemplateType(TemplateTypeInfo templateTypeInfo) { StringBuilder sbAddUser = new StringBuilder(); string GetSessionWithDsmId = string.Format(@"INSERT INTO templatetype (templatetype) VALUES('{0}')", templateTypeInfo.TemplateType); int iResult = DBHelper.ExcuteNoQuerySql(GetSessionWithDsmId); if (iResult == 1) { return(true); } else { return(false); } }