public void TestIt() { var o = new ClassHelperTest(); ClassHelper.CallFunction(o, "TestPublic", (byte)18); Assert.AreEqual(CallType.Public, ct); Assert.AreEqual(18, o.bn); ClassHelper.CallFunction(o, "TestPrivate", 23); Assert.AreEqual(CallType.Private, ct); Assert.AreEqual(23, o.num); ClassHelper.CallFunction(o, "TestStatic", "OK"); Assert.AreEqual(CallType.Static, ct); Assert.AreEqual("OK", str); }
public virtual string Update(long n) { var ctx = ModelContext.GetInstance(typeof(T)); var obj = DbEntry.GetObject <T>(n); foreach (MemberHandler m in ctx.Info.Members) { if (m.Is.RelationField) { continue; } if (!m.Is.AutoSavedValue && !m.Is.DbGenerate) { string s = HttpContextHandler.Instance[ControllerName + "[" + m.Name.ToLower() + "]"]; if (m.Is.LazyLoad) { object ll = m.MemberInfo.GetValue(obj); PropertyInfo pi = m.MemberInfo.MemberType.GetProperty("Value"); object v = ControllerHelper.ChangeType(s, m.MemberType.GetGenericArguments()[0]); pi.SetValue(ll, v, null); // TODO: get rid of use such method. ClassHelper.CallFunction(obj, "m_ColumnUpdated", m.Name); } else { m.MemberInfo.SetValue(obj, ControllerHelper.ChangeType(s, m.MemberType)); } } } if (obj is DbObjectSmartUpdate) { (obj as DbObjectSmartUpdate).Save(); } else { DbEntry.Save(obj); } Flash.Notice = string.Format("{0} was successfully updated", ControllerName); return(UrlTo().Action("show").Parameters(n)); }
private static void DebugPrint(string msg, params object[] os) { ClassHelper.CallFunction(typeof(Debug), "Print", msg, os); }
public void TestConvertType8() { var i = (DateTime?)ClassHelper.CallFunction(typeof(SmartPageBase), "GetValue", "2008-9-10", true, "test", typeof(DateTime?)); Assert.IsTrue(new DateTime(2008, 9, 10) == i); }
public void TestConvertType7() { var i = (int?)ClassHelper.CallFunction(typeof(SmartPageBase), "GetValue", "12", false, "test", typeof(int)); Assert.IsTrue(12 == i); }
public void TestConvertType5() { var i = ClassHelper.CallFunction(typeof(SmartPageBase), "GetValue", "aa", true, "test", typeof(int?)); Assert.IsTrue(null == i); }
public void TestConvertType4() { ClassHelper.CallFunction(typeof(SmartPageBase), "GetValue", "", false, "test", typeof(int?)); }
public void TestConvertType3() { var i = (string)ClassHelper.CallFunction(typeof(SmartPageBase), "GetValue", "", true, "test", typeof(string)); Assert.IsTrue("" == i); //?? }
protected override void DeriveParameters(IDbCommand e) { var type = Type.GetType("System.Data.OleDb.OleDbCommandBuilder, System.Data.OleDb"); ClassHelper.CallFunction(type, "DeriveParameters", e); }