Example #1
0
 public static Store GetByCode(string code)
 {
     using (StoreServiceClient client = new StoreServiceClient())
     {
         return(new Store(client.GetStoreByCode(code)));
     }
 }
Example #2
0
 public static Store GetById(int id)
 {
     using (StoreServiceClient client = new StoreServiceClient())
     {
         return(new Store(client.GetStoreById(id)));
     }
 }
Example #3
0
        public Main()
        {
            InitializeComponent();
            client = new StoreServiceClient();
            gui = new StoreGUIServiceClient(new System.ServiceModel.InstanceContext(this));
            client.Open();
            gui.registerGui();
            Dictionary<string, Book> books = client.getAllBooks();
            foreach (string key in books.Keys)
            {
                string[] list = new string[3];
                list[0] = books[key].title;
                list[1] = books[key].price.ToString();
                list[2] = books[key].quantity.ToString();
                ListViewItem v = new ListViewItem(list, books[key].title);
                stock.Items.Add(v);
            }

            Dictionary<int, StoreGUI.StoreServiceReference.Order> orders = client.getAllOrders();
            foreach (int key in orders.Keys)
            {

                string[] list = new string[8];
                list[0] = orders[key].id.ToString();
                list[1] = orders[key].book.title;
                list[2] = orders[key].book.price.ToString();
                list[3] = orders[key].quantity.ToString();
                list[4] = orders[key].name;
                list[5] = orders[key].email;
                list[6] = orders[key].address;
                list[7] = orders[key].state.ToString();
                ListViewItem v = new ListViewItem(list, orders[key].id.ToString());
                ordersView.Items.Add(v);
            }
        }
Example #4
0
 public WarehouseForm(ServiceHost h)
 {
     open       = false;
     host       = h;
     storeproxy = new StoreServiceClient(new InstanceContext(this));
     InitializeComponent();
     ListViewHeader();
 }
Example #5
0
 public Store()
 {
     using (StoreServiceClient client = new StoreServiceClient())
     {
         Proxy = client.CreateStore();
         client.Close();
     }
 }
Example #6
0
        public StoreWindow()
        {
            InitializeComponent();

            storeProxy = ((App)Application.Current).StoreProxy;

            RefreshScreen();
        }
Example #7
0
        public Form1()
        {
            InitializeComponent();

              _waitForResponse = new AutoResetEvent(false);

              InstanceContext callbackInstance = new InstanceContext(this);
              client = new StoreServiceClient(callbackInstance);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     client = new StoreServiceClient();
     Dictionary<string, Book> books = client.getAllBooks();
     foreach (string t in books.Keys)
     {
         listTitle.Items.Add(new ListItem(t));
     }
 }
Example #9
0
 public EmployeeForm(Employee empl, int department, DataTable deps, DataTable roles, DataTable users, StoreServiceClient client)
 {
     InitializeComponent();
       employee = empl;
       _department = department;
       _deps = deps;
       _roles = roles;
       _users = users;
       _client = client;
 }
Example #10
0
        public StoreForm()
        {
            InitializeComponent();
            storeProxy = new StoreServiceClient(new InstanceContext(this));

            BooksView();
            active   = "books";
            incoming = new List <KeyValuePair <string, string> >();
            //storeProxy.Open();
        }
Example #11
0
        public MainWindow()
        {
            InitializeComponent();
            List<Good> goods = new List<Good>();

            WCFStoreServiceManager.StoreServiceClient client = new StoreServiceClient();
            goods = client.Goods().ToList<Good>();
            //WCFClient wcfc = new WCFClient();
            //goods = wcfc.Goods().ToList<Good>();

            dg_goods.ItemsSource = goods;
        }
        public WarehouseService()
        {
            client = new StoreServiceClient();

            if (File.Exists(saveFile))
            {
                load(saveFile);
            }
            else
            {
                orders = new List<WarehouseOrder>();
            }
        }
Example #13
0
        public IEnumerable<StoreDAO> GetStores()
        {
            StoreServiceClient client = new StoreServiceClient();

            try
            {
                IEnumerable<StoreDAO> result = client.GetStores();
                return result;
            }
            catch (FaultException<KaskServiceException> e)
            {
                throw new HttpException(e.Message);
            }
        }
Example #14
0
        public StoreDAO GetStore(int id)
        {
            StoreServiceClient client = new StoreServiceClient();

            try
            {
                StoreDAO result = client.GetStoreByID(id);
                return result;
            }
            catch (FaultException<KaskServiceException> e)
            {
                throw new HttpException(e.Message);
            }
        }
Example #15
0
        public bool PostStore(StoreDAO store)
        {
            StoreServiceClient client = new StoreServiceClient();

            try
            {
                bool result = client.CreateStore(store);
                return result;
            }
            catch (FaultException<KaskServiceException> e)
            {
                throw new HttpException(e.Message);
            }
        }
Example #16
0
        private void b_Delete_Click(object sender, RoutedEventArgs e)
        {
            if (dg_goods.SelectedItems.Count == 0)
            {
                MessageBox.Show("Позиция не выбрана", "Внимание!");
                return;
            }

            Good item = (Good)dg_goods.SelectedValue;

            WCFStoreServiceManager.StoreServiceClient client = new StoreServiceClient();
            client.DeleteGood(item);
            //WCFClient wcfc = new WCFClient();
            //wcfc.DeleteGood(item);

            MessageBox.Show("Позиция удалена", "Внимание!");

        }
Example #17
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            StoreServiceClient storeServiceClient = new StoreServiceClient();

            Store newStore = new Store {
                Name = txtStoreName.Text
            };

            bool result = storeServiceClient.SaveStore(newStore);

            if (result)
            {
                MessageBox.Show("Mağaza Kaydedildi !", "Success", MessageBoxButton.OK);
            }
            else
            {
                MessageBox.Show("Hata Oluştu !", "Error", MessageBoxButton.OK);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="loginForm"></param>
        /// <returns></returns>
        public bool Login(LoginTemplate loginForm)
        {
            Proxy = new StoreServiceClient(new InstanceContext(this));

            if (Proxy.ClientCredentials == null)
            {
                return(false);
            }

            try
            {
                Proxy.ClientCredentials.UserName.UserName = loginForm.Email;
                Proxy.ClientCredentials.UserName.Password = loginForm.Password;

                var clerkInformation = Proxy.Profile();

                if (clerkInformation != null)
                {
                    Session = clerkInformation;
                }
                else
                {
                    return(false);
                }

                RefreshBooks();
                Transactions.Clear();
                Transactions.AddRange(Proxy.ListOrders());
                Transactions.AddRange(Proxy.ListPurchases());

                if (Proxy.State != CommunicationState.Faulted)
                {
                    Proxy.Subscribe();
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
 /// <summary>
 ///
 /// </summary>
 private LibrettoClient()
 {
     Proxy = new StoreServiceClient(new InstanceContext(this));
 }
        public LoginWindow()
        {
            InitializeComponent();

            storeProxy = ((App)Application.Current).StoreProxy;
        }
Example #21
0
 public EnterForm(StoreServiceClient client)
 {
     InitializeComponent();
       _client = client;
 }
Example #22
0
 public SellForm(StoreServiceClient sp)
 {
     storeProxy     = sp;
     warehouseProxy = new WarehouseServiceClient();
     InitializeComponent();
 }
Example #23
0
 public PrinterForm()
 {
     InitializeComponent();
     proxy = new StoreServiceClient(new InstanceContext(this));
     proxy.Open();
 }
Example #24
0
        private void Window_Activated(object sender, EventArgs e)
        {
            List<Good> goods = new List<Good>();

            WCFStoreServiceManager.StoreServiceClient client = new StoreServiceClient();
            goods = client.Goods().ToList<Good>();
            //WCFClient wcfc = new WCFClient();
//goods = wcfc.Goods().ToList<Good>();


            dg_goods.ItemsSource = goods;
        }
Example #25
0
 public OrderGui()
 {
     InitializeComponent();
     client = new StoreServiceClient();
 }
Example #26
0
 public Sell()
 {
     InitializeComponent();
     client = new StoreServiceClient();
 }
 public App()
 {
     StoreProxy = new StoreServiceClient();
 }