public void TestGuid() { var db = new TestDB(GetProviderType()); var guid1 = new Guid("{35450085-954D-4ed2-9C72-8F12293DB0F8}"); var guid2 = new Guid("{F9EE3130-72A7-4f66-93BB-50B2FFE3A27F}"); var guid3 = new Guid("{507DD15B-0F8E-44a9-9C26-F9E72835B14B}"); var guid4 = new Guid("{00D93FDD-1C8D-461a-89CA-5B89DF42FFD3}"); var item = new DotNetDataType { Guid1 = guid1, Guid2 = guid2, Guid3 = guid3, Guid4 = guid4, }; db.DotNetDataType.InsertOnSubmit(item); db.SubmitChanges(); var id = db.DotNetDataType.Max(o => o.ID); item = db.DotNetDataType.Where(o => o.ID == id).Single(); Assert.AreEqual(item.Guid1, guid1); Assert.AreEqual(item.Guid2, guid2); Assert.AreEqual(item.Guid3, guid3); Assert.AreEqual(item.Guid4, guid4); //Console.WriteLine(guid4.ToString().Length); }
public void GetEducationals() { ArrayList data = new Test.TestDB().GetEducationals(); String json = Test.JSON.Encode(data); Response.Write(json); }
//////////////////////////////////////////////////////////////// //多级排序 public void SearchEmployeesByMultiSort() { //查询条件 string key = Request["key"]; //分页 int pageIndex = Convert.ToInt32(Request["pageIndex"]); int pageSize = Convert.ToInt32(Request["pageSize"]); //字段排序 String sortString = Request["sortFields"]; ArrayList sortFields = new ArrayList(); if (!String.IsNullOrEmpty(sortString)) { sortFields = (ArrayList)Test.JSON.Decode(sortString); } //业务层:数据库操作 Hashtable result = new Test.TestDB().SearchEmployeesByMultiSort(key, pageIndex, pageSize, sortFields); //JSON String json = Test.JSON.Encode(result); Response.Write(json); }
public void GetEmployee() { String id = Request["id"]; Hashtable user = new Test.TestDB().GetEmployee(id); String json = Test.JSON.Encode(user); Response.Write(json); }
public void GetPositionsByDepartmenId() { String id = Request["id"]; ArrayList data = new Test.TestDB().GetPositionsByDepartmenId(id); String json = Test.JSON.Encode(data); Response.Write(json); }
public void GetDepartments() { //string ArrayList data = new Test.TestDB().GetDepartments(); String json = Test.JSON.Encode(data); Response.Write(json); }
public void GetDepartmentEmployees() { String dept_id = Request["dept_id"]; int pageIndex = Convert.ToInt32(Request["pageIndex"]); int pageSize = Convert.ToInt32(Request["pageSize"]); Hashtable result = new Test.TestDB().GetDepartmentEmployees(dept_id, pageIndex, pageSize); String json = Test.JSON.Encode(result); Response.Write(json); }
public ArrayList SearchEmployees() { //查询条件 string key = Request["key"]; //字段排序 String sortField = Request["sortField"]; String sortOrder = Request["sortOrder"]; Hashtable result = new Test.TestDB().SearchEmployees(key, 0, 10000, sortField, sortOrder); return result["data"] as ArrayList; }
public void CreateDatabase() { var db = new TestDB("DATA SOURCE=vpc1;PERSIST SECURITY INFO=True;USER ID=SYSTEM;PASSWORD=TEST", GetProviderType()) { Log = Console.Out }; if (db.DatabaseExists()) { db.DeleteDatabase(); } db.CreateDatabase(); }
public ArrayList SearchEmployees() { //查询条件 string key = Request["key"]; //字段排序 String sortField = Request["sortField"]; String sortOrder = Request["sortOrder"]; Hashtable result = new Test.TestDB().SearchEmployees(key, 0, 10000, sortField, sortOrder); return(result["data"] as ArrayList); }
//============================================================= public void SearchEmployees() { //查询条件 string key = Request["key"]; //分页 int pageIndex = Convert.ToInt32(Request["pageIndex"]); int pageSize = Convert.ToInt32(Request["pageSize"]); //字段排序 String sortField = Request["sortField"]; String sortOrder = Request["sortOrder"]; //业务层:数据库操作 Hashtable result = new Test.TestDB().SearchEmployees(key, pageIndex, pageSize, sortField, sortOrder); //JSON String json = Test.JSON.Encode(result); Response.Write(json); }
public void SearchEmployeesByJsonP() { //分页 string key = Request["key"]; int pageIndex = Convert.ToInt32(Request["pageIndex"]); int pageSize = Convert.ToInt32(Request["pageSize"]); //字段排序 String sortField = Request["sortField"]; String sortOrder = Request["sortOrder"]; //业务层:数据库操作 Hashtable result = new Test.TestDB().SearchEmployees(key, pageIndex, pageSize, sortField, sortOrder); //JSON String json = Test.JSON.Encode(result); //跨域:后台要读取约定好的jsonp的callback名称 string jsoncallback = Request["jsoncallback"]; //返回数据的时候,用jsoncallback作为方法名 Response.Write(jsoncallback + '(' + json + ')'); }
public void DataTypeTest() { TestDB db; //db = new TestDB("DATA SOURCE=vpc1;PERSIST SECURITY INFO=True;USER ID=SYSTEM;PASSWORD=TEST") // { // Log = Console.Out // }; //if (db.DatabaseExists()) //{ // db.DeleteDatabase(); //} //db.CreateDatabase(); db = new TestDB(GetProviderType()) { Log = Console.Out }; //var guid = new Guid("0ce0823c-a758-4da2-8aa2-25aa3830684d"); //var item = new T1 // { // PK = db.T1.Max(o => o.PK) + 1, // Blob = Encoding.Default.GetBytes("Hello World"), // Guid1 = guid, // Guid2 = guid, // OracleTimeStampTZ = new DateTime(1999, 11, 1), // OracleTimeStampLTZ = new DateTime(1999, 11, 1, 1, 1, 1) // }; //db.T1.InsertOnSubmit(item); //db.SubmitChanges(); //var id = item.PK; //item = db.T1.Where(o => o.PK == id).Single(); //Assert.AreEqual(item.OracleTimeStampTZ, new DateTime(1999, 11, 1)); var contactsXML = new XElement("Contacts", new XElement("Contact", new XElement("Name", "Patrick Hines"), new XElement("Phone", "206-555-0144")), new XElement("Contact", new XElement("Name", "Ellen Adams"), new XElement("Phone", "206-555-0155"))); { var item = new TString(); item.XmlType = contactsXML; db.TString.InsertOnSubmit(item); db.SubmitChanges(); //db.TString.Where(o => o.NVARCHAR2 != null).Select(o => o.NVARCHAR2.Substring(10)).ToList(); var id = db.TString.Max(o => o.ID); //var result = db.TString.Where(o => o.XmlType != null) // .Select(o => o.XmlType.Element("Contact")).ToList(); } { var item = new TNumber(); item.Char = 'A'; db.TNumber.InsertOnSubmit(item); db.SubmitChanges(); item = db.TNumber.Where(o => o.PK == item.PK).Single(); Assert.AreEqual('A', item.Char); } }