Update employeeview class to set id property.
Complete ArchiveCustomer functionality. Add: Update customer status query when status is changed on employee view
This commit is contained in:
parent
c74451cfd1
commit
06acaae9df
@ -30,7 +30,7 @@ namespace QueueSys
|
||||
|
||||
public class EmployeeView
|
||||
{
|
||||
public int id { get; }
|
||||
public int id { get; set; }
|
||||
public string customer_name { get; set; }
|
||||
}
|
||||
public class StatusModel
|
||||
@ -85,15 +85,15 @@ namespace QueueSys
|
||||
}
|
||||
}
|
||||
|
||||
public void ArchiveCustomer(ReportView customer)
|
||||
public void ArchiveCustomer(EmployeeView customer)
|
||||
{
|
||||
using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
|
||||
{
|
||||
string strQuery = "INSERT INTO archive(id, customer_name,num_bags,employee,status,start_time) SELECT id,customer_name,num_bags,employee,status,start_time WHERE id=@id";
|
||||
string strQuery = "INSERT INTO archive(id, customer_name,num_bags,employee,status_id,start_time) SELECT id,customer_name,num_bags,employee,status_id,start_time FROM active_customers WHERE id=@id";
|
||||
cnn.Execute(strQuery, customer);
|
||||
|
||||
// strQuery = "DELETE FROM active_customers WHERE id=@id";
|
||||
// cnn.Execute(strQuery, customer);
|
||||
strQuery = "DELETE FROM active_customers WHERE id=@id";
|
||||
cnn.Execute(strQuery, customer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,6 +108,15 @@ namespace QueueSys
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateCustomerStatus(int customer_id_in, string status_in)
|
||||
{
|
||||
using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
|
||||
{
|
||||
string strQuery = "UPDATE active_customers SET status_id = (SELECT status_lookup.status_id from status_lookup WHERE status_lookup.status = @status_str) WHERE id=@customer_id";
|
||||
cnn.Execute(strQuery, new {customer_id = customer_id_in, status_str = status_in });
|
||||
}
|
||||
}
|
||||
|
||||
private static string LoadConnectionString(string id="Default")
|
||||
{
|
||||
return ConfigurationManager.ConnectionStrings[id].ConnectionString;
|
||||
|
Loading…
x
Reference in New Issue
Block a user