public static DanhMuc Update(Int32?id, Int32?p_id, String p_ten, String p_alias, Int32?thutu, String ten, String alias, String keywords, String description, Int32?tongsotin, Int32?tongsotinmoi, Boolean?active) { DanhMuc Item = new DanhMuc(); SqlParameter[] obj = new SqlParameter[12]; if (id != null) { obj[0] = new SqlParameter("DM_ID", id); } else { obj[0] = new SqlParameter("DM_ID", DBNull.Value); } if (p_id != null) { obj[1] = new SqlParameter("DM_P_ID", p_id); } else { obj[1] = new SqlParameter("DM_P_ID", DBNull.Value); } if (p_ten != null) { obj[2] = new SqlParameter("DM_P_Ten", p_ten); } else { obj[2] = new SqlParameter("DM_P_Ten", DBNull.Value); } if (p_alias != null) { obj[3] = new SqlParameter("DM_P_Alias", p_alias); } else { obj[3] = new SqlParameter("DM_P_Alias", DBNull.Value); } if (thutu != null) { obj[4] = new SqlParameter("DM_ThuTu", thutu); } else { obj[4] = new SqlParameter("DM_ThuTu", DBNull.Value); } if (ten != null) { obj[5] = new SqlParameter("DM_Ten", ten); } else { obj[5] = new SqlParameter("DM_Ten", DBNull.Value); } if (alias != null) { obj[6] = new SqlParameter("DM_Alias", alias); } else { obj[6] = new SqlParameter("DM_Alias", DBNull.Value); } if (keywords != null) { obj[7] = new SqlParameter("DM_Keywords", keywords); } else { obj[7] = new SqlParameter("DM_Keywords", DBNull.Value); } if (description != null) { obj[8] = new SqlParameter("DM_Description", description); } else { obj[8] = new SqlParameter("DM_Description", DBNull.Value); } if (tongsotin != null) { obj[9] = new SqlParameter("DM_TongSoTin", tongsotin); } else { obj[9] = new SqlParameter("DM_TongSoTin", DBNull.Value); } if (tongsotinmoi != null) { obj[10] = new SqlParameter("DM_TongSoTinMoi", tongsotinmoi); } else { obj[10] = new SqlParameter("DM_TongSoTinMoi", DBNull.Value); } if (active != null) { obj[11] = new SqlParameter("DM_Active", active); } else { obj[11] = new SqlParameter("DM_Active", DBNull.Value); } using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssDanhMuc_Update_UpdateNormal_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
protected override void Render(HtmlTextWriter writer) { StringBuilder sb = new StringBuilder(); ClientScriptManager cs = this.Page.ClientScript; #region Tham số string _ID = Request["ID"]; string _Ten = Request["Ten"]; string _PID = Request["PID"]; string _Alias = Request["Alias"]; string _ThuTu = Request["ThuTu"]; string _Keywords = Request["Keywords"]; string _Description = Request["Description"]; docbao.entitites.DanhMuc ItemSave; #endregion switch (subAct) { case "get": #region lấy dữ liệu cho grid if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "BAO_ID"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "asc"; Pager<docbao.entitites.DanhMuc> PagerGet = docbao.entitites.DanhMucDal.pagerNormal("", false, jgrsidx + " " + jgrsord); List<jgridRow> ListRow = new List<jgridRow>(); foreach (docbao.entitites.DanhMuc dm in PagerGet.List) { ListRow.Add(new jgridRow(dm.ID.ToString(), new string[] { dm.ID.ToString() , dm.P_Ten , dm.Ten , dm.Alias ,dm.ThuTu.ToString() ,dm.Keywords ,dm.Description ,dm.TongSoTin.ToString() })); } jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGet.TotalPages.ToString(), PagerGet.Total.ToString(), ListRow); sb.Append(JavaScriptConvert.SerializeObject(grid)); break; #endregion case "del": #region xóa if (!string.IsNullOrEmpty(_ID)) { docbao.entitites.DanhMucDal.DeleteById(Convert.ToInt32(_ID)); } break; #endregion case "edit": #region chỉnh sửa if (!string.IsNullOrEmpty(_ID)) { sb.Append("(" + JavaScriptConvert.SerializeObject(docbao.entitites.DanhMucDal.SelectById(Convert.ToInt32(_ID))) + ")"); } break; #endregion case "save": #region lưu ItemSave = new docbao.entitites.DanhMuc(); if (!string.IsNullOrEmpty(_ID)) { ItemSave = docbao.entitites.DanhMucDal.SelectById(Convert.ToInt32(_ID)); } else { ItemSave = new docbao.entitites.DanhMuc(); } ItemSave.Ten = _Ten; ItemSave.P_ID = Convert.ToInt32(_PID); ItemSave.Alias = _Alias; ItemSave.Keywords = _Keywords; ItemSave.Description = _Description; ItemSave.ThuTu = Convert.ToInt32(_ThuTu); if (!string.IsNullOrEmpty(_ID)) { ItemSave = docbao.entitites.DanhMucDal.Update(ItemSave); } else { ItemSave = docbao.entitites.DanhMucDal.Insert(ItemSave); } sb.Append("1"); break; #endregion case "getautoComplete": #region Lấy danh sách danh mục sb.Append(JavaScriptConvert.SerializeObject(getTree(docbao.entitites.DanhMucDal.SelectAll()))); break; #endregion case "getautoCompletePid": #region Lấy danh sách danh mục sb.Append(JavaScriptConvert.SerializeObject(docbao.entitites.DanhMucDal.SelectPid())); break; #endregion case "scpt": #region Nạp js sb.AppendFormat(@"{0}" , cs.GetWebResourceUrl(typeof(Class1), "plugin.rss.phanLoai.JScript1.js")); break; #endregion default: #region nạp FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId); sb.Append(@"<div class=""mdl-head""> <span class=""mdl-head-searchPnl ui-state-default ui-corner-all""> <a href=""javascript:;"" class=""mdl-head-clearSearch""></a> <input type=""text"" class=""mdl-head-txt mdl-head-search mdl-head-search-phanLoaiMdl"" /> </span> <a class=""mdl-head-btn mdl-head-add"" id=""phanLoaiMdl-addBtn"" href=""javascript:phanLoaiFn.add();"">Thêm</a> <a class=""mdl-head-btn mdl-head-edit"" id=""phanLoaiMdl-editBtn"" href=""javascript:phanLoaiFn.edit();"">Sửa</a> <a class=""mdl-head-btn mdl-head-del"" id=""phanLoaiMdl-delBtn"" href=""javascript:phanLoaiFn.del();"">Xóa</a> </div> <table id=""phanLoaiMdl-List"" class=""mdl-list""></table> <div id=""phanLoaiMdl-Pager""></div>"); sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>" , cs.GetWebResourceUrl(typeof(Class1), "plugin.rss.phanLoai.JScript1.js") , "{phanLoaiFn.loadgrid();}"); sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn)); break; #endregion } writer.Write(sb.ToString()); base.Render(writer); }