Exemple #1
0
        private void WriteToAuditLog2(TeeTimeItem TT)
        {
            string    sSQL;
            DataSet   ds1;
            APICommon ApiCommon = new APICommon();

            sSQL = "SELECT * ";
            sSQL = sSQL + " FROM  [W_TeeTimes] ";
            sSQL = sSQL + " WHERE [TeeTimeGUID] = " + m.InQuote(TT.TTGUID);
            ds1  = m.SQLRunQuery(sSQL, c.DB.WhosIn);
            if (m.EmptyTable(ds1))
            {
                return;
            }

            if (m.GetFieldDateF("TeeTimeDate", ds1, c.DATE_FORMAT1) != m.FormatDT(TT.TTDate, c.DATE_FORMAT1))
            {
                ApiCommon.InsertLogItem(m, TT.TTGUID, "Date changed to " + m.FormatDT(TT.TTDate, c.DATE_FORMAT1));
            }

            if (m.GetFieldDateF("TeeTimeTime", ds1, c.DATE_FORMAT10) != m.FormatDT(TT.TTTime, c.DATE_FORMAT10))
            {
                ApiCommon.InsertLogItem(m, TT.TTGUID, "Time changed to " + m.FormatDT(TT.TTTime, c.DATE_FORMAT10));
            }

            if (m.GetFieldStr("OwnerComment", ds1) != TT.OwnerComment)
            {
                ApiCommon.InsertLogItem(m, TT.TTGUID, "Owner's comment changed.");
            }

            if (m.GetFieldStr("TeeTimeOwner", ds1) != TT.Owner)
            {
                ApiCommon.InsertLogItem(m, TT.TTGUID, "Owner changed to " + TT.Owner);
            }

            if (m.GetFieldStr("TeeTimeLocation", ds1) != TT.Location)
            {
                ApiCommon.InsertLogItem(m, TT.TTGUID, "Location to " + TT.Location);
            }

            if (m.GetFieldStr("GroupGUID", ds1) != TT.GroupGUID)
            {
                ApiCommon.InsertLogItem(m, TT.TTGUID, "Group changed.");
            }
        }
Exemple #2
0
        private void AddTeeTime(TeeTimeItem TT)
        {
            string    sSQL;
            int       i2;
            APICommon ApiCommon = new APICommon();

            TT.TTGUID = m.CreateGuid();


            if (m.IsEmpty(TT.Owner))
            {
                SetResultCode(c.BATCH_RESULT_FAIL, "Owner cannot be blank.");
                return;
            }

            if (m.IsEmpty(TT.Location))
            {
                SetResultCode(c.BATCH_RESULT_FAIL, "Location cannot be blank.");
                return;
            }

            if (m.IsEmpty(TT.GroupGUID))
            {
                SetResultCode(c.BATCH_RESULT_FAIL, "Group cannot be blank.");
                return;
            }


            if (TT.TTTime == null)
            {
                SetResultCode(c.BATCH_RESULT_FAIL, "Time cannot be blank.");
                return;
            }

            if (TT.TTDate == null)
            {
                SetResultCode(c.BATCH_RESULT_FAIL, "Date cannot be blank.");
                return;
            }

            if (m.BeforeToday(m.NoNullDate(TT.TTDate)))
            {
                SetResultCode(c.BATCH_RESULT_FAIL, "Date cannot be before today.");
                return;
            }

            if (m.FormatDT(TT.TTTime, "HH:mm") == "00:00")
            {
                SetResultCode(c.BATCH_RESULT_FAIL, "Time cannot be blank.");
                return;
            }

            if (TTAleadyExists(TT))
            {
                SetResultCode(c.BATCH_RESULT_FAIL, "This teetime already exists.");
                return;
            }

            sSQL = "INSERT INTO [dbo].[W_TeeTimes] ";
            sSQL = sSQL + "     ([TeeTimeGUID] ";
            sSQL = sSQL + "    ,[GroupGUID] ";
            sSQL = sSQL + "    ,[TeeTimeOwner] ";
            sSQL = sSQL + "    ,[TeeTimeLocation] ";
            sSQL = sSQL + "    ,[TeeTimeDate] ";
            sSQL = sSQL + "    ,[TeeTimeTime] ";
            sSQL = sSQL + "    ,[OwnerComment] ";
            sSQL = sSQL + "    ,[LockPlayer1] ";
            sSQL = sSQL + "    ,[LockPlayer2] ";
            sSQL = sSQL + "    ,[LockPlayer3] ";
            sSQL = sSQL + "    ,[LockPlayer4] ";
            sSQL = sSQL + "    ,[Player1] ";
            sSQL = sSQL + "    ,[Player2] ";
            sSQL = sSQL + "    ,[Player3] ";
            sSQL = sSQL + "    ,[Player4] ";
            sSQL = sSQL + "    ,[WaitList1] ";
            sSQL = sSQL + "    ,[WaitList2] ";
            sSQL = sSQL + "    ,[WaitList3] ";
            sSQL = sSQL + "    ,[LockMessages] ";
            sSQL = sSQL + "    ,[HideMessages] ";
            sSQL = sSQL + "    ,[IsDeleted] )";
            sSQL = sSQL + "  VALUES (";
            sSQL = sSQL + m.InQuote(TT.TTGUID, 50) + ", ";            //  (<TeeTimeGUID, varchar(50),> ";
            sSQL = sSQL + m.InQuote(TT.GroupGUID, 50) + ", ";         //      ,<GroupGUID, varchar(50),> ";
            sSQL = sSQL + m.InQuote(TT.Owner, 50) + ", ";             //        ,<TeeTimeOwner, nvarchar(max),> ";
            sSQL = sSQL + m.InQuote(TT.Location, 100) + ", ";         //        ,<TeeTimeLocation, nvarchar(max),> ";
            sSQL = sSQL + m.InQuoteT(m.NoNullDate(TT.TTDate)) + ", "; //        ,<TeeTimeDate, date,> ";
            sSQL = sSQL + m.InQuoteT(m.NoNullDate(TT.TTTime)) + ", "; //       ,<TeeTimeTime, time(0),> ";
            sSQL = sSQL + m.InQuote(TT.OwnerComment, 500) + ", ";     //       ,<OwnerComment, nvarchar(max),> ";
            sSQL = sSQL + m.InQuoteN(TT.LockPlayer1) + ", ";          //       ,<LockPlayer1, smallint,> ";
            sSQL = sSQL + m.InQuoteN(TT.LockPlayer2) + ", ";          //       ,<LockPlayer2, smallint,> ";
            sSQL = sSQL + m.InQuoteN(TT.LockPlayer3) + ", ";          //       ,<LockPlayer3, smallint,> ";
            sSQL = sSQL + m.InQuoteN(TT.LockPlayer4) + ", ";          //       ,<LockPlayer4, smallint,> ";
            sSQL = sSQL + m.InQuote(TT.Player1, 100) + ", ";          //       ,<Player1, nvarchar(max),> ";
            sSQL = sSQL + m.InQuote(TT.Player2, 100) + ", ";          //       ,<Player2, nvarchar(max),> ";
            sSQL = sSQL + m.InQuote(TT.Player3, 100) + ", ";          //       ,<Player3, nvarchar(max),> ";
            sSQL = sSQL + m.InQuote(TT.Player4, 100) + ", ";          //      ,<Player4, nvarchar(max),> ";
            sSQL = sSQL + m.InQuote(TT.WaitList1, 100) + ", ";        //      ,<WaitList1, nvarchar(max),> ";
            sSQL = sSQL + m.InQuote(TT.WaitList2, 100) + ", ";        //      ,<WaitList2, nvarchar(max),> ";
            sSQL = sSQL + m.InQuote(TT.WaitList3, 100) + ", ";        //  "    ,<WaitList3, nvarchar(max),>) ";
            sSQL = sSQL + m.InQuoteN(TT.LockMessages) + ", ";         //       ,<LockMessages, smallint,> ";
            sSQL = sSQL + m.InQuoteN(TT.HideMessages) + ", ";         //       ,<HideMessages, smallint,> ";
            sSQL = sSQL + m.InQuoteN(0) + ") ";                       //  "    ,<IsDeleted, int>) ";

            i2 = m.SQLExecuteCommand(sSQL, c.DB.WhosIn);

            ApiCommon.InsertLogItem(m, TT.TTGUID, "Tee Time created.");

            SetResultCode(c.BATCH_RESULT_OK, "TeeTime added.");

            DeleteOldTeeTimes();
            return;
        }
Exemple #3
0
        private void WriteToAuditLog1(TeeTimeItem TT)
        {
            string    sSQL;
            DataSet   ds1;
            APICommon ApiCommon = new APICommon();

            sSQL = "SELECT * ";
            sSQL = sSQL + " FROM  [W_TeeTimes] ";
            sSQL = sSQL + " WHERE [TeeTimeGUID] = " + m.InQuote(TT.TTGUID);
            ds1  = m.SQLRunQuery(sSQL, c.DB.WhosIn);
            if (m.EmptyTable(ds1))
            {
                return;
            }

            if (TT.PlayerNumberBeingEdited == 1)
            {
                if (m.GetFieldStr("Player1", ds1) != TT.Player1)
                {
                    if (m.IsEmpty(TT.Player1))
                    {
                        ApiCommon.InsertLogItem(m, TT.TTGUID, "Player 1 deleted.");
                    }
                    else
                    {
                        if (m.IsEmpty(m.GetFieldStr("Player1", ds1)))
                        {
                            ApiCommon.InsertLogItem(m, TT.TTGUID, "Player 1 set to " + TT.Player1);
                        }
                        else
                        {
                            ApiCommon.InsertLogItem(m, TT.TTGUID, "Player 1 changed to " + TT.Player1);
                        }
                    }
                }
            }



            if (TT.PlayerNumberBeingEdited == 2)
            {
                if (m.GetFieldStr("Player2", ds1) != TT.Player2)
                {
                    if (m.IsEmpty(TT.Player2))
                    {
                        ApiCommon.InsertLogItem(m, TT.TTGUID, "Player 2 deleted.");
                    }
                    else
                    {
                        if (m.IsEmpty(m.GetFieldStr("Player2", ds1)))
                        {
                            ApiCommon.InsertLogItem(m, TT.TTGUID, "Player 2 set to " + TT.Player2);
                        }
                        else
                        {
                            ApiCommon.InsertLogItem(m, TT.TTGUID, "Player 2 changed to " + TT.Player2);
                        }
                    }
                }
            }



            if (TT.PlayerNumberBeingEdited == 3)
            {
                if (m.GetFieldStr("Player3", ds1) != TT.Player3)
                {
                    if (m.IsEmpty(TT.Player3))
                    {
                        ApiCommon.InsertLogItem(m, TT.TTGUID, "Player 3 deleted.");
                    }
                    else
                    {
                        if (m.IsEmpty(m.GetFieldStr("Player3", ds1)))
                        {
                            ApiCommon.InsertLogItem(m, TT.TTGUID, "Player 3 set to " + TT.Player3);
                        }
                        else
                        {
                            ApiCommon.InsertLogItem(m, TT.TTGUID, "Player 3 changed to " + TT.Player3);
                        }
                    }
                }
            }

            if (TT.PlayerNumberBeingEdited == 4)
            {
                if (m.GetFieldStr("Player4", ds1) != TT.Player4)
                {
                    if (m.IsEmpty(TT.Player4))
                    {
                        ApiCommon.InsertLogItem(m, TT.TTGUID, "Player 4 deleted.");
                    }
                    else
                    {
                        if (m.IsEmpty(m.GetFieldStr("Player4", ds1)))
                        {
                            ApiCommon.InsertLogItem(m, TT.TTGUID, "Player 4 set to " + TT.Player4);
                        }
                        else
                        {
                            ApiCommon.InsertLogItem(m, TT.TTGUID, "Player 4 changed to " + TT.Player4);
                        }
                    }
                }
            }
        }