public CaseModel Error_DateTimeType() { return(new CaseModel() { NameSign = @"时间类型", ExeEvent = () => { DAL_MSSQLServer <TestModel> dal = new DAL_MSSQLServer <TestModel>(); TestModel[] array = new TestModel[999]; for (int i = 0; i < array.Length; i++) { string name = string.Format("第{0}条 - ", i); array[i] = new TestModel() { RecordIndex = i, Age = RandomData.GetInt(7828, 546822), DateOfBirth = new DateTime(2018, 10, 30, 14, 42, 33, i), Name = name + RandomData.GetChineseString(RandomData.GetInt(3, 5)), Sex = RandomData.Item(EnumInfo.GetALLItem <TestModel.SexEnum>()), }; } Console.WriteLine("dal.Delete(null): {0}s", RunHelp.GetRunTime(() => { dal.Delete(null); })); string[] sqls = null; Console.WriteLine("sqls create: {0}s", RunHelp.GetRunTime(() => { sqls = ConvertTool.ListConvertType(array, (model) => dal.SQLInsert(model, false)); })); Console.WriteLine("dal.Transaction(sqls): {0}s", RunHelp.GetRunTime(() => { dal.Transaction(sqls); })); //dal.Insert(array); DataTable dt = dal.QueryRecords(0, null, "RecordIndex asc").Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { TestModel a = array[i]; DataRow dr = dt.Rows[i]; TestModel s = dal.DataRowToModel(dr); if (a.DateOfBirth != s.DateOfBirth) { throw new Exception("错误"); } } /* * TestModel[] result = dal.Select(0, null, new KeyBoolean[] { * new KeyBoolean("RecordIndex", true), * }); * VerifyIList<TestModel, TestModel> verify = new VerifyIList<TestModel, TestModel>(CalcWayEnum.SingleCycle) { * Answer = array, * Source = result, * Func_isEquals = (a, s) => { * if (a.RecordIndex != s.RecordIndex) { * return false; * } * if (a.Age != s.Age) { * return false; * } * if (a.Name != s.Name) { * return false; * } * if (a.Sex != s.Sex) { * return false; * } * * if (a.DateOfBirth != s.DateOfBirth) { * string a_dt = a.DateOfBirth.ToString(Format.DATETIME_SECOND); * string s_dt = s.DateOfBirth.ToString(Format.DATETIME_SECOND); * Console.WriteLine("时间不一致! a:{0} s:{1}", a, s); * throw new Exception("错误"); * return false; * } * return true; * }, * }; * * bool isby = verify.Calc(); * if (!isby) { * return false; * } */ return true; }, }); }
public bool ShowUseMethod() { TestID model = new TestID(); TestID[] models = new TestID[] { }; int id = 0; string where = string.Empty; KeyObject[] kos = new KeyObject[] { }; int top = 0; KeyBoolean[] kbs = new KeyBoolean[] { }; int pcount = 0; int pindex = 0; int psum = 0; DataSet ds = null; DataRow dr = null; string sort = string.Empty; string[] sqls = new string[] { }; // BLL YTS.BLL.MSSQLServer_IntID <TestID, YTS.DAL.MSSQLServer_IntID <TestID> > bll = new YTS.BLL.MSSQLServer_IntID <TestID, YTS.DAL.MSSQLServer_IntID <TestID> >(); bll.Insert(model); bll.Insert(models); bll.Delete(where); bll.Update(kos, where); bll.Select(top, where, kbs); bll.Select(pcount, pindex, out psum, where, kbs); bll.GetRecordCount(where); bll.GetModel(where, kbs); bll.GetTableName(); bll.QueryRecords(top, where, sort); bll.QueryRecords(pcount, pindex, out psum, where, sort); bll.DataRowToModel(dr); bll.DataSetToModels(ds); bll.IDInsert(model, out id); bll.IDDelete(id); bll.IDUpdate(kos, id); bll.IDGetModel(id); BLL_MSSQLServer <TestID, YTS.DAL.MSSQLServer_IntID <TestID> > ms_bll = bll; ms_bll.Insert(model); ms_bll.Insert(models); ms_bll.Delete(where); ms_bll.Update(kos, where); ms_bll.Select(top, where, kbs); ms_bll.Select(pcount, pindex, out psum, where, kbs); ms_bll.GetRecordCount(where); ms_bll.GetModel(where, kbs); ms_bll.GetTableName(); ms_bll.QueryRecords(top, where, sort); ms_bll.QueryRecords(pcount, pindex, out psum, where, sort); ms_bll.DataRowToModel(dr); ms_bll.DataSetToModels(ds); AbsBLL <TestID, YTS.DAL.MSSQLServer_IntID <TestID>, string, ColumnModelParser <TestID>, ColumnInfo> abs_bll = ms_bll; abs_bll.Insert(model); abs_bll.Insert(models); abs_bll.Delete(where); abs_bll.Update(kos, where); abs_bll.Select(top, where, kbs); abs_bll.Select(pcount, pindex, out psum, where, kbs); abs_bll.GetRecordCount(where); abs_bll.GetModel(where, kbs); AbsBLL_OnlyQuery <TestID, YTS.DAL.MSSQLServer_IntID <TestID>, string, ColumnModelParser <TestID>, ColumnInfo> abs_bll_onlquery = abs_bll; abs_bll_onlquery.Select(top, where, kbs); abs_bll_onlquery.Select(pcount, pindex, out psum, where, kbs); abs_bll_onlquery.GetRecordCount(where); abs_bll_onlquery.GetModel(where, kbs); IBLL <TestID, YTS.DAL.MSSQLServer_IntID <TestID>, string, ColumnModelParser <TestID>, ColumnInfo> i_bll = ms_bll; i_bll.Insert(model); i_bll.Insert(models); i_bll.Delete(where); i_bll.Update(kos, where); i_bll.Select(top, where, kbs); i_bll.Select(pcount, pindex, out psum, where, kbs); i_bll.GetRecordCount(where); i_bll.GetModel(where, kbs); IBLL_OnlyQuery <TestID, YTS.DAL.MSSQLServer_IntID <TestID>, string, ColumnModelParser <TestID>, ColumnInfo> i_bll_onlyquery = abs_bll_onlquery; i_bll_onlyquery.Select(top, where, kbs); i_bll_onlyquery.Select(pcount, pindex, out psum, where, kbs); i_bll_onlyquery.GetRecordCount(where); i_bll_onlyquery.GetModel(where, kbs); // DAL YTS.DAL.MSSQLServer_IntID <TestID> dal = bll.SelfDAL; dal.Insert(model); dal.Insert(models); dal.Delete(where); dal.Update(kos, where); dal.Select(top, where, kbs); dal.Select(pcount, pindex, out psum, where, kbs); dal.GetRecordCount(where); dal.GetModel(where, kbs); dal.GetTableName(); dal.QueryRecords(top, where, sort); dal.QueryRecords(pcount, pindex, out psum, where, sort); dal.DataRowToModel(dr); dal.DataSetToModels(ds); dal.IsNeedSupplementary(); dal.ExecutionSupplementary(); dal.IDInsert(model, out id); dal.IDDelete(id); dal.IDUpdate(kos, id); dal.IDGetModel(id); dal.Transaction(sqls); DAL_MSSQLServer <TestID> ms_dal = dal; ms_dal.Insert(model); ms_dal.Insert(models); ms_dal.Delete(where); ms_dal.Update(kos, where); ms_dal.Select(top, where, kbs); ms_dal.Select(pcount, pindex, out psum, where, kbs); ms_dal.GetRecordCount(where); ms_dal.GetModel(where, kbs); ms_dal.GetTableName(); ms_dal.QueryRecords(top, where, sort); ms_dal.QueryRecords(pcount, pindex, out psum, where, sort); ms_dal.DataRowToModel(dr); ms_dal.DataSetToModels(ds); ms_dal.IsNeedSupplementary(); ms_dal.ExecutionSupplementary(); ms_dal.Transaction(sqls); AbsDAL <TestID, string, ColumnModelParser <TestID>, ColumnInfo> abs_dal = ms_dal; abs_dal.Insert(model); abs_dal.Insert(models); abs_dal.Delete(where); abs_dal.Update(kos, where); abs_dal.Select(top, where, kbs); abs_dal.Select(pcount, pindex, out psum, where, kbs); abs_dal.GetRecordCount(where); abs_dal.GetModel(where, kbs); AbsDAL_OnlyQuery <TestID, string, ColumnModelParser <TestID>, ColumnInfo> abs_dal_onlyquery = abs_dal; abs_dal_onlyquery.Select(top, where, kbs); abs_dal_onlyquery.Select(pcount, pindex, out psum, where, kbs); abs_dal_onlyquery.GetRecordCount(where); abs_dal_onlyquery.GetModel(where, kbs); IDAL <TestID, string, ColumnModelParser <TestID>, ColumnInfo> i_dal = abs_dal; i_dal.Insert(model); i_dal.Insert(models); i_dal.Delete(where); i_dal.Update(kos, where); i_dal.Select(top, where, kbs); i_dal.Select(pcount, pindex, out psum, where, kbs); i_dal.GetRecordCount(where); i_dal.GetModel(where, kbs); IDAL_OnlyQuery <TestID, string, ColumnModelParser <TestID>, ColumnInfo> i_dal_onlyquery = i_dal; i_dal_onlyquery.Select(top, where, kbs); i_dal_onlyquery.Select(pcount, pindex, out psum, where, kbs); i_dal_onlyquery.GetRecordCount(where); i_dal_onlyquery.GetModel(where, kbs); return(true); }