Пример #1
0
        static private void ShowAuthorsList()
        {
            AuthorServiceClient client = new AuthorServiceClient();

            var list = client.getAuthorsList();

            foreach (Author author in list)
            {
                Console.WriteLine(author.name);
            }
        }
 private void Enter(object sender, RoutedEventArgs e)
 {
     CreateUserImport import = new CreateUserImport
     {
         Username = input_Username.Text,
         Password = input_Password.Password,
         Rebate_Normal = Math.Round(Convert.ToDouble(input_Rebate_Normal.Text), 2),
         Rebate_IndefinitePosition = Math.Round(Convert.ToDouble(input_Rebate_IndefinitePosition.Text), 2),
         Token = DataManager.GetValue<AdministratorExport>(DataKey.IWorld_Backstage_AdministratorInfo).Token
     };
     AuthorServiceClient client = new AuthorServiceClient();
     client.CreateUserCompleted += ShowCreateUserResult;
     client.CreateUserAsync(import);
 }
Пример #3
0
        static private void AddAuthor()
        {
            Console.Clear();
            Console.WriteLine("Enter author name");
            var authorName = Console.ReadLine();

            AuthorServiceClient client = new AuthorServiceClient();
            Author author = new Author();

            author.name = authorName;

            client.addAuthor(author);

            client.Close();
        }
 private void CreateUserGroup(object sender, RoutedEventArgs e)
 {
     CreateUserGroupImport import = new CreateUserGroupImport
     {
         Name = input_Name.Text,
         Grade = Convert.ToInt32(input_Grade.Text),
         LowerOfConsumption = Math.Round(Convert.ToDouble(input_LowerOfConsumption.Text), 2),
         CapsOfConsumption = Math.Round(Convert.ToDouble(input_CapsOfConsumption.Text), 2),
         TimesOfWithdrawal = Convert.ToInt32(input_TimesOfWithdrawal.Text),
         MinimumWithdrawalAmount = Math.Round(Convert.ToDouble(input_MinimumWithdrawalAmount.Text), 2),
         MaximumWithdrawalAmount = Math.Round(Convert.ToDouble(input_MaximumWithdrawalAmount.Text), 2),
         Token = DataManager.GetValue<AdministratorExport>(DataKey.IWorld_Backstage_AdministratorInfo).Token
     };
     AuthorServiceClient client = new AuthorServiceClient();
     client.CreateUserGroupCompleted += ShowCreateUserGroupResult;
     client.CreateUserGroupAsync(import);
 }
Пример #5
0
 private void GetAndUpdateAuthor(string idToSearch)
 {
     AuthorServiceClient authorService = new AuthorServiceClient();
     try
     {
         Author author = authorService.GetAuthor(idToSearch);
         author.FirstName = author.FirstName + " NH";
         authorService.Save(author);
     }
     catch (Exception ex)
     {
         throw;
     }
     finally
     {
         authorService.Close();
     }
 }
        void Remove_do(object sender, EventArgs e)
        {
            NormalPrompt np = (NormalPrompt)sender;
            if (np.DialogResult != true) { return; }
            AdministratorExport aInfo = DataManager.GetValue<AdministratorExport>(DataKey.IWorld_Backstage_AdministratorInfo);

            RemoveGroupImport import = new RemoveGroupImport
            {
                Id = this.State.Id,
                Token = aInfo.Token
            };
            AuthorServiceClient client = new AuthorServiceClient();
            client.RemoveUserGroupCompleted += ShowRemoveResult;
            client.RemoveUserGroupAsync(import);
        }
Пример #7
0
        static void Main(string[] args)
        {
            BookService.Book newBook = new BookService.Book
            {
                AuthorId          = 1,
                Format            = "PRINTED",
                Isbn              = "123-asd-1234",
                NextStockDate     = DateTime.Now.AddMonths(2),
                Preface           = "önsöz123",
                PublisherId       = 1,
                QuantityLeft      = 2,
                ReleaseDate       = DateTime.Now,
                Version           = 1,
                WarehouseLocation = 5
            };

            //client.ClientCredentials.UserName.UserName = "******";
            //client.ClientCredentials.UserName.Password = "******";



            BookServiceClient client = new BookServiceClient();
            var book     = client.CheckStock("978-975-4187-53-3");
            var isbnList = new List <string>();

            isbnList.Add("978-975-4187-53-3");
            var    bookList = client.CheckStocks(isbnList.ToArray());
            string message  = client.AddBookToStock(newBook);

            client.Close();

            Console.WriteLine(book.AuthorName);
            Console.WriteLine(book.BookId);
            Console.WriteLine(book.Format);
            Console.WriteLine(book.Isbn);
            Console.WriteLine(book.IsValidIsbn);
            Console.WriteLine(book.NextStockDate);
            Console.WriteLine(book.Preface);
            Console.WriteLine(book.PublisherName);
            Console.WriteLine(book.QuantityLeft);
            Console.WriteLine(book.ReleaseDate);
            Console.WriteLine(book.Version);
            Console.WriteLine(book.WarehouseLocation);
            //---------------------------------------
            Console.WriteLine("---------------------------------------");
            Console.WriteLine(bookList.FirstOrDefault().AuthorName);
            Console.WriteLine("---------------------------------------");
            Console.WriteLine(message);

            Console.WriteLine("----------AUTHOR-----------------------------");
            var author = new AuthorService.Author()
            {
                AuthorId = 1
            };
            AuthorServiceClient authorClient = new AuthorServiceClient();
            var authorList  = authorClient.GetAuthors();
            var authorBooks = authorClient.GetAuthorBooks(author);

            authorClient.Close();
            Console.WriteLine(authorList.FirstOrDefault().FirstName);
            Console.WriteLine(authorBooks.FirstOrDefault().Isbn);
            Console.WriteLine("----------Publisher-----------------------------");
            var publisher = new Publisher()
            {
                PublisherId = 1
            };
            PublisherServiceClient publisherClient = new PublisherServiceClient();
            var publisherList  = publisherClient.GetPublishers();
            var publisherBooks = publisherClient.GetPublisherBooks(publisher);

            publisherClient.Close();
            Console.WriteLine(publisherList.FirstOrDefault().PublisherName);
            Console.WriteLine(publisherBooks.FirstOrDefault().Isbn);

            Console.ReadLine();
        }
 void Edit(object obj)
 {
     EditFundsCodeImport import = new EditFundsCodeImport
     {
         OldFundsCode = this.OldFundsCode,
         NewFundsCode = this.NewFundsCode,
         Token = DataManager.GetValue<string>(DataKey.IWorld_Client_Token)
     };
     AuthorServiceClient client = new AuthorServiceClient();
     client.EditFundsCodeCompleted += ShowEditFundsCodeResult;
     client.EditFundsCodeAsync(import);
 }
        private void SetExtraQuotas(object sender, RoutedEventArgs e)
        {
            AdministratorExport aInfo = DataManager.GetValue<AdministratorExport>(DataKey.IWorld_Backstage_AdministratorInfo);
            List<SetExtraQuotasImport.ExtraQuotaImport> eqs = new List<SetExtraQuotasImport.ExtraQuotaImport>();

            eqs.Add(new SetExtraQuotasImport.ExtraQuotaImport { Rebate = 13.0, Sum = Convert.ToInt32(input_ExtraQuotas_130.Text) });
            eqs.Add(new SetExtraQuotasImport.ExtraQuotaImport { Rebate = 12.9, Sum = Convert.ToInt32(input_ExtraQuotas_129.Text) });
            eqs.Add(new SetExtraQuotasImport.ExtraQuotaImport { Rebate = 12.8, Sum = Convert.ToInt32(input_ExtraQuotas_128.Text) });
            eqs.Add(new SetExtraQuotasImport.ExtraQuotaImport { Rebate = 12.7, Sum = Convert.ToInt32(input_ExtraQuotas_127.Text) });
            eqs.Add(new SetExtraQuotasImport.ExtraQuotaImport { Rebate = 12.6, Sum = Convert.ToInt32(input_ExtraQuotas_126.Text) });
            eqs.Add(new SetExtraQuotasImport.ExtraQuotaImport { Rebate = 12.5, Sum = Convert.ToInt32(input_ExtraQuotas_125.Text) });
            eqs.Add(new SetExtraQuotasImport.ExtraQuotaImport { Rebate = 12.4, Sum = Convert.ToInt32(input_ExtraQuotas_124.Text) });
            eqs.Add(new SetExtraQuotasImport.ExtraQuotaImport { Rebate = 12.3, Sum = Convert.ToInt32(input_ExtraQuotas_123.Text) });
            eqs.Add(new SetExtraQuotasImport.ExtraQuotaImport { Rebate = 12.2, Sum = Convert.ToInt32(input_ExtraQuotas_122.Text) });
            eqs.Add(new SetExtraQuotasImport.ExtraQuotaImport { Rebate = 12.1, Sum = Convert.ToInt32(input_ExtraQuotas_121.Text) });

            SetExtraQuotasImport import = new SetExtraQuotasImport
            {
                Id = this.State.Id,
                ExtraQuotas = eqs,
                Token = aInfo.Token
            };
            AuthorServiceClient client = new AuthorServiceClient();
            client.SetExtraQuotasCompleted += ShowSetExtraQuotasResult;
            client.SetExtraQuotasAsync(import);
        }
 void Edit(object obj)
 {
     EditBankImport import = new EditBankImport
     {
         HolderOfTheCard = this.HolderOfTheCard,
         Card = this.Card,
         BankOfTheCard = this.BankOfTheCard,
         Token = DataManager.GetValue<string>(DataKey.IWorld_Client_Token)
     };
     AuthorServiceClient client = new AuthorServiceClient();
     client.EditBankCompleted += ShowEditPasswordResult;
     client.EditBankAsync(import);
 }
        private void Edit(object sender, RoutedEventArgs e)
        {
            AdministratorExport aInfo = DataManager.GetValue<AdministratorExport>(DataKey.IWorld_Backstage_AdministratorInfo);
            UserStatus status = (UserStatus)Enum.Parse(typeof(UserStatus), (input_Status.SelectedItem as TextBlock).Text, false);
            Bank bankOfCard = (Bank)Enum.Parse(typeof(Bank), (input_BankOfTheCard.SelectedItem as TextBlock).Text, false);

            EditUserImport import = new EditUserImport
            {
                Id = this.State.Id,
                Status = status,
                Card = input_Card.Text,
                HolderOfTheCard = input_HolderOfTheCard.Text,
                BankOfTheCard = bankOfCard,
                Rebate_Normal = Convert.ToDouble(input_Rebate_Normal.Text),
                Rebate_IndefinitePosition = Convert.ToDouble(input_Rebate_IndefinitePosition.Text),
                Commission_A = Convert.ToDouble(input_Commission_A.Text),
                Commission_B = Convert.ToDouble(input_Commission_B.Text),
                Dividend = Convert.ToDouble(input_Dividend.Text),
                Token = aInfo.Token
            };
            AuthorServiceClient client = new AuthorServiceClient();
            client.EditUserCompleted += ShowEditUserResult;
            client.EditUserAsync(import);
        }
        //登陆
        void Login(object parameter)
        {
            if (IsBusy)
            {
                return;
            }
            this.LoadingMessage = "验证用户名和密码(1/7)...";
            IsBusy = true;

            //登陆
            AuthorServiceClient client = new AuthorServiceClient();
            client.LoginCompleted += ShowLoginResult;
            LoginImport import = new LoginImport
            {
                Username = this.Username,
                Password = this.Password
            };
            client.LoginAsync(import);
        }
 void Edit(object obj)
 {
     EditPasswordImport import = new EditPasswordImport
     {
         OldPassword = this.OldPassword,
         NewPassword = this.NewPassword,
         Token = DataManager.GetValue<string>(DataKey.IWorld_Client_Token)
     };
     AuthorServiceClient client = new AuthorServiceClient();
     client.EditPasswordCompleted += ShowEditPasswordResult;
     client.EditPasswordAsync(import);
 }