Exemplo n.º 1
0
 public EmployeeVM(Employee e)
 {
     SelectedEmployee = e;
     GetProducts();
     NewOrder();
     //ReadEID();
 }
        public HttpResponseMessage Put(Employee e)
        {
            ClaimsPrincipal p = RequestContext.Principal as ClaimsPrincipal;
            EmployeeDA.UpdateEmployee(e, p.Claims);

            return new HttpResponseMessage(HttpStatusCode.OK);
        }
        public HttpResponseMessage Post(Employee e)
        {
            ClaimsPrincipal p = RequestContext.Principal as ClaimsPrincipal;
            int id = EmployeeDA.InsertEmployee(e, p.Claims);

            HttpResponseMessage message = new HttpResponseMessage(HttpStatusCode.OK);
            message.Content = new StringContent(id.ToString());
            return message;
        }
Exemplo n.º 4
0
 public static int UpdateEmployee(Employee e, IEnumerable<Claim> claims)
 {
     string sql = "UPDATE Employee SET EmployeeName=@EmployeeName, Address=@Address, Email=@Email, Phone=@Phone WHERE ID=@ID";
     DbParameter par1 = Database.AddParameter(Database.ADMIN_DB, "@EmployeeName", e.EmployeeName);
     DbParameter par2 = Database.AddParameter(Database.ADMIN_DB, "@Address", e.Address);
     DbParameter par3 = Database.AddParameter(Database.ADMIN_DB, "@Email", e.Email);
     DbParameter par4 = Database.AddParameter(Database.ADMIN_DB, "@Phone", e.Phone);
     DbParameter par5 = Database.AddParameter(Database.ADMIN_DB, "@ID", e.ID);
     return Database.ModifyData(Database.GetConnection(CreateConnectionString(claims)), sql, par1, par2, par3, par4, par5);
 }
Exemplo n.º 5
0
 public static int InsertEmployee(Employee e, IEnumerable<Claim> claims)
 {
     string sql = "INSERT INTO Employee VALUES(@EmployeeName,@Address,@Email,@Phone,@Pass)";
     DbParameter par1 = Database.AddParameter(Database.ADMIN_DB, "@EmployeeName", e.EmployeeName);
     DbParameter par2 = Database.AddParameter(Database.ADMIN_DB, "@Address", e.Address);
     DbParameter par3 = Database.AddParameter(Database.ADMIN_DB, "@Email", e.Email);
     DbParameter par4 = Database.AddParameter(Database.ADMIN_DB, "@Phone", e.Phone);
     DbParameter par5 = Database.AddParameter(Database.ADMIN_DB, "@Pass", e.Password);
     return Database.InsertData(Database.GetConnection(CreateConnectionString(claims)), sql, par1, par2, par3, par4, par5);
 }
Exemplo n.º 6
0
 private void NewEmployee()
 {
     if (Employees == null)
         Employees = new ObservableCollection<Employee>();
     Employee e = new Employee();
     Employees.Add(e);
     SelectedEmployee = e;
 }