コード例 #1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase Delete()
        {
            fgMgr = new FgroupMgr(mySqlConnectionString);
            string json = string.Empty;

            try
            {
                if (!string.IsNullOrEmpty(Request.Form["rowID"]))
                {
                    string rowIDs = Request.Form["rowID"];
                    if (rowIDs.IndexOf("|") != -1)
                    {
                        foreach (string id in rowIDs.Split('|'))
                        {
                            if (!string.IsNullOrEmpty(id))
                            {
                                fg.rowid = Int32.Parse(id);
                                fgMgr.Delete(fg);
                            }
                        }
                        json = "{success:true,msg:\"删除成功\"}";
                    }
                    else
                    {
                        json = "{success:true,msg:\"删除失败\"}";
                    }
                }
                else
                {
                    json = "{success:true,msg:\"删除失败\"}";
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:true,msg:\"删除失败\"}";
            }

            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();

            return this.Response;
        }