Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     cManager         = GetComponent <CountManager>();
     audioSource      = GetComponent <AudioSource>();
     audioSource.clip = audioClip;
     dropObjectList.Add(dropObject[0]);
 }
Exemplo n.º 2
0
 void Start()
 {
     cManager = GetComponent <CountManager>();
     characterButtonObject = new GameObject[cManager.characterObject.Length];
     clickButtonObject     = new GameObject[cManager.clickObject.Length];
     charText        = new Text[cManager.characterObject.Length];
     charPerSecText  = new Text[cManager.characterObject.Length];
     clickText       = new Text[cManager.clickObject.Length];
     characterButton = new Button[characterButtonObject.Length];
     clickButton     = new Button[clickButtonObject.Length];
     if (sumTextObject != null)
     {
         sumText = sumTextObject.GetComponent <Text>();
     }
     if (aveTextObject != null)
     {
         aveText = aveTextObject.GetComponent <Text>();
     }
     for (int i = 0; i < cManager.characterObject.Length; i++)
     {
         characterButtonObject[i] = cManager.characterObject[i];
         characterButton[i]       = characterButtonObject[i].GetComponent <Button>();
         charText[i]            = characterButtonObject[i].transform.FindChild("NeedMoney").GetComponent <Text>();
         charPerSecText[i]      = characterButtonObject[i].transform.FindChild("PerSec").GetComponent <Text>();
         charPerSecText[i].text = "+" + (cManager.perSecVal[i] * 50).ToString() + "mp";
     }
     for (int i = 0; i < cManager.clickObject.Length; i++)
     {
         clickButtonObject[i] = cManager.clickObject[i];
         clickButton[i]       = clickButtonObject[i].GetComponent <Button>();
         clickText[i]         = clickButtonObject[i].transform.FindChild("Text").GetComponent <Text>();
         clickText[i].text    = cManager.clickNeedMoney[i].ToString() + "mp";
     }
 }
Exemplo n.º 3
0
 void Awake()
 {
     if (instance != this)
     {
         instance = this;
     }
     audio = GetComponent <AudioSource>();
 }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     cManager = GetComponent <CountManager>();
     for (int i = 0; i < buttonNeedMoneyTextObject.Length; i++)
     {
         buttonNeedMoneyText[i] = buttonNeedMoneyTextObject[i].GetComponent <Text>();
     }
 }
Exemplo n.º 5
0
	void Start () {
		sInstance = this;
		mTotalGenerateSpeed = RoomDataDao.Instance.GetTotalGenerateSpeed ();
		totalGenerateSpeedLabel.text = Math.Round((double)mTotalGenerateSpeed, 1, MidpointRounding.AwayFromZero) + " / \u79d2";
		mKeepMoneyCount = PrefsManager.Instance.GetMoneyCount ();
		SetKeepCountLabel();
		if(mTotalGenerateSpeed != 0){
			ResetTime ();
		}
	}
Exemplo n.º 6
0
    public void Start()
    {
        countManager     = GetComponent <CountManager>();
        interfaceManager = GetComponent <UIManager>();

        taskList   = new List <ValueTypes.ButtonType>();
        playerList = new List <ValueTypes.ButtonType>();

        countManager.ResetData();
        PrepareNewRound();
    }
Exemplo n.º 7
0
 void Awake()
 {
     // Setting up the references.
     anim                  = GetComponent <Animator>();
     enemyAudio            = GetComponent <AudioSource>();
     capsuleCollider       = GetComponent <CapsuleCollider>();
     myRenderer            = GetComponentInChildren <SkinnedMeshRenderer>();
     enemyHealthbarManager = GameObject.Find("EnemyHealthbarsCanvas");
     waveManager           = GameObject.Find("WaveManager").GetComponent <WaveManager>();
     scoreManager          = GameObject.Find("ScoreManager").GetComponent <ScoreManager>();
     pickupManager         = GameObject.Find("PickupManager").GetComponent <PickupManager>();
     countManager          = GameObject.Find("CountManager").GetComponent <CountManager>();
 }
Exemplo n.º 8
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, string type, string channelIndex, string channelName, int upLevel, int topLevel, EScopeType scope, string since)
        {
            var count = 0;

            var sinceDate = DateUtils.SqlMinValue;

            if (!string.IsNullOrEmpty(since))
            {
                sinceDate = DateTime.Now.AddHours(-DateUtils.GetSinceHours(since));
            }

            if (string.IsNullOrEmpty(type) || StringUtils.EqualsIgnoreCase(type, TypeContents))
            {
                var channelId = StlDataUtility.GetNodeIdByLevel(pageInfo.PublishmentSystemId, contextInfo.ChannelId, upLevel, topLevel);
                channelId = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, channelId, channelIndex, channelName);

                var nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, channelId);

                var nodeIdList = DataProvider.NodeDao.GetNodeIdListByScopeType(nodeInfo, scope, string.Empty, string.Empty);
                foreach (var nodeId in nodeIdList)
                {
                    var tableName = NodeManager.GetTableName(pageInfo.PublishmentSystemInfo, nodeId);
                    count += DataProvider.ContentDao.GetCountOfContentAdd(tableName, pageInfo.PublishmentSystemId, nodeId, EScopeType.Self, sinceDate, DateTime.Now.AddDays(1), string.Empty);
                }
            }
            else if (StringUtils.EqualsIgnoreCase(type, TypeChannels))
            {
                var channelId = StlDataUtility.GetNodeIdByLevel(pageInfo.PublishmentSystemId, contextInfo.ChannelId, upLevel, topLevel);
                channelId = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, channelId, channelIndex, channelName);

                var nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, channelId);
                count = nodeInfo.ChildrenCount;
            }
            else if (StringUtils.EqualsIgnoreCase(type, TypeComments))
            {
                count = DataProvider.CommentDao.GetCountChecked(pageInfo.PublishmentSystemId, contextInfo.ChannelId, contextInfo.ContentId);
            }
            else if (StringUtils.EqualsIgnoreCase(type, TypeDownloads))
            {
                if (contextInfo.ContentId > 0)
                {
                    count = CountManager.GetCount(pageInfo.PublishmentSystemInfo.AuxiliaryTableForContent, contextInfo.ContentId.ToString(), ECountType.Download);
                }
            }

            return(count.ToString());
        }
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }
            if (IsPostBack)
            {
                return;
            }

            VerifyAdministratorPermissions(ConfigManager.SettingsPermissions.Chart);

            DdlSiteId.Items.Add(new ListItem("<<全部站点>>", "0"));
            var siteIdList = SiteManager.GetSiteIdListOrderByLevel();

            foreach (var siteId in siteIdList)
            {
                var siteInfo = SiteManager.GetSiteInfo(siteId);
                DdlSiteId.Items.Add(new ListItem(siteInfo.SiteName, siteId.ToString()));

                var key = siteInfo.Id;
                //x轴信息
                SetXHashtable(key, siteInfo.SiteName);
                //y轴信息
                SetYHashtable(key, CountManager.GetCount(siteInfo.TableName, siteInfo.Id, ECountType.Download));
            }

            RptContents.DataSource     = siteIdList;
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();

            foreach (var key in _siteIdList)
            {
                var yValueDownload = GetYHashtable(key);
                if (yValueDownload != "0")
                {
                    StrArray += $@"
xArrayDownload.push('{GetXHashtable(key)}');
                    yArrayDownload.push('{yValueDownload}');";
                }
            }
            LtlTotalNum.Text = GetVerticalTotalNum();
        }
        private void ButPie_Click1(object sender, RoutedEventArgs e)
        {
            Simon1.Children.Clear();
            CreateChartPie1(title + "统计", strListx1, strListy1);
            int count = 0;

            for (int i = 0; i < strListy1.Count(); i++)
            {
                if (strListy1[i] != "0")
                {
                    count = 1;
                }
            }

            if (count == 0)
            {
                MessageBoxX.Show("提示", "报警次数为零!");
            }
        }
Exemplo n.º 11
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, string type, string channelIndex, string channelName, int upLevel, int topLevel, EScopeType scope, string since)
        {
            var count = 0;

            var sinceDate = DateUtils.SqlMinValue;

            if (!string.IsNullOrEmpty(since))
            {
                sinceDate = DateTime.Now.AddHours(-DateUtils.GetSinceHours(since));
            }

            if (string.IsNullOrEmpty(type) || StringUtils.EqualsIgnoreCase(type, TypeContents))
            {
                var channelId = StlDataUtility.GetChannelIdByLevel(pageInfo.SiteId, contextInfo.ChannelId, upLevel, topLevel);
                channelId = StlDataUtility.GetChannelIdByChannelIdOrChannelIndexOrChannelName(pageInfo.SiteId, channelId, channelIndex, channelName);

                var nodeInfo      = ChannelManager.GetChannelInfo(pageInfo.SiteId, channelId);
                var channelIdList = ChannelManager.GetChannelIdList(nodeInfo, scope, string.Empty, string.Empty, string.Empty);
                foreach (var theChannelId in channelIdList)
                {
                    var tableName = ChannelManager.GetTableName(pageInfo.SiteInfo, theChannelId);
                    count += Content.GetCountOfContentAdd(tableName, pageInfo.SiteId, theChannelId, EScopeType.Self, sinceDate, DateTime.Now.AddDays(1), string.Empty, ETriState.True);
                }
            }
            else if (StringUtils.EqualsIgnoreCase(type, TypeChannels))
            {
                var channelId = StlDataUtility.GetChannelIdByLevel(pageInfo.SiteId, contextInfo.ChannelId, upLevel, topLevel);
                channelId = StlDataUtility.GetChannelIdByChannelIdOrChannelIndexOrChannelName(pageInfo.SiteId, channelId, channelIndex, channelName);

                var nodeInfo = ChannelManager.GetChannelInfo(pageInfo.SiteId, channelId);
                count = nodeInfo.ChildrenCount;
            }
            else if (StringUtils.EqualsIgnoreCase(type, TypeDownloads))
            {
                if (contextInfo.ContentId > 0)
                {
                    count = CountManager.GetCount(pageInfo.SiteInfo.TableName, contextInfo.ContentId.ToString(), ECountType.Download);
                }
            }

            return(count.ToString());
        }
Exemplo n.º 12
0
        public void BindGrid()
        {
            var ie = DataProvider.PublishmentSystemDao.GetDataSource().GetEnumerator();

            while (ie.MoveNext())
            {
                var publishmentSystemId   = SqlUtils.EvalInt(ie.Current, "PublishmentSystemID");
                var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);

                var key = publishmentSystemInfo.PublishmentSystemId;
                //x轴信息
                SetXHashtable(key, publishmentSystemInfo.PublishmentSystemName);
                //y轴信息
                SetYHashtable(key, CountManager.GetCount(publishmentSystemInfo.AuxiliaryTableForContent, publishmentSystemInfo.PublishmentSystemId, ECountType.Download));
            }

            RpContents.DataSource     = DataProvider.PublishmentSystemDao.GetDataSource();
            RpContents.ItemDataBound += rpContents_ItemDataBound;
            RpContents.DataBind();
        }
Exemplo n.º 13
0
    private void Start()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        _countersDictionary = new Dictionary <CounterTag, Counter>();

        foreach (Counter counter in _counters)
        {
            _countersDictionary.Add(counter.CounterTag, counter);
        }

        UIManager.Instance.UpdateCounterText(CounterTag.Pets, _countersDictionary[CounterTag.Pets].Counter);
    }
Exemplo n.º 14
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var ltlItemTitle = (Literal)e.Item.FindControl("ltlItemTitle");
            var ltlChannel   = (Literal)e.Item.FindControl("ltlChannel");
            var ltlFileUrl   = (Literal)e.Item.FindControl("ltlFileUrl");

            var contentInfo = new ContentInfo(e.Item.DataItem);

            ltlItemTitle.Text = WebUtils.GetContentTitle(SiteInfo, contentInfo, PageUrl);

            string nodeNameNavigation;

            if (!_nodeNameNavigations.ContainsKey(contentInfo.ChannelId))
            {
                nodeNameNavigation = ChannelManager.GetChannelNameNavigation(SiteId, contentInfo.ChannelId);
                _nodeNameNavigations.Add(contentInfo.ChannelId, nodeNameNavigation);
            }
            else
            {
                nodeNameNavigation = _nodeNameNavigations[contentInfo.ChannelId] as string;
            }
            ltlChannel.Text = nodeNameNavigation;

            var fileUrl = contentInfo.GetString(BackgroundContentAttribute.FileUrl);

            if (!string.IsNullOrEmpty(fileUrl))
            {
                ltlFileUrl.Text =
                    $@"<a href=""{PageUtility.ParseNavigationUrl(SiteInfo, fileUrl, true)}"" target=""_blank"">{fileUrl}</a>";
            }

            //x轴信息
            SetXHashtable(contentInfo.Id, contentInfo.Title);
            //y轴信息
            SetYHashtable(contentInfo.Id, CountManager.GetCount(SiteInfo.TableName, contentInfo.Id.ToString(), ECountType.Download));
        }
Exemplo n.º 15
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var ltlItemTitle = (Literal)e.Item.FindControl("ltlItemTitle");
            var ltlChannel   = (Literal)e.Item.FindControl("ltlChannel");
            var ltlFileUrl   = (Literal)e.Item.FindControl("ltlFileUrl");

            var contentInfo = new BackgroundContentInfo(e.Item.DataItem);

            ltlItemTitle.Text = WebUtils.GetContentTitle(PublishmentSystemInfo, contentInfo, PageUrl);

            string nodeNameNavigation;

            if (!_nodeNameNavigations.ContainsKey(contentInfo.NodeId))
            {
                nodeNameNavigation = NodeManager.GetNodeNameNavigation(PublishmentSystemId, contentInfo.NodeId);
                _nodeNameNavigations.Add(contentInfo.NodeId, nodeNameNavigation);
            }
            else
            {
                nodeNameNavigation = _nodeNameNavigations[contentInfo.NodeId] as string;
            }
            ltlChannel.Text = nodeNameNavigation;

            ltlFileUrl.Text =
                $@"<a href=""{PageUtility.ParseNavigationUrl(PublishmentSystemInfo, contentInfo.FileUrl)}"" target=""_blank"">{contentInfo
                    .FileUrl}</a>";

            //x轴信息
            SetXHashtable(contentInfo.Id, contentInfo.Title);
            //y轴信息
            SetYHashtable(contentInfo.Id, CountManager.GetCount(PublishmentSystemInfo.AuxiliaryTableForContent, contentInfo.Id.ToString(), ECountType.Download));
        }
Exemplo n.º 16
0
        public void Main()
        {
            var isSuccess = false;

            try
            {
                var request = new AuthRequest();

                if (!string.IsNullOrEmpty(request.GetQueryString("siteId")) && !string.IsNullOrEmpty(request.GetQueryString("fileUrl")) && string.IsNullOrEmpty(request.GetQueryString("contentId")))
                {
                    var siteId  = request.GetQueryInt("siteId");
                    var fileUrl = TranslateUtils.DecryptStringBySecretKey(request.GetQueryString("fileUrl"));

                    if (PageUtils.IsProtocolUrl(fileUrl))
                    {
                        isSuccess = true;
                        PageUtils.Redirect(fileUrl);
                    }
                    else
                    {
                        var siteInfo = SiteManager.GetSiteInfo(siteId);
                        var filePath = PathUtility.MapPath(siteInfo, fileUrl);
                        var fileType = EFileSystemTypeUtils.GetEnumType(PathUtils.GetExtension(filePath));
                        if (EFileSystemTypeUtils.IsDownload(fileType))
                        {
                            if (FileUtils.IsFileExists(filePath))
                            {
                                isSuccess = true;
                                PageUtils.Download(HttpContext.Current.Response, filePath);
                            }
                        }
                        else
                        {
                            isSuccess = true;
                            PageUtils.Redirect(PageUtility.ParseNavigationUrl(siteInfo, fileUrl, false));
                        }
                    }
                }
                else if (!string.IsNullOrEmpty(request.GetQueryString("filePath")))
                {
                    var filePath = TranslateUtils.DecryptStringBySecretKey(request.GetQueryString("filePath"));
                    var fileType = EFileSystemTypeUtils.GetEnumType(PathUtils.GetExtension(filePath));
                    if (EFileSystemTypeUtils.IsDownload(fileType))
                    {
                        if (FileUtils.IsFileExists(filePath))
                        {
                            isSuccess = true;
                            PageUtils.Download(HttpContext.Current.Response, filePath);
                        }
                    }
                    else
                    {
                        isSuccess = true;
                        var fileUrl = PageUtils.GetRootUrlByPhysicalPath(filePath);
                        PageUtils.Redirect(PageUtils.ParseNavigationUrl(fileUrl));
                    }
                }
                else if (!string.IsNullOrEmpty(request.GetQueryString("siteId")) && !string.IsNullOrEmpty(request.GetQueryString("channelId")) && !string.IsNullOrEmpty(request.GetQueryString("contentId")) && !string.IsNullOrEmpty(request.GetQueryString("fileUrl")))
                {
                    var siteId      = request.GetQueryInt("siteId");
                    var channelId   = request.GetQueryInt("channelId");
                    var contentId   = request.GetQueryInt("contentId");
                    var fileUrl     = TranslateUtils.DecryptStringBySecretKey(request.GetQueryString("fileUrl"));
                    var siteInfo    = SiteManager.GetSiteInfo(siteId);
                    var nodeInfo    = ChannelManager.GetChannelInfo(siteId, channelId);
                    var tableName   = ChannelManager.GetTableName(siteInfo, nodeInfo);
                    var contentInfo = DataProvider.ContentDao.GetContentInfo(tableName, contentId);

                    if (!string.IsNullOrEmpty(contentInfo?.GetString(BackgroundContentAttribute.FileUrl)))
                    {
                        //string fileUrl = contentInfo.GetString(BackgroundContentAttribute.FileUrl);
                        if (siteInfo.Additional.IsCountDownload)
                        {
                            CountManager.AddCount(tableName, contentId.ToString(), ECountType.Download);
                        }

                        if (PageUtils.IsProtocolUrl(fileUrl))
                        {
                            isSuccess = true;
                            PageUtils.Redirect(fileUrl);
                        }
                        else
                        {
                            var filePath = PathUtility.MapPath(siteInfo, fileUrl, true);
                            var fileType = EFileSystemTypeUtils.GetEnumType(PathUtils.GetExtension(filePath));
                            if (EFileSystemTypeUtils.IsDownload(fileType))
                            {
                                if (FileUtils.IsFileExists(filePath))
                                {
                                    isSuccess = true;
                                    PageUtils.Download(HttpContext.Current.Response, filePath);
                                }
                            }
                            else
                            {
                                isSuccess = true;
                                PageUtils.Redirect(PageUtility.ParseNavigationUrl(siteInfo, fileUrl, false));
                            }
                        }
                    }
                }
            }
            catch
            {
                // ignored
            }
            if (!isSuccess)
            {
                HttpContext.Current.Response.Write("下载失败,不存在此文件!");
            }
        }
Exemplo n.º 17
0
 void Start()
 {
     cManager = GetComponent <CountManager>();
     clEvent  = GetComponent <ClickEvent>();
 }
Exemplo n.º 18
0
        private void btnCountLook_Click()
        {
            //安装汇总结构
            new CountManager().SearchInitDataGridView(Filter, cond, dgvCountList);
            //设置条件
            string idwhere = CountWhereBillIndex();
            //设置Group by 分组的字符串
            string group = "";

            for (int i = 0; i < cond.Count(); i++)
            {
                group += Filter[cond[i]] + ",";
            }
            List <Bill> bills = new CountManager().GetGroupByTotal(idwhere + " group by " + group.Substring(0, group.Length - 1) + " order by " + group.Substring(0, group.Length - 1));   //这是拿到一个总的记录集合 分类汇总的

            foreach (Bill item in bills)
            {
                //===========================下方是行数据==========================================
                string where = "";
                int index = dgvCountList.Rows.Add();                   //表格操作
                foreach (string item_cond in cond)
                {
                    string context = item.GetType().GetProperty(Filter[item_cond]).GetValue(item, null).ToString();
                    dgvCountList.Rows[index].Cells["dgvCount" + Filter[item_cond]].Value = context;   //表格操作 插入选择项内容
                    if (context == "")
                    {
                        where += " " + "(typeof(" + Filter[item_cond] + ")='null' or " + Filter[item_cond] + "='')" + " and";
                    }
                    else
                    {
                        where += " " + Filter[item_cond] + "='" + item.GetType().GetProperty(Filter[item_cond]).GetValue(item, null).ToString() + "' and";
                    }
                }
                where = "(" + where.Substring(0, where.Length - 3) + ")";
                //计算箱子数量  涉及的艘次
                List <Total> total       = new BaseService <Total>().GetRecords(where + " and " + idwhere);
                Total        countNumber = new BaseService <Total>().GetRecord(where + " and " + idwhere);
                //插入SQL到表格中
                dgvCountList.Rows[index].Cells["dgvCountSQL"].Value    = where + " and " + idwhere;       //表格操作 插入条件SQL
                dgvCountList.Rows[index].Cells["dgvCountDetail"].Value = "点击详情";                          //这里需要显示 几条船记录
                //插入到表格控件里
                //这里是明细 进出方向
                //设置一个计数器
                CaleRowNumber(index, total, countNumber);

                //=================行记录到此结束============================================================
            }
            //添加总计项目
            List <Total> countTotal   = new BaseService <Total>().GetRecords(idwhere);
            Total        countNumber2 = new BaseService <Total>().GetRecord(idwhere);
            int          countIndex   = dgvCountList.Rows.Add();

            //=============================================小计的样式
            dgvCountList.Rows[countIndex].DefaultCellStyle.Font      = new Font("宋体", 10, FontStyle.Bold); //行文字加粗
            dgvCountList.Rows[countIndex].DefaultCellStyle.BackColor = Color.Peru;                         //行背景颜色
            //=============================================
            dgvCountList.Rows[countIndex].Cells[0].Value = "总计";                                           //行标题
            for (int i = 1; i < cond.Count(); i++)                                                         //其它内容全部是""
            {
                dgvCountList.Rows[countIndex].Cells[i].Value = "";
            }
            //填充箱子数量
            CaleRowNumber(countIndex, countTotal, countNumber2);
            new CountManager().AddSmallTotal(dgvCountList, cond, Filter);
        }
Exemplo n.º 19
0
        /// <summary>
        /// 这是行是货种 列是港口的表格
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLiuXiang_Click(object sender, EventArgs e)
        {
            //行是各大货种 列是目的港  流向港

            //1.现统计大货种的分类
            List <GoodsTypeUp> goodsName = new BaseService <GoodsTypeUp>().GetRecords(" 1=1 order by Code");

            goodsNames = goodsName.OrderBy(x => x.Code).Select(x => x.Name).Distinct().ToList();  //获取所有大货种的分类名称
            //2.创建dgv表格
            dgvCountList.Rows.Clear();
            dgvCountList.Columns.Clear();
            dgvCountList.RowHeadersVisible           = false;
            dgvCountList.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;      //设置列头不能自动高度
            dgvCountList.ColumnHeadersHeight         = 30;
            dgvCountList.RowsDefaultCellStyle        = new DataGridViewCellStyle()
            {
                Alignment = DataGridViewContentAlignment.MiddleCenter
            };
            dgvCountList.Columns.Add(new DataGridViewTextBoxColumn()
            {
                HeaderText = "进出口", Width = 40
            });
            dgvCountList.Columns.Add(new DataGridViewTextBoxColumn()
            {
                HeaderText = "目的/流向", Width = 80
            });
            foreach (string item in goodsNames)
            {
                dgvCountList.Columns.Add(new DataGridViewTextBoxColumn()
                {
                    HeaderText = item, Width = 60
                });
            }
            dgvCountList.Columns.Add(new DataGridViewTextBoxColumn()
            {
                HeaderText = "合计(TEU)", Width = 80
            });
            dgvCountList.Columns.Add(new DataGridViewTextBoxColumn()
            {
                HeaderText = "吞吐量", Width = 80
            });
            //2.现统计下目的港
            string        idwhere    = CountWhereBillIndex();                                                                     //设置左侧条件
            List <Bill>   inBills    = new CountManager().GetGroupByTotal(idwhere + " and inout='出口' order by aim ");             //拿到所有出口的箱信息 按目的港排序
            List <Bill>   outBills   = new CountManager().GetGroupByTotal(idwhere + " and inout='进口' order by direction ");       //拿到所有进口的箱信息 按流向地排序
            List <string> aims       = inBills.OrderByDescending(x => x.Aim).Select(x => x.Aim).Distinct().ToList();              //目的港存入集合
            List <string> directions = outBills.OrderByDescending(x => x.Direction).Select(x => x.Direction).Distinct().ToList(); //流向港存入集合

            //先计算出口的   按目的港循环计算
            foreach (string item_aim in aims)
            {
                int index = dgvCountList.Rows.Add();
                dgvCountList.Rows[index].Cells[0].Value = "出";
                dgvCountList.Rows[index].Cells[1].Value = (item_aim == "" ? "其它" : item_aim);
                List <string> gup     = inBills.OrderByDescending(x => x.Aim == item_aim).Select(x => x.GoodsTypeUp).Distinct().ToList();
                int           totalC  = 0;
                double        weightC = 0;
                foreach (string item_gp in gup)
                {
                    int    C20    = inBills.Where(x => x.Aim == item_aim && x.GoodsTypeUp.Trim() == item_gp && x.BoxSize == "20").Count();
                    int    C40    = inBills.Where(x => x.Aim == item_aim && x.GoodsTypeUp.Trim() == item_gp && x.BoxSize == "40").Count();
                    double weight = inBills.Where(x => x.Aim == item_aim && x.GoodsTypeUp.Trim() == item_gp).Sum(x => double.Parse(x.Weight));
                    totalC  += C20 + C40 * 2;
                    weightC += weight;
                    int wz = goodsNames.IndexOf(item_gp);  //查找货种所在列位置  没找到就是其它
                    if (wz == -1 || item_gp == "其它")
                    {
                        wz = goodsNames.Count + 1;   //那就是其它
                        if (dgvCountList.Rows[index].Cells[wz].Value == null)
                        {
                            dgvCountList.Rows[index].Cells[wz].Value = C20 + C40 * 2;
                        }
                        else
                        {
                            dgvCountList.Rows[index].Cells[wz].Value = Int32.Parse(dgvCountList.Rows[index].Cells[wz].Value.ToString()) + C20 + C40 * 2;
                        }
                    }
                    else
                    {
                        wz += 2;   //位置加2就是列的位置
                        dgvCountList.Rows[index].Cells[wz].Value = C20 + C40 * 2;
                    }
                    //dgvCountList.Rows[index].Cells[wz].Value = C20+C40*2;
                }
                //总teu
                dgvCountList.Rows[index].Cells[goodsNames.Count + 2].Value = totalC;
                //总吨数
                dgvCountList.Rows[index].Cells[goodsNames.Count + 3].Value = weightC.ToString("F3");
            }
            //分界线
            dgvCountList.Rows.Add(new DataGridViewRow()
            {
                DefaultCellStyle = new DataGridViewCellStyle()
                {
                    BackColor = Color.Red
                }
            });
            //再计算进口的
            foreach (string item_directions in directions)
            {
                int index = dgvCountList.Rows.Add();
                dgvCountList.Rows[index].Cells[0].Value = "进";
                dgvCountList.Rows[index].Cells[1].Value = (item_directions == "" ? "其它" : item_directions);
                List <string> gup     = inBills.OrderByDescending(x => x.Direction == item_directions).Select(x => x.GoodsTypeUp).Distinct().ToList();
                int           totalC  = 0;
                double        weightC = 0;
                foreach (string item_gp in gup)
                {
                    int    C20    = outBills.Where(x => x.Direction == item_directions && x.GoodsTypeUp == item_gp && x.BoxSize == "20").Count();
                    int    C40    = outBills.Where(x => x.Direction == item_directions && x.GoodsTypeUp == item_gp && x.BoxSize == "40").Count();
                    double weight = outBills.Where(x => x.Direction == item_directions && x.GoodsTypeUp == item_gp).Sum(x => double.Parse(x.Weight));
                    totalC  += C20 + C40 * 2;
                    weightC += weight;
                    int wz = goodsNames.IndexOf(item_gp);  //查找货种所在列位置  没找到就是其它
                    if (wz == -1 || item_gp == "其它")
                    {
                        wz = goodsNames.Count + 1;   //那就是其它
                        if (dgvCountList.Rows[index].Cells[wz].Value == null)
                        {
                            dgvCountList.Rows[index].Cells[wz].Value = C20 + C40 * 2;
                        }
                        else
                        {
                            dgvCountList.Rows[index].Cells[wz].Value = Int32.Parse(dgvCountList.Rows[index].Cells[wz].Value.ToString()) + C20 + C40 * 2;
                        }
                    }
                    else
                    {
                        wz += 2;   //位置加2就是列的位置
                        dgvCountList.Rows[index].Cells[wz].Value = C20 + C40 * 2;
                    }
                    //dgvCountList.Rows[index].Cells[wz].Value = C20 + C40 * 2;
                }
                //总teu
                dgvCountList.Rows[index].Cells[goodsNames.Count + 2].Value = totalC;
                //总吨数
                dgvCountList.Rows[index].Cells[goodsNames.Count + 3].Value = weightC.ToString("F3");
            }
            Btn_fun = "货种流向分析";
        }
Exemplo n.º 20
0
        public static string GetContentTitle(SiteInfo siteInfo, ContentInfo contentInfo, string pageUrl)
        {
            string url;
            var    title = ContentUtility.FormatTitle(contentInfo.GetString(BackgroundContentAttribute.TitleFormatString), contentInfo.Title);

            var displayString = contentInfo.IsTop ? $"<span style='color:#ff0000;text-decoration:none' title='醒目'>{title}</span>" : title;

            if (contentInfo.ChannelId < 0)
            {
                url = displayString;
            }
            else if (contentInfo.IsChecked)
            {
                url =
                    $"<a href='{PageRedirect.GetRedirectUrlToContent(siteInfo.Id, contentInfo.ChannelId, contentInfo.Id)}' target='blank'>{displayString}</a>";
            }
            else
            {
                url =
                    $"<a href='{PageContentView.GetContentViewUrl(siteInfo.Id, contentInfo.ChannelId, contentInfo.Id, pageUrl)}'>{displayString}</a>";
            }

            var image = string.Empty;

            if (contentInfo.IsRecommend)
            {
                image += "&nbsp;<img src='../pic/icon/recommend.gif' title='推荐' align='absmiddle' border=0 />";
            }
            if (contentInfo.IsHot)
            {
                image += "&nbsp;<img src='../pic/icon/hot.gif' title='热点' align='absmiddle' border=0 />";
            }
            if (contentInfo.IsTop)
            {
                image += "&nbsp;<img src='../pic/icon/top.gif' title='置顶' align='absmiddle' border=0 />";
            }
            if (contentInfo.ReferenceId > 0)
            {
                if (contentInfo.GetString(ContentAttribute.TranslateContentType) == ETranslateContentType.ReferenceContent.ToString())
                {
                    image += "&nbsp;<img src='../pic/icon/reference.png' title='引用内容' align='absmiddle' border=0 />(引用内容)";
                }
                else if (contentInfo.GetString(ContentAttribute.TranslateContentType) != ETranslateContentType.ReferenceContent.ToString())
                {
                    image += "&nbsp;<img src='../pic/icon/reference.png' title='引用地址' align='absmiddle' border=0 />(引用地址)";
                }
            }
            if (!string.IsNullOrEmpty(contentInfo.GetString(ContentAttribute.LinkUrl)))
            {
                image += "&nbsp;<img src='../pic/icon/link.png' title='外部链接' align='absmiddle' border=0 />";
            }
            if (!string.IsNullOrEmpty(contentInfo.GetString(BackgroundContentAttribute.ImageUrl)))
            {
                var imageUrl         = PageUtility.ParseNavigationUrl(siteInfo, contentInfo.GetString(BackgroundContentAttribute.ImageUrl), true);
                var openWindowString = ModalMessage.GetOpenWindowString(siteInfo.Id, "预览图片", $"<img src='{imageUrl}' />", 500, 500);
                image +=
                    $@"&nbsp;<a href=""javascript:;"" onclick=""{openWindowString}""><img src='../assets/icons/img.gif' title='预览图片' align='absmiddle' border=0 /></a>";
            }
            if (!string.IsNullOrEmpty(contentInfo.GetString(BackgroundContentAttribute.VideoUrl)))
            {
                var openWindowString = ModalMessage.GetOpenWindowStringToPreviewVideoByUrl(siteInfo.Id, contentInfo.GetString(BackgroundContentAttribute.VideoUrl));
                image +=
                    $@"&nbsp;<a href=""javascript:;"" onclick=""{openWindowString}""><img src='../pic/icon/video.png' title='预览视频' align='absmiddle' border=0 /></a>";
            }
            if (!string.IsNullOrEmpty(contentInfo.GetString(BackgroundContentAttribute.FileUrl)))
            {
                image += "&nbsp;<img src='../pic/icon/attachment.gif' title='附件' align='absmiddle' border=0 />";
                if (siteInfo.Additional.IsCountDownload)
                {
                    var count = CountManager.GetCount(siteInfo.TableName, contentInfo.Id.ToString(), ECountType.Download);
                    image += $"下载次数:<strong>{count}</strong>";
                }
            }
            if (!string.IsNullOrEmpty(contentInfo.WritingUserName))
            {
                var openWindowString = ModalUserView.GetOpenWindowString(contentInfo.WritingUserName);
                image +=
                    $@"&nbsp;(<a href=""javascript:;"" onclick=""{openWindowString}"">投稿用户:{contentInfo.WritingUserName}</a>)";
            }
            return(url + image);
        }
Exemplo n.º 21
0
        private void btnCountLook_Click(object sender, EventArgs e)
        {
            if (lbFilter2.Items.Count <= 0)
            {
                lblFilterError.Text = "没有可汇总的选项";
                return;
            }
            string[] cond = new string[lbFilter2.Items.Count];
            Dictionary <string, int> rowNumber = new Dictionary <string, int>();

            for (int i = 0; i < lbFilter2.Items.Count; i++)
            {
                cond[i] = lbFilter2.Items[i].ToString().Substring(lbFilter2.Items[i].ToString().IndexOf('.') + 1);
                rowNumber.Add(cond[i], 0);     //行记录的数量 清0 开始
            }
            //安装汇总结构
            new CountManager().SearchInitDataGridView(Filter, cond, dgvCountList);
            //设置条件
            string idwhere = CountWhereBillIndex();
            //设置Group by 分组的字符串
            string group = "";

            for (int i = 0; i < cond.Count(); i++)
            {
                group += Filter[cond[i]] + ",";
            }
            List <Bill> bills = new CountManager().GetGroupByTotal(idwhere + " group by " + group.Substring(0, group.Length - 1) + " order by " + group.Replace("InOut", "InOut desc").Substring(0, group.Replace("InOut", "InOut desc").Length - 1));   //这是拿到一个总的记录集合 分类汇总的

            foreach (Bill item in bills)
            {
                //===========================下方是行数据==========================================
                string where = "";
                int index = dgvCountList.Rows.Add();                   //表格操作
                foreach (string item_cond in cond)
                {
                    string context = item.GetType().GetProperty(Filter[item_cond]).GetValue(item, null).ToString();
                    dgvCountList.Rows[index].Cells["dgvCount" + Filter[item_cond]].Value = context;   //表格操作 插入选择项内容
                    if (context == "")
                    {
                        where += " " + "(typeof(" + Filter[item_cond] + ")='null' or " + Filter[item_cond] + "='')" + " and";
                    }
                    else
                    {
                        where += " " + Filter[item_cond] + "='" + item.GetType().GetProperty(Filter[item_cond]).GetValue(item, null).ToString() + "' and";
                    }
                }
                where = "(" + where.Substring(0, where.Length - 3) + ")";
                //计算箱子数量  涉及的艘次
                List <Total> total       = new BaseService <Total>().GetRecords(where + " and " + idwhere);
                Total        countNumber = new BaseService <Total>().GetRecord(where + " and " + idwhere); //这个是停泊艘次和作业艘次的统计
                //插入SQL到表格中
                dgvCountList.Rows[index].Cells["dgvCountSQL"].Value    = where + " and " + idwhere;        //表格操作 插入条件SQL
                dgvCountList.Rows[index].Cells["dgvCountDetail"].Value = "点击详情";                           //这里需要显示 几条船记录
                double s1 = 0;                                                                             //货物重量
                double s2 = 0;                                                                             //总重量
                foreach (Total weightTotal in total)
                {
                    s1 += weightTotal.GoodsWeight;
                    s2 += weightTotal.TotalWeight;
                }
                dgvCountList.Rows[index].Cells["dgvCountTotalWeight"].Value = s2.ToString();
                dgvCountList.Rows[index].Cells["dgvCountGoodsWeight"].Value = s1.ToString();
                //插入到表格控件里
                //这里是明细 进出方向
                //设置一个计数器
                CaleRowNumber(index, total, countNumber);

                //=================行记录到此结束============================================================
            }
            //添加总计项目
            List <Total> countTotal   = new BaseService <Total>().GetRecords(idwhere);
            Total        countNumber2 = new BaseService <Total>().GetRecord(idwhere);
            int          countIndex   = dgvCountList.Rows.Add();

            //=============================================小计的样式
            dgvCountList.Rows[countIndex].DefaultCellStyle.Font      = new Font("宋体", 10, FontStyle.Bold); //行文字加粗
            dgvCountList.Rows[countIndex].DefaultCellStyle.BackColor = Color.Peru;                         //行背景颜色
            //=============================================
            dgvCountList.Rows[countIndex].Cells[0].Value = "总计";                                           //行标题
            for (int i = 1; i < cond.Count(); i++)                                                         //其它内容全部是""
            {
                dgvCountList.Rows[countIndex].Cells[i].Value = "";
            }
            //填充箱子数量
            CaleRowNumber(countIndex, countTotal, countNumber2);
            new CountManager().AddSmallTotal(dgvCountList, cond, Filter);
        }
Exemplo n.º 22
0
 public CountHub(CountManager countManager)
 {
     _countManager = countManager;
 }
Exemplo n.º 23
0
 private void Awake()
 {
     instance = this;
 }