Ejemplo n.º 1
0
 private async Task<DistributedProfitsInfo> GetDistributedProfitsInfo(ProfitType type, long period)
 {
     return await ProfitContractStub.GetDistributedProfitsInfo.CallAsync(
         new SchemePeriod
         {
             SchemeId = ProfitItemsIds[type],
             Period = period
         });
 }
Ejemplo n.º 2
0
        string ShowBestTrips(ProfitType type)
        {
            List <SingleTrip> secureTrips   = null;
            List <SingleTrip> shortestTrips = null;
            string            output        = string.Empty;

            // Testing this at the moment..
            int numroutes = Convert.ToInt32(input["numroutes"]);

            switch (type)
            {
            case ProfitType.ProfitPerWarpFromStartingSystem:
                finder.SortByProfitPerWarpFromStartingSystem(true);
                secureTrips = finder.BestHighSecTrips(numroutes);

                finder.SortByProfitPerWarpFromStartingSystem(false);
                shortestTrips = finder.BestTrips(numroutes);
                break;

            case ProfitType.MaxProfitPerWarp:
                finder.SortByProfitPerWarp(true);
                secureTrips = finder.BestHighSecTrips(numroutes);

                finder.SortByProfitPerWarp(false);
                shortestTrips = finder.BestTrips(numroutes);
                break;

            case ProfitType.MaxProfit:
                finder.SortByProfit();
                secureTrips   = finder.BestHighSecTrips(numroutes);
                shortestTrips = finder.BestTrips(numroutes);
                break;
            }

            foreach (SingleTrip trip in secureTrips)
            {
                output += "<tr><td>" + Info(trip) + "</td></tr>";
            }
            foreach (SingleTrip trip in shortestTrips)
            {
                output += "<tr><td>" + Info(trip) + "</td></tr>";
            }

            return(output);
        }
Ejemplo n.º 3
0
        private async Task<long> GetProfitAmount(ProfitType type)
        {
            ProfitContractContainer.ProfitContractStub stub;
            switch (type)
            {
                case ProfitType.CitizenWelfare:
                    stub = GetProfitContractTester(VoterKeyPairs[0]);
                    break;
                default:
                    stub = GetProfitContractTester(ValidationDataCenterKeyPairs[0]);
                    break;
            }

            return (await stub.GetProfitAmount.CallAsync(new ClaimProfitsInput
            {
                SchemeId = ProfitItemsIds[type],
                Symbol = EconomicContractsTestConstants.NativeTokenSymbol
            })).Value;
        }
Ejemplo n.º 4
0
        string ShowBestTrips(ProfitType type)
        {
            List<SingleTrip> secureTrips = null;
            List<SingleTrip> shortestTrips = null;
            string output = string.Empty;

            // Testing this at the moment..
            int numroutes = Convert.ToInt32(input["numroutes"]); 

            switch (type)
            {
                case ProfitType.ProfitPerWarpFromStartingSystem:
                    finder.SortByProfitPerWarpFromStartingSystem(true);
                    secureTrips = finder.BestHighSecTrips(numroutes); 

                    finder.SortByProfitPerWarpFromStartingSystem(false);
                    shortestTrips = finder.BestTrips(numroutes); 
                    break;

                case ProfitType.MaxProfitPerWarp:
                    finder.SortByProfitPerWarp(true);
                    secureTrips = finder.BestHighSecTrips(numroutes);

                    finder.SortByProfitPerWarp(false);
                    shortestTrips = finder.BestTrips(numroutes);
                    break;

                case ProfitType.MaxProfit:
                    finder.SortByProfit();
                    secureTrips = finder.BestHighSecTrips(numroutes);
                    shortestTrips = finder.BestTrips(numroutes);
                    break;
            }

            foreach (SingleTrip trip in secureTrips) output += "<tr><td>" + Info(trip) + "</td></tr>";
            foreach (SingleTrip trip in shortestTrips) output += "<tr><td>" + Info(trip) + "</td></tr>";

            return output;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取酒店设置的佣金及推广员可实际获得的佣金
        /// </summary>
        /// <param name="TypeValue"></param>
        /// <param name="weixinid"></param>
        /// <param name="Money"></param>
        /// <returns></returns>
        public static TuiGuangMoney GetTuiGuangProfit(this ProfitType TypeValue, string weixinid, string userweixinid, double Money)
        {
            TuiGuangMoney Result = new TuiGuangMoney()
            {
                promoterid = 0, hotelCommission = 0, userCommission = 0
            };

            int promoterid = 0;

            if (!userweixinid.Contains(DAL.PromoterDAL.WX_ShareLinkUserWeiXinId))
            {
                promoterid = MemberCardBuyRecord.GetPromoterid(weixinid, userweixinid);
                if (promoterid <= 0)
                {
                    //不存在推广员id
                    return(Result);
                }
            }

            Result.promoterid = promoterid;
            string sql = "select kefang,canyin,tuangou,chaoshi from S_HuoDongTianBao_fenxiao with(nolock) where  weixinId=@weixinId";
            Dictionary <string, DBParam> Dic = new Dictionary <string, DBParam>();

            Dic.Add("weixinId", new DBParam {
                ParamValue = weixinid
            });
            DataTable dt = SQLHelper.Get_DataTable(sql, SQLHelper.GetCon(), Dic);

            if (dt == null || dt.Rows.Count <= 0)
            {
                return(Result);
            }

            string kefangStr  = dt.Rows[0]["kefang"].ToString();
            string canyinStr  = dt.Rows[0]["canyin"].ToString();
            string tuangouStr = dt.Rows[0]["tuangou"].ToString();
            string chaoshiStr = dt.Rows[0]["chaoshi"].ToString();

            int    Error = 0;
            double TuiGuangProfitValue = TuiGuangProfit();


            int ProfitValue = 0;

            switch (TypeValue)
            {
            case ProfitType.kefang:
                int kefang = int.TryParse(kefangStr, out Error) ? int.Parse(kefangStr) : 0;
                ProfitValue = kefang;
                break;

            case ProfitType.canyin:
                int canyin = int.TryParse(canyinStr, out Error) ? int.Parse(canyinStr) : 0;
                ProfitValue = canyin;
                break;

            case ProfitType.tuangou:
                int tuangou = int.TryParse(tuangouStr, out Error) ? int.Parse(tuangouStr) : 0;
                ProfitValue = tuangou;
                break;

            case ProfitType.chaoshi:
                int chaoshi = int.TryParse(chaoshiStr, out Error) ? int.Parse(chaoshiStr) : 0;
                ProfitValue = chaoshi;
                break;
            }
            Result.hotelCommission = Money * ProfitValue / 100;
            Result.userCommission  = Result.hotelCommission * TuiGuangProfitValue;
            return(Result);
        }