示例#1
0
        /// <summary>
        /// 根据ID 集合获取相应的服务信息
        /// </summary>
        public void GetServicesByIds(HttpContext context)
        {
            var serviceIds = context.Request.QueryString["ids"];

            if (!string.IsNullOrEmpty(serviceIds))
            {
                var serList = new ivt_service_dal().GetServiceList($" and id in({serviceIds})");
                if (serList != null && serList.Count > 0)
                {
                    List <ServiceDto> serDtoList = new List <ServiceDto>();
                    var accBll = new CompanyBLL();
                    var dDal   = new d_general_dal();
                    var dccDal = new d_cost_code_dal();
                    serList.ForEach(_ => {
                        var thisDto = new ServiceDto()
                        {
                            id             = _.id,
                            name           = _.name,
                            description    = _.description,
                            unit_cost      = (_.unit_cost ?? 0),
                            unit_price     = (_.unit_price ?? 0),
                            cost_code_id   = _.cost_code_id,
                            period_type_id = _.period_type_id,
                            vendor_id      = _.vendor_account_id,
                        };
                        if (_.vendor_account_id != null)
                        {
                            var thisVendor = accBll.GetCompany((long)_.vendor_account_id);
                            if (thisVendor != null)
                            {
                                thisDto.vendor_name = thisVendor.name;
                            }
                        }
                        if (_.period_type_id != null)
                        {
                            var thisType = dDal.FindNoDeleteById((long)_.period_type_id);
                            if (thisType != null)
                            {
                                thisDto.period_type_name = thisType.name;
                            }
                        }
                        var thisCode = dccDal.FindNoDeleteById(_.cost_code_id);
                        if (thisCode != null)
                        {
                            thisDto.cost_code_name = thisCode.name;
                        }
                        serDtoList.Add(thisDto);
                    });

                    context.Response.Write(new EMT.Tools.Serialize().SerializeJson(serDtoList));
                }
            }
        }
示例#2
0
        /// <summary>
        /// 根据ID 集合获取相应的服务 每月价格
        /// </summary>
        public void GetServicePriceByIds(HttpContext context)
        {
            decimal unit_price = 0;
            var     serviceIds = context.Request.QueryString["ids"];

            if (!string.IsNullOrEmpty(serviceIds))
            {
                var serList = new ivt_service_dal().GetServiceList($" and id in({serviceIds})");
                if (serList != null && serList.Count > 0)
                {
                    serList.ForEach(_ => {
                        switch (_.period_type_id)
                        {
                        case (int)DTO.DicEnum.QUOTE_ITEM_PERIOD_TYPE.ONE_TIME:
                        case (int)DTO.DicEnum.QUOTE_ITEM_PERIOD_TYPE.MONTH:
                            unit_price += (_.unit_price ?? 0);
                            break;

                        case (int)DTO.DicEnum.QUOTE_ITEM_PERIOD_TYPE.QUARTER:
                            unit_price += ((_.unit_price ?? 0) / 3);
                            break;

                        case (int)DTO.DicEnum.QUOTE_ITEM_PERIOD_TYPE.HALFYEAR:
                            unit_price += ((_.unit_price ?? 0) / 6);
                            break;

                        case (int)DTO.DicEnum.QUOTE_ITEM_PERIOD_TYPE.YEAR:
                            unit_price += ((_.unit_price ?? 0) / 12);
                            break;

                        default:
                            break;
                        }
                    });
                }
            }
            context.Response.Write(unit_price.ToString("#0.0000"));
        }