public ActionResult Edit_DB_Classify() { this.Response.ContentType = "text/plain"; string classify_num = this.Request.QueryString["Num"]; NModel.DB_Classify model = new NModel.DB_Classify(); BLL.DB_Classify dal = new BLL.DB_Classify(); String JsonStr = ""; bool isGet = Tool.NStr.PostForSetVal <NModel.DB_Classify>(ref model, ref JsonStr, ""); model.Classify_Num = classify_num; // 下面代码编写 if (isGet && model.Classify_AddTime != null && !string.IsNullOrEmpty(model.Classify_Name) && !string.IsNullOrEmpty(model.Classify_Num) && model.Classify_ID > 0 ) { //取默认值 model.Classify_EditTime = DateTime.Parse(DateTime.Now.ToString("s")); bool isEdit = dal.EditFree(model, string.Format(" 'Classify_ID={0}'", model.Classify_ID)) > 0 ? true : false; string msg = dal.ErrorMsg; if (!string.IsNullOrEmpty(msg)) { msg = "原因:" + msg; } if (isEdit) { this.Response.Write(Tool.NMsg.SetMsg("修改成功", "1")); this.Response.End(); } else { this.Response.Write(Tool.NMsg.SetMsg("修改失败" + msg, "0")); this.Response.End(); } dal.Close(); } else { this.Response.Write(Tool.NMsg.SetMsg("提交失败", "0")); this.Response.End(); } dal.Close(); return(View()); }
public ActionResult Del_All_DB_Classify() { string Num = this.Request.QueryString["Num"]; if (!string.IsNullOrEmpty(Num)) { BLL.DB_Classify bll = new BLL.DB_Classify(); long delNumber = bll.DelAllByNum(Num); if (delNumber > 0) { this.Response.Write(Tool.NMsg.SetMsg("删除成功", "1")); this.Response.End(); } else { this.Response.Write(Tool.NMsg.SetMsg("删除失败", "0")); this.Response.End(); } bll.Close(); } else { this.Response.Write(Tool.NMsg.SetMsg("删除失败Num==null", "0")); this.Response.End(); } return(View()); }
public ActionResult Data_DB_ClassifyByWhere() { string page = this.Request.QueryString["page"]; string rows = this.Request.QueryString["rows"]; string where = this.Request.QueryString["Num"]; /// string order = this.Request.Form["order"]; string order = " Classify_sortno asc, Classify_addtime desc "; bool IsNotEmpty = !string.IsNullOrEmpty(where); if (IsNotEmpty) { where = string.Format(" Classify_Num=''{0}'' ", where); } int _page = 0, _rows = 0; int.TryParse(page, out _page); int.TryParse(rows, out _rows); if (_page == 0) { _page = 1; } if (_rows == 0) { _rows = 220; } BLL.DB_Classify dal = new BLL.DB_Classify(); List <NModel.DB_Classify> inModel = new List <NModel.DB_Classify>(); inModel = dal.GetSortAndWherePagerList(_page, _rows, order, where); NModel.PageData <NModel.DB_Classify> outModel = BLL.Fun.SetDJsonData <NModel.DB_Classify>(inModel, DataApped_DB_Classify); // inModel[0].Count_Show dal.Close(); return(View(outModel)); }
public ActionResult Index() { //分类 BLL.DB_Classify bll_Classify = new BLL.DB_Classify(); //广告 BLL.DB_AD bll_ad = new BLL.DB_AD(); NModel.NewsPager model_pager = LoadConfig("/nlcq/index"); model_pager.IDictClassify = new Dictionary <string, IList <NModel.DB_Classify> >(); { IList <NModel.DB_Classify> modelClassifyList = null; modelClassifyList = bll_Classify.GetListByNumAndTop("1", 150); modelClassifyList = modelClassifyList != null ? modelClassifyList : new List <NModel.DB_Classify>(); model_pager.IDictClassify.Add("代码分类", modelClassifyList); } { IList <NModel.DB_Classify> modelClassifyList = null; modelClassifyList = bll_Classify.GetListByNumAndTop("2", 150); modelClassifyList = modelClassifyList != null ? modelClassifyList : new List <NModel.DB_Classify>(); model_pager.IDictClassify.Add("素材分类", modelClassifyList); } { model_pager.IDictListAd = new Dictionary <string, IList <NModel.DB_AD> >(); string sql_ad = string.Format(" ''01'' "); IList <NModel.DB_AD> model_ad_list = bll_ad.GetListByNumAndTop(sql_ad, 8); model_pager.IDictListAd.Add("首页广告一", model_ad_list != null ? model_ad_list : new List <NModel.DB_AD>()); } bll_ad.Close(); bll_Classify.Close(); return(View(model_pager)); }
public ActionResult Data_DB_Classify() { string[] keys = this.Request.Form.AllKeys; string page = this.Request.Form["page"]; string rows = this.Request.Form["rows"]; string where = this.Request.Form["where"]; string order = this.Request.Form["order"]; // where = Server.UrlDecode(where); //1=1 and file_name like '%va%' int _page = 0, _rows = 0; int.TryParse(page, out _page); int.TryParse(rows, out _rows); if (_page == 0) { _page = 1; } if (_rows == 0) { _rows = 20; } BLL.DB_Classify dal = new BLL.DB_Classify(); List <NModel.DB_Classify> inModel = new List <NModel.DB_Classify>(); inModel = dal.GetSortAndWherePagerList(_page, _rows, order, where); NModel.PageData <NModel.DB_Classify> outModel = BLL.Fun.SetDJsonData <NModel.DB_Classify>(inModel, DataApped_DB_Classify); // inModel[0].Count_Show dal.Close(); return(View(outModel)); }
public ActionResult Del_DB_Classify() { this.Response.ContentType = "text/plain"; string delList = this.Request.Form["delList[]"]; if (!string.IsNullOrEmpty(delList)) { string[] arrStr = delList.Split(','); int[] delIntArr = Tool.NTool.ArrayToAll <int, string>(arrStr); if (Tool.NTool.IsArrNULL <int>(delIntArr)) { BLL.DB_Classify dal = new BLL.DB_Classify(); bool isGO = true; long hasID = 0; for (int i = 0; i < delIntArr.Length; i++) { long isHas = dal.HasNextLevelByID(delIntArr[i]); if (isHas > 0) { isGO = false; hasID = delIntArr[i]; break; } } if (isGO) { long long_Result = dal.DelList(delIntArr); if (long_Result > 0) { this.Response.Write(Tool.NMsg.SetMsg(string.Format("删除成功!总共删除{0}条", long_Result), "1")); this.Response.End(); } else { this.Response.Write(Tool.NMsg.SetMsg("删除失败!", "0")); this.Response.End(); } } else { this.Response.Write(Tool.NMsg.SetMsg("删除失败!有下级菜单 请删除下级菜单 ID 为 " + hasID, "0")); this.Response.End(); } dal.Close(); } else { this.Response.Write(Tool.NMsg.SetMsg("提交失败/填写数据不完整!", "0")); this.Response.End(); } } else { this.Response.Write(Tool.NMsg.SetMsg("提交失败/填写数据不完整!", "0")); this.Response.End(); } return(View()); }
public ActionResult Add_DB_Classify() { byte bLevel = 0; this.Response.ContentType = "text/plain"; string level = "0"; //this.Request.Form["level"];//0顶级1下一级 string classify_num = this.Request.QueryString["Num"]; NModel.DB_Classify model = new NModel.DB_Classify(); BLL.DB_Classify dal = new BLL.DB_Classify(); dal.Open(); String JsonStr = ""; bool isGet = Tool.NStr.PostForSetVal <NModel.DB_Classify>(ref model, ref JsonStr, ""); model.Classify_Num = classify_num; if (model.Classify_X == null || model.Classify_X <= 0 && model.Classify_Y <= 0 && model.Classify_Z <= 0) { model.Classify_X = 1; model.Classify_Y = 1; model.Classify_Z = 1; } else { level = "1"; model.Classify_Z = model.Classify_Z - 1; } byte.TryParse(level, out bLevel); // 下面代码编写 if (isGet && model != null && !string.IsNullOrEmpty(model.Classify_Name) && !string.IsNullOrEmpty(model.Classify_Num) && model.Classify_X != null && model.Classify_X > 0 && model.Classify_Y > 0 && model.Classify_Z > 0 ) { string Xstr = (model.Classify_X + ""); long xOutLong = 0; long? zOutLong = 0; long yOutLong = 0; long? xLong = 0; DataTable dtMax = null; if (bLevel == 0) { if (model.Classify_Y == 1 && model.Classify_Z == 1) { dtMax = dal.GetFristLevelMaxXModel(); if (dtMax != null && dtMax.Rows.Count > 0) { long.TryParse(dtMax.Rows[0]["next_x"] + "", out xOutLong); model.Classify_X = xOutLong; } else { xOutLong = 1; yOutLong = 1; zOutLong = 1; } } else if (model.Classify_Z >= 2) { NModel.DB_Classify nadm = dal.GetMaxXANDZYModel(model.Classify_X, model.Classify_Z); model.Classify_Y = (long)(nadm.Classify_Y + 1); } } else if (bLevel == 1) { string xStr = (model.Classify_X + ""); xStr = xStr.Replace("-", ""); long eqStr = 0; if (model.Classify_Z >= 2) { long.TryParse(string.Format("{0}{1}", xStr, model.Classify_Y), out eqStr); } else { long.TryParse(xStr + "", out eqStr); } dtMax = dal.GetXMaxYModel(eqStr); if (dtMax != null && dtMax.Rows.Count > 0) { long.TryParse(dtMax.Rows[0]["next_y"] + "", out yOutLong); } else { yOutLong = 1; } xOutLong = eqStr; zOutLong = model.Classify_Z + 1; model.Classify_X = xOutLong; model.Classify_Y = yOutLong > 0 ? yOutLong : 1; model.Classify_Z = zOutLong; } else { this.Response.Write(Tool.NMsg.SetMsg("请选择加级", "0")); return(View()); } model.Classify_AddTime = DateTime.Parse(DateTime.Now.ToString("s")); ; model.Classify_EditTime = DateTime.Parse(DateTime.Now.ToString("s")); ; long isAdd = dal.AddFree(model); if (isAdd > 0) { this.Response.Write(Tool.NMsg.SetMsg("增加成功", "1")); } else { this.Response.Write(Tool.NMsg.SetMsg("增加失败", "0")); } dal.Close(); } else { this.Response.Write(Tool.NMsg.SetMsg("提交失败/填写数据不完整", "0")); this.Response.End(); } dal.Close(); return(View()); }
public ActionResult Item_db_classify() { BLL.DB_Classify dal = new BLL.DB_Classify(); string num = this.Request.QueryString["Num"]; string id = this.Request.QueryString["id"]; string pagenum = this.Request.Form["pagenum"]; string numPerPage = this.Request.Form["numPerPage"]; string dbClassifydate = this.Request.Form["dbClassifydate"]; string dbClassifyurl = this.Request.Form["dbClassifyurl"]; string search = this.Request.Form["search"]; string x = this.Request.QueryString["x"]; string y = this.Request.QueryString["y"]; string z = this.Request.QueryString["z"]; string _where = this.Request.QueryString["_where"]; string where = "", order = "Classify_sortno asc,Classify_addtime desc"; if (string.IsNullOrEmpty(numPerPage)) { numPerPage = "20"; } if (string.IsNullOrEmpty(pagenum)) { pagenum = "1"; } where += " 1=1 "; if (!string.IsNullOrEmpty(num)) { where += string.Format(" and Classify_Num={0}", num); } if (!string.IsNullOrEmpty(dbClassifydate)) { where += string.Format(" and ( CONVERT(varchar(100), Classify_addtime, 23)=''{0}'' )", dbClassifydate); } if (!string.IsNullOrEmpty(dbClassifyurl)) { where += string.Format(" and Classify_Name like ''%{0}%''", dbClassifyurl); } if (!string.IsNullOrEmpty(search)) { } else { if (!string.IsNullOrEmpty(y) && !string.IsNullOrEmpty(z)) { long _x = 0, _y = 0, _z = 0; long.TryParse(x, out _x); long.TryParse(y, out _y); long.TryParse(z, out _z); if (_x == 0 && _y == 0 && _z == 0) { _x = 1; _y = 1; _z = 1; } bool isThree = _z > 2; string xy = x + ""; if (isThree) { xy = string.Format("{0}{1}", _x, _y); } where += string.Format(" and Classify_x={0} and Classify_z={1} ", xy, (_z)); } else { where += string.Format(" and Classify_y={0} and Classify_z={1} ", 1, 1); } } if (!string.IsNullOrEmpty(_where)) { where = this.Server.UrlDecode(_where); } NModel.PageData <NModel.DB_Classify> PD = new NModel.PageData <NModel.DB_Classify>() { NumPerPage = numPerPage, PageNum = pagenum, TotalPage = dal.GetWhereListTotal(where), Where = where, OrderField = order }; dal.Close(); return(View(PD)); }