private void InvokeTotalChanged(TotalInfo totalInfo, TotalInfo newTotalInfo)
 {
     if (TotalChanged != null)
     {
         TotalChanged(this, new ChangedEventArgs <TotalInfo>(totalInfo, newTotalInfo));
     }
 }
 private void InvokeTotalDeleted(TotalInfo totalInfo)
 {
     if (TotalDeleted != null)
     {
         TotalDeleted(this, new ValueEventArgs <TotalInfo>(totalInfo));
     }
 }
        // TOTALS

        public void CreateTotal(TotalInfo totalInfo)
        {
            if (Report != null)
            {
                UpdateTotal(null, totalInfo);
            }
        }
 public void ChangeTotal(TotalInfo totalInfo, TotalInfo newTotalInfo)
 {
     if (Report != null)
     {
         var total = Report.Dictionary.Totals.FindByName(totalInfo.Name);
         UpdateTotal(total, newTotalInfo);
     }
 }
 public void DeleteTotal(TotalInfo totalInfo)
 {
     if (Report != null)
     {
         var total = Report.Dictionary.Totals.FindByName(totalInfo.Name);
         RemoveCollectionItem(Report.Dictionary.Totals, total);
         RefreshReport();
     }
 }
Exemple #6
0
        /// <summary>
        /// 取得所有统计数据
        /// </summary>
        /// <param name="app_key">第三方应用唯一key</param>
        /// <param name="call_id">请求序号</param>
        /// <param name="sig">签名</param>
        /// <param name="v">api版本</param>
        /// <param name="format">返回结果格式,暂时值支持json</param>
        /// <param name="lan">语言环境,暂时只支持中英文</param>
        /// <returns></returns>
        public ActionResult TotalInfo(string app_key, string call_id, string sig, string v, string format, string username, string lan)
        {
            setlan(lan);
            TotalInfo tinfo = new TotalInfo();

            if (string.IsNullOrEmpty(username))
            {
                double allTotalEnergy = DeviceRunDataService.GetInstance().GetAllTotalEnergy();
                double allDayEnergy   = CollectorRunDataService.GetInstance().GetAllDayEnergy();
                double allDayPower    = CollectorRunDataService.GetInstance().getAllPower();
                tinfo.totalDayEnergy      = Util.upDigtal(allDayEnergy);
                tinfo.totalDayEnergyUnit  = Util.upEnergyUnit(allDayEnergy);
                tinfo.plantsCount         = PlantService.GetInstance().GetPlantInfoList().Count();
                tinfo.totalCO2Reduce      = Util.upDigtal(ItemConfig.reductionRate * allTotalEnergy);
                tinfo.totalCO2ReduceUnit  = Util.upCo2Unit(ItemConfig.reductionRate * allTotalEnergy);
                tinfo.totalEnergy         = Util.upDigtal(allTotalEnergy);
                tinfo.totalEnergyUnit     = Util.upEnergyUnit(allTotalEnergy);
                tinfo.totalTodayPower     = Util.upDigtal(allDayPower);
                tinfo.totalTodayPowerUnit = Util.upPowerUnit(allDayPower);
                double top = PlantService.GetInstance().getTotalPower();
                tinfo.totalPower     = Util.upDigtal(top);
                tinfo.totalPowerUnit = Util.upPowerUnit(top);
                tinfo.treeNum        = (allTotalEnergy / 40).ToString("0");
            }
            else
            {
                User user = UserService.GetInstance().GetUserByName(username);
                if (user != null)
                {
                    double allTotalEnergy = user.TotalEnergy;
                    double allDayEnergy   = user.TotalDayEnergy;
                    double allDayPower    = user.TotalPower;
                    tinfo.totalDayEnergy      = Util.upDigtal(allDayEnergy);
                    tinfo.totalDayEnergyUnit  = Util.upEnergyUnit(allDayEnergy);
                    tinfo.plantsCount         = user.plants.Count;
                    tinfo.totalCO2Reduce      = Util.upDigtal(ItemConfig.reductionRate * allTotalEnergy);
                    tinfo.totalCO2ReduceUnit  = Util.upCo2Unit(ItemConfig.reductionRate * allTotalEnergy);
                    tinfo.totalEnergy         = Util.upDigtal(allTotalEnergy);
                    tinfo.totalEnergyUnit     = Util.upEnergyUnit(allTotalEnergy);
                    tinfo.totalTodayPower     = Util.upDigtal(allDayPower);
                    tinfo.totalTodayPowerUnit = Util.upPowerUnit(allDayPower);
                    double top = 0;
                    foreach (Plant p in user.plants)
                    {
                        top += p.design_power;
                    }
                    tinfo.totalPower     = Util.upDigtal(top);
                    tinfo.totalPowerUnit = Util.upPowerUnit(top);
                    tinfo.treeNum        = (allTotalEnergy / 40).ToString("0");
                }
            }
            string data = JsonUtil.convertToJson(tinfo, typeof(TotalInfo));

            return(Content(data));
        }
Exemple #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="warehouse"></param>
        /// <returns></returns>
        public async Task <ActionResult> GetLocationsInfo(int warehouse)
        {
            TotalInfo info = await new CWLocation().GetLocsInfoAsync();
            var       data = new
            {
                type  = 1,
                total = info.Total,
                temp  = info.Temp
            };

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        private void UpdateTotalNode(TotalInfo totalInfo, TreeNode totalNode)
        {
            if (totalNode == null)
            {
                totalNode = CreateNode(DataTree.Nodes["Totals"], totalInfo.Name, "Total", TotalMenu);
            }

            totalNode.Name = totalInfo.Name;
            totalNode.Text = totalInfo.Name;

            totalNode.Parent.Expand();

            DataTree.SelectedNode = totalNode;
        }
        public void UpdateTotal(Total total, TotalInfo newTotalInfo)
        {
            var newTotal = new Total
            {
                Name      = newTotalInfo.Name,
                Evaluator =
                    Report.AllObjects.Cast <object>()
                    .OfType <DataBand>()
                    .FirstOrDefault(i => i.Name == newTotalInfo.DataBand),
                PrintOn =
                    Report.AllObjects.Cast <object>()
                    .OfType <BandBase>()
                    .FirstOrDefault(i => i.Name == newTotalInfo.PrintBand),
                TotalType  = TotalTypes[newTotalInfo.TotalFunc],
                Expression = BuildExpression(newTotalInfo.Expression)
            };

            UpdateCollectionItem(Report.Dictionary.Totals, total, newTotal);
            RefreshReport();
        }
Exemple #10
0
        /// <summary>
        /// 给PLC的统计信息
        /// </summary>
        /// <returns></returns>
        public async Task <TotalInfo> GetLocsInfoAsync()
        {
            TotalInfo info = new TotalInfo();
            Log       log  = LogFactory.GetLogger("GetLocsInfoAsync");

            try
            {
                CWICCard        cwiccd   = new CWICCard();
                List <Location> locLst   = await new CWLocation().FindLocationListAsync();
                List <Customer> custsLst = await cwiccd.FindCustListAsync(cu => cu.Type == EnmICCardType.FixedLocation || cu.Type == EnmICCardType.VIP);

                int total = 0;
                int temp  = 0;
                for (int i = 0; i < locLst.Count; i++)
                {
                    Location loc = locLst[i];
                    if (loc.Type == EnmLocationType.Normal)
                    {
                        if (loc.Status == EnmLocationStatus.Space)
                        {
                            total++;

                            if (!custsLst.Exists(cc => cc.Warehouse == loc.Warehouse && cc.LocAddress == loc.Address))
                            {
                                temp++;
                            }
                        }
                    }
                }
                info.Total = total;
                info.Temp  = temp;
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());

                info.Total = 99;
                info.Temp  = 99;
            }
            return(info);
        }
Exemple #11
0
        public TotalInfo GetPersonInfo()
        {
            TotalInfo total = new TotalInfo();

            total.MyWk = new WorkOrder()
            {
                Wk_Closed = 5, Wk_NotPay = 4, Wk_Processing = 17, Wk_Totoal = 22
            };
            total.PersonInfo = new PersonInfo()
            {
                id = 1, HasTeam = true
            };
            total.TeamWk = new WorkOrder()
            {
                Wk_Closed = 10, Wk_Totoal = 30, Wk_Processing = 20, Wk_NotPay = 7
            };
            total.OrgList = new List <Organization>()
            {
                new Organization()
                {
                    OrgId = "0", OrgName = "神龙教"
                },
                new Organization()
                {
                    OrgId = "1", OrgName = "玉女教"
                },
                new Organization()
                {
                    OrgId = "2", OrgName = "佛教"
                },
                new Organization()
                {
                    OrgId = "3", OrgName = "光明顶"
                }
            };
            return(total);
        }
 public abstract void InitializeWorld(TotalInfo totalInfo);
Exemple #13
0
    private void analysisPaiInfo(HupaiResponseItem parms)
    {
        itemData = parms.totalInfo;
        string gangpaiStr = itemData.gang;

        if (gangpaiStr != null && gangpaiStr.Length > 0)
        {
            string[] gangtemps = gangpaiStr.Split(new char[1] {
                ','
            });
            for (int i = 0; i < gangtemps.Length; i++)
            {
                string     item       = gangtemps [i];
                GangpaiObj gangpaiObj = new GangpaiObj();
                gangpaiObj.uuid = item.Split(new char[1] {
                    ':'
                })[0];
                gangpaiObj.cardPiont = int.Parse(item.Split(new char[1] {
                    ':'
                })[1]);
                gangpaiObj.type = item.Split(new char[1] {
                    ':'
                })[2];
                //增加判断是否为自己的杠牌的操作

                paiArray [gangpaiObj.cardPiont] -= 4;
                gangPaiList.Add(gangpaiObj);

                if (gangpaiObj.type == "an")
                {
                    mdesCribe += "暗杠  ";
                }
                else
                {
                    mdesCribe += "明杠  ";
                }
            }
        }


        string pengpaiStr = itemData.peng;

        if (pengpaiStr != null && pengpaiStr.Length > 0)
        {
            pengpaiList = pengpaiStr.Split(new char[1] {
                ','
            });


            //string[] pengpaiListTTT = pengpaiList;
            List <string> pengpaiListTTT = new List <string>();
            for (int i = 0; i < pengpaiList.Length; i++)
            {
                if (paiArray [int.Parse(pengpaiList [i])] >= 3)
                {
                    paiArray [int.Parse(pengpaiList [i])] -= 3;
                    pengpaiListTTT.Add(pengpaiList [i]);
                }
            }
            pengpaiList = pengpaiListTTT.ToArray();
        }


        string chipaiStr = itemData.chi;

        if (chipaiStr != null && chipaiStr.Length > 0)
        {
            string[] chitemps = chipaiStr.Split(new char[1] {
                ','
            });
            for (int i = 0; i < chitemps.Length; i++)
            {
                string    item      = chitemps[i];
                ChipaiObj chipaiObj = new ChipaiObj();
                string[]  pointStr  = item.Split(new char[1] {
                    ':'
                });
                chipaiObj.cardPionts = pointStr;
                chipaiList.Add(chipaiObj);
                paiArray [int.Parse(chipaiObj.cardPionts[0])] -= 1;
                paiArray [int.Parse(chipaiObj.cardPionts[1])] -= 1;
                paiArray [int.Parse(chipaiObj.cardPionts[2])] -= 1;
            }
        }



        string hupaiStr = itemData.hu;

        if (hupaiStr != null && hupaiStr.Length > 0)
        {
            hupaiObj.uuid = hupaiStr.Split(new char[1] {
                ':'
            }) [0];
            hupaiObj.cardPiont = int.Parse(hupaiStr.Split(new char[1] {
                ':'
            }) [1]);
            hupaiObj.type = hupaiStr.Split(new char[1] {
                ':'
            }) [2];
            //增加判断是否是自己胡牌的判断

            if (hupaiStr.Contains("d_other"))               //排除一炮多响的情况
            {
                mdesCribe += "点炮";
            }
            else if (hupaiObj.type == "zi_common")
            {
                mdesCribe += "自摸";
                huFlagImg.SetActive(true);
                paiArray [hupaiObj.cardPiont] -= 1;
            }
            else if (hupaiObj.type == "d_self")
            {
                mdesCribe += "接炮";
                huFlagImg.SetActive(true);
                paiArray [hupaiObj.cardPiont] -= 1;
            }
            else if (hupaiObj.type == "qiyise")
            {
                mdesCribe += "清一色";
                huFlagImg.SetActive(true);
                paiArray [hupaiObj.cardPiont] -= 1;
            }
            else if (hupaiObj.type == "zi_qingyise")
            {
                mdesCribe += "自摸清一色";
                huFlagImg.SetActive(true);
                paiArray [hupaiObj.cardPiont] -= 1;
            }
            else if (hupaiObj.type == "qixiaodui")
            {
                mdesCribe += "七小对";
                huFlagImg.SetActive(true);
                paiArray [hupaiObj.cardPiont] -= 1;
            }
            else if (hupaiObj.type == "self_qixiaodui")
            {
                mdesCribe += "自摸七小对";
                huFlagImg.SetActive(true);
                paiArray [hupaiObj.cardPiont] -= 1;
            }
            else if (hupaiObj.type == "gangshangpao")
            {
                mdesCribe += "杠上炮";
            }
            else if (hupaiObj.type == "gangshanghua")
            {
                mdesCribe += "杠上花";
                huFlagImg.SetActive(true);
                paiArray [hupaiObj.cardPiont] -= 1;
            }
        }

        if (mHupaiResponseItemData.huType != null)
        {
            mdesCribe += mHupaiResponseItemData.huType;
        }

        resultDes.text = mdesCribe;
        maPais         = parms.getMaPoints();
        arrangePai();
    }
Exemple #14
0
        /// <summary>
        /// 填充首页数据
        /// </summary>
        private void fixData()
        {
            TotalInfo total = new TotalInfo();

            try
            {
                ConfigPara cp = ConfigManagerService.GetInstance().LoadConfig();
                lblSysName.Content = cp.sysname;
                string root_url = cp.domain;
                string username = "";
                if (cp.CounterType == ConfigPara.currentUser)
                {
                    username = cp.CounterUser;
                }
                string json = JsonUtil.loadJsonStr(root_url + "/openapi/totalinfo?username="******"en-us");
                total = JsonUtil.Deserialize <TotalInfo>(json);
                if (total == null)
                {
                    return;
                }
            }
            catch (Exception ee)
            {
                Console.WriteLine(ee.StackTrace);
                return;
            }

            string[] items = config.displayItems.Split('|');
            int      index = 0;

            foreach (var item in items)
            {
                string data = string.Empty;
                string unit = string.Empty;
                if (string.IsNullOrEmpty(item))
                {
                    continue;
                }
                switch (item)//item 对应 configpara.displayItemsName 索引
                {
                case "0":
                    data = total.plantsCount.ToString();
                    unit = "";
                    break;

                case "1":
                    data = total.totalDayEnergy.ToString("0.00");
                    unit = total.totalDayEnergyUnit;
                    break;

                case "2":
                    data = total.totalEnergy.ToString("0.00");
                    unit = total.totalEnergyUnit;
                    break;

                case "3":
                    data = total.totalCO2Reduce.ToString("0.00");
                    unit = total.totalCO2ReduceUnit;
                    break;

                case "4":
                    unit = "rmb";
                    switch (config.currencyType)
                    {
                    case ConfigPara.MY:
                        unit = "my";
                        break;

                    case ConfigPara.LUBU:
                        unit = "lubu";
                        break;

                    case ConfigPara.HANYUAN:
                        unit = "hany";
                        break;

                    case ConfigPara.OUYUAN:
                        unit = "ouyuan";
                        break;

                    case ConfigPara.YBANG:
                        unit = "ybang";
                        break;

                    default:
                        break;
                    }
                    data = (total.totalEnergy * (double)config.incomeRate).ToString("0.00");
                    break;

                case "5":    //今日功率
                    data = total.totalTodayPower.ToString("0.00");
                    unit = total.totalTodayPowerUnit;
                    break;

                case "6":    //总装机容量
                    data = total.totalPower.ToString("0.00");
                    unit = total.totalPowerUnit;
                    break;

                case "7":
                    data = total.treeNum;
                    unit = "Ke";
                    break;
                }
                addDataImage(data, unit, index++, int.Parse(item), touchPad);
            }
            ////添置电站数量数据
            //addDataImage(total.plantsCount.ToString(), "", datatype_count, touchPad);
            ////添加电站日发电量
            //addDataImage(total.totalDayEnergy.ToString("0.00"), total.totalDayEnergyUnit, datatype_dayp, touchPad);
            ////添加电站总发电量
            //addDataImage(total.totalEnergy.ToString("0.00"), total.totalEnergyUnit, datatype_totalp, touchPad);
            ////添加电站co2减排
            //addDataImage(total.totalCO2Reduce.ToString("0.00"), total.totalCO2ReduceUnit, datatype_co2, touchPad);
            ////收益
            //string key = "rmb";
            //switch (config.currencyType)
            //{
            //    case ConfigPara.MY:
            //        key = "my";
            //        break;
            //    case ConfigPara.LUBU:
            //        key = "lubu";
            //        break;
            //    case ConfigPara.HANYUAN:
            //        key = "hany";
            //        break;
            //    case ConfigPara.OUYUAN:
            //        key = "ouyuan";
            //        break;
            //    case ConfigPara.YBANG:
            //        key = "ybang";
            //        break;
            //    default:
            //        break;

            //}
            //addDataImage((total.totalEnergy * (double)config.incomeRate).ToString("0.00"), key, datatype_income, touchPad);
        }
 public abstract void InitializeWorld(TotalInfo totalInfo);
Exemple #16
0
    private void analysisPaiInfo(HupaiResponseItem parms)
    {
        itemData = parms.totalInfo;
        string gangpaiStr = itemData.gang;

        if (gangpaiStr != null && gangpaiStr.Length > 0)
        {
            string[] gangtemps = gangpaiStr.Split(new char[1] {
                ','
            });
            for (int i = 0; i < gangtemps.Length; i++)
            {
                string     item       = gangtemps [i];
                GangpaiObj gangpaiObj = new GangpaiObj();
                gangpaiObj.uuid = item.Split(new char[1] {
                    ':'
                })[0];
                gangpaiObj.cardPiont = int.Parse(item.Split(new char[1] {
                    ':'
                })[1]);
                gangpaiObj.type = item.Split(new char[1] {
                    ':'
                })[2];
                //增加判断是否为自己的杠牌的操作

                paiArray [gangpaiObj.cardPiont] -= 4;
                gangPaiList.Add(gangpaiObj);

                if (gangpaiObj.type == "an")
                {
                    mdesCribe += "暗杠  ";
                }
                else
                {
                    mdesCribe += "明杠  ";
                }
            }
        }


        //20171102
        if (GlobalDataScript.roomVo.roomType == 11)
        {
            if (parms.shanghuo)
            {
                mdesCribe += "上火  ";
            }
            else
            {
                mdesCribe += "不上火  ";
            }
            mdesCribe += "飘数:" + parms.piao + "  ";
        }


        string pengpaiStr = itemData.peng;

        if (pengpaiStr != null && pengpaiStr.Length > 0)
        {
            pengpaiList = pengpaiStr.Split(new char[1] {
                ','
            });


            //string[] pengpaiListTTT = pengpaiList;
            List <string> pengpaiListTTT = new List <string>();
            for (int i = 0; i < pengpaiList.Length; i++)
            {
                string[] temp = pengpaiList [i].Split(':');
                if (paiArray [int.Parse(temp [0])] >= 3)
                {
                    paiArray [int.Parse(temp [0])] -= 3;
                    pengpaiListTTT.Add(temp [0]);
                }
            }
            pengpaiList = pengpaiListTTT.ToArray();
        }


        string chipaiStr = itemData.chi;

        if (chipaiStr != null && chipaiStr.Length > 0)
        {
            string[] chitemps = chipaiStr.Split(new char[1] {
                ','
            });
            for (int i = 0; i < chitemps.Length; i++)
            {
                string    item      = chitemps[i];
                ChipaiObj chipaiObj = new ChipaiObj();
                string[]  pointStr  = item.Split(new char[1] {
                    ':'
                });
                chipaiObj.cardPionts = pointStr;
                chipaiList.Add(chipaiObj);
                paiArray [int.Parse(chipaiObj.cardPionts[0])] -= 1;
                paiArray [int.Parse(chipaiObj.cardPionts[1])] -= 1;
                paiArray [int.Parse(chipaiObj.cardPionts[2])] -= 1;
            }
        }

        string hupaiStr = itemData.hu;

        if (hupaiStr != null && hupaiStr.Length > 0)
        {
            bool     isJian = false;
            string[] hupai  = hupaiStr.Split(new char[1] {
                ','
            });
            foreach (string hu in hupai)
            {
                if (hu == null || hu.Length == 0)
                {
                    continue;
                }
                hupaiObj.uuid = hu.Split(new char[1] {
                    ':'
                }) [0];
                hupaiObj.cardPiont = int.Parse(hu.Split(new char[1] {
                    ':'
                }) [1]);
                hupaiObj.type = hu.Split(new char[1] {
                    ':'
                }) [2];
                //增加判断是否是自己胡牌的判断

                if (hupaiStr.Contains("d_other"))                   //排除一炮多响的情况
                {
                    mdesCribe += "点炮";
                }
                else if (hupaiStr.Contains("other_common"))                     //排除一炮多响的情况

                {
                }
                else
                {
                    if (hupaiObj.type == "menqing")
                    {
                        mdesCribe += "门清";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "zi_common")
                    {
                        mdesCribe += "自摸";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "d_self")
                    {
                        mdesCribe += "接炮";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "qiyise")
                    {
                        mdesCribe += "清一色";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "zi_qingyise")
                    {
                        mdesCribe += "自摸清一色";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "qixiaodui")
                    {
                        mdesCribe += "七小对";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "self_qixiaodui")
                    {
                        mdesCribe += "七小对";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "gangshangpao")
                    {
                        mdesCribe += "杠上炮";
                    }
                    else if (hupaiObj.type == "gangshanghua")
                    {
                        mdesCribe += "杠上花";
                        huFlagImg.SetActive(true);
                    }
                    //红中宝
                    else if (hupaiObj.type == "tian_hu")
                    {
                        mdesCribe += "天胡";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "di_hu")
                    {
                        mdesCribe += "地胡";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "chaochaoqidui")
                    {
                        mdesCribe += "超超豪华七对";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "chaoqidui")
                    {
                        mdesCribe += "超豪华七对";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "haohuaqidui")
                    {
                        mdesCribe += "豪华七对";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "quanfengtou")
                    {
                        mdesCribe += "全风头";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "qingyise")
                    {
                        mdesCribe += "清一色";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "hunyise")
                    {
                        mdesCribe += "混一色";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "quanyaojiu")
                    {
                        mdesCribe += "全幺九";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "hunyaojiu")
                    {
                        mdesCribe += "混幺九";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "shisanyao")
                    {
                        mdesCribe += "十三幺";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "shibaluohan")
                    {
                        mdesCribe += "十八罗汉";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "kankanhu")
                    {
                        mdesCribe += "坎坎胡";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "pengpenghu")
                    {
                        mdesCribe += "碰碰胡";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "haidilao")
                    {
                        mdesCribe += "海底捞X2";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "dasixi")
                    {
                        mdesCribe += "大四喜";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "xiaosixi")
                    {
                        mdesCribe += "小四喜";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "dasanyuan")
                    {
                        mdesCribe += "大三元";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "xiaosanyuan")
                    {
                        mdesCribe += "小三元";
                        huFlagImg.SetActive(true);
                    }
                    //瑞金
                    else if (hupaiObj.type == "tian_hu")
                    {
                        mdesCribe += "天胡";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "di_hu")
                    {
                        mdesCribe += "地胡";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "jing_diao")
                    {
                        mdesCribe += "飞牌";
                        huFlagImg.SetActive(true);
                    }

                    if (!isJian)
                    {
                        paiArray [hupaiObj.cardPiont] -= 1;
                        isJian = true;
                    }
                }

                mdesCribe += " ";
            }
        }

        if (mHupaiResponseItemData.huType != null)
        {
            mdesCribe += mHupaiResponseItemData.huType;
        }

        resultDes.text = mdesCribe;
        maPais         = parms.getMaPoints();
        arrangePai(hupaiStr);
    }
Exemple #17
0
 public void Execute()
 {
     TotalInfo.Run();
 }
        public ActionResult GetSystemInforms(string code, string tons, string ac, string uv, string hm, string dw)
        {
            var noHVACDescription = "This package is not available\nin your pricebook.";//"No HVAC configuration\nhas been defined\nfor this selection.";
            var context           = GetContext();
            var configId          = GetConfigID();
            var frId        = GetFranchiseID();
            var priceBookId = GetPriceBookId(frId, context);

            var ton      = double.Parse(tons.Replace('.', ','));
            var lastcode = Convert.ToInt32(12 * ton).ToString();

            if (lastcode.Length == 3)
            {
                lastcode = lastcode.Remove(2, 1);
            }

            var linkedQustions = GetAllowedAcc(ac, uv, hm, dw);

            var mainSystemInfos = GetSelectedSystemsP().Select(s => new SystemInfoModelWithParts()
            {
                JobCode     = s.tbl_HVAC_SystemType.SystemTypeName + "-" + code + lastcode,
                id          = s.tbl_HVAC_SystemType.SystemTypeName,
                Description = noHVACDescription,
                Price       = 0,
                SEER        = s.SEER.GetValueOrDefault().ToString(),
                AFUE        = s.AFUE.GetValueOrDefault().ToString()
            }).ToList();

            var list = GetPackagesFromDB(priceBookId, context, mainSystemInfos);

            var listparts = GetListOfPartsFromDB(priceBookId, context, list);

            var totalInfoList = new List <TotalInfo>();

            foreach (var viewHvacApp in list)
            {
                var hvacSys = mainSystemInfos.Single(item => item.JobCode == viewHvacApp.JobCode);
                hvacSys.Count       = 1;
                hvacSys.Description = String.Format("SEER Rating {0}, AFUE {1}, {2}", hvacSys.SEER, hvacSys.AFUE,
                                                    viewHvacApp.JobCodeDescription);
                hvacSys.Price          = viewHvacApp.JobStdPrice;
                hvacSys.ResAccountCode = viewHvacApp.ResAccountCode;
                hvacSys.Parts          = listparts
                                         .Where(item => item.JobCode == hvacSys.JobCode)
                                         .Select(item => new JobPart
                {
                    PartCode     = item.PartCode,
                    PartCost     = item.PartCost,
                    PartID       = item.PartID,
                    PartName     = item.PartName,
                    PartStdPrice = item.PartStdPrice,
                    Qty          = item.Qty
                }).ToList();
                if (hvacSys.Parts.Count == 0)
                {
                    hvacSys.Description = noHVACDescription;
                }
            }

            foreach (var hvacSys in mainSystemInfos)
            {
                var totalsystem = new TotalInfo
                {
                    MainSystem = hvacSys,
                    Tax        = 0.05m
                };

                totalsystem.AddMainSystem(hvacSys);
                var listOfAccCodes =
                    context.tbl_HVAC_ConfigPackages.Where(
                        item =>
                        item.ConfigID == configId &&
                        item.tbl_HVAC_SystemType.SystemTypeName == hvacSys.id &&
                        linkedQustions.Contains(item.LinkedQuestionID.HasValue ? item.LinkedQuestionID.Value : 0)
                        ).ToArray().Select(item => item.JobCode.Replace("##", code)).ToArray();

                var listOfAcc = context.View_HVAC_APP.Where(item => item.PriceBookID == priceBookId).Where(
                    i => listOfAccCodes.Contains(i.JobCode)).ToList();

                foreach (var hvacApp1 in listOfAcc)
                {
                    totalsystem.AddAccessory(new AccessoryModel
                    {
                        JobCodeId      = hvacApp1.JobCodeID,
                        Code           = hvacApp1.JobCode,
                        JobCode        = hvacApp1.JobCode,
                        ResAccountCode = hvacApp1.ResAccountCode,
                        Count          = 1,
                        Description    = hvacApp1.JobCodeDescription,
                        Price          = hvacApp1.JobStdPrice
                    });
                }
                totalInfoList.Add(totalsystem);
            }
            return(Json(new { system_ids = mainSystemInfos.Select(item => item.id).ToArray(), systems = totalInfoList.ToArray() }));
        }
    public void setUI(HupaiResponseItem itemData, List <int> validMas, int mainuuid)
    {
        _itemData     = itemData;
        this.validMas = validMas;

        nickName.text   = itemData.nickname;
        totalScroe.text = itemData.totalScore.ToString();
        gangScore.text  = itemData.gangScore.ToString();
        fanCount.text   = itemData.fanCount.ToString();

        huFlag.SetActive(false);
        zhongMaFlag.SetActive(false);
        if (itemData.totalInfo.genzhuang == "1" && itemData.uuid == mainuuid)
        {
            GenzhuangFlag.SetActive(true);
        }
        else
        {
            GenzhuangFlag.SetActive(false);
        }

        string    mdesCribe = "";
        TotalInfo totalInfo = _itemData.totalInfo;

        int[] paiArray = _itemData.paiArray;

        var gangs = totalInfo.getGangInfos();

        for (int i = 0; i < gangs.Length; i++)
        {
            var info = gangs [i];
            paiArray [info.cardPoint] -= 4;
            if (info.type == "an")
            {
                mdesCribe += "暗杠  ";
            }
            else
            {
                mdesCribe += "明杠  ";
            }
        }

        var pengs = totalInfo.getPengInfos();

        for (int i = 0; i < pengs.Length; i++)
        {
            var info = pengs [i];
            if (paiArray [info.cardPoint] >= 3)
            {
                paiArray [info.cardPoint] -= 3;
            }
            else
            {
                pengs [i] = null;
            }
        }

        var chis = totalInfo.getChiInfos();

        for (int i = 0; i < chis.Length; i++)
        {
            var info = chis [i];
            paiArray [info.cardPionts [0]] -= 1;
            paiArray [info.cardPionts [1]] -= 1;
            paiArray [info.cardPionts [2]] -= 1;
        }


        var hu = totalInfo.getHuInfo();

        if (hu != null)
        {
            var kind = GameHelper.getHelper().getHuType(hu);
            mdesCribe += GameHelper.getHelper().getHuString(hu);
            if (kind == HuType.ZI_MO || kind == HuType.JIE_PAO)
            {
                huFlag.SetActive(true);
                paiArray [hu.cardPiont] -= 1;
            }
        }

        if (_itemData.huType != null)
        {
            mdesCribe += _itemData.huType;
        }

        resultDes.text = mdesCribe;

        //显示手牌
        float      startPosition = 30f;
        GameObject card;

        for (int i = 0; i < gangs.Length; i++)
        {
            TGangInfo info = gangs [i];
            if (info.type == "an")
            {
                for (int j = 0; j < 3; j++)
                {
                    createCard(info.cardPoint, startPosition, true);
                    startPosition += 36f;
                }
                createCard(info.cardPoint, startPosition);
                startPosition += 36f;
            }
            else
            {
                for (int j = 0; j < 4; j++)
                {
                    createCard(info.cardPoint, startPosition);
                    startPosition += 36f;
                }
            }
        }
        startPosition = startPosition + (gangs.Length > 0 ? 8f : 0f);

        var ii = 0;

        for (int i = 0; i < pengs.Length; i++)
        {
            if (pengs [i] != null)
            {
                for (int j = 0; j < 3; j++)
                {
                    createCard(pengs [i].cardPoint, startPosition);
                    startPosition += 36f;
                }
            }
            else
            {
                ii++;
            }
        }
        startPosition = startPosition + (pengs.Length - ii > 0 ? 8f : 0f);

        for (int i = 0; i < chis.Length; i++)
        {
            TChiInfo info = chis [i];
            for (int j = 0; j < 3; j++)
            {
                createCard(info.cardPionts[j], startPosition);
                startPosition += 36f;
            }
        }
        startPosition = startPosition + (chis.Length > 0 ? 8f : 0f);

        for (int i = 0; i < paiArray.Length; i++)
        {
            if (paiArray [i] > 0)
            {
                for (int j = 0; j < paiArray [i]; j++)
                {
                    createCard(i, startPosition);
                    startPosition += 36f;
                }
            }
        }
        startPosition += 8f;

        if (hu != null)
        {
            if (GameHelper.getHelper().isHu(hu.type))
            {
                createCard(hu.cardPiont, startPosition);
            }
            startPosition = startPosition + 36f + 52f;
        }
        else
        {
            startPosition = startPosition + 52f;
        }

        List <int> maPais = _itemData.getMaPoints();
        bool       flag   = false;

        if (maPais != null && maPais.Count > 0)
        {
            for (int i = 0; i < maPais.Count; i++)
            {
                flag = flag || isMaValid(maPais [i]);

                card = Instantiate(Resources.Load("Prefab/ThrowCard/ZhongMa")) as GameObject;
                card.transform.SetParent(paiArrayPanel.transform);
                card.GetComponent <PutoutCardView> ().setPoint(maPais [i]);
                card.transform.localScale    = new Vector3(0.8f, 0.8f, 1f);
                card.transform.localPosition = new Vector3((20 + i) * 36f, 0, 0);
            }
            zhongMaFlag.SetActive(flag);
        }

        if (GlobalData.getInstance().roomVO.roomType == GameType.HUA_SHUI)
        {
            card = Instantiate(Resources.Load("Prefab/Image_yu")) as GameObject;
            card.transform.SetParent(paiArrayPanel.transform);
            card.GetComponent <yuSetScript> ().setCount(GlobalData.getInstance().roomVO.xiaYu);
            card.transform.localScale    = Vector3.one;
            card.transform.localPosition = new Vector3(20 * 36f, 0, 0);
        }
    }
 /// <summary>
 /// 取得用户所有电站统计数据
 /// </summary>
 /// <param name="app_key"></param>
 /// <param name="sig"></param>
 /// <param name="v"></param>
 /// <param name="username"></param>
 /// <param name="lan"></param>
 /// <returns></returns>
 public ActionResult TotalInfo(string app_key, string sig, string v, string username, string lan)
 {
     setlan(lan);
     TotalInfo tinfo = new TotalInfo();
     if (string.IsNullOrEmpty(username))
     {
         double allTotalEnergy = DeviceRunDataService.GetInstance().GetAllTotalEnergy();
         double allDayEnergy = CollectorRunDataService.GetInstance().GetAllDayEnergy();
         double allDayPower = CollectorRunDataService.GetInstance().getAllPower();
         tinfo.totalDayEnergy = Util.upDigtal(allDayEnergy);
         tinfo.totalDayEnergyUnit = Util.upEnergyUnit(allDayEnergy);
         tinfo.plantsCount = PlantService.GetInstance().GetPlantInfoList().Count();
         tinfo.totalCO2Reduce = Util.upDigtal(ItemConfig.reductionRate * allTotalEnergy);
         tinfo.totalCO2ReduceUnit = Util.upCo2Unit(ItemConfig.reductionRate * allTotalEnergy);
         tinfo.totalEnergy = Util.upDigtal(allTotalEnergy);
         tinfo.totalEnergyUnit = Util.upEnergyUnit(allTotalEnergy);
         tinfo.totalTodayPower = Util.upDigtal(allDayPower);
         tinfo.totalTodayPowerUnit = Util.upPowerUnit(allDayPower);
         double top = PlantService.GetInstance().getTotalPower();
         tinfo.totalPower = Math.Round(top, 2);
         tinfo.totalPowerUnit = Util.upPowerUnit(tinfo.totalPower);
         tinfo.treeNum = (allTotalEnergy / 40).ToString("0");
     }
     else
     {
         User user = UserService.GetInstance().GetUserByName(username);
         if (user != null)
         {
             double allTotalEnergy = user.TotalEnergy;
             double allDayEnergy = user.TotalDayEnergy;
             double allDayPower = user.TotalPower;
             tinfo.totalDayEnergy = Util.upDigtal(allDayEnergy);
             tinfo.totalDayEnergyUnit = Util.upEnergyUnit(allDayEnergy);
             tinfo.plantsCount = user.relatedPlants.Count;
             tinfo.totalCO2Reduce = Util.upDigtal(ItemConfig.reductionRate * allTotalEnergy);
             tinfo.totalCO2ReduceUnit = Util.upCo2Unit(ItemConfig.reductionRate * allTotalEnergy);
             tinfo.totalEnergy = Util.upDigtal(allTotalEnergy);
             tinfo.totalEnergyUnit = Util.upEnergyUnit(allTotalEnergy);
             tinfo.totalTodayPower = Util.upDigtal(allDayPower);
             tinfo.totalTodayPowerUnit = Util.upPowerUnit(allDayPower);
             double top = 0;
             foreach (Plant p in user.relatedPlants)
             {
                 top += p.design_power;
             }
             tinfo.totalPower = Math.Round(top, 2);
             tinfo.totalPowerUnit = Util.upPowerUnit(tinfo.totalPower);
             tinfo.treeNum = (allTotalEnergy / 40).ToString("0");
         }
     }
     string data = JsonUtil.convertToJson(tinfo, typeof(TotalInfo));
     return Content(data);
 }
Exemple #21
0
        /// <summary>
        /// 生成首页数据
        /// </summary>
        /// <param name="websiteOwnerList">站点列表</param>
        /// <param name="date">日期</param>
        public void BuildDashboardInfo(List <string> websiteList, DateTime nDate)
        {
            if (websiteList.Count == 0)
            {
                return;
            }

            int nDateInt      = DateTimeHelper.ToDateInt8ByDateTime(nDate);
            int lastDate7Int  = DateTimeHelper.ToDateInt8ByDateTime(nDate.AddDays(-6));
            int lastDate30Int = DateTimeHelper.ToDateInt8ByDateTime(nDate.AddDays(-29));
            List <DashboardLog>  dashLogList  = GetDashboardLogList(null, lastDate30Int, nDateInt);
            List <DashboardInfo> dashInfoList = GetDashboardInfoList();

            List <DashboardLog> uvDashLogList = new List <DashboardLog>();

            #region 访客记录统计

            List <MonitorEventDetailsInfo> uvList             = GetDashboardUVList(null, nDate.AddDays(-29).ToString("yyyy-MM-dd"), nDate.ToString("yyyy-MM-dd"));
            List <DashboardMonitorInfo>    uvDashboardLogList = GetColList <DashboardMonitorInfo>(int.MaxValue, 1, "1=1", "DetailID");
            //ExecuteSql("truncate table ZCJ_DashboardMonitorInfo");//清除原30天UV记录
            if (uvList.Count > 0)
            {
                List <DashboardMonitorInfo> uvGroupList = uvList.GroupBy(p => new
                {
                    p.WebsiteOwner,
                    p.EventUserID
                }).Select(g => new DashboardMonitorInfo
                {
                    WebsiteOwner = g.Key.WebsiteOwner,
                    EventUserID  = g.Key.EventUserID,
                    DetailID     = g.Max(p => p.DetailID).Value
                }).OrderByDescending(x => x.DetailID).ToList();

                //删除数据
                List <int> delIdList = uvDashboardLogList.Where(p => !uvGroupList.Exists(pi => pi.DetailID == p.DetailID)).Select(pid => pid.DetailID).ToList();
                if (delIdList.Count > 0)
                {
                    DeleteMultByKey <DashboardMonitorInfo>("DetailID", ZentCloud.Common.MyStringHelper.ListToStr(delIdList, "", ","));
                }

                List <int> addIdList = uvGroupList.Where(p => !uvDashboardLogList.Exists(pi => pi.DetailID == p.DetailID)).Select(pid => pid.DetailID).ToList();

                List <DashboardMonitorInfo> uvAddDashboardList = uvList.Where(p => addIdList.Exists(pi => pi == p.DetailID.Value)).Select(g => new DashboardMonitorInfo
                {
                    DetailID       = g.DetailID.Value,
                    WebsiteOwner   = g.WebsiteOwner,
                    EventUserID    = g.EventUserID,
                    EventDate      = g.EventDate.Value,
                    SourceIP       = g.SourceIP,
                    IPLocation     = g.IPLocation,
                    EventBrowserID = g.EventBrowserID
                }).ToList();

                if (uvAddDashboardList.Count > 0)
                {
                    string          userIds  = MyStringHelper.ListToStr(uvAddDashboardList.Select(p => p.EventUserID).Distinct().ToList(), "'", ",");
                    List <UserInfo> userList = GetColMultListByKey <UserInfo>(int.MaxValue, 1, "UserID", userIds, "AutoID,UserID,TrueName,Phone,WXNickname,WXHeadimgurl");
                    for (int i = 0; i < uvAddDashboardList.Count; i++)
                    {
                        UserInfo nuser = userList.FirstOrDefault(p => p.UserID == uvAddDashboardList[i].EventUserID);
                        if (nuser != null)
                        {
                            uvAddDashboardList[i].EventUserWXNikeName = nuser.WXNickname;
                            uvAddDashboardList[i].EventUserTrueName   = nuser.TrueName;
                            uvAddDashboardList[i].EventUserWXImg      = nuser.WXHeadimgurl;
                            uvAddDashboardList[i].EventUserPhone      = nuser.Phone;
                        }
                        Add(uvAddDashboardList[i]);
                    }
                }

                uvDashLogList = uvList.Where(ni => uvGroupList.Exists(pi => pi.DetailID == ni.DetailID)).GroupBy(p => new
                {
                    p.WebsiteOwner,
                    Value = DateTimeHelper.ToDateInt8ByDateTime(p.EventDate.Value)
                }).Select(g => new DashboardLog
                {
                    WebsiteOwner  = g.Key.WebsiteOwner,
                    Date          = g.Key.Value,
                    DashboardType = "UV",
                    Num           = g.Count()
                }).OrderByDescending(x => x.Date).ThenBy(x => x.WebsiteOwner).ToList();
            }
            #endregion

            List <DashboardLog> fansDashLogList = new List <DashboardLog>();
            #region 粉丝记录统计
            List <Log> fansList = GetDashboardSubscribeList(null, nDate.AddDays(-29).ToString("yyyy-MM-dd"), nDate.ToString("yyyy-MM-dd"));
            if (fansList.Count > 0)
            {
                fansDashLogList = fansList.GroupBy(p => new
                {
                    p.WebsiteOwner,
                    p.UserID
                }).Select(g => new Log
                {
                    WebsiteOwner = g.Key.WebsiteOwner,
                    UserID       = g.Key.UserID,
                    InsertDate   = g.Max(p => p.InsertDate)
                }).GroupBy(e => new
                {
                    e.WebsiteOwner,
                    Value = DateTimeHelper.ToDateInt8ByDateTime(e.InsertDate)
                }).Select(f => new DashboardLog
                {
                    WebsiteOwner  = f.Key.WebsiteOwner,
                    Date          = f.Key.Value,
                    DashboardType = "Fans",
                    Num           = f.Count()
                }).OrderByDescending(x => x.Date).ThenBy(x => x.WebsiteOwner).ToList();
            }
            #endregion

            List <TotalInfo> memberTotalList = GetAllDashboardRegUserTotal();
            List <TotalInfo> uvTotalList     = GetAllDashboardUVTotal();
            List <TotalInfo> fansTotalList   = GetAllDashboardSubscribeTotal();
            List <TotalInfo> orderTotalList  = GetAllDashboardOrderTotal("0,1,2,3");
            List <TotalInfo> visitTotalList  = GetAllDashboardMonitorEventDetailsTotal();

            foreach (string web in websiteList)
            {
                DashboardInfo ndi = dashInfoList.FirstOrDefault(p => p.WebsiteOwner == web);
                //if (ndi!=null && ndi.Date == nDateInt) continue;
                DashboardJson nDashboardJson = new DashboardJson();
                nDashboardJson.visit_num_lastday  = dashLogList.Where(p => p.WebsiteOwner == web && p.DashboardType == "WebAccessLog" && p.Date == nDateInt).Sum(p => p.Num);
                nDashboardJson.order_num_lastday  = dashLogList.Where(p => p.WebsiteOwner == web && p.DashboardType == "WXMallOrder" && p.Date == nDateInt).Sum(p => p.Num);
                nDashboardJson.member_num_lastday = dashLogList.Where(p => p.WebsiteOwner == web && p.DashboardType == "Member" && p.Date == nDateInt).Sum(p => p.Num);
                nDashboardJson.uv_num_lastday     = uvDashLogList.Where(p => p.WebsiteOwner == web && p.Date == nDateInt).Sum(p => p.Num);
                nDashboardJson.fans_num_lastday   = fansDashLogList.Where(p => p.WebsiteOwner == web && p.Date == nDateInt).Sum(p => p.Num);

                nDashboardJson.visit_num_lastweek  = dashLogList.Where(p => p.WebsiteOwner == web && p.DashboardType == "WebAccessLog" && p.Date >= lastDate7Int && p.Date <= nDateInt).Sum(p => p.Num);
                nDashboardJson.order_num_lastweek  = dashLogList.Where(p => p.WebsiteOwner == web && p.DashboardType == "WXMallOrder" && p.Date >= lastDate7Int && p.Date <= nDateInt).Sum(p => p.Num);
                nDashboardJson.member_num_lastweek = dashLogList.Where(p => p.WebsiteOwner == web && p.DashboardType == "Member" && p.Date >= lastDate7Int && p.Date <= nDateInt).Sum(p => p.Num);
                nDashboardJson.uv_num_lastweek     = uvDashLogList.Where(p => p.WebsiteOwner == web && p.Date >= lastDate7Int && p.Date <= nDateInt).Sum(p => p.Num);
                nDashboardJson.fans_num_lastweek   = fansDashLogList.Where(p => p.WebsiteOwner == web && p.Date >= lastDate7Int && p.Date <= nDateInt).Sum(p => p.Num);

                nDashboardJson.visit_num_lastmonth  = dashLogList.Where(p => p.WebsiteOwner == web && p.DashboardType == "WebAccessLog" && p.Date >= lastDate30Int && p.Date <= nDateInt).Sum(p => p.Num);
                nDashboardJson.order_num_lastmonth  = dashLogList.Where(p => p.WebsiteOwner == web && p.DashboardType == "WXMallOrder" && p.Date >= lastDate30Int && p.Date <= nDateInt).Sum(p => p.Num);
                nDashboardJson.member_num_lastmonth = dashLogList.Where(p => p.WebsiteOwner == web && p.DashboardType == "Member" && p.Date >= lastDate30Int && p.Date <= nDateInt).Sum(p => p.Num);
                nDashboardJson.uv_num_lastmonth     = uvDashLogList.Where(p => p.WebsiteOwner == web && p.Date >= lastDate30Int && p.Date <= nDateInt).Sum(p => p.Num);
                nDashboardJson.fans_num_lastmonth   = fansDashLogList.Where(p => p.WebsiteOwner == web && p.Date >= lastDate30Int && p.Date <= nDateInt).Sum(p => p.Num);

                TotalInfo memberTotal = memberTotalList.FirstOrDefault(p => p.WebsiteOwner == web);
                if (memberTotal != null)
                {
                    nDashboardJson.member_total = memberTotal.Total;
                }

                TotalInfo uvTotal = uvTotalList.FirstOrDefault(p => p.WebsiteOwner == web);
                if (uvTotal != null)
                {
                    nDashboardJson.uv_total = uvTotal.Total;
                }

                TotalInfo fansTotal = fansTotalList.FirstOrDefault(p => p.WebsiteOwner == web);
                if (fansTotal != null)
                {
                    nDashboardJson.fans_total = fansTotal.Total;
                }

                TotalInfo orderTotal = orderTotalList.FirstOrDefault(p => p.WebsiteOwner == web);
                if (orderTotal != null)
                {
                    nDashboardJson.order_total = orderTotal.Total;
                }

                TotalInfo visitTotal = visitTotalList.FirstOrDefault(p => p.WebsiteOwner == web);
                if (visitTotal != null)
                {
                    nDashboardJson.visit_total = visitTotal.Total;
                }

                for (DateTime i = nDate; i >= nDate.AddDays(-29); i = i.AddDays(-1))
                {
                    int    rDateInt    = ZentCloud.Common.DateTimeHelper.ToDateInt8ByDateTime(i);
                    string rDateString = i.ToString("yyyy-MM-dd");
                    nDashboardJson.day_list.Add(rDateString);
                    DashboardLog rVisitLog = dashLogList.FirstOrDefault(p => p.WebsiteOwner == web && p.DashboardType == "WebAccessLog" && p.Date == rDateInt);
                    if (rVisitLog == null)
                    {
                        nDashboardJson.visit_num_list.Add(0);
                    }
                    else
                    {
                        nDashboardJson.visit_num_list.Add(rVisitLog.Num);
                    }
                    DashboardLog rOrderLog = dashLogList.FirstOrDefault(p => p.WebsiteOwner == web && p.DashboardType == "WXMallOrder" && p.Date == rDateInt);
                    if (rOrderLog == null)
                    {
                        nDashboardJson.order_num_list.Add(0);
                    }
                    else
                    {
                        nDashboardJson.order_num_list.Add(rOrderLog.Num);
                    }
                    DashboardLog rMemberLog = dashLogList.FirstOrDefault(p => p.WebsiteOwner == web && p.DashboardType == "Member" && p.Date == rDateInt);
                    if (rMemberLog == null)
                    {
                        nDashboardJson.member_num_list.Add(0);
                    }
                    else
                    {
                        nDashboardJson.member_num_list.Add(rMemberLog.Num);
                    }

                    DashboardLog rUVLog = uvDashLogList.FirstOrDefault(p => p.WebsiteOwner == web && p.Date == rDateInt);
                    if (rUVLog == null)
                    {
                        nDashboardJson.uv_num_list.Add(0);
                    }
                    else
                    {
                        nDashboardJson.uv_num_list.Add(rUVLog.Num);
                    }

                    DashboardLog rFansLog = fansDashLogList.FirstOrDefault(p => p.WebsiteOwner == web && p.Date == rDateInt);
                    if (rFansLog == null)
                    {
                        nDashboardJson.fans_num_list.Add(0);
                    }
                    else
                    {
                        nDashboardJson.fans_num_list.Add(rFansLog.Num);
                    }
                }
                nDashboardJson.timestamp = DateTimeHelper.DateTimeToUnixTimestamp(DateTime.Now);

                string nJson = JsonConvert.SerializeObject(nDashboardJson);
                if (ndi == null)
                {
                    Add(new DashboardInfo()
                    {
                        WebsiteOwner = web, Date = nDateInt, Json = nJson
                    });
                }
                else
                {
                    Update(new DashboardInfo()
                    {
                        WebsiteOwner = web, Date = nDateInt, Json = nJson
                    });
                }
            }
        }