コード例 #1
0
ファイル: API06.cs プロジェクト: davesperoni/WhosIn.golf
        private void AddChat2(ChatDM gItem)
        {
            string sSQL;
            int    i2;
            string sMessage;

            sMessage = m.Left2(gItem.Message, 32) + " : " + gItem.Initials;

            sSQL = "INSERT INTO [dbo].[W_TeeTimeChat] ";
            sSQL = sSQL + " ([ChatGUID] ";
            sSQL = sSQL + " ,[TeeTimeGUID] ";
            sSQL = sSQL + " ,[DateTimeEntered] ";
            sSQL = sSQL + " ,[Message] ";
            sSQL = sSQL + " ,[IPAddress]) ";
            sSQL = sSQL + " VALUES ( ";
            sSQL = sSQL + m.InQuote(m.CreateGuid()) + ", ";         //  (<ChatGUID, varchar(50),>
            sSQL = sSQL + m.InQuote(gItem.TeeTimeGUID, 150) + ", "; //  ,<TeeTimeGUID, nvarchar(max),>
            sSQL = sSQL + m.InQuoteT(m.Now2()) + ", ";              //  ,<DateTimeEntered, datetime,>
            sSQL = sSQL + m.InQuote(sMessage, 150) + ", ";          //  ,<Message, nvarchar(max),>
            sSQL = sSQL + m.InQuote(gItem.IPAddress, 50) + ") ";    //  ,<IPAddress, varchar(max),>)
            i2   = m.SQLExecuteCommand(sSQL, c.DB.WhosIn);

            SetResultCode(c.BATCH_RESULT_OK, "Message added.");
            return;
        }
コード例 #2
0
        private void AddGroup(GroupItemDM gItem)
        {
            string sSQL;
            int    i2;

            if (m.IsEmpty(gItem.GroupName))
            {
                SetResultCode(c.BATCH_RESULT_FAIL, "Group Name cannot be blank.");
                return;
            }

            if (m.IsEmpty(gItem.GroupDescription))
            {
                SetResultCode(c.BATCH_RESULT_FAIL, "Group Description cannot be blank.");
                return;
            }

            sSQL = " INSERT INTO [dbo].[W_Groups] ";
            sSQL = sSQL + " ([GroupGUID] ";
            sSQL = sSQL + " ,[GroupName] ";
            sSQL = sSQL + " ,[GroupDescription] ";
            sSQL = sSQL + " ,[GroupPin] ";
            sSQL = sSQL + " ,[GroupPhone] ";
            sSQL = sSQL + " ,[GroupEmail] ";
            sSQL = sSQL + " ,[GroupActive] ";
            sSQL = sSQL + " ,[GroupIsDefault] ";
            sSQL = sSQL + " ,[GroupShowAllGroups] ";
            sSQL = sSQL + " ,[GroupColor]) ";
            sSQL = sSQL + " VALUES (";

            sSQL = sSQL + m.InQuote(m.CreateGuid()) + ", ";
            sSQL = sSQL + m.InQuote(gItem.GroupName, 50) + ", ";
            sSQL = sSQL + m.InQuote(gItem.GroupDescription, 100) + ", ";
            sSQL = sSQL + m.InQuote(gItem.GroupPin) + ", ";
            sSQL = sSQL + m.InQuote(gItem.GroupPhone) + ", ";
            sSQL = sSQL + m.InQuote(gItem.GroupEmail, 500) + ", ";
            sSQL = sSQL + m.InQuoteN(gItem.GroupActive) + ", ";
            sSQL = sSQL + m.InQuoteN(gItem.GroupIsDefault) + ", ";
            sSQL = sSQL + m.InQuoteN(gItem.GroupShowAllGroups) + ", ";
            sSQL = sSQL + m.InQuote(gItem.GroupColor, 100);
            sSQL = sSQL + " )";

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

            SetResultCode(c.BATCH_RESULT_OK, "TeeTime added.");
            return;
        }
コード例 #3
0
        public void InsertLogItem(cMain m, string sTTGUID, string sLogMessage)
        {
            string sSQL;
            int    i2;
            string sIPAddress = "";

            sSQL = "INSERT INTO [dbo].[W_TeeTimeLog] ";
            sSQL = sSQL + " ([LogGUID] ";
            sSQL = sSQL + " ,[TTGUID] ";
            sSQL = sSQL + " ,[LogDateTime] ";
            sSQL = sSQL + " ,[LogEvent] ";
            sSQL = sSQL + " ,[LogIPAddress]) ";
            sSQL = sSQL + " VALUES ( ";
            sSQL = sSQL + m.InQuote(m.CreateGuid()) + ", ";         //  (<LogGUID, varchar(50),>
            sSQL = sSQL + m.InQuote(sTTGUID, 150) + ", ";           //  ,<TTGUID, nvarchar(max),>
            sSQL = sSQL + m.InQuoteT(m.Now2()) + ", ";              //  ,<LogDateTime, datetime,>
            sSQL = sSQL + m.InQuote(sLogMessage, 300) + ", ";       //  ,<LogEvent, nvarchar(max),>
            sSQL = sSQL + m.InQuote(sIPAddress, 50) + ") ";         //  ,<LogIPAddress, varchar(max),>)
            i2   = m.SQLExecuteCommand(sSQL, c.DB.WhosIn);
        }
コード例 #4
0
ファイル: API02.cs プロジェクト: davesperoni/WhosIn.golf
        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;
        }