Ejemplo n.º 1
0
        public JsonResult Delete()
        {
            string Operator = "";

            if (Session["username"].ToString() != null)
            {
                Operator = Session["username"].ToString();
            }                                                                       //Log日志要记录的用户名
            string             computername = Request.Form["computername"].Trim().ToString();
            string             domain       = Request.Form["domain"].Trim().ToString();
            Computers          ad_computer  = HttpContext.Application["ad_computer"] as Computers;
            List <ComputerDTO> col          = ad_computer.SearchAllComputersDTO(computername, domain, (int)SearchPattern.Equals);
            ComputerDTO        cd           = col.ElementAt(0);
            string             m;

            if (ad_computer.DeleteComputerDTO(cd))
            {
                m = "Delete success";
                LogHelper.WriteLog(typeof(ComputerManagementController), Operator, "Delete%a%Computer%named%" + computername, true);
            }
            else
            {
                m = "Delete failed";
                LogHelper.WriteLog(typeof(ComputerManagementController), Operator, "Delete%a%Computer%named%" + computername, false);
            }
            return(Json(new JsonData(m)));
        }