Esempio n. 1
0
        /// <summary>
        /// 服务编辑
        /// </summary>
        /// <param name="ser"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public bool EditService(ivt_service ser, long userId)
        {
            ivt_service_dal dal     = new ivt_service_dal();
            ivt_service     service = dal.FindById(ser.id);
            ivt_service     serOld  = dal.FindById(ser.id);

            service.update_time         = Tools.Date.DateHelper.ToUniversalTimeStamp();
            service.update_user_id      = userId;
            service.name                = ser.name;
            service.description         = ser.description;
            service.invoice_description = ser.invoice_description;
            service.sla_id              = ser.sla_id;
            service.vendor_account_id   = ser.vendor_account_id;
            service.period_type_id      = ser.period_type_id;
            service.unit_cost           = ser.unit_cost;
            service.unit_price          = ser.unit_price;
            service.cost_code_id        = ser.cost_code_id;
            service.is_active           = ser.is_active;

            var desc = OperLogBLL.CompareValue <ivt_service>(serOld, service);

            if (!string.IsNullOrEmpty(desc))
            {
                dal.Update(service);
                OperLogBLL.OperLogUpdate(desc, service.id, userId, DTO.DicEnum.OPER_LOG_OBJ_CATE.IVT_SERVICE, "编辑服务");
            }
            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// 激活停用服务
        /// </summary>
        public bool ActiveService(long serviceId, bool isActive, long userId, ref string faileReason)
        {
            var isDal   = new ivt_service_dal();
            var thisSer = isDal.FindNoDeleteById(serviceId);

            if (thisSer == null)
            {
                faileReason = "未查询到该服务信息";
                return(false);
            }
            if (thisSer.is_active == (sbyte)(isActive ? 1 : 0))
            {
                faileReason = $"该服务已经是{(isActive?"激活":"停用")}状态!";
                return(false);
            }
            thisSer.is_active      = (sbyte)(isActive ? 1 : 0);
            thisSer.update_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            thisSer.update_user_id = userId;
            var oldSer = isDal.FindNoDeleteById(serviceId);

            isDal.Update(thisSer);
            OperLogBLL.OperLogUpdate <ivt_service>(thisSer, oldSer, thisSer.id, userId, DTO.DicEnum.OPER_LOG_OBJ_CATE.IVT_SERVICE, "编辑服务");
            return(true);
        }