예제 #1
0
        public ActionResult Item_admin_role()
        {
            BLL.Admin_Role dal = new BLL.Admin_Role();

            string pagenum    = this.Request.Form["pagenum"];
            string numPerPage = this.Request.Form["numPerPage"];

            if (string.IsNullOrEmpty(numPerPage))
            {
                numPerPage = "20";
            }
            if (string.IsNullOrEmpty(pagenum))
            {
                pagenum = "1";
            }

            NModel.PageData <NModel.Admin_Role> PD = new NModel.PageData <NModel.Admin_Role>()
            {
                NumPerPage = numPerPage,
                PageNum    = pagenum,
                TotalPage  = dal.GetListTotal()
            };
            dal.Close();
            return(View(PD));
        }
예제 #2
0
		public ActionResult Del_Admin_Role()
		{
			// 'choices[]': ["Jon", "Susan"] }

			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.Admin_Role dal = new BLL.Admin_Role();
					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();
					}
					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();
		}
예제 #3
0
		public ActionResult Del_All_Admin_Role()
		{
			BLL.Admin_Role bll = new BLL.Admin_Role();
			long delNumber = bll.DelAll();

			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();
			return View();
		}
예제 #4
0
		public ActionResult Edit_Admin_Role()
		{
			this.Response.ContentType = "text/plain";

			NModel.Admin_Role model = new NModel.Admin_Role();
			BLL.Admin_Role dal = new BLL.Admin_Role();

			String JsonStr = "";

			bool isGet = Tool.NStr.PostForSetVal<NModel.Admin_Role>(ref model, ref JsonStr, "");

			if (isGet &&
			   !string.IsNullOrEmpty(model.Role_Name) &&
			   !string.IsNullOrEmpty(model.Role_Menu) && !string.IsNullOrEmpty(model.Role_SortNo + "") &&
			   !string.IsNullOrEmpty(model.Role_Status + "") &&
				model.Role_AddTime != null &&
				model.Role_ID > 0

			   )
			{
				bool isEdit = dal.Edit(model) > 0 ? true : false;
				string msg = dal.ErrorMsg;

				if (isEdit)
				{
					this.Response.Write(Tool.NMsg.SetMsg("修改成功", "1"));
					this.Response.End();
				}
				else
				{
					this.Response.Write(Tool.NMsg.SetMsg("修改失败", "0"));
					this.Response.End();
				}
			}
			else
			{
				this.Response.Write(Tool.NMsg.SetMsg("提交失败/填写数据不完整", "0"));
				this.Response.End();
			}
			dal.Close();
			return View();
		}
예제 #5
0
		public ActionResult Add_Admin_Role()
		{
			this.Response.ContentType = "text/plain";

			NModel.Admin_Role model = new NModel.Admin_Role();
			BLL.Admin_Role dal = new BLL.Admin_Role();

			String JsonStr = "";

			bool isGet = Tool.NStr.PostForSetVal<NModel.Admin_Role>(ref model, ref JsonStr, "");
			if (isGet &&
				!string.IsNullOrEmpty(model.Role_Name) &&
				!string.IsNullOrEmpty(model.Role_Menu) && !string.IsNullOrEmpty(model.Role_SortNo + "") &&
				!string.IsNullOrEmpty(model.Role_Status + "")
				)
			{
				model.Role_AddTime = DateTime.Parse(DateTime.Now.ToString("s"));
				model.Role_EditTime = DateTime.Parse(DateTime.Now.ToString("s"));
				;
				bool isAdd = dal.Add(model) > 0 ? true : false;
				if (isAdd)
				{
					this.Response.Write(Tool.NMsg.SetMsg("增加成功", "1"));
				}
				else
				{
					this.Response.Write(Tool.NMsg.SetMsg("增加失败", "0"));
				}
			}
			else
			{
				this.Response.Write(Tool.NMsg.SetMsg("提交失败/填写数据不完整", "0"));
				this.Response.End();
			}

			dal.Close();

			return View();
		}
예제 #6
0
        public ActionResult Data_Admin_Role()
        {
            // this.Response.ContentType = "text/plain";
            // this.Response.ContentType = "text/plain";
            string page = this.Request.QueryString["page"];
            string rows = this.Request.QueryString["rows"];
            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.Admin_Role dal = new BLL.Admin_Role();
            // long TatalPage = dal.GetListTotal();

            string[] keys = this.Request.Form.AllKeys;

            List <NModel.Admin_Role> inModel = dal.GetPagerList(_page, _rows);

            StringBuilder sbStr = new StringBuilder();

            if (Tool.NTool.IsLtNULL <NModel.Admin_Role>(inModel))
            {
                Dictionary <string, string> dict = new Dictionary <string, string>();

                int lastdo = 0;
                foreach (NModel.Admin_Role outmodel in inModel)
                {
                    dict.Clear();

                    dict.Add("role_id", "" + outmodel.Role_ID);
                    dict.Add("role_menu", ("" + outmodel.Role_Menu).Trim());
                    dict.Add("role_name", "" + outmodel.Role_Name);

                    dict.Add("role_sortno", "" + outmodel.Role_SortNo);
                    dict.Add("role_status", "" + outmodel.Role_Status);

                    dict.Add("role_status_show", "" + Tool.NStr.SetStatusMsg(outmodel.Role_Status, "启用", "禁用"));

                    dict.Add("role_edittime", "" + outmodel.Role_EditTime);
                    dict.Add("role_addtime", "" + outmodel.Role_AddTime);

                    //cw_group_key

                    //Tool.N_STR.SetStatusMsg(outmodel.Level_Status, "启用", "禁用")
                    lastdo++;
                    if (lastdo >= inModel.Count)
                    {
                        sbStr.Append(Tool.NTool.ObjectToJsonStr(dict));
                    }
                    else
                    {
                        sbStr.Append(Tool.NTool.ObjectToJsonStr(dict) + ",");
                    }
                }
            }

            NModel.PageData <NModel.Admin_Role> outModel = new NModel.PageData <NModel.Admin_Role>();
            outModel.TotalPage = 1;
            // outModel.OutData = inModel;

            outModel.OutStr = sbStr.ToString();

            dal.Close();

            return(View(outModel));
        }