public IActionResult EditFeedbackPost(FeedbackViewModel feedbackViewModel)
 {
     if (!CharacterLength.CheckLength(feedbackViewModel.Message))
     {
         ViewData["Limit"] = CharacterLength.LimitNumber;
         return(View("CharacterLimit"));
     }
     if (!EmailValidation.CheckEmail(feedbackViewModel.Email))
     {
         ViewData["Limit"] = FeedbackNumberPerEmail.LimitNumber;
         return(View("InvalidMail"));
     }
     try
     {
         string email = _feedbackService.UpdateFeedback(feedbackViewModel);
         if (email == null)
         {
             return(View("FeedbackNumber"));
         }
         return(RedirectToAction("Details", new { id = feedbackViewModel.Id }));
     }
     catch
     {
         return(View("ExceptionView"));
     }
 }
Ejemplo n.º 2
0
    void Start()
    {
        onColorChange = UpdateColor; // 格納
        onColorChange(Color.green);  // 実行

        changeColor = UpdateColor;
        changeColor(Color.black);

        c1 = GetCharacters;
        Debug.Log(c1("HIRO302") + " : CharacterLength1");

        c2 = GetCharacters;
        Debug.Log(c2("HIRO") + " : CharacterLength2");
    }
Ejemplo n.º 3
0
 static void Main(string[] args)
 {
     DualEncoding.Run();
     GraphemeIdentifiers.DiacriticalMark();
     GraphemeIdentifiers.ZeroWidthJoiner();
     GraphemeIdentifiers.IdeographicVariationSelector();
     DecodeSample.Decode();
     Performance.Check();
     CompatibleWithBstr.WriteLayout();
     NoAllocation.AllocationCheck();
     AllCharactersInUnicodeData.Count().Wait();
     CharacterLength.WriteLength();
     ComparisonWithSystemString.Run();
 }
        private void ThenColumnShouldBe(string name, DataType dataType, CharacterLength size, string collation, Nullable nullable, string defaultExpression, string defaultConstraintName, string description)
        {
            ThenColumnShouldBe(name, dataType, defaultExpression, defaultConstraintName, description);
            Assert.That(_column.Nullable, Is.EqualTo(nullable));

            var sizeClause = "(max)";

            if (size == null)
            {
                if (dataType.ToString().Contains("Var"))
                {
                    Assert.That(_column.Size, Is.Not.Null);
                    Assert.That(_column.Size.Value, Is.EqualTo(CharacterLength.Max));
                    Assert.That(((CharacterLength)_column.Size).IsMax, Is.True);
                    Assert.That(_column.Size.ToString(), Is.EqualTo("(max)"));
                }
                else
                {
                    Assert.That(_column.Size, Is.Null);
                    sizeClause = "";
                }
            }
            else
            {
                Assert.That(_column.Size.Value, Is.EqualTo(size.Value));
                sizeClause = string.Format("({0})", _column.Size.Value);
            }
            Assert.That(_column.Collation, Is.EqualTo(collation));

            var collationClause = "";

            if (collation != null)
            {
                collationClause = string.Format(" collate {0}", collation);
            }

            var notNullClause = ConvertToNotNullClause(nullable);
            var sparseClause  = ConvertToSparseClause(nullable);
            var defaultClause = ConvertToDefaultClause(defaultExpression, defaultConstraintName, true);

            var expectedDefintion = string.Format("[{0}] {1}{2}{3}{4}{5}{6}", name, dataType.ToString().ToLowerInvariant(), sizeClause, collationClause, notNullClause,
                                                  defaultClause, sparseClause);

            Assert.That(_column.GetColumnDefinition(true), Is.EqualTo(expectedDefintion));
        }
Ejemplo n.º 5
0
    private void Start()
    {
        int count = 0;

        CharacterLength cl = GetCharacter;

        count = cl("John");
        Debug.Log("Character count: " + count);

        AnotherCharacterLength = GetCharacter;
        count = AnotherCharacterLength("Mariana");
        Debug.Log("Character count: " + count);

        // Same thing as above
        AnotherCharacterLength = (name) => name.Length;
        count = AnotherCharacterLength("Isabel");
        Debug.Log("Character count: " + count);
    }
    void Start()
    {
        // Delegate
        // インスタンス作成
        c1 = new CharacterLength(GetCharacters);
        // 実行
        int count = c1("abcd");

        Debug.Log("Delegate : " + count);

        // Function
        FunkCharacterLength = GetCharacters;
        int count2 = FunkCharacterLength("abcde");

        Debug.Log("Func : " + count2);

        // Lambda
        Funk2CharacterLength = (name) => name.Length; // 引数 => 返り値
        int count3 = Funk2CharacterLength("abc");

        Debug.Log("Lambda : " + count3);
    }
Ejemplo n.º 7
0
        public void CreteFeedback(FeedbackViewModel feedback)
        {
            List <Feedback> allFeedback = _feedbackRepository.GetFeedbackFromEmail(feedback.Email);

            if (!FeedbackNumberPerEmail.CalcFeedbackNumber(allFeedback))
            {
                throw new Exception($"Feedback count per mail excedeed! Only {FeedbackNumberPerEmail.maxLength} comments per email are allowed");
            }
            if (!CharacterLength.CheckLength(feedback.Message))
            {
                throw new Exception($"Feedback {CharacterLength.maxLength} characters limit excedeed!");
            }
            if (!EmailValidation.CheckEmail(feedback.Email))
            {
                throw new Exception("Invalid email format!");
            }
            int feedbackId = _feedbackRepository.Insert(feedback.ToFeedbackDomainModel());

            if (feedbackId <= 0)
            {
                throw new Exception("Feedback was not saved! Something went wrong!");
            }
        }
Ejemplo n.º 8
0
        public void UpdateFeedback(FeedbackViewModel feedbackViewModel)
        {
            Feedback feedback = _feedbackRepository.GetById(feedbackViewModel.Id);

            if (feedback == null)
            {
                throw new Exception($"Feedback with id: {feedbackViewModel.Id} does not exist!");
            }
            List <Feedback> allFeedback = _feedbackRepository.GetFeedbackFromEmail(feedbackViewModel.Email).Where(x => x.Id != feedbackViewModel.Id).ToList();

            if (!FeedbackNumberPerEmail.CalcFeedbackNumber(allFeedback))
            {
                throw new Exception($"Feedback count per mail excedeed! Only {FeedbackNumberPerEmail.maxLength} comments per email are allowed");
            }
            if (!CharacterLength.CheckLength(feedback.Message))
            {
                throw new Exception($"Feedback {CharacterLength.maxLength} characters limit excedeed!");
            }
            if (!EmailValidation.CheckEmail(feedback.Email))
            {
                throw new Exception("Invalid email format!");
            }
            _feedbackRepository.UpdateEntity(feedbackViewModel.ToFeedbackDomainModel());
        }
Ejemplo n.º 9
0
        private string GetCustomDBType()
        {
            #region FieldTypes by number
            switch (FieldType)
            {
            case 261:
                if (FieldSubType.HasValue)
                {
                    return("BLOB sub_type " + FieldSubType.Value.ToString());
                }
                else
                {
                    return("BLOB");
                }

            case 14:
                return("CHAR");

            case 40:
                return("CSTRING");

            case 11:
                return("D_FLOAT");

            case 27:
                return("DOUBLE");

            case 10:
                return("FLOAT");

            case 16:
                return("BIGINT");

            case 8:
                return("INTEGER");

            case 9:
                return("QUAD");

            case 7:
                return("SMALLINT");

            case 12:
                return("DATE");

            case 13:
                return("TIME");

            case 35:
                return("TIMESTAMP");

            case 37:
                return("VARCHAR(" + CharacterLength.ToString() + ")");
            }
            #endregion

            switch (FieldTypeName)
            {
            case "VARYING":
                return("VARCHAR(" + CharacterLength.ToString() + ")");

            case "LONG":
                return("INTEGER");

            case "INT64":
                return("BIGINT");
            }
            return(FieldTypeName);
        }
Ejemplo n.º 10
0
        public void ShouldCreateExpression()
        {
            var size = new CharacterLength(393);

            Assert.That(size.ToString(), Is.EqualTo("(393)"));
        }
Ejemplo n.º 11
0
        public void ShouldCreateExpressionForMaxColumns()
        {
            var size = new CharacterLength();

            Assert.That(size.ToString(), Is.EqualTo("(max)"));
        }
Ejemplo n.º 12
0
        private void Start()
        {
            CharacterLength cl = new CharacterLength(GetCharacters); //this assigns the GetCharacters function to the return type delegate variable "cl"

            Debug.Log(cl("Evan")); //
        }