コード例 #1
0
ファイル: Form1.cs プロジェクト: zhangyulin/AsNum.Xmj
        private async Task Publish(DestAccount account)
        {
            this.Log("偿试发布到账户:{0}", account.User);
            var api     = new APIClient(account.User, account.Pwd);
            var product = (this.ppgProduct.SelectedObject as Product).SerializeCopy();

            await this.ReplaceImage(api, product);

            //替换产品组和运费模板
            product.ProductGroup      = account.ProductGroup.ID;
            product.FreightTemplateID = account.FrightTemplate.ID;

            var method = new ProductNewProduct()
            {
                ProductDetail = product
            };

            var result = await api.Execute(method);

            if (result.Success)
            {
                MessageBox.Show(string.Format("Copy 到 {0} 成功", account.User));
            }
            else
            {
                MessageBox.Show(method.ResultString, string.Format("Copy 到 {0} 失败", account.User));
            }

            //Thread.CurrentThread.Interrupt();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: zhangyulin/AsNum.Xmj
        private void DealAccount(DestAccount account)
        {
            var da = this.DestAccounts.FirstOrDefault(a => a.User.Equals(account.User));

            if (da != null)
            {
                this.DestAccounts.Remove(da);
            }
            this.DestAccounts.Add(account);
        }
コード例 #3
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     this.Account = new DestAccount()
     {
         User             = this.txtUser.Text.Trim(),
         Pwd              = this.txtPwd.Text.Trim(),
         ProductGroup     = (ProductGroup2)this.drpProductGroup.SelectedItem,
         FrightTemplate   = (FreightTemplate)this.drpFrightTemplate.SelectedItem,
         ProductGroups    = this.Groups,
         FreightTemplates = this.Templates
     };
     this.DialogResult = System.Windows.Forms.DialogResult.OK;
     this.Close();
 }
コード例 #4
0
        public EditAccountForm(DestAccount account)
            : this()
        {
            this.Account = account;

            this.txtUser.Text = account.User;
            this.txtPwd.Text  = account.Pwd;

            this.drpFrightTemplate.DataSource    = account.FreightTemplates;
            this.drpFrightTemplate.DisplayMember = "Name";
            this.drpFrightTemplate.ValueMember   = "ID";

            this.drpProductGroup.DataSource    = account.ProductGroups;
            this.drpProductGroup.DisplayMember = "Name";
            this.drpProductGroup.ValueMember   = "ID";

            this.Groups    = account.ProductGroups;
            this.Templates = account.FreightTemplates;
        }