Пример #1
0
        private IList <BudgetReportData> GetCostChartDataByMonthDemssion(BaseParam baseParam)
        {
            var costsQueryable = _context.Costs.Where(item => item.Year == baseParam.Year.Value && item.Month != null);

            if (baseParam.CompanyId.HasValue)
            {
                costsQueryable = costsQueryable.Where(item => item.CompanyId == baseParam.CompanyId.Value);
            }
            var lst = costsQueryable.GroupBy(item => item.Month).Select(item => new {
                Month                   = item.Key,
                Salary                  = item.Sum(x => x.Salary),
                WorkersWelfare          = item.Sum(x => x.WorkersWelfare),
                ControllableCost        = item.Sum(x => x.ControllableCost),
                OtherControllableCost   = item.Sum(x => x.OtherControllableCost),
                OtherUnControllableCost = item.Sum(x => x.OtherUnControllableCost)
            }).ToList();
            var budgetReportDatas = GetCharDataInfoOfMonth();

            foreach (var budgetReportData in budgetReportDatas)
            {
                var cost = lst.FirstOrDefault(item => item.Month == budgetReportData.Month);
                if (cost == null)
                {
                    continue;
                }
                budgetReportData.Salary                  = cost.Salary;
                budgetReportData.WorkersWelfare          = cost.WorkersWelfare;
                budgetReportData.ControllableCost        = cost.ControllableCost;
                budgetReportData.OtherControllableCost   = cost.OtherControllableCost;
                budgetReportData.OtherUnControllableCost = cost.OtherUnControllableCost;
            }
            return(budgetReportDatas);
        }
Пример #2
0
        public IQueryable <NewInfo> LoagPageData(BaseParam queryParam)
        {
            var temp = DbSession.NewInfoDal.GetEntity(u => u.DelFlag == true);

            if (!string.IsNullOrEmpty(queryParam.Key))
            {
                switch (queryParam.ItemId)
                {
                case 1: temp = temp.Where(u => u.Title.Contains(queryParam.Key)).AsQueryable(); break;

                case 2: temp = temp.Where(u => u.Author.Contains(queryParam.Key)).AsQueryable(); break;

                case 4: temp = temp.Where(u => u.Msg.Contains(queryParam.Key)).AsQueryable(); break;

                case 3: bool ddf = "党内即时新闻".Contains(queryParam.Key); var ff = ddf ? (short)1: (short)2; temp = temp.Where(u => u.Type == ff).AsQueryable(); break;

                case 5: bool dd = "正常".Contains(queryParam.Key); short b = dd ? (short)1 : (short)0; temp = temp.Where(u => u.Status == b).AsQueryable(); break;

                default: temp = temp.Where(u => u.Title.Contains(queryParam.Key)).AsQueryable(); break;
                }
            }

            queryParam.Total = temp.Count();

            return(temp.OrderBy(u => u.ID).Skip(queryParam.PageSize * (queryParam.PageIndex - 1)).Take(queryParam.PageSize).AsQueryable());
        }
Пример #3
0
        //======================================================================================================

        public static float ComputeBaseWeapon(WeaponDropSettings res, BaseParam param, int level, int point, ColorInfo color)
        {
            float first  = param.baseVal * (1.0f + param.levelMult * (float)level / (float)res.maxLevel);
            float second = (1.0f + param.pointMult * (float)point / (float)res.damageOdPtMax);

            return((first + second) * color.factor * Rand.Float(param.randMin, param.randMax));
        }
Пример #4
0
        public void RemoveParam(BaseParam baseParam)
        {
            //  根据key移除
            BaseParam bp;

            DicParam.TryRemove(baseParam.GetKey(), out bp);
        }
Пример #5
0
        public IQueryable <PaityMember> LoagPageData(BaseParam queryParam)
        {
            var temp = DbSession.PaityMemberDal.GetEntity(u => u.DelFlag == true);

            if (!string.IsNullOrEmpty(queryParam.Key))
            {
                switch (queryParam.ItemId)
                {
                case 1: temp = temp.Where(u => u.Name.Contains(queryParam.Key)).AsQueryable(); break;

                case 2: temp = temp.Where(u => u.Sex.Contains(queryParam.Key)).AsQueryable(); break;

                case 3: temp = temp.Where(u => u.IDCard.Contains(queryParam.Key)).AsQueryable(); break;

                case 4: temp = temp.Where(u => u.Telphone.Contains(queryParam.Key)).AsQueryable(); break;

                case 5: bool dd = "正常".Contains(queryParam.Key); short b = dd ? (short)1 : (short)0; temp = temp.Where(u => u.Status == b).AsQueryable(); break;

                default: temp = temp.Where(u => u.Name.Contains(queryParam.Key)).AsQueryable(); break;
                }
            }

            queryParam.Total = temp.Count();

            return(temp.OrderBy(u => u.ID).Skip(queryParam.PageSize * (queryParam.PageIndex - 1)).Take(queryParam.PageSize).AsQueryable());
        }
Пример #6
0
        public Task <HttpResponseMessage> Get(string data)
        {
            try
            {
                if (!string.IsNullOrEmpty(data))
                {
                    BaseParam param  = CommonFunction.DeserializeObject <BaseParam>(data);
                    Token     oToken = null;
                    if (tokenRep.ValidateToken(param.TokenID, ref oToken))
                    {
                        HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);

                        IBaseReportRepository rep = this.GetRep(param);

                        byte[] xlsInBytes = rep.ExportExcel(param);

                        result.Content = new ByteArrayContent(xlsInBytes);
                        result.Content.Headers.ContentType                 = new MediaTypeHeaderValue("application/octet-stream");
                        result.Content.Headers.ContentDisposition          = new ContentDispositionHeaderValue("attachment");
                        result.Content.Headers.ContentDisposition.FileName = $"{Guid.NewGuid()}.xls";
                        result.Content.Headers.ContentLength               = xlsInBytes.Length;
                        return(Task.FromResult(result));
                    }
                    else
                    {
                        return(Task.FromResult(new HttpResponseMessage(HttpStatusCode.Unauthorized)));
                    }
                }
            }
            catch (Exception ex)
            {
                CommonFunction.CommonLogError(ex);
            }
            return(Task.FromResult(new HttpResponseMessage(HttpStatusCode.InternalServerError)));
        }
Пример #7
0
        public static List <BaseParam> GetBlockSettingsInfo(string BlockType)
        {
            List <BaseParam> result = new List <BaseParam>();

            BaseParam Action = new BaseParam()
            {
                BlockType   = BlockType,
                listParam   = false,
                name        = "Action",
                paramSource = "",
                required    = true
            };

            Action.conditionOperators.Add("", "Default");
            Action.paramTemplates.Add(Guid.NewGuid(), "Subscribe");
            Action.paramTemplates.Add(Guid.NewGuid(), "Unsubscribe");
            Action.paramTemplates.Add(Guid.NewGuid(), "UnsubscribeAll");

            BaseParam ClubId = new BaseParam()
            {
                BlockType   = BlockType,
                listParam   = false,
                name        = "ClubId",
                paramSource = "clubs2.clubs.clubs",
                required    = false
            };

            ClubId.conditionOperators.Add("", "Default");
            ClubId.GetParamTemplates();

            result.Add(Action);
            result.Add(ClubId);

            return(result);
        }
Пример #8
0
        /// <summary>
        /// Lấy về rep tương ứng
        /// </summary>
        /// <param name="data">Dữ liều</param>
        /// <returns>Lấy về Rep</returns>
        /// Create by: dvthang:10.03.2018
        private IBaseReportRepository GetRep(BaseParam data)
        {
            IBaseReportRepository rep = null;

            switch (data.ReportID)
            {
                //case MT.Library.Enummation.ReportID.ChamCong:
                //    rep = (LabordayRepository)this.unitOfWork.GetRepByName("Laborday");
                //    break;
                //case MT.Library.Enummation.ReportID.ChamCongTC:
                //    rep = (LabordayRepository)this.unitOfWork.GetRepByName("Laborday");
                //    break;
                //case MT.Library.Enummation.ReportID.LuongCoBan:
                //    rep = (SalaryExportRepository)this.unitOfWork.GetRepByName("SalaryExport");
                //    break;
                //case MT.Library.Enummation.ReportID.HeSoTienCong:
                //    rep = (WageCoefficientExportRepository)this.unitOfWork.GetRepByName("WageCoefficientExport");
                //    break;
                //case MT.Library.Enummation.ReportID.ThueKhoanChuyenMon:
                //    rep = (ContractedProfessionalExportRepository)this.unitOfWork.GetRepByName("ContractedProfessionalExport");
                //    break;
                //case MT.Library.Enummation.ReportID.ThueKhoanChuyenMonExcel:
                //    rep = (ContractedProfessionalExportExcelRepository)this.unitOfWork.GetRepByName("ContractedProfessionalExportExcel");
                //    break;
                //case MT.Library.Enummation.ReportID.BaoCaoSoNgayConDeChamCong:
                //    rep = (DaysLeftExportExcelRepository)this.unitOfWork.GetRepByName("DaysLeftExportExcel");
                //break;
            }
            return(rep);
        }
Пример #9
0
        public IQueryable <TopicInfo> LoagPageData(BaseParam queryParam)
        {
            var temp = DbSession.TopicInfoDal.GetEntity(u => u.DelFlag == true);

            if (!string.IsNullOrEmpty(queryParam.Key))
            {
                switch (queryParam.ItemId)
                {
                case 1: temp = temp.Where(u => u.Title.Contains(queryParam.Key)).AsQueryable(); break;

                case 2: temp = temp.Where(u => u.Content.Contains(queryParam.Key)).AsQueryable(); break;

                case 3: var ff = StringToShort(queryParam.Key); temp = temp.Where(u => u.Type == ff).AsQueryable(); break;

                case 5: temp = temp.Where(u => u.UserInfo.UserName.Contains(queryParam.Key)).AsQueryable(); break;

                case 6: bool dd = "正常".Contains(queryParam.Key); short b = dd ? (short)1 : (short)0; temp = temp.Where(u => u.Status == b).AsQueryable(); break;

                default: temp = temp.Where(u => u.Title.Contains(queryParam.Key)).AsQueryable(); break;
                }
            }

            queryParam.Total = temp.Count();

            return(temp.OrderBy(u => u.ID).Skip(queryParam.PageSize * (queryParam.PageIndex - 1)).Take(queryParam.PageSize).AsQueryable());
        }
Пример #10
0
        /// <summary>
        ///     Get the maximum amount of <see cref="BaseParam" /> that can be melded to the current item.
        /// </summary>
        /// <param name="baseParam"><see cref="BaseParam" /> for which to get the amount.</param>
        /// <param name="onHq">A value indicating whether bonuses for a hiqh-quality item should be taken into account.</param>
        /// <returns>The maximum amount of <c>baseParam</c> that can be melded to the current item.</returns>
        public int GetMateriaMeldCap(BaseParam baseParam, bool onHq)
        {
            int max     = GetMaximumParamValue(baseParam);
            int present = GetParameterValue(baseParam, onHq);

            return(Math.Max(0, max - present));
        }
Пример #11
0
        public IQueryable <ActionInfo> LoagPageData(BaseParam queryParam)
        {
            var temp = DbSession.ActionInfoDal.GetEntity(u => u.DelFlag == true);

            if (!string.IsNullOrEmpty(queryParam.Key))
            {
                switch (queryParam.ItemId)
                {
                case 1: temp = temp.Where(u => u.ActionName.Contains(queryParam.Key)).AsQueryable(); break;

                case 2: temp = temp.Where(u => u.Url.Contains(queryParam.Key)).AsQueryable(); break;

                case 3: temp = temp.Where(u => u.HttpMethd.Contains(queryParam.Key)).AsQueryable(); break;

                case 4: bool ddf = "是".Contains(queryParam.Key); var ff = ddf ? true : false; temp = temp.Where(u => u.IsMenu == ff).AsQueryable(); break;

                case 5: bool dd = "正常".Contains(queryParam.Key); short b = dd ? (short)1 : (short)0; temp = temp.Where(u => u.Status == b).AsQueryable(); break;

                default: temp = temp.Where(u => u.ActionName.Contains(queryParam.Key)).AsQueryable(); break;
                }
            }

            queryParam.Total = temp.Count();

            return(temp.OrderBy(u => u.ID).Skip(queryParam.PageSize * (queryParam.PageIndex - 1)).Take(queryParam.PageSize).AsQueryable());
        }
Пример #12
0
        /*
         * public static float ComputeHP(float techFactor, float baseHP, float baseHPFactor, int level, int points, float pointValue, float pointsFactor) {
         *
         *
         *  //float first  = techFactor * baseHP * Mathf.Pow(baseHPFactor, level - 1);
         *  //float second = points * pointValue * Mathf.Pow(pointsFactor, level - 1);
         *  //return (first + second);
         *
         *
         *  float first = techFactor * baseHP * baseHPFactor*((float)level / 12.0f + 1);
         *  float second = points * pointValue * pointsFactor * ((float)level / 12.0f + 1);
         *  return (first + second);
         * }*/

        public static float ComputeBase(ModuleSettingsRes res, BaseParam param, int level, int point, ColorInfo color)
        {
            float first  = param.baseVal * (1.0f + param.levelMult * (float)level / (float)res.maxLevel);
            float second = (1.0f + param.pointMult * (float)point / (float)res.hpSpeedCargoPtMax);

            return((first + second) * color.factor * Rand.Float(param.randMin, param.randMax));
        }
Пример #13
0
        /// <summary>
        ///     Retrieve the <see cref="BaseParam" />, <see cref="Value" /> and <see cref="Tier" /> from the <see cref="Materia" />
        ///     to which the current item is assigned.
        /// </summary>
        private void Build()
        {
            if (_IsBuilt)
            {
                return;
            }

            bool found = false;
            IXivSheet <Materia> materiaSheet = Sheet.Collection.GetSheet <Materia>();

            foreach (Materia materia in materiaSheet)
            {
                Materia.ItemValue entry = materia.Items.FirstOrDefault(e => e.Item == this);
                if (entry == null)
                {
                    continue;
                }

                _BaseParam = materia.BaseParam;
                _Value     = entry.Value;
                _Tier      = entry.Tier;
                found      = true;
                break;
            }

            if (!found)
            {
                _Tier      = -1;
                _Value     = 0;
                _BaseParam = Sheet.Collection.GetSheet <BaseParam>()[0];
            }

            _IsBuilt = true;
        }
Пример #14
0
        private IList <BudgetReportData> GetCostChartDataByYearAndQuarterDemssion(BaseParam baseParam)
        {
            var costQueryable = _context.Costs.Where(item => item.Month >= 1 + 3 * (baseParam.Quarter.Value - 1) && item.Month <= baseParam.Quarter.Value * 3);

            if (baseParam.CompanyId.HasValue)
            {
                costQueryable = costQueryable.Where(item => item.CompanyId == baseParam.CompanyId.Value);
            }
            var lst = costQueryable.GroupBy(item => new { item.Year }).Select(g => new {
                g.Key.Year,
                Salary                  = g.Sum(x => x.Salary),
                WorkersWelfare          = g.Sum(x => x.WorkersWelfare),
                ControllableCost        = g.Sum(x => x.ControllableCost),
                OtherControllableCost   = g.Sum(x => x.OtherControllableCost),
                OtherUnControllableCost = g.Sum(x => x.OtherUnControllableCost),
            }).ToList();
            var budgetReportDatas = GetCharDataInfoOfYearAndQuarter(baseParam.Quarter.GetValueOrDefault());

            foreach (var budgetReportData in budgetReportDatas)
            {
                var cost = lst.FirstOrDefault(item => item.Year == budgetReportData.Year);
                if (cost == null)
                {
                    continue;
                }
                budgetReportData.Salary                  = cost.Salary;
                budgetReportData.WorkersWelfare          = cost.WorkersWelfare;
                budgetReportData.ControllableCost        = cost.ControllableCost;
                budgetReportData.OtherControllableCost   = cost.OtherControllableCost;
                budgetReportData.OtherUnControllableCost = cost.OtherUnControllableCost;
            }
            return(budgetReportDatas);
        }
Пример #15
0
        private IList <BudgetReportData> GetElectricChartDataByYearAndMonthDemssion(BaseParam baseParam)
        {
            var electricQueryable = _context.Electrics.Where(item => item.Month == baseParam.Month);

            if (baseParam.CompanyId.HasValue)
            {
                electricQueryable = electricQueryable.Where(item => item.CompanyId == baseParam.CompanyId.Value);
            }
            var lst = electricQueryable.GroupBy(item => new { item.Year, item.Month }).Select(item => new {
                item.Key.Year,
                item.Key.Month,
                Electricity     = item.Sum(x => x.Electricity),
                BuyElectricity  = item.Sum(x => x.BuyElectricity),
                BuyAvgPrice     = item.Sum(x => x.BuyAvgPrice),
                SellElectricity = item.Sum(x => x.SellElectricity),
                SellAvgPrice    = item.Sum(x => x.SellAvgPrice)
            }).ToList();
            var budgetReportDatas = GetCharDataInfoOfYearAndMonth(baseParam.Month.GetValueOrDefault());

            foreach (var budgetReportData in budgetReportDatas)
            {
                var electric = lst.FirstOrDefault(item => item.Year == budgetReportData.Year && item.Month == budgetReportData.Month);
                if (electric == null)
                {
                    continue;
                }
                budgetReportData.Electricity     = electric.Electricity;
                budgetReportData.BuyElectricity  = electric.BuyElectricity;
                budgetReportData.BuyAvgPrice     = electric.BuyAvgPrice;
                budgetReportData.SellElectricity = electric.SellElectricity;
                budgetReportData.SellAvgPrice    = electric.SellAvgPrice;
            }
            return(budgetReportDatas);
        }
Пример #16
0
 public IList <BudgetReportData> GetBudgetReportData(BaseParam baseParam)
 {
     if (baseParam.Month.HasValue || baseParam.Quarter.HasValue)
     {
         return(GetBudgetReportDataByMonth(baseParam));
     }
     return(GetBudgetReportDataByYear(baseParam));
 }
Пример #17
0
        protected override void Initialize(RequestContext requestContext)
        {
            base.Initialize(requestContext);

            param             = new BaseParam();
            param._IP         = WebHelper.GetIP();
            param._IsPost     = WebHelper.IsPost();
            param._MerchantNo = requestContext.HttpContext.Request.Headers.Get("MerchantNo");
        }
Пример #18
0
        public IList <BudgetReportData> GetChartDatas(BaseParam baseParam)
        {
            //看某个12个月的数据
            if (baseParam.Year.HasValue && !baseParam.Month.HasValue && !baseParam.Quarter.HasValue)
            {
                if (ElectricTargets.Contains(baseParam.TargetKey))
                {
                    return(GetElectricChartDataByMonthDemssion(baseParam));
                }
                if (CostTargets.Contains(baseParam.TargetKey))
                {
                    return(GetCostChartDataByMonthDemssion(baseParam));
                }

                if (ProfitTargets.Contains(baseParam.TargetKey))
                {
                    return(GetProfitChartDataByMonthDemssion(baseParam));
                }
            }
            //看每年的某个月的数据
            if (!baseParam.Year.HasValue && baseParam.Month.HasValue)
            {
                if (ElectricTargets.Contains(baseParam.TargetKey))
                {
                    return(GetElectricChartDataByYearAndMonthDemssion(baseParam));
                }
                if (CostTargets.Contains(baseParam.TargetKey))
                {
                    return(GetCostChartDataByYearAndMonthDemssion(baseParam));
                }

                if (ProfitTargets.Contains(baseParam.TargetKey))
                {
                    return(GetProfitChartDataByYearAndMonthDemssion(baseParam));
                }
            }

            //看每年某个季度的数据
            if (!baseParam.Year.HasValue && baseParam.Quarter.HasValue)
            {
                if (ElectricTargets.Contains(baseParam.TargetKey))
                {
                    return(GetElectricChartDataByYearAndQuarterDemssion(baseParam));
                }
                if (CostTargets.Contains(baseParam.TargetKey))
                {
                    return(GetCostChartDataByYearAndQuarterDemssion(baseParam));
                }

                if (ProfitTargets.Contains(baseParam.TargetKey))
                {
                    return(GetProfitChartDataByYearAndQuarterDemssion(baseParam));
                }
            }
            return(null);
        }
Пример #19
0
        public IList <BudgetReportData> GetBudgetReportDataByYear(BaseParam baseParam)
        {
            var companyQueryable  = _context.Companies.Where(item => true);
            var costQueryable     = _context.Costs.Where(item => item.Month == null);
            var electricQueryable = _context.Electrics.Where(item => item.Month == null);
            var profitQueryable   = _context.Profits.Where(item => item.Month == null);

            if (baseParam.CompanyId.HasValue)
            {
                companyQueryable  = companyQueryable.Where(item => item.Id == baseParam.CompanyId.Value);
                costQueryable     = costQueryable.Where(item => item.CompanyId == baseParam.CompanyId.Value);
                electricQueryable = electricQueryable.Where(item => item.CompanyId == baseParam.CompanyId.Value);
                profitQueryable   = profitQueryable.Where(item => item.CompanyId == baseParam.CompanyId.Value);
            }
            if (baseParam.Year.HasValue)
            {
                costQueryable     = costQueryable.Where(item => item.Year == baseParam.Year.Value);
                electricQueryable = electricQueryable.Where(item => item.Year == baseParam.Year.Value);
                profitQueryable   = profitQueryable.Where(item => item.Year == baseParam.Year.Value);
            }
            var query = from cy in companyQueryable
                        join ele in electricQueryable on cy.Id equals ele.CompanyId into tele
                        from tc in tele.DefaultIfEmpty()
                        join c in costQueryable on new { CompanyId = cy.Id, tc.Year } equals new { c.CompanyId, c.Year } into tcost
            from cost in tcost.DefaultIfEmpty()
            join p in profitQueryable on new { CompanyId = cy.Id, tc.Year } equals new { p.CompanyId, p.Year } into tp
            from pt in tp.DefaultIfEmpty()
            select new BudgetReportData {
                CompanyName = cy.Name,
                Year        = tc.Year,

                Electricity     = tc.Electricity,
                BuyElectricity  = tc.BuyElectricity,
                BuyAvgPrice     = tc.BuyAvgPrice,
                SellElectricity = tc.SellElectricity,
                SellAvgPrice    = tc.SellAvgPrice,

                Salary                  = cost.Salary,
                WorkersWelfare          = cost.WorkersWelfare,
                ControllableCost        = cost.ControllableCost,
                OtherControllableCost   = cost.OtherControllableCost,
                OtherUnControllableCost = cost.OtherUnControllableCost,

                ThirdMaintenanceFee     = pt.ThirdMaintenanceFee,
                EngineeringAndLeasehold = pt.EngineeringAndLeasehold,
                OtherCost            = pt.OtherCost,
                TaxAndAdditional     = pt.TaxAndAdditional,
                FinancialCost        = pt.FinancialCost,
                AssetsImpairmentLoss = pt.AssetsImpairmentLoss,
                ProfitValue          = pt.ProfitValue
            };

            var budgetReportDatas = GetBudgetReportDatas(query);

            return(budgetReportDatas);
        }
Пример #20
0
        public ListResult <CheckRecordEntity> GetMine(BaseParam model)
        {
            var bll   = new CheckRecordBLL();
            var total = 0;
            var data  = bll.GetMine(model.UserId, model.PageSize, model.PageIndex, out total);

            return(new ListResult <CheckRecordEntity>()
            {
                Success = true, Total = total, Data = data
            });
        }
Пример #21
0
 public byte[] ExportExcel(BaseParam data)
 {
     byte[] xlsInBytes;
     using (MemoryStream ms = new MemoryStream())
     {
         ExcelFile xls = CreateReport(data);
         xls.Save(ms, TFileFormats.Xls);
         xlsInBytes = ms.ToArray();
     }
     return(xlsInBytes);
 }
Пример #22
0
        public SingleValueParam(_Condition Data, BaseParam Info)
        {
            InitializeComponent();
            this.Data = Data;
            this.Block.BorderBrush = (Info.required) ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.Black);

            ParamName.Text = Data.Property;
            if (Data.Operation == "Default")
            {
                OperationType.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                foreach (var item in OperationList)
                {
                    OperationType.Items.Add(item);
                }
                OperationType.SelectedIndex = OperationList.IndexOf(Data.Operation);
            }

            textValue = (Info.paramTemplates == null || Info.paramTemplates.Count == 0);

            if (textValue)
            {
                this.Value.Visibility     = System.Windows.Visibility.Visible;
                this.ValueList.Visibility = System.Windows.Visibility.Collapsed;
                this.Value.Text           = Data.Value;
            }
            else
            {
                this.Value.Visibility     = System.Windows.Visibility.Collapsed;
                this.ValueList.Visibility = System.Windows.Visibility.Visible;

                Guid curValueId;
                bool PossibleValuesIsGuid = Guid.TryParse(Data.Value, out curValueId);
                foreach (var item in Info.paramTemplates)
                {
                    ComboBoxItem cbItem = new ComboBoxItem();
                    cbItem.Content     = item.Value;
                    cbItem.DataContext = item;

                    if (PossibleValuesIsGuid && item.Key == curValueId)
                    {
                        cbItem.IsSelected = true;
                    }
                    if (!PossibleValuesIsGuid && item.Value == Data.Value)
                    {
                        cbItem.IsSelected = true;
                    }
                    this.ValueList.Items.Add(cbItem);
                }
            }
        }
Пример #23
0
        /// <summary>
        ///     Add the default (base) parameters to a <see cref="ParameterCollection" />.
        /// </summary>
        /// <param name="parameters"><see cref="ParameterCollection" /> to which to add the parameters.</param>
        private void AddDefaultParameters(ParameterCollection parameters)
        {
            const int Count = 6;

            for (int i = 0; i < Count; ++i)
            {
                BaseParam baseParam = As <BaseParam>("BaseParam", i);
                int       value     = AsInt32("BaseParamValue", i);

                AddParameter(parameters, ParameterType.Base, baseParam, value, i);
            }
        }
Пример #24
0
        /// <summary>
        ///     Attempt to add a parameter to a <see cref="ParameterCollection" />.
        /// </summary>
        /// <param name="parameters"><see cref="ParameterCollection" /> to which to add the parameters.</param>
        /// <param name="type"><see cref="ParameterType" /> of the parameter to be added.</param>
        /// <param name="baseParam"><see cref="BaseParam" /> for which a parameter should be added.</param>
        /// <param name="value">Value of the parameter to be added.</param>
        private static void AddParameter(ParameterCollection parameters,
                                         ParameterType type,
                                         BaseParam baseParam,
                                         int value)
        {
            if (baseParam.Key == 0)
            {
                return;
            }

            parameters.AddParameterValue(baseParam, new ParameterValueFixed(type, value));
        }
Пример #25
0
        public IQueryable <Dailogue> LoagPageData(BaseParam queryParam)
        {
            var temp = DbSession.DailogueDal.GetEntity(u => u.DelFlag == true);

            if (!string.IsNullOrEmpty(queryParam.Key))
            {
                temp = temp.Where(u => u.Name.Contains(queryParam.Key)).AsQueryable();
            }

            queryParam.Total = temp.Count();

            return(temp.OrderBy(u => u.ID).Skip(queryParam.PageSize * (queryParam.PageIndex - 1)).Take(queryParam.PageSize).AsQueryable());
        }
Пример #26
0
        public String SendGet(String uri, BaseParam param)
        {
            String data = ParamToFormData.TransferFormData(param);

            if (String.IsNullOrWhiteSpace(data))
            {
                uri += $"?{data}";
            }

            var response = GetHttpRequest(uri, HttpMethod.GET).GetResponse();

            return(GetResponseString(0, response.GetResponseStream()));
        }
Пример #27
0
 public void AddOrUpdateParam(BaseParam baseParam)
 {
     //  对比更新
     DicParam.AddOrUpdate(baseParam.GetKey(), baseParam, (k, v) =>
     {
         if (v.IsHistoryParam && v.IsHistoryComplete)
         {
             return(v);
         }
         v = baseParam;
         return(v);
     });
 }
Пример #28
0
        public override void ExecuteTask(BaseParam param)
        {
            BRBaseParam bp = param as BRBaseParam;

            var url = bp.GetUrl();

            var html = RequestPage(url);

            BRData data = new BRData()
            {
                Param = param, Html = html
            };

            EnQueueData(data);
        }
Пример #29
0
        /// <summary>
        ///     Get the maximum amount of a <see cref="BaseParam" /> possible for the current item.
        /// </summary>
        /// <param name="baseParam"><see cref="BaseParam" /> for which to get the amount.</param>
        /// <returns>The maximum amount of <c>baseParam</c> on the current item.</returns>
        public int GetMaximumParamValue(BaseParam baseParam)
        {
            // Base value for the param based on the item's level
            int maxBase = ItemLevel.GetMaximum(baseParam);
            // Factor, in percent, for the param when applied to the item's equip slot
            int slotFactor = baseParam.GetMaximum(EquipSlotCategory);
            // Factor, in percent, for the param when used for the item's role
            int roleModifier = baseParam.GetModifier(BaseParamModifier);

            // TODO: Not confirmed to use Round, could be Ceiling or Floor; or applied at different points
            // Rounding appears to use AwayFromZero.  Tested with:
            // Velveteen Work Gloves (#3601) for gathering (34.5 -> 35)
            // Gryphonskin Ring (#4526) for wind resistance (4.5 -> 5)
            // Fingerless Goatskin Gloves of Gathering (#3578) for GP (2.5 -> 3)
            return((int)Math.Round(maxBase * slotFactor * roleModifier / 10000.0, MidpointRounding.AwayFromZero));
        }
Пример #30
0
        public MultiValueParam(_Condition Data, BaseParam Info)
        {
            InitializeComponent();
            this.Data = Data;
            this.Block.BorderBrush = (Info.required) ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.Black);

            Dictionary <Guid, string> ValueList = new Dictionary <Guid, string>();
            var buffer = Data.Value.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var item in buffer)
            {
                ValueList.Add(new Guid(item), Info.paramTemplates[new Guid(item)]);
            }

            dataContext      = new MultiValueParamData(Data.Property, Data.Operation, ValueList, Info.paramTemplates);
            this.DataContext = dataContext;
        }
Пример #31
0
        /// <summary>
        ///     Attempt to add a parameter to a <see cref="ParameterCollection" />.
        /// </summary>
        /// <param name="parameters"><see cref="ParameterCollection" /> to which to add the parameters.</param>
        /// <param name="type"><see cref="ParameterType" /> of the parameter to be added.</param>
        /// <param name="baseParam"><see cref="BaseParam" /> for which a parameter should be added.</param>
        /// <param name="value">Value of the parameter to be added.</param>
        private static void AddParameter(ParameterCollection parameters,
                                         ParameterType type,
                                         BaseParam baseParam,
                                         int value)
        {
            if (baseParam.Key == 0)
                return;

            parameters.AddParameterValue(baseParam, new ParameterValueFixed(type, value));
        }
Пример #32
0
        /// <summary>
        ///     Get the amount of <see cref="BaseParam" /> present on the current item.
        /// </summary>
        /// <param name="param"><see cref="BaseParam" /> for which to get the amount.</param>
        /// <param name="includeNonBase">
        ///     A value indicating whether to include bonuses that are not primary or the item's base
        ///     parameter.
        /// </param>
        /// <returns>Returns the amount of <see cref="BaseParam" /> present on the current item.</returns>
        public int GetParameterValue(BaseParam baseParam, bool includeNonBase)
        {
            var present = AllParameters.FirstOrDefault(_ => _.BaseParam == baseParam);
            // ReSharper disable InvertIf
            if (present == null) return 0;

            if (includeNonBase)
                return (int)present.Cast<ParameterValueFixed>().Sum(p => p.Amount);

            return
                (int)
                present.Where(_ => _.Type == ParameterType.Base || _.Type == ParameterType.Primary)
                       .Cast<ParameterValueFixed>()
                       .Sum(p => p.Amount);
        }
Пример #33
0
        /// <summary>
        ///     Get the maximum amount of a <see cref="BaseParam" /> possible for the current item.
        /// </summary>
        /// <param name="baseParam"><see cref="BaseParam" /> for which to get the amount.</param>
        /// <returns>The maximum amount of <c>baseParam</c> on the current item.</returns>
        public int GetMaximumParamValue(BaseParam baseParam)
        {
            // Base value for the param based on the item's level
            var maxBase = ItemLevel.GetMaximum(baseParam);
            // Factor, in percent, for the param when applied to the item's equip slot
            var slotFactor = baseParam.GetMaximum(EquipSlotCategory);
            // Factor, in percent, for the param when used for the item's role
            var roleModifier = baseParam.GetModifier(BaseParamModifier);

            // TODO: Not confirmed to use Round, could be Ceiling or Floor; or applied at different points
            // Rounding appears to use AwayFromZero.  Tested with:
            // Velveteen Work Gloves (#3601) for gathering (34.5 -> 35)
            // Gryphonskin Ring (#4526) for wind resistance (4.5 -> 5)
            // Fingerless Goatskin Gloves of Gathering (#3578) for GP (2.5 -> 3)
            return (int)Math.Round(maxBase * slotFactor * roleModifier / 10000.0, MidpointRounding.AwayFromZero);
        }
Пример #34
0
        /// <summary>
        ///     Get the maximum amount of <see cref="BaseParam" /> that can be melded to the current item.
        /// </summary>
        /// <param name="baseParam"><see cref="BaseParam" /> for which to get the amount.</param>
        /// <param name="onHq">A value indicating whether bonuses for a hiqh-quality item should be taken into account.</param>
        /// <returns>The maximum amount of <c>baseParam</c> that can be melded to the current item.</returns>
        public int GetMateriaMeldCap(BaseParam baseParam, bool onHq)
        {
            var max = GetMaximumParamValue(baseParam);
            var present = GetParameterValue(baseParam, onHq);

            return Math.Max(0, max - present);
        }
Пример #35
0
        /// <summary>
        ///     Retrieve the <see cref="BaseParam" />, <see cref="Value" /> and <see cref="Tier" /> from the <see cref="Materia" />
        ///     to which the current item is assigned.
        /// </summary>
        private void Build()
        {
            if (_IsBuilt)
                return;

            var found = false;
            var materiaSheet = Sheet.Collection.GetSheet<Materia>();
            foreach (var materia in materiaSheet) {
                var entry = materia.Items.FirstOrDefault(e => e.Item == this);
                if (entry == null) continue;

                _BaseParam = materia.BaseParam;
                _Value = entry.Value;
                _Tier = entry.Tier;
                found = true;
                break;
            }

            if (!found) {
                _Tier = -1;
                _Value = 0;
                _BaseParam = Sheet.Collection.GetSheet<BaseParam>()[0];
            }

            _IsBuilt = true;
        }