예제 #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
파일: CallLog.cs 프로젝트: NiiQ12/DotSlash
        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();
        }