public HttpResponseMessage Put(Customer c) { ClaimsPrincipal p = RequestContext.Principal as ClaimsPrincipal; CustomerDA.UpdateCustomer(c, p.Claims); return new HttpResponseMessage(HttpStatusCode.OK); }
public HttpResponseMessage Post(Customer c) { ClaimsPrincipal p = RequestContext.Principal as ClaimsPrincipal; int id = CustomerDA.InsertCustomer(c, p.Claims); HttpResponseMessage message = new HttpResponseMessage(HttpStatusCode.OK); message.Content = new StringContent(id.ToString()); return message; }
public static int InsertCustomer(Customer c, IEnumerable<Claim> claims) { string sql = "INSERT INTO Customer VALUES(@CustomerName,@Address,@Picture,@Balance,@CardID)"; DbParameter par1 = Database.AddParameter(Database.ADMIN_DB, "@CustomerName", c.CustomerName); DbParameter par2 = Database.AddParameter(Database.ADMIN_DB, "@Address", c.Address); DbParameter par3 = Database.AddParameter(Database.ADMIN_DB, "@Picture", c.Picture); DbParameter par4 = Database.AddParameter(Database.ADMIN_DB, "@Balance", c.Balance); DbParameter par5 = Database.AddParameter(Database.ADMIN_DB, "@CardID", c.CardID); return Database.InsertData(Database.GetConnection(CreateConnectionString(claims)), sql, par1, par2, par3, par4, par5); }
public static int UpdateCustomer(Customer c, IEnumerable<Claim> claims) { string sql = "UPDATE Customer SET CustomerName=@CustomerName, Address=@Address, Picture=@Picture, Balance=@Balance, CardID=@CardID WHERE ID=@ID"; DbParameter par1 = Database.AddParameter(Database.ADMIN_DB, "@CustomerName", c.CustomerName); DbParameter par2 = Database.AddParameter(Database.ADMIN_DB, "@Address", c.Address); DbParameter par3 = Database.AddParameter(Database.ADMIN_DB, "@Picture", c.Picture); DbParameter par4 = Database.AddParameter(Database.ADMIN_DB, "@Balance", c.Balance); DbParameter par5 = Database.AddParameter(Database.ADMIN_DB, "@CardID", c.CardID); DbParameter par6 = Database.AddParameter(Database.ADMIN_DB, "@ID", c.ID); return Database.ModifyData(Database.GetConnection(CreateConnectionString(claims)), sql, par1, par2, par3, par4, par5, par6); }
public static List<Sale> GetSalesByCustomerID(Customer c, IEnumerable<Claim> claims) { List<Sale> list = new List<Sale>(); string sql = "SELECT * FROM Sale WHERE CustomerID=@ID"; DbParameter parID = Database.AddParameter(Database.ADMIN_DB, "@ID", c.ID); DbDataReader reader = Database.GetData(Database.GetConnection(CreateConnectionString(claims)), sql, parID); while (reader.Read()) { list.Add(Create(reader)); } reader.Close(); return list; }
public CustomerVM(Customer c) { SelectedCustomer = c; }
private Customer Load_eidCustomer() { Customer c = new Customer(); c.Address = new ReadData("beidpkcs11.dll").GetStreet() + ", " + new ReadData("beidpkcs11.dll").GetZip() + " " + new ReadData("beidpkcs11.dll").GetCity(); c.CardID = new ReadData("beidpkcs11.dll").GetCardNumber(); c.CustomerName = new ReadData("beidpkcs11.dll").GetFirstName() + " " + new ReadData("beidpkcs11.dll").GetSurname(); c.Picture = new ReadData("beidpkcs11.dll").GetPhotoFile(); c.Balance = 0; return c; }
private void NewCustomer() { if (Customers == null) Customers = new ObservableCollection<Customer>(); Customer c = new Customer(); Customers.Add(c); SelectedCustomer = c; }
public RegisterCustomerVM(Customer c) { SelectedCustomer = c; }