public bool isStampsdifferent(Stamp s)
        {
            bool compareBool = false;

            if (s.IsIgnored != IsIgnored && s.ID == ID)
            {
                compareBool = true;
            }
            return(compareBool);
        }
        public bool compareStamps(Stamp s)
        {
            bool compareBool = false;

            if (s.ID == ID)
            {
                compareBool = true;
            }
            return(compareBool);
        }
示例#3
0
        static void getStampsfromDB(MySqlConnection conn, List <Stamp> allStampsfromDB)
        {
            string       sql = "Select * from stamps";
            MySqlCommand cmd = new MySqlCommand();

            cmd.Connection  = conn;
            cmd.CommandText = sql;

            using (DbDataReader reader = cmd.ExecuteReader())
            {
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        int StampIDIndex = reader.GetOrdinal("StampID");
                        int StampID      = Convert.ToInt32(reader.GetValue(StampIDIndex));

                        int      StampDateandTimeIndex = reader.GetOrdinal("StampDateandTime");
                        DateTime StampDateandTime      = Convert.ToDateTime(reader.GetValue(StampDateandTimeIndex));

                        int    StampRemarkIndex = reader.GetOrdinal("StampRemark");
                        string StampRemark      = reader.GetString(StampRemarkIndex);

                        int StampWorkcodeIndex = reader.GetOrdinal("StampWorkcode");
                        int StampWorkcode      = Convert.ToInt32(reader.GetValue(StampWorkcodeIndex));

                        int  IsIgnoredIndex = reader.GetOrdinal("IsIgnored");
                        bool IsIgnored      = Convert.ToBoolean(reader.GetValue(IsIgnoredIndex));

                        int UserIDIndex = reader.GetOrdinal("UserID");
                        int UserID      = Convert.ToInt32(reader.GetValue(UserIDIndex));

                        Stamp s = new Stamp();
                        s.ID          = StampID;
                        s.DateAndTime = StampDateandTime;
                        s.Remark      = StampRemark;
                        s.Workcode    = StampWorkcode;
                        s.IsIgnored   = IsIgnored;
                        s.UserID      = UserID;
                        allStampsfromDB.Add(s);
                    }
                }
            }
        }
        public bool isStampsdouble(Stamp s)
        {
            bool compareBool = false;

            TimeSpan d = new TimeSpan();

            if (DateAndTime > s.DateAndTime)
            {
                d = DateAndTime - s.DateAndTime;
            }
            else
            {
                d = s.DateAndTime - DateAndTime;
            }
            if (d.TotalSeconds < secondsbetweenstamps && s.UserID == UserID)
            {
                compareBool = true;
            }
            return(compareBool);
        }