Пример #1
0
        /// <summary>
        /// 删除操作
        /// </summary>
        /// <param name="id">删除ID</param>
        /// <returns></returns>
        private string DeleteData(string id)
        {
            //返回删除之后的信息
            string msg = string.Empty;
            //实例化业务层
            BIndividual bllBIndividual = new BIndividual();

            string[] workReportIds = { "" };
            //判断删除是批量还是单个删除
            if (id.Contains(','))
            {
                workReportIds = id.Split(',');
            }
            else
            {
                workReportIds[0] = id;
            }
            //删除操作
            #region 转换string[]为int[]
            int[] workReportIdsint = { 0 };
            for (int i = 0; i < workReportIds.Length; i++)
            {
                if (!string.IsNullOrEmpty(workReportIds[i]))
                {
                    workReportIdsint[i] = Utils.GetInt(workReportIds[i]);
                }
            }
            #endregion
            if (bllBIndividual.DelWorkReport(workReportIdsint))
            {
                msg = UtilsCommons.AjaxReturnJson("true", "删除成功");
            }
            else
            {
                msg = UtilsCommons.AjaxReturnJson("false", "删除失败");
            }
            //删除操作
            return(msg);
        }