Exemplo n.º 1
0
 private void VeranderInfoLijst()
 {
     //VolledigeLijst = await servicelayer.getKassas();
     Info = new ObservableCollection <Register_Employee>();
     if (Selected == "System.Windows.Controls.ComboBoxItem: Medewerker")
     {
         foreach (Register_Employee reg in VolledigeLijst)
         {
             if (reg.Medewerker.Name == SelectedList)
             {
                 Info.Add(reg);
             }
         }
     }
     else
     {
         foreach (Register_Employee reg in VolledigeLijst)
         {
             if (reg.Kassa.Registername == SelectedList)
             {
                 Register_Employee emp = reg;
                 emp.Kassa.Registername = reg.Medewerker.Name;
                 Info.Add(emp);
             }
         }
     }
 }
Exemplo n.º 2
0
 public static void Register_EmployerInvullen()
 {
     reg_emp            = new Register_Employee();
     reg_emp.Kassa      = register;
     reg_emp.Medewerker = ingelogdeMedewerker;
     reg_emp.From       = DateTime.Now;
 }
Exemplo n.º 3
0
        public static void AddRegisterEmployee(Register_Employee r)
        {
            string      sql  = "INSERT INTO Register_Employee VALUES(@RegisterID, @EmployeeID, @Vanaf, @Until)";
            DbParameter par1 = Database.AddParameter("ConnectionString", "@RegisterID", r.RegisterID);
            DbParameter par2 = Database.AddParameter("ConnectionString", "@EmployeeID", r.EmployeeID);
            DbParameter par3 = Database.AddParameter("ConnectionString", "@Vanaf", DateTimeToUnixTimeStamp(r.Vanaf));
            DbParameter par4 = Database.AddParameter("ConnectionString", "@Until", DateTimeToUnixTimeStamp(r.Until));

            Database.InsertData("ConnectionString", sql, par1, par2, par3, par4);
        }
Exemplo n.º 4
0
        public static async Task <Boolean> SaveReg_Emp(Register_Employee reg_emp)
        {
            using (HttpClient client = new HttpClient())
            {
                client.SetBearerToken(ApplicationVM.token.AccessToken);
                string json = JsonConvert.SerializeObject(reg_emp);
                HttpResponseMessage resp = await client.PostAsync(baseUrl + "/register", new StringContent(json, Encoding.UTF8, "application/json"));

                return(resp.IsSuccessStatusCode);
            }
        }
Exemplo n.º 5
0
        public static int SaveLogin(Register_Employee newLogin, IEnumerable <Claim> claims)
        {
            string      sql  = "INSERT INTO Register_Employee VALUES(@RegisterID,@EmployeeID,@FromTime,@UntilTime)";
            DbParameter par1 = Database.AddParameter("ConnectionString", "@RegisterID", newLogin.RegisterID.RegisterID);
            DbParameter par2 = Database.AddParameter("ConnectionString", "@EmployeeID", newLogin.EmployeeID.ID);
            DbParameter par3 = Database.AddParameter("ConnectionString", "@FromTime", newLogin.From);
            DbParameter par4 = Database.AddParameter("ConnectionString", "@UntilTime", newLogin.Until);
            int         id   = Database.InsertData(Database.GetConnection(CreateConnectionString(claims)), sql, par1, par2, par3, par4);

            return(id);
        }
Exemplo n.º 6
0
        public static int AddRegister(Register_Employee register, IEnumerable <Claim> claims)
        {
            DbConnection con  = GetConnection(claims);
            string       sql  = "INSERT INTO Register_employee (RegisterId, EMployeeId, FromTime, UntilTime) VALUES (@Register,@Employe, @from, @until)";
            DbParameter  par1 = Database.AddParameter("System.Data.SqlClient", "@Register", register.Kassa.Id);
            DbParameter  par2 = Database.AddParameter("System.Data.SqlClient", "@Employe", register.Medewerker.Id);
            DbParameter  par3 = Database.AddParameter("System.Data.SqlClient", "@from", DateTimeToTimestamp(register.From));
            DbParameter  par4 = Database.AddParameter("System.Data.SqlClient", "@until", DateTimeToTimestamp(register.Until));

            return(Database.InsertData(con, sql, par1, par2, par3, par4));
        }
Exemplo n.º 7
0
        private void LogOut()
        {
            Until = DateTime.Now;

            Register_Employee r = new Register_Employee();

            r.RegisterID = registerID;
            r.EmployeeID = EmployeeID;
            r.Vanaf      = From;
            r.Until      = Until;

            InsertRegisterEmployeeIntoDB(r);
        }
Exemplo n.º 8
0
        public static List <Register_Employee> GetListRegisters(IEnumerable <Claim> claims)
        {
            DbConnection             con    = GetConnection(claims);
            List <Register_Employee> lijst  = new List <Register_Employee>();
            DbDataReader             reader = Database.GetData(con, "Select reem.UntilTime, reem.FromTime,emp.Address, emp.Email, emp.EmployeeName,emp.Id,emp.Phone, reg.Device,reg.Id as 'regId',reg.Registername from dbo.Register_Employee reem left outer join dbo.Employee emp on reem.EmployeeId = emp.Id left outer join dbo.Registers reg on reem.RegisterId = reg.Id");

            while (reader.Read())
            {
                Register_Employee re = CreateRegister_Employee(reader);
                lijst.Add(re);
            }
            return(lijst);
        }
        private async void Logout()
        {
            Register_Employee newLogin = new Register_Employee();

            newLogin.EmployeeID = GekozenEmployee;
            newLogin.From       = From;
            newLogin.Until      = DateTime.Now;
            newLogin.RegisterID = GekozenKassa;
            await SaveLogin(newLogin);

            token = null;
            ChangePage(new PageOneVM());
            MenuVisibility = false;
        }
        public async Task <int> SaveLogin(Register_Employee newLogin)
        {
            using (HttpClient client = new HttpClient())
            {
                client.SetBearerToken(ApplicationVM.token.AccessToken);
                string url  = string.Format("{0}{1}", URL, "/RegisterEmployee");
                string json = JsonConvert.SerializeObject(newLogin);
                HttpResponseMessage response = await client.PostAsync(url, new StringContent(json, Encoding.UTF8, "application/json"));

                if (response.IsSuccessStatusCode)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
        }
Exemplo n.º 11
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");
                }
            }
        }
Exemplo n.º 12
0
        public HttpResponseMessage Post(Register_Employee newRegister)
        {
            try
            {
                if (newRegister == null)
                {
                    throw new HttpResponseException(AddRequest(HttpStatusCode.BadRequest, "parameter is empty"));
                }
                ClaimsPrincipal p = RequestContext.Principal as ClaimsPrincipal;

                int id = RegisterDA.AddRegister(newRegister, p.Claims);

                HttpResponseMessage response = new HttpResponseMessage();
                string url = string.Format("{0}{1}", HttpContext.Current.Request.Url.ToString(), id);
                response.Headers.Location = new Uri(url);
                response.StatusCode       = HttpStatusCode.Created;
                return(response);
            }
            catch
            {
                return(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
        }
Exemplo n.º 13
0
 public HttpResponseMessage Post(Register_Employee r)
 {
     Register_EmployeeDA.AddRegisterEmployee(r);
     return(new HttpResponseMessage(HttpStatusCode.OK));
 }
        public int Post(Register_Employee newLogin)
        {
            ClaimsPrincipal p = Request.GetRequestContext().Principal as ClaimsPrincipal;

            return(RegisterEmployeeDA.SaveLogin(newLogin, p.Claims));
        }