protected void btnRegister_Click(object sender, EventArgs e) { ClientSession clt = new ClientSession(); clt.status = Status.GetStatus(1).ElementAt(0); clt.session = session; clt.client = Client.GetClient(int.Parse(ddlClients.SelectedValue)).ElementAt(0); ClientSession.AddClientSession(clt); Response.Redirect("~/Sessions.aspx?SessionID=" + session.SessionID); }
protected void btnEnroll_Click(object sender, EventArgs e) { if (ddlCourses.SelectedValue != "-1" && ddlSessionsByCourse.SelectedValue != "-1") { ClientSession clientSession = new ClientSession(); clientSession.client = Client.GetClient(int.Parse(ddlClientSearch.SelectedValue)).ElementAt(0); clientSession.session = Classes.Session.GetSession(int.Parse(ddlSessionsByCourse.SelectedValue)).ElementAt(0); clientSession.ClientSessionPrice = decimal.Parse(tbPrice.Text); clientSession.ClientSessionPaid = cbPaid.Checked; clientSession.status = Status.GetStatus(1).ElementAt(0); ClientSession.AddClientSession(clientSession); } else { lblStatusText.Text = "You must select a Course and a Session to Enroll"; } }
private static void AddParameters(ClientSession clientSession, SqlCommand comm) { comm.Parameters.AddWithValue("ClientID", clientSession.ClientID); comm.Parameters.AddWithValue("SessionID", clientSession.SessionID); comm.Parameters.AddWithValue("StatusID", clientSession.StatusID); comm.Parameters.AddWithValue("Paid", clientSession.ClientSessionPaid); comm.Parameters.AddWithValue("Price", clientSession.ClientSessionPrice); }
public static int UpdateClientSession(ClientSession clientSession, ClientSession oldClientSession) { int rowsAffected = 0; // Setup Connection using (DatabaseConnection db = new DatabaseConnection("dbo.UpdateClientSesssion")) { // Set Parameters AddParameters(clientSession, db.comm); AddOldParameters(oldClientSession, db.comm); // Open Connection db.conn.Open(); // Execute Command and Read Response rowsAffected = db.comm.ExecuteNonQuery(); } return rowsAffected; }
public static ClientSession ReadClientSession(SqlDataReader reader) { ClientSession clientSession = new ClientSession(); clientSession.ClientSessionID = (int)reader["ClientSessionID"]; clientSession.ClientSessionPaid = (bool)reader["ClientSessionPaid"]; clientSession.ClientSessionPrice = (decimal)reader["ClientSessionPrice"]; clientSession.client = Client.ReadClient(reader); clientSession.session = Session.ReadSession(reader); clientSession.status = Status.ReadStatus(reader); return clientSession; }
public static int AddClientSession(ClientSession clientSession) { int clientSessionID = -1; // Setup Connection using (DatabaseConnection db = new DatabaseConnection("dbo.AddClientSession")) { // Set Parameters AddParameters(clientSession, db.comm); // Open Connection db.conn.Open(); // Execute Command and Read Response clientSessionID = Convert.ToInt32(db.comm.ExecuteScalar()); } return clientSessionID; }
public InvoiceItem() { clientSession = new ClientSession(); invoice = new Invoice(); }