Ejemplo n.º 1
0
        /// <summary>
        /// 删除费用单信息
        /// </summary>
        /// <param name="id">费用单id</param>
        /// <returns>删除是否成功</returns>
        public Result Del(int id)
        {
            Result res = new Result()
            {
                Code    = RES.ERROR,
                Message = "删除失败"
            };
            CostApplyDAL apply = new CostApplyDAL();
            //获取该费用单的审批状态
            byte status = apply.QueryMain(new Dictionary <string, object>
            {
                { "id", id }
            }).First().status;

            //如果费用单不是未审批状态,则删除失败
            if (status != 0)
            {
                return(res);
            }
            List <cost_detail>   listDetail   = apply.QueryDetail(id);
            List <cost_approval> ListApproval = apply.QueryApproval(id);

            if (apply.Del(id) == ListApproval.Count + listDetail.Count + 1)
            {
                res.Code    = RES.OK;
                res.Message = "删除成功!";
            }
            return(res);
        }