public static void EndCallLog(CallLog callLog) { try { connection.Open(); if (connection.State == ConnectionState.Open) { OleDbCommand cmd = new OleDbCommand("spEndCall", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@EndDateTime", OleDbType.Date).Value = callLog.EndDateTime; cmd.Parameters.Add("@CallLogID", OleDbType.Integer).Value = lastCallLogID; cmd.ExecuteNonQuery(); } else { throw new CustomException("Connection to the database cannot be established!"); } } catch (OleDbException e) { MessageBox.Show(e.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (CustomException e) { MessageBox.Show(e.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { connection.Close(); } }
public override bool Equals(object obj) { if (obj != null) { if (obj is CallLog) { CallLog callLog = obj as CallLog; return((this.startDateTime == callLog.startDateTime) && (this.endDateTime == callLog.endDateTime) && (this.administratorID == callLog.administratorID)); } else { return(false); } } else { return(false); } }
public static void AddCallLog(CallLog callLog) { DataTable tbl; tbl = ds.Tables["CallLog"]; DataRow drNew; drNew = tbl.NewRow(); string startDate = callLog.StartDateTime.ToString(); DateTime startDateTime = DateTime.Parse(startDate); drNew["StartDateTime"] = startDateTime; drNew["AdministratorID"] = callLog.AdministratorID; tbl.Rows.Add(drNew); UpdateDB("CallLog"); SetCallLogID(); }