public ActionResult Delete()
        {
            var rm = new ReturnMessage();

            try
            {
                string paramData = Request.Form["paramData"];
                if (!string.IsNullOrWhiteSpace(paramData))
                {
                    string[] ids  = paramData.Split('*');
                    var      rIds = ids.Select(int.Parse).ToList();
                    if (_bll.Delete(rIds))
                    {
                        //OperateLogHelper.Delete(modelList);
                        rm.IsSuccess = true;
                        rm.Message   = "删除成功!";
                    }
                    else
                    {
                        rm.IsSuccess = false;
                        rm.Message   = "删除失败!";
                    }
                }
            }
            catch (Exception ex)
            {
                rm.IsSuccess = false;
                rm.Message   = ex.Message;
            }
            return(Json(rm, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public ActionResult DataDel()
        {
            var rm = new ReturnMessage();

            try
            {
                string paramData = Request.Form["paramData"];
                if (!string.IsNullOrWhiteSpace(paramData))
                {
                    var RidArr = paramData.Split('*').Select(int.Parse);
                    var ridArr = RidArr as IList <int> ?? RidArr.ToList();
                    var res    = _bll.Delete(ridArr);
                    //StringBuilder strSql = new StringBuilder(" delete from FunctionalAuthority where Rid in " + DBContext.DataDecision.AssemblyInCondition(ridArr.ToList()));
                    //lsSql.Add(strSql.ToString());
                    //List<FunctionalAuthority> F_modelList = BusinessContext.FunctionalAuthority.GetList(Query<FunctionalAuthority>.In(t => t.Rid, ridArr)).ToList();

                    var rids =
                        BusinessContext.tblGroupButton.GetList(Query <tblGroupButton> .In(t => t.Group_NameId, ridArr))
                        .Select(t => t.Rid)
                        .ToList();

                    res = res &&
                          BusinessContext.sys_role_right.Delete(Query <sys_role_right> .In(t => t.rf_Right_Code, rids));
                    //strSql = new StringBuilder("delete from dbo.sys_role_right where rf_right_code in (select Rid  from dbo.tblGroupButton where Group_NameId in " + DBContext.DataDecision.AssemblyInCondition(ridArr.ToList()) + ")");
                    //lsSql.Add(strSql.ToString());
                    //List<sys_role_right> S_modelList = BusinessContext.sys_role_right.GetModelList("rf_right_code in (select Rid  from dbo.tblGroupButton where Group_NameId in " + DBContext.DataDecision.AssemblyInCondition(ridArr.ToList()) + ")").ToList();


                    res = res && BusinessContext.tblGroupButton.Delete(rids);
                    //strSql = new StringBuilder("delete from dbo.tblGroupButton where Group_NameId in " + DBContext.DataDecision.AssemblyInCondition(ridArr.ToList()));
                    //lsSql.Add(strSql.ToString());
                    //List<tblGroupButton> G_modelList = BusinessContext.tblGroupButton.GetModelList("Group_NameId in " + DBContext.DataDecision.AssemblyInCondition(ridArr.ToList())).ToList();

                    if (res)
                    {
                        rm.IsSuccess = true;
                        rm.Message   = "删除成功!";
                    }
                    else
                    {
                        rm.IsSuccess = false;
                        rm.Message   = "删除失败!";
                    }
                }
            }

            catch (Exception ex)
            {
                rm.IsSuccess = false;
                rm.Message   = ex.Message;
            }
            return(Json(rm, JsonRequestBehavior.AllowGet));
        }