Exemple #1
0
        public static int USign(int userID)
        {
            System.Data.DataTable dataTable = UserSignHelper.SignInfoByUser(userID);
            UserSign userSign = new UserSign();
            int      result;

            if (dataTable.Rows.Count < 1)
            {
                userSign.UserID    = userID;
                userSign.Continued = 1;
                UserSignHelper.InsertUserSign(userSign);
            }
            else
            {
                userSign.ID        = Convert.ToInt32(dataTable.Rows[0]["ID"]);
                userSign.SignDay   = DateTime.Now;
                userSign.UserID    = Convert.ToInt32(dataTable.Rows[0]["UserID"]);
                userSign.Continued = Convert.ToInt32(dataTable.Rows[0]["Continued"]);
                if (UserSignHelper.MaxContinued(Convert.ToDateTime(dataTable.Rows[0]["SignDay"]), userSign.SignDay) == 1)
                {
                    userSign.Continued++;
                }
                else if (UserSignHelper.MaxContinued(Convert.ToDateTime(dataTable.Rows[0]["SignDay"]), userSign.SignDay) == 0)
                {
                    result = -1;
                    return(result);
                }
            }
            int num = UserSignHelper.AddPoint(userSign);

            UserSignHelper.UpdateUserSign(userSign);
            result = num;
            return(result);
        }
Exemple #2
0
        public static int USign(int userID)
        {
            int       num;
            DataTable dataTable = UserSignHelper.SignInfoByUser(userID);
            UserSign  userSign  = new UserSign();

            if (dataTable.Rows.Count >= 1)
            {
                userSign.ID        = Convert.ToInt32(dataTable.Rows[0]["ID"]);
                userSign.SignDay   = DateTime.Now;
                userSign.UserID    = Convert.ToInt32(dataTable.Rows[0]["UserID"]);
                userSign.Continued = Convert.ToInt32(dataTable.Rows[0]["Continued"]);
                DateTime dateTime = Convert.ToDateTime(dataTable.Rows[0]["SignDay"]);
                DateTime date     = dateTime.Date;
                dateTime = userSign.SignDay;
                int num1 = UserSignHelper.MaxContinued(date, dateTime.Date);
                if (num1 <= 0)
                {
                    num = -1;
                    return(num);
                }
                if (num1 == 1)
                {
                    UserSign continued = userSign;
                    continued.Continued = continued.Continued + 1;
                }
                else if (num1 > 1)
                {
                    userSign.Continued = 1;
                }
            }
            else
            {
                userSign.UserID    = userID;
                userSign.Continued = 1;
                UserSignHelper.InsertUserSign(userSign);
            }
            int num2 = UserSignHelper.AddPoint(userSign);

            UserSignHelper.UpdateUserSign(userSign);
            num = num2;
            return(num);
        }