示例#1
0
        static void CommunicateWithClient(object objData)
        {
            ClientData clientData = (ClientData)objData;

            string input;

            while ((input = TransferHelper.Receive(clientData.ClientSocket)) != null)
            {
                Console.WriteLine(input);
                string[] splittedData = input.Split('/');
                if (splittedData[0] == "button")
                {
                    _game.Move((int)Char.GetNumericValue(splittedData[1][1]),
                               (int)Char.GetNumericValue(splittedData[1][2]), clientData.Name == Game.TicTacToe.Players.X);
                }
                else if (splittedData[0] == "restart")
                {
                    SendAll("restart");
                    if (_isOConnected && _isXConnected)
                    {
                        SendAll("start");
                    }
                    TransferHelper.Send("turn/false", clientData.ClientSocket);
                    _game = new Game.TicTacToe();
                }

                foreach (ClientData client in _clients)
                {
                    TransferHelper.Send(input, client.ClientSocket);
                    if (clientData != client)
                    {
                        TransferHelper.Send("turn/true", client.ClientSocket);
                    }

                    if (_game.IsWinner(clientData.Name == Game.TicTacToe.Players.X))
                    {
                        TransferHelper.Send("win/" + clientData.Name + " wins the game", client.ClientSocket);
                    }
                    else if (_game.IsDraw())
                    {
                        TransferHelper.Send("draw", client.ClientSocket);
                    }
                }
            }

            clientData.ClientSocket.Shutdown(SocketShutdown.Both);
            clientData.ClientSocket.Close();
            _clients.Remove(clientData);
            Console.WriteLine($"{clientData.Name} disconnected.");

            SendAll("disconnected");
            if (clientData.Name == Game.TicTacToe.Players.X)
            {
                _isXConnected = false;
            }
            else
            {
                _isOConnected = false;
            }
        }
示例#2
0
 private void btnExport_Click(object sender, EventArgs e)
 {
     if ((!this._includeUnSales && !this._includeOnSales) && !this._includeInStock)
     {
         this.ShowMsg("至少要选择包含一个商品状态", false);
     }
     else
     {
         string selectedValue = this.dropExportVersions.SelectedValue;
         if (string.IsNullOrEmpty(selectedValue) || (selectedValue.Length == 0))
         {
             this.ShowMsg("请选择一个导出版本", false);
         }
         else
         {
             bool    includeCostPrice = false;
             bool    includeStock     = this.chkExportStock.Checked;
             bool    flag3            = true;
             string  str2             = "http://" + HttpContext.Current.Request.Url.Host + ((HttpContext.Current.Request.Url.Port == 80) ? "" : (":" + HttpContext.Current.Request.Url.Port)) + Globals.ApplicationPath;
             string  applicationPath  = Globals.ApplicationPath;
             DataSet set = ProductHelper.GetExportProducts(this.GetQuery(), includeCostPrice, includeStock, (string)this.ViewState["RemoveProductIds"]);
             TransferHelper.GetExporter(selectedValue, new object[] { set, includeCostPrice, includeStock, flag3, str2, applicationPath }).DoExport();
         }
     }
 }
示例#3
0
 private static void SendAll(string msg)
 {
     foreach (ClientData client in _clients)
     {
         TransferHelper.Send(msg, client.ClientSocket);
     }
 }
        private void btnImport_Click(object sender, System.EventArgs e)
        {
            if (!this.CheckItems())
            {
                return;
            }
            string            text          = this.dropFiles.SelectedValue;
            string            text2         = System.IO.Path.Combine(this._dataPath, System.IO.Path.GetFileNameWithoutExtension(text));
            ImportAdapter     importer      = TransferHelper.GetImporter(this.dropImportVersions.SelectedValue, new object[0]);
            int               value         = this.dropCategories.SelectedValue.Value;
            int               value2        = this.dropProductLines.SelectedValue.Value;
            int?              selectedValue = this.dropBrandList.SelectedValue;
            ProductSaleStatus saleStatus    = ProductSaleStatus.OnStock;

            text = System.IO.Path.Combine(this._dataPath, text);
            if (!System.IO.File.Exists(text))
            {
                this.ShowMsg("选择的数据包文件有问题!", false);
                return;
            }
            importer.PrepareDataFiles(new object[]
            {
                text
            });
            text2 = text2.ToLower().Replace("cpage\\supplier\\" + Hidistro.Membership.Context.HiContext.Current.User.UserId, "data");
            object[] array = importer.ParseProductData(new object[]
            {
                text2
            });
            Methods.Supplier_PtImportProducts((System.Data.DataTable)array[0], value, value2, selectedValue, saleStatus, false);
            System.IO.File.Delete(text);
            System.IO.Directory.Delete(text2, true);
            this.BindFiles();
            this.ShowMsg("此次商品批量导入操作已成功!", true);
        }
示例#5
0
    /// <summary>
    /// 设置头顶的ICON
    /// </summary>
    public override void SetHeadIcons(EHeadIcon icon_type)
    {
        TextNameBehavior textNameBehavoir = GetBehavior <TextNameBehavior>();

        if (textNameBehavoir == null)
        {
            return;
        }

        textNameBehavoir.EnableBehaviors(mVisibleCtrl.VisibleMode == EVisibleMode.Visible /* && !IsDead()*/);

        if ((icon_type & EHeadIcon.TEAM) == EHeadIcon.TEAM)
        {
            string spriteName = "";
            bool   isShow     = false;
            if (TeamManager.Instance.IsLeader(UID.obj_idx) == true)
            {
                spriteName = "MainWindow_New@TeamWindow@LeaderTag";
                isShow     = true;
            }
            else if (TeamManager.Instance.IsMember(UID.obj_idx) == true)
            {
                spriteName = "MainWindow_New@TeamWindow@MemberTag";
                isShow     = true;
            }
            textNameBehavoir.ShowTeamIcon(spriteName, isShow);
        }
        else if ((icon_type & EHeadIcon.PEAK) == EHeadIcon.PEAK)
        {
            bool isPeak = TransferHelper.IsPeak((uint)Level, TransferLv);
            textNameBehavoir.ShowPeakTeamIcon(isPeak);
        }
    }
示例#6
0
        private void PrepareZipFile(string filename)
        {
            if (string.IsNullOrEmpty(filename) || filename.Length == 0)
            {
                this.chkFlag.Checked = false;
                this.txtPTXml.Text   = string.Empty;
                return;
            }
            filename = System.IO.Path.Combine(this._dataPath, filename);
            if (!System.IO.File.Exists(filename))
            {
                this.chkFlag.Checked = false;
                this.txtPTXml.Text   = string.Empty;
                return;
            }
            ImportAdapter importer = TransferHelper.GetImporter(this.dropImportVersions.SelectedValue, new object[0]);
            string        text     = importer.PrepareDataFiles(new object[]
            {
                filename
            });

            object[] array = importer.ParseIndexes(new object[]
            {
                text
            });
            this.lblVersion.Text             = (string)array[0];
            this.lblQuantity.Text            = array[1].ToString();
            this.chkIncludeCostPrice.Checked = (bool)array[2];
            this.chkIncludeStock.Checked     = (bool)array[3];
            this.chkIncludeImages.Checked    = (bool)array[4];
            this.txtPTXml.Text   = (string)array[5];
            this.chkFlag.Checked = true;
        }
示例#7
0
        private void btn_getMin_Click(object sender, EventArgs e)
        {
            if (cmb_abSearches.SelectedValue + "" == "-1")
            {
                MessageBox.Show("Select a search");
                return;
            }
            if (cmb_accounts.SelectedValue + "" == "-1")
            {
                MessageBox.Show("Login And select a account to run search with");
                return;
            }

            lbl_minResult.Visible = true;

            var playerSearchCriteria = SearchDAL.GetSearch <PlayerSearchCriteria>(cmb_abSearches.SelectedValue);
            var userCrendential      = UserDAL.GetUser(cmb_accounts.SelectedValue);

            var loginResult = LoginAccount(userCrendential);

            if (loginResult == "Loggedin Successfully")
            {
                TransferHelper helper          = new TransferHelper(userCrendential);
                var            minPriceResults = helper.GetMinPrice(playerSearchCriteria);
                grd_minPrices.DataSource = minPriceResults;
                grd_minPrices.Visible    = true;
                lbl_minResult.Text       = $"Top {minPriceResults.Count} Min Price for the search";
            }
            else
            {
                MessageBox.Show("Error occured when trying to login");
            }
        }
示例#8
0
        private void btnExport_Click(object sender, System.EventArgs e)
        {
            if (!this._includeUnSales && !this._includeOnSales && !this._includeInStock)
            {
                this.ShowMsg("至少要选择包含一个商品状态", false);
                return;
            }
            string selectedValue = this.dropExportVersions.SelectedValue;

            if (!string.IsNullOrEmpty(selectedValue) && selectedValue.Length != 0)
            {
                bool   flag                        = false;
                bool   @checked                    = this.chkExportStock.Checked;
                bool   flag2                       = true;
                string text                        = "http://" + System.Web.HttpContext.Current.Request.Url.Host + ((System.Web.HttpContext.Current.Request.Url.Port == 80) ? "" : (":" + System.Web.HttpContext.Current.Request.Url.Port)) + Globals.ApplicationPath;
                string applicationPath             = Globals.ApplicationPath;
                System.Data.DataSet exportProducts = ProductHelper.GetExportProducts(this.GetQuery(), flag, @checked, (string)this.ViewState["RemoveProductIds"]);
                ExportAdapter       exporter       = TransferHelper.GetExporter(selectedValue, new object[]
                {
                    exportProducts,
                    flag,
                    @checked,
                    flag2,
                    text,
                    applicationPath
                });
                exporter.DoExport();
                return;
            }
            this.ShowMsg("请选择一个导出版本", false);
        }
示例#9
0
 private void PrepareZipFile(string filename)
 {
     if (string.IsNullOrEmpty(filename) || (filename.Length == 0))
     {
         chkFlag.Checked = false;
         txtPTXml.Text   = string.Empty;
     }
     else
     {
         filename = Path.Combine(_dataPath, filename);
         if (!File.Exists(filename))
         {
             chkFlag.Checked = false;
             txtPTXml.Text   = string.Empty;
         }
         else
         {
             ImportAdapter importer = TransferHelper.GetImporter(dropImportVersions.SelectedValue, new object[0]);
             string        str      = importer.PrepareDataFiles(new object[] { filename });
             object[]      objArray = importer.ParseIndexes(new object[] { str });
             lblVersion.Text             = (string)objArray[0];
             lblQuantity.Text            = objArray[1].ToString();
             chkIncludeCostPrice.Checked = (bool)objArray[2];
             chkIncludeStock.Checked     = (bool)objArray[3];
             chkIncludeImages.Checked    = (bool)objArray[4];
             txtPTXml.Text   = (string)objArray[5];
             chkFlag.Checked = true;
         }
     }
 }
示例#10
0
        private void RunUserSearches(UserCredential userCredential)
        {
            TransferHelper helper = new TransferHelper(userCredential);

            while (GetUserStatus(userCredential.Id) == "Loggedin Successfully")
            {
                try
                {
                    foreach (var search in userCredential.PlayerSearchCriterias)
                    {
                        if (search.ABSetting == null && search.SettingId != null)
                        {
                            search.ABSetting = SettingDAL.GetSetting(search.SettingId);
                        }
                        if (!string.IsNullOrEmpty(search.ABSetting.BuyPrice))
                        {
                            helper.SnipeCard(search);
                        }

                        if (search.ABSetting.SellTransferList)
                        {
                            helper.SellCards();
                        }
                    }
                }
                catch (Exception)
                {
                    continue;
                }
            }
        }
示例#11
0
 public ApiTransferPaymentProcessor(string text, string value)
 {
     this.text           = text;
     this.value          = value;
     this.transferableTo = TransferHelper.GetAvailableListItems(value).
                           Select(elem => new ApiPaymentProcessor(elem.Text, elem.Value)).ToList();
 }
示例#12
0
 private void WriteIndexes(XmlWriter indexWriter)
 {
     indexWriter.WriteStartElement("types");
     foreach (DataRow row in this._exportData.Tables["types"].Rows)
     {
         indexWriter.WriteStartElement("type");
         indexWriter.WriteElementString("typeId", row["TypeId"].ToString());
         TransferHelper.WriteCDataElement(indexWriter, "typeName", row["TypeName"].ToString());
         TransferHelper.WriteCDataElement(indexWriter, "remark", row["Remark"].ToString());
         indexWriter.WriteStartElement("attributes");
         foreach (DataRow row2 in this._exportData.Tables["attributes"].Select("TypeId=" + row["TypeId"].ToString()))
         {
             indexWriter.WriteStartElement("attribute");
             indexWriter.WriteElementString("attributeId", row2["AttributeId"].ToString());
             TransferHelper.WriteCDataElement(indexWriter, "attributeName", row2["AttributeName"].ToString());
             indexWriter.WriteElementString("displaySequence", row2["DisplaySequence"].ToString());
             indexWriter.WriteElementString("usageMode", row2["UsageMode"].ToString());
             indexWriter.WriteStartElement("values");
             foreach (DataRow row3 in this._exportData.Tables["values"].Select("AttributeId=" + row2["AttributeId"].ToString()))
             {
                 indexWriter.WriteStartElement("value");
                 TransferHelper.WriteCDataElement(indexWriter, "valueStr", row3["ValueStr"].ToString());
                 indexWriter.WriteEndElement();
             }
             indexWriter.WriteEndElement();
             indexWriter.WriteEndElement();
         }
         indexWriter.WriteEndElement();
         indexWriter.WriteEndElement();
     }
     indexWriter.WriteEndElement();
     this._exportData.Tables.Remove("types");
 }
        private void WriteIndexes(XmlWriter indexWriter)
        {
            indexWriter.WriteStartElement("types");
            DataSet set = this.ReadySkuData();

            foreach (DataRow row in this._exportData.Tables["types"].Rows)
            {
                indexWriter.WriteStartElement("type");
                indexWriter.WriteElementString("typeId", row["TypeId"].ToString());
                TransferHelper.WriteCDataElement(indexWriter, "typeName", row["TypeName"].ToString());
                TransferHelper.WriteCDataElement(indexWriter, "remark", row["Remark"].ToString());
                indexWriter.WriteStartElement("attributes");
                foreach (DataRow row2 in this._exportData.Tables["attributes"].Select("TypeId=" + row["TypeId"].ToString()))
                {
                    indexWriter.WriteStartElement("attribute");
                    indexWriter.WriteElementString("attributeId", row2["AttributeId"].ToString());
                    TransferHelper.WriteCDataElement(indexWriter, "attributeName", row2["AttributeName"].ToString());
                    indexWriter.WriteElementString("displaySequence", row2["DisplaySequence"].ToString());
                    indexWriter.WriteElementString("usageMode", row2["UsageMode"].ToString());
                    indexWriter.WriteStartElement("values");
                    foreach (DataRow row3 in this._exportData.Tables["values"].Select("AttributeId=" + row2["AttributeId"].ToString()))
                    {
                        indexWriter.WriteStartElement("value");
                        TransferHelper.WriteCDataElement(indexWriter, "valueStr", row3["ValueStr"].ToString());
                        indexWriter.WriteEndElement();
                    }
                    indexWriter.WriteEndElement();
                    indexWriter.WriteEndElement();
                }
                foreach (DataRow row4 in set.Tables["attributes"].Select("typeId='" + row["TypeId"].ToString() + "'", "attributeId asc"))
                {
                    IList <string> list = new List <string>();
                    indexWriter.WriteStartElement("attribute");
                    indexWriter.WriteElementString("attributeId", row4["AttributeId"].ToString());
                    TransferHelper.WriteCDataElement(indexWriter, "attributeName", row4["AttributeName"].ToString());
                    indexWriter.WriteElementString("displaySequence", row4["DisplaySequence"].ToString());
                    indexWriter.WriteElementString("usageMode", row4["UsageMode"].ToString());
                    indexWriter.WriteStartElement("values");
                    foreach (DataRow row5 in set.Tables["values"].Select("AttributeId=" + row4["AttributeId"].ToString()))
                    {
                        if (!list.Contains(row5["ValueStr"].ToString().Trim()))
                        {
                            indexWriter.WriteStartElement("value");
                            TransferHelper.WriteCDataElement(indexWriter, "valueStr", row5["ValueStr"].ToString());
                            indexWriter.WriteEndElement();
                            list.Add(row5["ValueStr"].ToString().Trim());
                        }
                    }
                    indexWriter.WriteEndElement();
                    indexWriter.WriteEndElement();
                }
                indexWriter.WriteEndElement();
                indexWriter.WriteEndElement();
            }
            indexWriter.WriteEndElement();
            this._exportData.Tables.Remove("types");
        }
示例#14
0
 private void btnImport_Click(object sender, System.EventArgs e)
 {
     if (this.CheckItems())
     {
         string              selectedValue = this.dropFiles.SelectedValue;
         string              path          = System.IO.Path.Combine(this._dataPath, System.IO.Path.GetFileNameWithoutExtension(selectedValue));
         ImportAdapter       importer      = TransferHelper.GetImporter(this.dropImportVersions.SelectedValue, new object[0]);
         System.Data.DataSet mappingSet    = null;
         if (this.txtMappedTypes.Text.Length > 0)
         {
             XmlDocument document = new XmlDocument();
             document.LoadXml(this.txtMappedTypes.Text);
             mappingSet = (importer.CreateMapping(new object[]
             {
                 document,
                 path
             })[0] as System.Data.DataSet);
             ProductHelper.EnsureMapping(mappingSet);
         }
         bool includeCostPrice    = this.chkIncludeCostPrice.Checked;
         bool includeStock        = this.chkIncludeStock.Checked;
         bool includeImages       = this.chkIncludeImages.Checked;
         int  categoryId          = this.dropCategories.SelectedValue.Value;
         int? bandId              = this.dropBrandList.SelectedValue;
         ProductSaleStatus delete = ProductSaleStatus.Delete;
         if (this.radInStock.Checked)
         {
             delete = ProductSaleStatus.OnStock;
         }
         if (this.radUnSales.Checked)
         {
             delete = ProductSaleStatus.UnSale;
         }
         if (this.radOnSales.Checked)
         {
             delete = ProductSaleStatus.OnSale;
         }
         ProductHelper.ImportProducts((System.Data.DataSet)importer.ParseProductData(new object[]
         {
             mappingSet,
             path,
             includeCostPrice,
             includeStock,
             includeImages
         })[0], categoryId, 0, bandId, delete, includeCostPrice, includeStock, includeImages);
         System.IO.File.Delete(System.IO.Path.Combine(this._dataPath, selectedValue));
         System.IO.Directory.Delete(path, true);
         this.chkFlag.Checked        = false;
         this.txtMappedTypes.Text    = string.Empty;
         this.txtProductTypeXml.Text = string.Empty;
         this.txtPTXml.Text          = string.Empty;
         this.OutputProductTypes();
         this.BindFiles();
         this.ShowMsg("此次商品批量导入操作已成功!", true);
     }
 }
示例#15
0
 protected void btnImport_Click(object sender, EventArgs e)
 {
     //try
     //{
     if (CheckItems())
     {
         string        selectedValue = dropFiles.SelectedValue;
         string        path          = Path.Combine(_dataPath, Path.GetFileNameWithoutExtension(selectedValue));
         ImportAdapter importer      = TransferHelper.GetImporter(dropImportVersions.SelectedValue, new object[0]);
         DataSet       mappingSet    = null;
         if (txtMappedTypes.Text.Length > 0)
         {
             XmlDocument document = new XmlDocument();
             document.LoadXml(txtMappedTypes.Text);
             mappingSet = importer.CreateMapping(new object[] { document, path })[0] as DataSet;
             ProductHelper.EnsureMapping(mappingSet);
         }
         bool includeCostPrice    = chkIncludeCostPrice.Checked;
         bool includeStock        = chkIncludeStock.Checked;
         bool includeImages       = chkIncludeImages.Checked;
         int  categoryId          = dropCategories.SelectedValue.Value;
         int  lineId              = dropProductLines.SelectedValue.Value;
         int? bandId              = dropBrandList.SelectedValue;
         ProductSaleStatus delete = ProductSaleStatus.Delete;
         if (radInStock.Checked)
         {
             delete = ProductSaleStatus.OnStock;
         }
         if (radUnSales.Checked)
         {
             delete = ProductSaleStatus.UnSale;
         }
         if (radOnSales.Checked)
         {
             delete = ProductSaleStatus.OnSale;
         }
         ProductHelper.ImportProducts((DataSet)importer.ParseProductData(new object[] { mappingSet, path, includeCostPrice, includeStock, includeImages })[0], categoryId, lineId, bandId, delete, includeCostPrice, includeStock, includeImages);
         if (chkDeleteFiles.Checked)
         {
             File.Delete(Path.Combine(_dataPath, selectedValue));
             Directory.Delete(path, true);
         }
         chkFlag.Checked        = false;
         txtMappedTypes.Text    = string.Empty;
         txtProductTypeXml.Text = string.Empty;
         txtPTXml.Text          = string.Empty;
         OutputProductTypes();
         BindFiles();
         ShowMsg("此次商品批量导入操作已成功!", true);
     }
     //}
     //catch (Exception ex)
     //{
     //    ShowMsg("导入失败,请检查数据包格式是否正确",false);
     // }
 }
示例#16
0
 private void BindExporter()
 {
     this.dropExportVersions.Items.Clear();
     this.dropExportVersions.Items.Add(new System.Web.UI.WebControls.ListItem("-请选择-", ""));
     System.Collections.Generic.Dictionary <string, string> exportAdapters = TransferHelper.GetExportAdapters(new YfxTarget("1.2"), "淘宝助理");
     foreach (string str in exportAdapters.Keys)
     {
         this.dropExportVersions.Items.Add(new System.Web.UI.WebControls.ListItem(exportAdapters[str], str));
     }
 }
示例#17
0
 private void BindImporters()
 {
     this.dropImportVersions.Items.Clear();
     this.dropImportVersions.Items.Add(new System.Web.UI.WebControls.ListItem("-请选择-", ""));
     System.Collections.Generic.Dictionary <string, string> importAdapters = TransferHelper.GetImportAdapters(new YfxTarget("1.2"), "淘宝助理");
     foreach (string current in importAdapters.Keys)
     {
         this.dropImportVersions.Items.Add(new System.Web.UI.WebControls.ListItem(importAdapters[current], current));
     }
 }
示例#18
0
        private void BindImporters()
        {
            this.dropImportVersions.Items.Clear();
            this.dropImportVersions.Items.Add(new ListItem("请选择插件版本", ""));
            Dictionary <string, string> importAdapters = TransferHelper.GetImportAdapters(new YfxTarget("1.2"), "淘宝助理");

            foreach (string key in importAdapters.Keys)
            {
                this.dropImportVersions.Items.Add(new ListItem(importAdapters[key], key));
            }
        }
        private void BindImporters()
        {
            this.dropImportVersions.Items.Clear();
            this.dropImportVersions.Items.Add(new ListItem("-请选择-", ""));
            Dictionary <string, string> importAdapters = TransferHelper.GetImportAdapters(new YfxTarget("1.2"), "拍拍助理");

            foreach (string str in importAdapters.Keys)
            {
                this.dropImportVersions.Items.Add(new ListItem(importAdapters[str].Replace("4.0", "2013"), str));
            }
        }
示例#20
0
        private void BindExporter()
        {
            dropExportVersions.Items.Clear();
            dropExportVersions.Items.Add(new ListItem("-请选择-", ""));
            Dictionary <string, string> exportAdapters = TransferHelper.GetExportAdapters(new YfxTarget("1.2"), "拍拍助理");

            foreach (string str in exportAdapters.Keys)
            {
                dropExportVersions.Items.Add(new ListItem(exportAdapters[str], str));
            }
        }
示例#21
0
        private void BindImporters()
        {
            dropImportVersions.Items.Clear();
            dropImportVersions.Items.Add(new ListItem("-请选择-", ""));
            Dictionary <string, string> importAdapters = TransferHelper.GetImportAdapters(new YfxTarget("1.2"), "Hishop");

            foreach (string str in importAdapters.Keys)
            {
                dropImportVersions.Items.Add(new ListItem(importAdapters[str], str));
            }
        }
示例#22
0
    protected void SetRadioToValues()
    {
        RadioTo.Items.Clear();

        if (!string.IsNullOrEmpty(RadioFrom.SelectedValue))
        {
            RadioTo.Items.AddRange(TransferHelper.GetAvailableListItems(RadioFrom.SelectedValue));
        }

        SetRadioItemsValues(RadioTo);
        RemoveDuplicatesFromList();
    }
示例#23
0
        public ActionResult Challenge(string challengeId, string challengeName)
        {
            using (var db = new DataContext())
            {
                Challenge challenge = db.Challenges.Find(challengeId);

                var result = (ChallengeTransport)TransferHelper.ChallengeTransport(challenge);


                return(View(result));
            }
        }
示例#24
0
        private void Mainform_Load(object sender, EventArgs e)
        {
            _transferHelper = new TransferHelper();

            var td = new Thread(new ThreadStart(new Action(() =>
            {
                while (!this.IsDisposed)
                {
                    try
                    {
                        SystemInfo systemInfo = new SystemInfo();

                        var cpu = $"核心数:{systemInfo.ProcessorCount}个 使用率:{systemInfo.CpuLoad}%";

                        var mem = $"{StringExtention.ToFormatString(systemInfo.MemoryAvailable)}/{StringExtention.ToFormatString(systemInfo.PhysicalMemory)}";

                        var sb = new StringBuilder();

                        var hds = systemInfo.GetLogicalDrives();

                        foreach (var item in hds)
                        {
                            sb.Append($"{item.Name}盘 {StringExtention.ToFormatString(item.FreeSpace)}/{StringExtention.ToFormatString(item.Size)} \t");
                        }

                        try
                        {
                            this.Invoke(new Action(() =>
                            {
                                label8.Text  = cpu;
                                label9.Text  = mem;
                                label10.Text = sb.ToString();
                            }));
                        }
                        catch { }
                    }
                    catch (Exception ex)
                    {
                        break;
                    }

                    Thread.Sleep(1000);
                }
            })));

            td.IsBackground = true;
            td.Start();

            NetMonitor();
        }
示例#25
0
        private void btnImport_Click(object sender, System.EventArgs e)
        {
            if (!this.CheckItems())
            {
                return;
            }
            string            text          = this.dropFiles.SelectedValue;
            string            text2         = System.IO.Path.Combine(this._dataPath, System.IO.Path.GetFileNameWithoutExtension(text));
            ImportAdapter     importer      = TransferHelper.GetImporter(this.dropImportVersions.SelectedValue, new object[0]);
            int               value         = this.dropCategories.SelectedValue.Value;
            int?              selectedValue = this.dropBrandList.SelectedValue;
            ProductSaleStatus saleStatus    = ProductSaleStatus.Delete;

            if (this.radInStock.Checked)
            {
                saleStatus = ProductSaleStatus.OnStock;
            }
            if (this.radUnSales.Checked)
            {
                saleStatus = ProductSaleStatus.UnSale;
            }
            if (this.radOnSales.Checked)
            {
                saleStatus = ProductSaleStatus.OnSale;
            }
            text = System.IO.Path.Combine(this._dataPath, text);
            if (!System.IO.File.Exists(text))
            {
                this.ShowMsg("选择的数据包文件有问题!", false);
                return;
            }
            this.PrepareDataFiles(text2, text);
            try
            {
                object[] array = importer.ParseProductData(new object[]
                {
                    text2
                });
                ProductHelper.ImportProducts((System.Data.DataTable)array[0], value, 0, selectedValue, saleStatus, true);
                System.IO.File.Delete(text);
                System.IO.Directory.Delete(text2, true);
                this.BindFiles();
                this.ShowMsg("此次商品批量导入操作已成功!", true);
            }
            catch (System.Exception)
            {
                this.ShowMsg("选择的数据包文件有问题!", false);
            }
        }
示例#26
0
        private void btnImport_Click(object sender, System.EventArgs e)
        {
            if (!this.CheckItems())
            {
                return;
            }
            string        selectedValue = this.dropFiles.SelectedValue;
            string        text          = System.IO.Path.Combine(this._dataPath, System.IO.Path.GetFileNameWithoutExtension(selectedValue));
            ImportAdapter importer      = TransferHelper.GetImporter(this.dropImportVersions.SelectedValue, new object[0]);

            text = text.ToLower().Replace("cpage\\supplier\\" + Hidistro.Membership.Context.HiContext.Current.User.UserId, "data");
            System.Data.DataSet dataSet = null;
            if (this.txtMappedTypes.Text.Length > 0)
            {
                System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
                xmlDocument.LoadXml(this.txtMappedTypes.Text);
                dataSet = (importer.CreateMapping(new object[]
                {
                    xmlDocument,
                    text
                })[0] as System.Data.DataSet);
                ProductHelper.EnsureMapping(dataSet);
            }
            bool @checked       = this.chkIncludeCostPrice.Checked;
            bool checked2       = this.chkIncludeStock.Checked;
            bool checked3       = this.chkIncludeImages.Checked;
            int  value          = this.dropCategories.SelectedValue.Value;
            int  value2         = this.dropProductLines.SelectedValue.Value;
            int? selectedValue2 = this.dropBrandList.SelectedValue;

            object[] array = importer.ParseProductData(new object[]
            {
                dataSet,
                text,
                @checked,
                checked2,
                checked3
            });
            Methods.Supplier_PtImportProducts((System.Data.DataSet)array[0], value, value2, selectedValue2, ProductSaleStatus.OnStock, @checked, checked2, checked3);
            System.IO.File.Delete(System.IO.Path.Combine(this._dataPath, selectedValue));
            System.IO.Directory.Delete(text, true);
            this.chkFlag.Checked        = false;
            this.txtMappedTypes.Text    = string.Empty;
            this.txtProductTypeXml.Text = string.Empty;
            this.txtPTXml.Text          = string.Empty;
            this.OutputProductTypes();
            this.BindFiles();
            this.ShowMsg("此次商品批量导入操作已成功!", true);
        }
示例#27
0
            /// <summary>
            /// 刷新角色选择列表按钮的显示
            /// </summary>
            public void UpdateButtonList()
            {
                for (int i = 0; i < ACTOR_MAX_NUM; ++i)
                {
                    Transform btn_trans    = mActorButton[i].transform;
                    Transform select_trans = btn_trans.Find("Select");
                    Transform create_trans = btn_trans.Find("Create");

                    // 当前具备的角色数据
                    if (i < mData.Count)
                    {
                        select_trans.gameObject.SetActive(true);
                        create_trans.gameObject.SetActive(false);

                        string name = System.Text.Encoding.UTF8.GetString(mData[i].name);
                        select_trans.Find("Normal/NameText").GetComponent <Text>().text   = name;
                        select_trans.Find("Selected/NameText").GetComponent <Text>().text = name;

                        uint peakLevel = 0;
                        bool isPeak    = TransferHelper.IsPeak(mData[i].level, out peakLevel, mData[i].transfer);
                        if (isPeak == true)
                        {
                            select_trans.Find("Normal/LevelPanel/PeakLevelIconImage").gameObject.SetActive(true);
                            select_trans.Find("Selected/LevelPanel/PeakLevelIconImage").gameObject.SetActive(true);
                            select_trans.Find("Normal/LevelPanel/LevelText").GetComponent <Text>().text   = peakLevel.ToString();
                            select_trans.Find("Selected/LevelPanel/LevelText").GetComponent <Text>().text = peakLevel.ToString();
                        }
                        else
                        {
                            select_trans.Find("Normal/LevelPanel/PeakLevelIconImage").gameObject.SetActive(false);
                            select_trans.Find("Selected/LevelPanel/PeakLevelIconImage").gameObject.SetActive(false);
                            select_trans.Find("Normal/LevelPanel/LevelText").GetComponent <Text>().text   = "LV." + peakLevel.ToString();
                            select_trans.Find("Selected/LevelPanel/LevelText").GetComponent <Text>().text = "LV." + peakLevel.ToString();
                        }
                    }
                    // 还有可创建的空位
                    else if (i < Game.GetInstance().CharactorMaxCount)
                    {
                        select_trans.gameObject.SetActive(false);
                        create_trans.gameObject.SetActive(true);
                    }
                    // 剩下的不能创建
                    else
                    {
                        select_trans.gameObject.SetActive(false);
                        create_trans.gameObject.SetActive(true);
                    }
                }
            }
示例#28
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            string selectedValue = dropExportVersions.SelectedValue;

            if (string.IsNullOrEmpty(selectedValue) || (selectedValue.Length == 0))
            {
                ShowMsg("请选择一个导出版本", false);
            }
            else
            {
                bool    includeCostPrice = false;
                bool    includeStock     = chkExportStock.Checked;
                DataSet exportData       = ProductHelper.GetExportProducts(GetQuery(), includeCostPrice, includeStock, (string)ViewState["RemoveProductIds"]);
                TransferHelper.GetExporter(selectedValue, exportData, includeCostPrice, includeStock, true).DoExport();
            }
        }
示例#29
0
 private void btnImport_Click(object sender, System.EventArgs e)
 {
     if (this.CheckItems())
     {
         string            selectedValue = this.dropFiles.SelectedValue;
         string            path          = System.IO.Path.Combine(this._dataPath, System.IO.Path.GetFileNameWithoutExtension(selectedValue));
         ImportAdapter     importer      = TransferHelper.GetImporter(this.dropImportVersions.SelectedValue, new object[0]);
         int               categoryId    = this.dropCategories.SelectedValue.Value;
         int?              brandId       = this.dropBrandList.SelectedValue;
         ProductSaleStatus delete        = ProductSaleStatus.Delete;
         if (this.radInStock.Checked)
         {
             delete = ProductSaleStatus.OnStock;
         }
         if (this.radUnSales.Checked)
         {
             delete = ProductSaleStatus.UnSale;
         }
         if (this.radOnSales.Checked)
         {
             delete = ProductSaleStatus.OnSale;
         }
         selectedValue = System.IO.Path.Combine(this._dataPath, selectedValue);
         if (!System.IO.File.Exists(selectedValue))
         {
             this.ShowMsg("选择的数据包文件有问题!", false);
         }
         else
         {
             importer.PrepareDataFiles(new object[] { selectedValue });
             try
             {
                 ProductHelper.ImportProducts((System.Data.DataTable)importer.ParseProductData(new object[] { path })[0], categoryId, 0, brandId, delete, false);
                 System.IO.File.Delete(selectedValue);
                 System.IO.Directory.Delete(path, true);
                 this.BindFiles();
                 this.ShowMsg("此次商品批量导入操作已成功!", true);
             }
             catch
             {
                 System.IO.File.Delete(selectedValue);
                 System.IO.Directory.Delete(path, true);
                 this.ShowMsg("选择的数据包文件有问题!", false);
             }
         }
     }
 }
示例#30
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            string selectedValue = this.dropExportVersions.SelectedValue;

            if (string.IsNullOrEmpty(selectedValue) || (selectedValue.Length == 0))
            {
                this.ShowMsg("请选择一个导出版本", false);
            }
            else
            {
                bool    includeCostPrice = false;
                bool    includeStock     = this.chkExportStock.Checked;
                bool    flag3            = true;
                DataSet set = SubSiteProducthelper.GetExportProducts(this.GetQuery(), includeCostPrice, includeStock, (string)this.ViewState["RemoveProductIds"]);
                TransferHelper.GetExporter(selectedValue, new object[] { set, includeCostPrice, includeStock, flag3 }).DoExport();
            }
        }