Beispiel #1
0
        public static void Update(StdTypeVM item)
        {
            StdType dbItem = GetSingleById(item.Id);

            dbItem.UpdateStandardType(item);
            RepositoryBase <StdType> .Update(dbItem);

            RepositoryBase <StdType> .SaveChanges();
        }
Beispiel #2
0
        public static void SetBlocked(string Id, bool value, string StaffID)
        {
            StdType model = GetSingleById(Id);

            model.Blocked = value;

            model.UpdatedDate = DateTime.Now;
            model.UpdatedBy   = StaffID;
            RepositoryBase <StdType> .SaveChanges();
        }
Beispiel #3
0
        public static void SetActived(string Id, bool value)
        {
            StdType model = RepositoryBase <StdType> .GetSingleById(Id);

            model.Actived = value;

            model.UpdatedDate = DateTime.Now;
            model.UpdatedBy   = HttpContext.Current.User.Identity.Name;
            RepositoryBase <StdType> .SaveChanges();
        }
Beispiel #4
0
        public static StdType Add(StdTypeVM item)
        {
            StdType dbItem = new StdType();

            dbItem.UpdateStandardType(item);

            dbItem.Id      = item.Id;
            dbItem.Actived = item.Actived;

            dbItem.CreatedDate = DateTime.Now;
            dbItem.CreatedBy   = HttpContext.Current.User.Identity.Name;

            StdType model = RepositoryBase <StdType> .Add(dbItem);

            RepositoryBase <StdType> .SaveChanges();

            return(dbItem);
        }
Beispiel #5
0
        public void MaxValueTest()
        {
            GenieLamp lamp = InitializationTest.LoadTestProject("TestProject.xml");

            lamp.Init();

            TypeDefinition tdFixed = new TypeDefinition(false, 1, false, 0, false, true, false, false, false, "");

            StdType t1 = new StdType(lamp.Model, "", "testType1", BaseType.TypeInt, tdFixed);

            Assert.IsNotNull(t1.MaxValue, "Has not max value");
            Assert.AreEqual(byte.MaxValue, t1.MaxValue.Value);

            tdFixed.Length = 2;
            StdType t2 = new StdType(lamp.Model, "", "testType2", BaseType.TypeInt, tdFixed);

            Assert.IsNotNull(t2.MaxValue, "Has not max value");
            Assert.AreEqual(Int16.MaxValue, t2.MaxValue.Value);

            tdFixed.Length = 4;
            StdType t3 = new StdType(lamp.Model, "", "testType3", BaseType.TypeInt, tdFixed);

            Assert.IsNotNull(t3.MaxValue, "Has not max value");
            Assert.AreEqual(Int32.MaxValue, t3.MaxValue.Value);

            tdFixed.Length = 8;
            StdType t4 = new StdType(lamp.Model, "", "testType4", BaseType.TypeInt, tdFixed);

            Assert.IsNotNull(t4.MaxValue, "Has not max value");
            Assert.AreEqual(Int64.MaxValue, t4.MaxValue.Value);

            tdFixed.Length = 20;
            StdType t5 = new StdType(lamp.Model, "", "testType5", BaseType.TypeDecimal, tdFixed);

            Assert.IsNotNull(t5.MaxValue, "Has not max value");
            Assert.AreEqual(Convert.ToDecimal(Math.Pow(10, 20)), t5.MaxValue.Value);

            StdType t6 = new StdType(lamp.Model, "", "testType6", BaseType.TypeCurrency, tdFixed);

            Assert.IsNull(t6.MaxValue, "Has max value");
        }
Beispiel #6
0
 public static void UpdateStandardType(this StdType item, StdTypeVM itemVM)
 {
     item.Name = itemVM.Name;
 }