示例#1
0
        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();
            }
        }
示例#2
0
        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);
            }
        }
示例#3
0
        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();
        }