public void TestCall6() { //创建动态类实例代理 var instance = DictOperator <TestB> .Create(); instance.New(); Assert.Equal("111", (string)instance["Name"]); //调用动态委托赋值 instance.Set("Name", "222"); Assert.Equal("222", (string)instance["Name"]); var c = (TestC)instance["InstanceC"]; Assert.Equal("abc", c.Name); instance["InstanceC"] = (new TestC() { Name = "bbca" }); Assert.Equal("bbca", ((TestC)instance["InstanceC"]).Name); }
public TestCaller() { string temp = "Hello"; Dict = new Dictionary <string, Action <CallModel, object> >(); Type type = typeof(CallModel); CallerManagement.AddType(type); DictHandler = DictOperator.CreateFromType(type); FuzzyDictHandler = FuzzyDictOperator.CreateFromType(type); HashDictHandler = HashDictOperator.CreateFromType(type); LinkHandler = LinkOperator.CreateFromType(type); FuzzyLinkHandler = FuzzyLinkOperator.CreateFromType(type); HashLinkHandler = HashLinkOperator.CreateFromType(type); Model = new CallModel(); Dynamic = new CallModel(); DictModel = new CallModel(); DictHandler.New(); FuzzyDictHandler.New(); HashDictHandler.New(); LinkHandler.New(); FuzzyLinkHandler.New(); HashLinkHandler.New(); Dict["Name"] = NDelegate.DefaultDomain().Action <CallModel, object>("arg1.Name=(string)arg2;"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DepartMentOperator.Bind2(ddlSchoolCode); ddlSchoolCode.Items.Insert(0, new ListItem("全部", "all")); DictOperator.BindDropDownList("车辆类型", ddlCarType); ddlCarType.Items.Insert(0, new ListItem("全部", "all")); ArrayList localtypes = SimpleOrmOperator.QueryConditionList <FpLocalType>("where km3_verify_ind='Y'"); string localtypeArray = ""; foreach (FpLocalType localtype in localtypes) { localtypeArray += localtype.ID; localtypeArray += ","; } string condition = " statue<={0} and localtype in ({1}) "; condition = string.Format(condition, FpStudentObject.STATUE_TRAIN_END, localtypeArray.TrimEnd(',')); condition += " and km3_verify !='Y' "; this.ProcedurePager1.TableName = "fp_student"; this.ProcedurePager1.FieldString = @" lsh,idcard ,name ,school_name,car_type ".Replace("\r\n", "").Replace("\t", ""); this.ProcedurePager1.SortString = " order by lsh asc"; this.ProcedurePager1.RowFilter = condition; //WebTools.Alert(condition); this.txtQueryValue.Focus(); } }
public void TestCall1() { //ScriptComplier.Init(); string text = @"using System; using System.Collections; using System.Linq; using System.Text; namespace HelloWorld { public static class StaticTest2 { static StaticTest2(){ Name=""111""; } public static string Name; public static int Age{get;set;} } }"; //根据脚本创建动态类 Type type = (new OopComplier()).GetClassType(text); //创建动态类实例代理 var instance = DictOperator.Create(type); //Get动态调用 Assert.Equal("111", (string)instance["Name"]); //调用动态委托赋值 instance["Name"] = "222"; Assert.Equal("222", (string)instance["Name"]); Assert.Equal("222", instance.Get <string>("Name")); }
protected void Page_Load(object sender, EventArgs e) { this._FP = new FpBase(this, new EventHandler(TrustLink_OperDlgPostEvent)); if (!IsPostBack) { ArrayList listLoacaltype = SimpleOrmOperator.QueryConditionList <FpLocalType>(""); ddlLocaltype.DataSource = listLoacaltype; ddlLocaltype.DataTextField = "NAME"; ddlLocaltype.DataValueField = "ID"; ddlLocaltype.DataBind(); DepartMentOperator.Bind2(ddlSchool); ddlSchool.SelectedValue = "440400"; DictOperator.BindDropDownList("车辆类型", ddlCarType); string strTmp = Request.Params["strTmp"]; if (!string.IsNullOrEmpty(strTmp)) { int result = wsFingerM.wsFPEnroll(strTmp); this.fnUINewEnrollStudentSucess(result == FpBase.SUCCESSED); } } ///WebTools.PlaySound("../../sound/test1.wav"); //WebTools.PlayBackGroupSound("孙燕姿-02.追.是时候.mp3", 1); //Response.Write("<bgsound loop=1 src='孙燕姿-02.追.是时候.mp3' />"); //WebTools.WriteScript("alert('hhlin');"); //WebTools.PlaySound("孙燕姿-02.追.是时候.mp3"); // BeepHelper.Beep(800,8000); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DictOperator.BindDropDownList("考试地点", this.cbKsdd); DictOperator.BindDropDownList("考试场次", this.cbKscc); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DictOperator.BindDropDownList("身份证明名称", this.cbIdCardTypeValue); this.cbIdCardTypeValue.SelectedValue = "A"; } }
public DataTable DgBind() { DataTable table = null; string typename = this.DropDownList1.Text; string dicttext = this.txtDictText.Text.Trim(); table = DictOperator.Search(typename, dicttext); return(table); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DictOperator.BindDropDownList("身份证明名称", this.cbIdCardType); DictOperator.BindDropDownList("体检业务类型", this.cbBusType); this.txtDabh1.Text = ConfigurationManager.AppSettings["DefaultDabh"]; } }
public void TestCall5() { //创建动态类实例代理 var instance = DictOperator <TestB> .Create(); instance.New(); Assert.Equal("111", (string)instance["Name"]); //调用动态委托赋值 instance.Set("Name", "222"); Assert.Equal("222", (string)instance["Name"]); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { qDateStart.Value = DateTime.Now.ToString("yyyy-MM-dd"); qDateEnd.Value = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"); DepartMentOperator.Bind2(ddlSchoolCode); ddlSchoolCode.Items.Insert(0, new ListItem("全部", "all")); DictOperator.BindDropDownList("车辆类型", ddlCarType); ddlCarType.Items.Insert(0, new ListItem("全部", "all")); } }
protected void DataGrid1_ItemCommand1(object source, DataGridCommandEventArgs e) { if (e.CommandName == "Delete") { int id = Convert.ToInt32(e.CommandArgument); DictOperator.Delete(id); WebTools.Alert(this, "删除成功!"); this.SimplePager1.Changed = true; } else if (e.CommandName == "Detail") { int id = Convert.ToInt32(e.CommandArgument); this.Pop(id); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DictOperator.BindDropDownList("考试地点", this.cbKsdd); DictOperator.BindDropDownList("考试场次", this.cbKscc); // SchoolCarInfoOperator.Bind(this.cbCarNo, this.Operator.Desp3); if (Request.Params["id"] != null) { YuyueLimit entity = YuyueLimitOperator.Get(Convert.ToInt32(Request.Params["id"])); //this.yuyueLimit = entity; this.InitYuyueLimit(entity); } } }
public void TestCall3() { //创建动态类实例代理 var instance = DictOperator.Create(typeof(FakeStaticTestModel2)); FakeStaticTestModel2.Name = "111"; Assert.Equal("111", (string)instance["Name"]); instance["Name"] = "222"; Assert.Equal("222", (string)instance["Name"]); FakeStaticTestModel2.Age = 1001; Assert.Equal(1001, (int)instance["Age"]); FakeStaticTestModel2.Temp = DateTime.Now; instance["Temp"] = FakeStaticTestModel2.Temp; Assert.Equal(FakeStaticTestModel2.Temp, (DateTime)instance["Temp"]); }
public void TestCall2() { //创建动态类实例代理 CallerManagement.AddType(typeof(StaticTestModel2)); var instance = DictOperator.CreateFromType(typeof(StaticTestModel2)); StaticTestModel2.Name = "111"; Assert.Equal("111", (string)instance["Name"]); instance["Name"] = "222"; Assert.Equal("222", (string)instance["Name"]); StaticTestModel2.Age = 1001; Assert.Equal(1001, (int)instance["Age"]); StaticTestModel2.Temp = DateTime.Now; instance["Temp"] = StaticTestModel2.Temp; Assert.Equal(StaticTestModel2.Temp, (DateTime)instance["Temp"]); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DictOperator.BindDropDownList("车辆类型", this.cbCarType); this.cbCarType.Items.Insert(0, "全部车型"); this.ProcedurePager1.TableName = "table_bus_all_info"; this.ProcedurePager1.FieldString = @"c_lsh , c_idcard , c_dabh , c_xm, regdate , c_car_type , decode(i_state,0,'受理中',1,'已体检',2,'已退办') as c_state " .Replace("\r\n", "").Replace("\t", ""); this.ProcedurePager1.SortString = " order by regdate desc"; } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { DictOperator.BindDropDownList("考试地点", this.cbKsdd); DictOperator.BindDropDownList("考试场次", this.cbKscc); DepartMentOperator.Bind(this.cbSchool, "驾校"); DictOperator.BindDropDownList("考试科目", this.cbKm); this.ProcedurePager1.TableName = "table_yuyue_info"; this.ProcedurePager1.FieldString = @"id,c_lsh,date_ksrq,c_kscc,c_ksdd,i_km,c_idcard, c_xm,date_pxshrq,c_hmhp,c_jbr, decode(i_checked,0,'未审核',1,'已审核',2,'审核不过') i_checked, c_check_result " .Replace("\r\n", "").Replace("\t", ""); this.ProcedurePager1.SortString = " order by id desc"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // ViewState DictOperator.BindDropDownList("考试地点", this.cbKsdd); DictOperator.BindDropDownList("考试场次", this.cbKscc); DepartMentOperator.BindNick(this.cbSchool, "驾校"); this.InitTableControls(); if (Request.Params["id"] != null) { WeekRecord entity = WeekRecordOperator.Get(Convert.ToInt32(Request.Params["id"])); //weekRocord = WeekRecordOperator.Get(Convert.ToInt32(Request.Params["id"])); this.InitWeekRecord(entity); string querySql = string.Format("where I_WEEK_NUM={0}", entity.WeekNum); ArrayList listLimits = SimpleOrmOperator.QueryConditionList <YuyueLimit>(querySql); ViewState[VIEWSTATUE_LIMITS] = listLimits; ViewState[VIEWSTATUE_WEEKRECORD] = entity; } } }
protected void Page_Load(object sender, EventArgs e) { this._FP = new FpBase(this, null, false); if (!IsPostBack) { DepartMentOperator.Bind2(ddlSchoolCode); ddlSchoolCode.Items.Insert(0, new ListItem("全部", "all")); DictOperator.BindDropDownList("车辆类型", ddlCarType); ddlCarType.Items.Insert(0, new ListItem("全部", "all")); this.ProcedurePager1.TableName = "fp_student"; this.ProcedurePager1.FieldString = @" lsh,idcard ,name ,school_name,car_type ".Replace("\r\n", "").Replace("\t", ""); this.ProcedurePager1.SortString = " order by idcard desc"; if (cbFinish.Checked) { string condition = " statue>={0}"; this.ProcedurePager1.RowFilter = string.Format(condition, FpStudentObject.STATUE_KM3_ENTER); } } }
public void TestCall4() { //ScriptComplier.Init(); string text = @"using System; using System.Collections; using System.Linq; using System.Text; namespace HelloWorld { public class Test { public Test(){ Name=""111""; } public string Name; public int Age{get;set;} } }"; //根据脚本创建动态类 var oop = new AssemblyCSharpBuilder(); oop.Syntax.Add(text); Type type = oop.GetTypeFromShortName("Test"); CallerManagement.AddType(type); //创建动态类实例代理 var instance = DictOperator.CreateFromType(type); instance.New(); //Get动态调用 Assert.Equal("111", (string)instance["Name"]); //调用动态委托赋值 instance.Set("Name", "222"); Assert.Equal("222", (string)instance["Name"]); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DepartMentOperator.Bind2(ddlSchoolCode); ddlSchoolCode.Items.Insert(0, new ListItem("全部", "all")); DictOperator.BindDropDownList("车辆类型", ddlCarType); ddlCarType.Items.Insert(0, new ListItem("全部", "all")); string condition = " statue<{0} and lsh is not null "; condition = string.Format(condition, FpStudentObject.STATUE_LESSON_START); condition += " and fee_statue != 'Y' "; this.ProcedurePager1.TableName = "fp_student"; this.ProcedurePager1.FieldString = @" lsh,idcard ,name ,school_name,car_type,fee_verify_date ".Replace("\r\n", "").Replace("\t", ""); this.ProcedurePager1.SortString = " order by lsh asc"; this.ProcedurePager1.RowFilter = condition; this.btnBatchVerify.Attributes.Add("onclick", "return confirm('确认进行批量审核?');"); this.btnBatchDisVerify.Attributes.Add("onclick", "return confirm('确认进行批量取消审核?');"); } this.txtQueryValue.Focus(); }
protected void Page_Load(object sender, EventArgs e) { this._FP = new FpBase(this, new EventHandler(TrustLink_OperDlgPostEvent)); _FP.isSa = true; if (!IsPostBack) { ArrayList listLoacaltype = SimpleOrmOperator.QueryConditionList <FpLocalType>(""); ddlLocaltype.DataSource = listLoacaltype; ddlLocaltype.DataTextField = "NAME"; ddlLocaltype.DataValueField = "ID"; ddlLocaltype.DataBind(); DepartMentOperator.Bind2(ddlSchool); ddlSchool.SelectedValue = "440400"; DictOperator.BindDropDownList("车辆类型", ddlCarType); } ///WebTools.PlaySound("../../sound/test1.wav"); //WebTools.PlayBackGroupSound("孙燕姿-02.追.是时候.mp3", 1); //Response.Write("<bgsound loop=1 src='孙燕姿-02.追.是时候.mp3' />"); //WebTools.WriteScript("alert('hhlin');"); //WebTools.PlaySound("孙燕姿-02.追.是时候.mp3"); // BeepHelper.Beep(800,8000); }
static void Main(string[] args) { TempTime = DateTime.Now; Stopwatch stopwatch = new Stopwatch(); for (int j = 0; j < 20; j++) { Console.WriteLine("========================================="); stopwatch.Restart(); for (int i = 0; i < 40000; i++) { var tEntity = new TestB(); if (tEntity.A2ge712 == "111") { //调用动态委托赋值 tEntity.A2ge712 = "222"; } } stopwatch.Stop(); Console.WriteLine("原生调用:\t\t" + stopwatch.Elapsed); var entity = LinkOperator.Create(typeof(TestB)); stopwatch.Restart(); for (int i = 0; i < 40000; i++) { entity.New(); if (entity.Get <string>("A2ge712") == "111") { //调用动态委托赋值 entity.Set("A2ge712", "222"); } } stopwatch.Stop(); Console.WriteLine("NCaller SimpleCaller:\t" + stopwatch.Elapsed); stopwatch.Restart(); for (int i = 0; i < 40000; i++) { RunDynamic(new TestB()); } stopwatch.Stop(); Console.WriteLine("Dynamic :\t\t" + stopwatch.Elapsed); var dict = DictOperator.Create(typeof(TestB)); stopwatch.Restart(); for (int i = 0; i < 40000; i++) { dict.New(); if ((string)(dict["A2ge712"]) == "111") { //调用动态委托赋值 dict["A2ge712"] = "222"; } } stopwatch.Stop(); Console.WriteLine("NCaller DictCaller:\t" + stopwatch.Elapsed); stopwatch.Restart(); for (int i = 0; i < 40000; i++) { RunDynamic(new TestB()); } stopwatch.Stop(); Console.WriteLine("Dynamic :\t\t" + stopwatch.Elapsed); stopwatch.Restart(); for (int i = 0; i < 40000; i++) { var tEntity = (new TestB()).LinkCaller(); if (tEntity.Get <string>("A2ge712") == "111") { //调用动态委托赋值 tEntity.Set("A2ge712", "222"); } } stopwatch.Stop(); Console.WriteLine("NCaller Extension:\t" + stopwatch.Elapsed); //entity = DynamicCaller.Create(typeof(TestB)); //stopwatch.Restart(); //for (int i = 0; i < 40000; i++) //{ // entity.New(); // if (entity.Get<DateTime>("Time") != TempTime) // { // //调用动态委托赋值 // entity.Set("Time", TempTime); // } //} //stopwatch.Stop(); //Console.WriteLine("NCaller SimpleCaller:\t" + stopwatch.Elapsed); //stopwatch.Restart(); //for (int i = 0; i < 40000; i++) //{ // RunDynamicTime(new TestB()); //} //stopwatch.Stop(); //Console.WriteLine("Dynamic :\t\t" + stopwatch.Elapsed); //entity = DynamicCaller.Create(typeof(TestB)); //stopwatch.Restart(); //for (int i = 0; i < 40000; i++) //{ // entity.New(); // if (entity.Get<DateTime>("Time") != TempTime) // { // //调用动态委托赋值 // entity.Set("Time", TempTime); // } //} //stopwatch.Stop(); //Console.WriteLine("NCaller SimpleCaller:\t" + stopwatch.Elapsed); Console.WriteLine("========================================="); } //var dict = DictOperator<TestB>.Create(); //dict["Name"] = "Hello"; //dict["Age"] = 100; //dict["Time"] = DateTime.Now; Console.ReadKey(); }