Пример #1
0
        public void TestMethod1()
        {
            tracer.Debug("Test1111");
            tracer.Error("Error1111");
            tracer.Info("Infor00000");
            string s = BasicCrypto.EncryptString("Test");

            Assert.Fail();
        }
Пример #2
0
        public ActionResult EditConfigurations(FASTWeb.Models.ConfigurationViewModel model)
        {
            Configuration config = new Configuration();

            try
            {
                bool encrypted = false;
                Boolean.TryParse(model.IsEncrypted.ToString(), out encrypted);

                config.ConfigID = model.ConfigID;
                config.Name     = model.ConfigName;

                if (encrypted)
                {
                    config.Value = BasicCrypto.EncryptString(model.Value);
                }
                else
                {
                    config.Value = model.Value;
                }

                config.ModuleID    = model.ModuleID;
                config.IsEncrypted = model.IsEncrypted;
                config.CanExpire   = model.CanExpire;
                config.ExpiryDays  = model.ExpiryDays;

                if (String.Compare(config.Value, model.OriginalValue) != 0)
                {
                    config.LastModified = DateTime.Now;
                }
                else
                {
                    config.LastModified = model.LastModified;
                }


                GenericProcess <Configuration> configProcess =
                    new GenericProcess <Configuration>();

                configProcess.UserID = User.Identity.Name.ToInteger();

                int result = configProcess.Update(config);

                if (result == FASTConstant.RETURN_VAL_SUCCESS)
                {
                    TempData[FASTConstant.TMPDATA_RESULT]       = FASTConstant.SUCCESSFUL;
                    TempData[FASTConstant.TMPDATA_SOURCE]       = "Edit Configuration";
                    TempData[FASTConstant.TMPDATA_EXTRAMESSAGE] = "The configuration record has been modified.";
                    TempData[FASTConstant.TMPDATA_ACTION]       = "Index";
                    TempData[FASTConstant.TMPDATA_CONTROLLER]   = "Configuration";

                    return(View("~/Views/Shared/Result.cshtml"));
                }
                else
                {
                    throw new Exception("There was an error while editing configuration.");
                }
            }
            catch (Exception ex)
            {
                TempData[FASTConstant.TMPDATA_RESULT]       = FASTConstant.FAILURE;
                TempData[FASTConstant.TMPDATA_SOURCE]       = "Edit Configuration";
                TempData[FASTConstant.TMPDATA_EXTRAMESSAGE] = ex.Message;
                return(View("~/Views/Shared/Result.cshtml"));
            }
        }