示例#1
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();
		}
示例#2
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();
		}