public fwMenu Insert(fwMenu obj) { var ID = DataUtilities.Insert(@"insert into fwMenu([Title], [ParentID], [Url], [Icon], [Order], [Actived],[SubAction]) values(@Title, @ParentID, @Url, @Icon, @Order, @Actived, @SubAction)", CommandType.Text, "@Title", obj.Title, "@ParentID", obj.ParentID, "@Url", obj.Url, "@Icon", obj.Icon, "@Order", obj.Order, "@Actived", obj.Actived, "@SubAction", obj.SubAction); obj.ID = ID; return obj; }
public ActionResult AddRoleToMenu(int groupID, string listID) { var g = new fwMenu() { ID = groupID }; var lst = listID.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); foreach (var item in g.fwRole.Select(m => m.ID).ToList()) { if (!lst.Contains(item.ToString())) g.RemoveRole(item); } foreach (var item in lst) { g.AddRole(int.Parse(item)); } return RedirectToAction("ListMenu"); }
public ActionResult EditMenu(fwMenu model) { if (model.ID == 0) new fwMenuDAL().Insert(model); else new fwMenuDAL().Update(model); return RedirectToAction("ListMenu"); }
public fwMenu Update(fwMenu obj) { var ID = DataUtilities.ExcuteNonQuery(@"update fwMenu set [Title] = @Title, [ParentID]=@ParentID, [Url]=@Url, [Icon]=@Icon, [Order]=@Order, [Actived]=@Actived, SubAction=@SubAction where ID=@ID", CommandType.Text, "@Title", obj.Title, "@ParentID", obj.ParentID, "@Url", obj.Url, "@Icon", obj.Icon, "@Order", obj.Order, "@Actived", obj.Actived, "@SubAction", obj.SubAction, "@ID", obj.ID); return obj; }
private fwMenu CreateObj(DataRow row) { var obj = new fwMenu(); obj.ID = (int)row["ID"]; obj.Title = (string)row["Title"]; obj.ParentID = GetInt(row["ParentID"]); obj.Url = GetString(row["Url"]); obj.Icon = GetString(row["Icon"]); obj.Order = GetInt(row["Order"]); obj.Actived = GetBool(row["Actived"]); obj.SubAction = GetString(row["SubAction"]); return obj; }