Ejemplo n.º 1
0
        private void Login()
        {
            CheckEmployeeID();

            if (IsID == true)
            {
                ApplicationVM appvm = App.Current.MainWindow.DataContext as ApplicationVM;
                OrderVM       order = new OrderVM();
                order.EmployeeID = Convert.ToInt32(EmployeeID);

                appvm.ChangePage(order);
            }
            else
            {
                MakeErrorLog("Login with wrong ID: " + EmployeeID, mname, "Login");
            }
        }
Ejemplo n.º 2
0
        private async void InsertRegisterEmployeeIntoDB(Register_Employee r)
        {
            using (HttpClient client = new HttpClient())
            {
                string re = JsonConvert.SerializeObject(r);
                HttpResponseMessage response = await
                                               client.PostAsync("http://localhost:65079/api/RegisterEmployee", new StringContent(re,
                                                                                                                                 Encoding.UTF8, "application/json"));

                if (response.IsSuccessStatusCode)
                {
                    ApplicationVM appvm = App.Current.MainWindow.DataContext as ApplicationVM;
                    appvm.ChangePage(new LoginVM());
                }
                else
                {
                    MakeErrorLog("Couldn't add register employee to db", mname, "InsertRegisterEmployeeIntoDB");
                }
            }
        }