Exemple #1
0
        /// <summary>
        /// 删除客户
        /// </summary>
        public string Delete(int id, Model.manager manager)
        {
            Model.Customer model = GetModel(id);
            if (model == null)
            {
                return("客户不存在");
            }
            if (model.c_flag == 2)
            {
                return("已审批通过的客户不能删除");
            }
            //判断是否含有删除客户的权限
            if (model.c_owner != manager.user_name && model.c_ownerName != manager.real_name)
            {
                if (!new BLL.permission().checkHasPermission(manager, "0301"))
                {
                    //如果没有删除客户的权限,判断是不是本人的客户
                    return("没有客户管理权限0301,且不是客户所属人,不能删除客户信息");
                }
            }

            if (checkIsUse(id))
            {
                return("该客户已被使用,不能删除");
            }
            if (dal.Delete(id))
            {
                Model.business_log logmodel = new Model.business_log();
                logmodel.ol_title       = "删除客户";
                logmodel.ol_cid         = id;
                logmodel.ol_content     = "客户名称:" + model.c_name + "";
                logmodel.ol_operateDate = DateTime.Now;
                new business_log().Add(DTEnums.ActionEnum.Delete.ToString(), logmodel, manager.user_name, manager.real_name);
                return("");
            }
            return("删除失败");
        }