public ActionResult CreateList(Table3 t12) { FirstDBEntities1 obj1 = new FirstDBEntities1(); Table3 t1 = new Table3(); t1.Register_no = t12.Register_no; t1.custname = t12.custname; t1.Phone_no = t12.Phone_no; obj1.Table3.Add(t1); //db.crud.InsertOnSubmit(data1); if (t12.Register_no == t1.Register_no) { ViewBag.ang = "register number is already taken, please give some other number"; } obj1.SaveChanges(); //if(t12.Register_no==0 && t12.custname==null && t12.Phone_no==null ) // { // ViewBag.Error = "Please Dont keep the textbox empty and dont use null values"; // } // //var ing= obj1.SaveChanges(); namelist nameobj = new namelist(); nameobj.firstName = "Ashwin"; nameobj.lastName = "kumar"; ViewBag.name1 = nameobj.firstName + nameobj.lastName; return(View()); }
public void buttonCOClicked(object sender, EventArgs args) { string connetionString; SqlConnection cnn; connetionString = WebConfigurationManager.ConnectionStrings["constr"].ConnectionString; cnn = new SqlConnection(connetionString); cnn.Open(); SqlDataAdapter c1 = new SqlDataAdapter("Order_Contributor", cnn); c1.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; DataTable tab = new DataTable(); c1.Fill(tab); Table3.DataSource = tab; Table3.DataBind(); cnn.Close(); }
private void LoadTableDemo() { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Age", typeof(string)); for (int i = 0; i < 3; i++) { int id = i + 1; DataRow row = dt.NewRow(); row["Id"] = id; row["Name"] = "Name " + id; row["Age"] = id * 10; dt.Rows.Add(row); } Table1.DataSource = dt; Table1.DataBind(); Table2.DataSource = dt; Table2.DataBind(); Table3.DataSource = dt; Table3.DataBind(); Table4.DataSource = dt; Table4.DataBind(); Table5.DataSource = dt; Table5.DataBind(); }
public ActionResult Login(Table3 T1) { //FirstDBEntities1 db = new FirstDBEntities1(); //Table3 T2 = new Table3(); //if (T2.Register_no == T1.Register_no && T2.custname == T1.custname) //{ // return View("Index"); //} return(View()); }
public int UpdateRecord(Table3 record, int id) { string sql = "UPDATE Table_3 SET 列1 = '" + record.column1 + "',列2='" + record.column2 + "' WHERE id = " + Convert.ToInt32(id) + ""; conn.Open(); SqlCommand comm = new SqlCommand(sql, conn); int result = comm.ExecuteNonQuery(); conn.Close(); return(result); }
private void InitData(string databaseName) { var optionBuilder = new DbContextOptionsBuilder() .UseInMemoryDatabase(databaseName: databaseName) .Options; _context = new TestContext(optionBuilder); var table1 = _context.Set <Table1>(); var table3Entry = new Table3() { Id = 1, Name = "Test2" }; var table2Entry = new Table2() { Name = "Test2", Id = "Abc", ThirdTableRows = new List <Table3>() { table3Entry } }; var table1Entry = new Table1() { Name = "Test", SecondTableRows = new List <Table2>() { table2Entry }, Id = Guid.Parse("542c31f0-35e3-4a7d-a939-803f18f94669") }; table1.Add(table1Entry); var table1Entry_2 = new Table1() { Name = "Test", Id = Guid.Parse("642c31f0-35e3-4a7d-a939-803f18f94669") }; table1.Add(table1Entry_2); var additionalData = _context.Set <AdditionalData>(); additionalData.Add(new AdditionalData() { Name = "TestAdditional", Id = Guid.Parse("cca5e277-77e7-4d70-9eb1-067156222da3"), }); _context.SaveChanges(); _exportService = new ExportImportService <Table1>(_context); }
public int AddRecord(Table3 table) { conn.Open(); string sql = "insert into Table_3 values('" + table.column1 + "','" + table.column2 + "')"; comm = new SqlCommand(sql, conn); int result = comm.ExecuteNonQuery(); conn.Close(); return(result); }
public void name(Table3 tab1) { namelist n1 = new namelist(); Table3 t1 = new Table3(); t1.Register_no = 100; t1.Phone_no = 12345; if (tab1.Register_no == t1.Register_no) { inttest(); } }
public void MyMethod() { Table1 t1 = new Table1(); Table1 t2 = new Table2(); Table1 t3 = new Table3(); t1.UsingMethod2(); // will be called from ITableBaseExtensions t1.Method2(); // will be called from ITableBase - must implemented in Table1 class t2.Method3(some_argument); // will be called from ITableBase - must implemented in Table2 class t2.GetIdAsString(); // will be called from ITableBaseExtensions // etc. }
public ActionResult Update(FormCollection form, string id) { Table3 record = new Table3(); record.column1 = form["column1"]; record.column2 = form["column2"]; DBHelper helper = HelperFactory.GetHelperInstance("LocalDB"); Response.Write("成功修改" + helper.UpdateRecord(record, Convert.ToInt32(id)) + "条记录"); Init(); return(View("Index")); }
public ActionResult Add(FormCollection form) { //表单提交新增,不跳转 Table3 record = new Table3(); //record.column1 = Request["column1"]; //record.column2 = Request["column2"]; record.column1 = form["column1"]; record.column2 = form["column2"]; DBHelper helper = HelperFactory.GetHelperInstance("LocalDB"); int result = helper.AddRecord(record); Response.Write("成功添加" + result + "条记录!"); Init(); return(View("Index")); }
public IActionResult Details(Int32?table3Id) { Int32 currentTable3Id = table3Id ?? 0; if (currentTable3Id == 0) { return(RedirectToAction(nameof(HomeController.Index))); } Table3 table3 = _myService.GetTable3ByTable3Id(currentTable3Id); if (table3 == null) { return(RedirectToAction(nameof(HomeController.Index))); } return(View("Details", table3)); }
public Byte[] GetTable3FileData(Int32 table3Id) { try { Table3 table3 = _context.Table3s.FirstOrDefault(t3 => table3Id == t3.Id); if (table3 == null) { return(null); } return(table3.FileData); } catch (Exception) { return(null); } }
public Table3 SearchRecordByID(int id) { conn.Open(); string sql = "select * from Table_3 where(id=" + id + ")"; comm = new SqlCommand(sql, conn); SqlDataReader reader = comm.ExecuteReader(); Table3 item = new Table3(); if (reader.Read()) { item.id = reader.GetInt32(reader.GetOrdinal("id")); item.column1 = reader.GetString(reader.GetOrdinal("列1")); item.column2 = reader.GetString(reader.GetOrdinal("列2")); } reader.Close(); conn.Close(); return(item); }
protected void Page_Load(object sender, EventArgs e) { string connetionString; SqlConnection cnn; connetionString = WebConfigurationManager.ConnectionStrings["constr"].ConnectionString; cnn = new SqlConnection(connetionString); cnn.Open(); int vw_id = Convert.ToInt32(Session["ids"]); String sql = "Select ID,information,contributor_id From New_Request WHERE viewer_id=" + "'" + vw_id + "'" + "AND accept_status IS NULL"; SqlDataAdapter sda = new SqlDataAdapter(sql, cnn); DataTable t3 = new DataTable(); sda.Fill(t3); Table3.DataSource = t3; Table3.DataBind(); cnn.Close(); }
public Boolean SaveFileData(Int32 table3Id, Byte[] fileData) { try { Table3 table3 = GetTable3ByTable3Id(table3Id); if (table3 == null) { return(false); } table3.FileData = fileData; _context.SaveChanges(); return(true); } catch (Exception) { return(false); } }
private void Grid_Loaded(object sender, RoutedEventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add("Col1", typeof(string)); dt.Columns.Add("Col2", typeof(string)); dt.Columns.Add("Col3", typeof(string)); dt.Rows.Add(new string[] { "aaa", "bbbbb", "Mono是一个由Xamarin公司(先前是Novell,最早为Ximian)所主持的自由开放源代码项目。[1] 该项目的目标是创建一系列匹配ECMA标准(Ecma-334和Ecma-335)的.NET工具" }); dt.Rows.Add(new string[] { "aaa", "bbbbb", "Mono是一个由Xamarin公司(先前是Novell,最早为Ximian)所主持的自由开放源代码项目。[1] 该项目的目标是创建一系列匹配ECMA标准(Ecma-334和Ecma-335)的.NET工具" }); dt.Rows.Add(new string[] { "aaa", "bbbbb", "Mono是一个由Xamarin公司(先前是Novell,最早为Ximian)所主持的自由开放源代码项目。[1] 该项目的目标是创建一系列匹配ECMA标准(Ecma-334和Ecma-335)的.NET工具" }); dt.Rows.Add(new string[] { "aaa", "bbbbb", "Mono是一个由Xamarin公司(先前是Novell,最早为Ximian)所主持的自由开放源代码项目。[1] 该项目的目标是创建一系列匹配ECMA标准(Ecma-334和Ecma-335)的.NET工具" }); dt.Rows.Add(new string[] { "aaa", "bbbbb", "Mono是一个由Xamarin公司(先前是Novell,最早为Ximian)所主持的自由开放源代码项目。[1] 该项目的目标是创建一系列匹配ECMA标准(Ecma-334和Ecma-335)的.NET工具" }); dt.Rows.Add(new string[] { "aaa", "bbbbb", "Mono是一个由Xamarin公司(先前是Novell,最早为Ximian)所主持的自由开放源代码项目。[1] 该项目的目标是创建一系列匹配ECMA标准(Ecma-334和Ecma-335)的.NET工具" }); dt.Rows.Add(new string[] { "aaa", "bbbbb", "Mono是一个由Xamarin公司(先前是Novell,最早为Ximian)所主持的自由开放源代码项目。[1] 该项目的目标是创建一系列匹配ECMA标准(Ecma-334和Ecma-335)的.NET工具" }); dt.Rows.Add(new string[] { "aaa", "bbbbb", "Mono是一个由Xamarin公司(先前是Novell,最早为Ximian)所主持的自由开放源代码项目。[1] 该项目的目标是创建一系列匹配ECMA标准(Ecma-334和Ecma-335)的.NET工具" }); Table1.SetColumn("Col1", 60); Table1.SetColumn("Col2", 60); Table1.SetColumn("Col3", 160); Table1.UpdateDataSource(dt); Table1.Width = double.NaN; Table2.SetColumn("Col1", 60); Table2.SetColumn("Col2", 60); Table2.SetColumn("Col3", 160); Table2.UpdateDataSource(dt); Table3.SetColumn("Col1", 60); Table3.SetColumn("Col2", 60); Table3.SetColumn("Col3", 160); Table3.UpdateDataSource(dt); Table3.Width = 240; Table3.Height = 120; datagrid1.ItemsSource = dt.DefaultView; }
public List <Table3> GetAllRecord() { conn.Open(); string sql = "select * from Table_3"; comm = new SqlCommand(sql, conn); SqlDataReader reader = comm.ExecuteReader(); result = new List <Table3>(); while (reader.Read()) { Table3 item = new Table3(); item.id = reader.GetInt32(reader.GetOrdinal("id")); item.column1 = reader.GetString(reader.GetOrdinal("列1")); item.column2 = reader.GetString(reader.GetOrdinal("列2")); result.Add(item); } reader.Close(); conn.Close(); return(result); }
public static void Main(string[] args) { string host = "esqa.moneris.com"; string store_id = "moneris"; string api_token = "hurgle"; string order_id = "Need_Unique_Order_ID"; string txn_number = "8916-30-1"; string amount = "62.37"; /******************** Table 1 - HEADING *********************/ string n101 = "R6"; //Entity ID Code string n102 = "Retailing Inc. International"; //Name string n301 = "919 Oriole Rd."; //Address Line 1 string n401 = "Toronto"; //City string n402 = "On"; //State or Province string n403 = "H1T6W3"; //Postal Code string big04 = "PO7758545"; //Purchase Order Number string big05 = "RN0049858"; //Release Number string big10 = "INV998769"; //Invoice Number string[] ref01 = new string[] { "4C", "CR" }; //Reference ID Qualifier string[] ref02 = new string[] { "M5T3A5", "16802309004" }; //Reference ID RefAx[] refID = new RefAx[2]; refID[0] = new RefAx(ref01[0], ref02[0]); refID[1] = new RefAx(ref01[1], ref02[1]); N1_loop[] n1 = new N1_loop[1]; n1[0] = new N1_loop(n101, n102, n301, "", n401, n402, n403, refID); Table1 tbl1 = new Table1(big04, big05, big10, n1); /********************* Table 2 - DETAIL *********************/ //the sum of the extended amount field (i.e. paramater #7 of It1_Loop //must equal the level 1 amount field) string[] it102 = new string[] { "1", "1", "1", "1" }; //Line item quantity invoiced string[] it103 = new string[] { "EA", "EA", "EA", "EA" }; //Line item unit or basis of measurement code string[] it104 = new string[] { "10.00", "25.00", "8.62", "10.00" }; //Line item unit price string[] it105 = new string[] { "", "", "", "" }; //Line item basis of unit price code string[] it10618 = new string[] { "MG", "MG", "MG", "MG" }; //Product/Service ID qualifier string[] it10719 = new string[] { "DJFR4", "JFJ49", "FEF33", "FEE43" }; //Product/Service ID (corresponds to it10618) string[] txi01_GST = new string[] { "GS", "GS", "GS", "GS" }; //Tax type code string[] txi02_GST = new string[] { "0.70", "1.75", "1.00", "0.80" }; //Monetary amount string[] txi03_GST = new string[] { "", "", "", "" }; //Percent string[] txi06_GST = new string[] { "", "", "", "" }; //Tax exempt code string[] txi01_PST = new string[] { "PG", "PG", "PG", "PG" }; //Tax type code string[] txi02_PST = new string[] { "0.80", "2.00", "1.00", "0.80" }; //Monetary amount string[] txi03_PST = new string[] { "", "", "", "" }; //Percent string[] txi06_PST = new string[] { "", "", "", "" }; //Tax exempt code Txi[] taxGST = new Txi[4] { new Txi(txi01_GST[0], txi02_GST[0], txi03_GST[0], txi06_GST[0]), new Txi(txi01_GST[1], txi02_GST[1], txi03_GST[1], txi06_GST[1]), new Txi(txi01_GST[2], txi02_GST[2], txi03_GST[2], txi06_GST[2]), new Txi(txi01_GST[3], txi02_GST[3], txi03_GST[3], txi06_GST[3]) }; Txi[] taxPST = new Txi[4] { new Txi(txi01_PST[0], txi02_PST[0], txi03_PST[0], txi06_PST[0]), new Txi(txi01_PST[1], txi02_PST[1], txi03_PST[1], txi06_PST[1]), new Txi(txi01_PST[2], txi02_PST[2], txi03_PST[2], txi06_PST[2]), new Txi(txi01_PST[3], txi02_PST[3], txi03_PST[3], txi06_PST[3]) }; string[] pam05 = new string[] { "11.50", "28.75", "10.62", "11.50" }; //Extended line-item amount string[] pid05 = new string[] { "Stapler", "Lamp", "Bottled Water", "Fountain Pen" }; //Line item description ArrayList itQual = new ArrayList(); //array list to hold product IDs and Descriptions ArrayList level3Taxes = new ArrayList(); //list to hold GST and PST objects for each item int numOfItems = pid05.Length; It1_loop[] itemLoop = new It1_loop[numOfItems]; //instantiate array of items object for (int item = 0; item < pid05.Length; item++) { itQual.Add(new It106s[] { new It106s(it10618[item], it10719[item]) }); itQual.Add(new It106s[] { new It106s(it10618[item], it10719[item]) }); itQual.Add(new It106s[] { new It106s(it10618[item], it10719[item]) }); itQual.Add(new It106s[] { new It106s(it10618[item], it10719[item]) }); level3Taxes.Add(new Txi[] { taxGST[0], taxPST[0] }); //create tax object for item 1 level3Taxes.Add(new Txi[] { taxGST[1], taxPST[1] }); //create tax object for item 2 level3Taxes.Add(new Txi[] { taxGST[2], taxPST[2] }); //create tax object for item 3 level3Taxes.Add(new Txi[] { taxGST[3], taxPST[3] }); //create tax object for item 4 itemLoop[item] = new It1_loop(it102[item], it103[item], it104[item], it105[item], (It106s[])(itQual[item]), (Txi[])(level3Taxes[item]), pam05[item], pid05[item]); } Table2 tbl2 = new Table2(itemLoop); //element of AXLevel23 /********************* Table 3 - SUMMARY ********************/ Txi[] taxTbl3 = new Txi[3]; taxTbl3[0] = new Txi("GS", "4.25", "", ""); //sum of GST taxes taxTbl3[1] = new Txi("PG", "4.60", "", ""); //sum of PST taxes taxTbl3[2] = new Txi("TX", "8.85", "", ""); Table3 tbl3 = new Table3(taxTbl3); /********************** REQUEST ************************/ AXLevel23 level23 = new AXLevel23(tbl1, tbl2, tbl3); try { L23HttpsPostRequest request = new L23HttpsPostRequest(host, store_id, api_token, new AXRefund(order_id, amount, txn_number, level23)); Receipt myReceipt = request.GetReceipt(); Console.WriteLine("CardType = " + myReceipt.GetCardType()); Console.WriteLine("TransAmount = " + myReceipt.GetTransAmount()); Console.WriteLine("TxnNumber = " + myReceipt.GetTxnNumber()); Console.WriteLine("ReceiptId = " + myReceipt.GetReceiptId()); Console.WriteLine("TransType = " + myReceipt.GetTransType()); Console.WriteLine("ReferenceNum = " + myReceipt.GetReferenceNum()); Console.WriteLine("ResponseCode = " + myReceipt.GetResponseCode()); Console.WriteLine("ISO = " + myReceipt.GetISO()); Console.WriteLine("BankTotals = " + myReceipt.GetBankTotals()); Console.WriteLine("Message = " + myReceipt.GetMessage()); Console.WriteLine("AuthCode = " + myReceipt.GetAuthCode()); Console.WriteLine("Complete = " + myReceipt.GetComplete()); Console.WriteLine("TransDate = " + myReceipt.GetTransDate()); Console.WriteLine("TransTime = " + myReceipt.GetTransTime()); Console.WriteLine("Ticket = " + myReceipt.GetTicket()); Console.WriteLine("TimedOut = " + myReceipt.GetTimedOut()); Console.WriteLine("CorporateCard = " + myReceipt.GetCorporateCard()); Console.WriteLine("MessageId = " + myReceipt.GetMessageId()); } catch (Exception e) { Console.WriteLine(e); } }
protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); Table1 record1 = new Table1() { Id = Guid.Parse("79946776-b133-4d6e-892b-97d8dbbc26d8"), IntOne = 1, NameOne = "A", DateOne = DateTime.Now }; modelBuilder.Entity <Table1>().HasData(record1); Table2 record2 = new Table2() { Id = 1, IntSecond = 1, NameSecond = "A", DateSecond = DateTime.Now, TableOneId = record1.Id }; modelBuilder.Entity <Table2>().HasData(record2); Table2 record3 = new Table2() { Id = 2, IntSecond = 1, NameSecond = "A", DateSecond = DateTime.Now, TableOneId = record1.Id }; modelBuilder.Entity <Table2>().HasData(record3); Table3 record4 = new Table3() { Id = "A", IntThird = 1, NameThird = "A", DateThird = DateTime.Now, TableSecondId = 1 }; modelBuilder.Entity <Table3>().HasData(record4); Table3 record5 = new Table3() { Id = "B", IntThird = 1, NameThird = "A", DateThird = DateTime.Now, TableSecondId = 1 }; modelBuilder.Entity <Table3>().HasData(record5); Table3 record6 = new Table3() { Id = "C", IntThird = 1, NameThird = "A", DateThird = DateTime.Now, TableSecondId = 2 }; modelBuilder.Entity <Table3>().HasData(record6); Table3 record7 = new Table3() { Id = "D", IntThird = 1, NameThird = "A", DateThird = DateTime.Now, TableSecondId = 2 }; modelBuilder.Entity <Table3>().HasData(record7); AdditionalDataTable record8 = new AdditionalDataTable() { Id = Guid.Parse("88ddf83c-9eaf-4f4a-abb3-2f3277096d17"), NameAdditional = "Test1" }; modelBuilder.Entity <AdditionalDataTable>().HasData(record8); AdditionalDataTable record9 = new AdditionalDataTable() { Id = Guid.Parse("64925c3c-8ceb-490b-8735-6fdcc1f47c96"), NameAdditional = "Test2" }; modelBuilder.Entity <AdditionalDataTable>().HasData(record9); }