Exemple #1
0
        private void btnMyRoom_Click(object sender, EventArgs e)
        {
            OpenFileDialog diaFile = new OpenFileDialog();

            diaFile.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath);
            diaFile.CheckFileExists  = true;
            diaFile.Filter           = "xlsx|*.xlsx";
            diaFile.ShowDialog();

            string strFilePath = diaFile.FileName;

            if (string.IsNullOrEmpty(strFilePath))
            {
                return;
            }

            //读取蓝图数据
            Classes.CEVEMarketFile.ExcelWorkingReader(strFilePath);
            //读取矿价
            Classes.CEVEMarketAPI.SearchChart();

            //查询用对象
            List <Objects.SearchingItem> lstSeach = new List <Objects.SearchingItem>();

            foreach (Objects.T1Product Item in Classes.CEVEMarketFile.lstT1Item)
            {
                Objects.SearchingItem newSearch = new Objects.SearchingItem();
                newSearch.Name      = Item.Name;
                newSearch.Volume    = Item.Volume;
                newSearch.BasePrice =
                    Item.Tri * Classes.CEVEMarketAPI.baseChart.Tri +
                    Item.Pye * Classes.CEVEMarketAPI.baseChart.Pye +
                    Item.Mex * Classes.CEVEMarketAPI.baseChart.Mex +
                    Item.Iso * Classes.CEVEMarketAPI.baseChart.Iso +
                    Item.Noc * Classes.CEVEMarketAPI.baseChart.Noc +
                    Item.Zyd * Classes.CEVEMarketAPI.baseChart.Zyd +
                    Item.Meg * Classes.CEVEMarketAPI.baseChart.Meg;

                newSearch.BasePrice = newSearch.BasePrice / Item.Volume;
                lstSeach.Add(newSearch);
            }

            //查询,设置,显示
            Classes.CEVEMarketAPI.SearchPrice(lstSeach);
            if (Classes.CEVEMarketAPI.lstResult.Count == 0)
            {
                return;
            }

            frmT1 frmResult = new frmT1();

            frmResult.SearchResult = Classes.CEVEMarketAPI.lstResult;
            frmResult.Show();
        }
Exemple #2
0
        private void btnMoon_Click(object sender, EventArgs e)
        {
            OpenFileDialog diaFile = new OpenFileDialog();

            diaFile.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath);
            diaFile.CheckFileExists  = true;
            diaFile.Filter           = "xlsx|*.xlsx";
            diaFile.ShowDialog();

            string strFilePath = diaFile.FileName;

            if (string.IsNullOrEmpty(strFilePath))
            {
                return;
            }

            //读取蓝图数据
            Classes.CEVEMarketFile.ExcelMoonChart(strFilePath);

            //查询用对象
            List <Objects.SearchingItem> lstSeach = new List <Objects.SearchingItem>();

            List <string> lstSourceName = new List <string>();

            foreach (Objects.OreCommon Item in Classes.CEVEMarketFile.lstOreCommon)
            {
                Objects.SearchingItem objSearch = new Objects.SearchingItem();
                objSearch.Name = Item.Name;

                foreach (string strSourceName in Item.Items.Keys)
                {
                    if (!lstSourceName.Contains(strSourceName))
                    {
                        lstSourceName.Add(strSourceName);
                    }
                }
                lstSeach.Add(objSearch);
            }

            foreach (string strName in lstSourceName)
            {
                lstSeach.Add(new Objects.SearchingItem()
                {
                    Name = strName
                });
            }

            //查询,设置,显示
            Classes.CEVEMarketAPI.SearchPrice(lstSeach);

            foreach (Objects.OreCommon Item in Classes.CEVEMarketFile.lstOreCommon)
            {
                double dBasePrice = 0;
                Objects.SearchingResult IceItem = Classes.CEVEMarketAPI.lstResult.Find(X => X.Name == Item.Name);
                foreach (string strKeys in Item.Items.Keys)
                {
                    //组件
                    Objects.SearchingResult result = Classes.CEVEMarketAPI.lstResult.Find(X => X.Name == strKeys);
                    if (result != null)
                    {
                        //冰矿收单价
                        dBasePrice += double.Parse(result.Buy1) * Item.Items[strKeys];
                    }
                }
                //平均成本
                IceItem.BasePrice = (dBasePrice * 0.697) / 100;
            }

            frmIce frmResult = new frmIce();

            frmResult.SearchResult = Classes.CEVEMarketAPI.lstResult;
            frmResult.Show();
        }