/// <summary> /// Create a new Table1 object. /// </summary> /// <param name="id">Initial value of id.</param> public static Table1 CreateTable1(int id) { Table1 table1 = new Table1(); table1.id = id; return(table1); }
// Stores a single Table1 record public int Post(Table1 request) { // Add your method to store a single record var CRUD = new CRUDFunctions(Db); return(CRUD.AddData(request)); // Return the ID of the created record }
public Reply Login([FromBody] AccessViewModel model) { Reply oR = new Reply(); try { using (mvcApiEntities1 db = new mvcApiEntities1()) { var lst = db.Table1.Where(d => d.email == model.email && d.passwordd == model.password && d.idEstatus == 1); if (lst.Count() > 0) { oR.result = 1; oR.data = Guid.NewGuid().ToString(); Table1 oUser = lst.First(); oUser.token = (string)oR.data; db.Entry(oUser).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } else { oR.message = "Datos Incorrectos"; } } } catch (Exception ex) { oR.result = 1; oR.message = "Ocurrio un Error" + ex; } return(oR); }
static void Main(string[] args) { var config = new RealmConfiguration(Path.Combine( Directory.GetCurrentDirectory(), "Relation.realm")); Realm.DeleteRealm(config); var realm = Realm.GetInstance(config); realm.Write(() => { var insertObject = new Table1 { Name = "Table1-1", Object1 = new Table2 { Name = "Table2-1" }, }; insertObject.ObjectN.Add(new Table2 { Name = "Table2-2" }); insertObject.ObjectN.Add(new Table2 { Name = "Table2-3" }); realm.Add(insertObject); }); foreach (var i in realm.All <Table1>()) { Console.WriteLine(i); } }
public FromM010 Get(ToM010 toM010) { // add records var scope = _serviceProvider.CreateScope(); var dbx = scope.ServiceProvider.GetService <Db2Ctx>(); Table1 t = new Table1 { Num1 = 10, String1 = $"MOD10" }; dbx.Table1.Add(t); dbx.SaveChanges(); var m001 = _serviceProvider.GetService <IM001>(); m001.Get(new ToM001()); var m002 = _serviceProvider.GetService <IM002>(); m002.Get(new ToM002()); return(new FromM010 { Nbr1 = 10 }); }
public IHttpActionResult PutTable1(int id, Table1 table1) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != table1.id) { return(BadRequest()); } db.Entry(table1).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Table1Exists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
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"]); SqlCommand cmd = new SqlCommand("Show_New_Content", cnn); cmd.CommandType = System.Data.CommandType.StoredProcedure; SqlDataAdapter sda = new SqlDataAdapter("Show_New_Content", cnn); sda.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@viewer_id", vw_id)); cmd.Parameters.Add(new SqlParameter("@content_id", DBNull.Value)); sda.SelectCommand.Parameters.Add(new SqlParameter("@viewer_id", vw_id)); sda.SelectCommand.Parameters.Add(new SqlParameter("@content_id", DBNull.Value)); DataTable t1 = new DataTable(); sda.Fill(t1); Table1.DataSource = t1; Table1.DataBind(); cnn.Close(); }
//--------------------------------------------------- public bool AddParametre(IColumnDeEasyQuery colFromTable1, IColumnDeEasyQuery colFromTable2) { if (Table1 == null || Table2 == null) { return(false); } CDefinitionProprieteDynamique def1 = null; CDefinitionProprieteDynamique def2 = null; foreach (CDefinitionProprieteDynamique def in Table1.GetDefinitionsChamps(Table1.GetType())) { if (def.NomProprieteSansCleTypeChamp == colFromTable1.ColumnName) { def1 = def; break; } } foreach (CDefinitionProprieteDynamique def in Table2.GetDefinitionsChamps(Table2.GetType())) { if (def.NomProprieteSansCleTypeChamp == colFromTable2.ColumnName) { def2 = def; break; } } if (def1 != null && def2 != null) { CParametreJointure parametre = new CParametreJointure( new C2iExpressionChamp(def1), new C2iExpressionChamp(def2)); m_listeParametresJointure.Add(parametre); return(true); } return(false); }
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 sql1 = "Select original_content_id,date,text FROM Comment WHERE Viewer_id=" + "'" + vw_id + "'"; SqlDataAdapter sda1 = new SqlDataAdapter(sql1, cnn); DataTable t1 = new DataTable(); sda1.Fill(t1); Table1.DataSource = t1; Table1.DataBind(); String sql2 = "Select C.*,O.rating From Original_Content O INNER JOIN Content C ON O.ID=C.ID"; SqlDataAdapter sda2 = new SqlDataAdapter(sql2, cnn); DataTable t2 = new DataTable(); sda2.Fill(t2); Table2.DataSource = t2; Table2.DataBind(); cnn.Close(); }
public async Task <IActionResult> Edit(int id, [Bind("Id,text")] Table1 table1) { if (id != table1.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(table1); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Table1Exists(table1.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(table1)); }
public async Task <IActionResult> PutTable1(string id, Table1 table1) { if (id != table1.Test1) { return(BadRequest()); } _context.Entry(table1).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Table1Exists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
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(); }
protected void btn_project3_marks_save_Click(object sender, EventArgs e) { int n = 0; string[] marks = new string[a]; for (int s = 0; s < a; s++) { string t = n.ToString(); TextBox tx1 = (TextBox)Table1.FindControl("tx" + s.ToString()); if (tx1.Text == null) { marks[s] = "0"; } else { marks[s] = tx1.Text; } string t_id = Session["t_id"].ToString(); string su_id = Session["teachersubject_id"].ToString(); con.Open(); MySqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "update subject_result set p3='" + marks[s] + "',total_p3_marks='" + Total_p3_marks.Text + "' where srs_id =(Select srs_id from student_registered_courses where su_id='" + su_id + "' limit " + t + ",1)"; cmd.ExecuteNonQuery(); con.Close(); n = n + 1; } btn_project3_marks_save.Text = "Edit"; }
public ActionResult PersonCourses() { using (SchoolEntitiesDBContext db = new SchoolEntitiesDBContext()) { List <OnlineCourse> onlineCourses = new List <OnlineCourse>(); List <OnsiteCourse> onsiteCourses = new List <OnsiteCourse>(); List <PersonCours> allPersonCourses = new List <PersonCours>(); onsiteCourses = db.OnsiteCourses.ToList(); onlineCourses = db.OnlineCourses.ToList(); allPersonCourses = db.PersonCourses.ToList(); SessionData objSession = Session["UserData"] as SessionData; var lstAllCoursesOfPerson = from objOnlineCourse in onlineCourses join objOnsiteCourse in onsiteCourses on objOnlineCourse.CourseID equals objOnsiteCourse.CourseID into Table1 from objOnsiteCourse in Table1.ToList() join objPersonCourses in allPersonCourses on objOnsiteCourse.CourseID equals objPersonCourses.CourseID into Table2 from objPersonCourses in Table2.ToList() where objPersonCourses.PersonID == objSession.PersonID select new PersonCourses { busOnlineCourses = objOnlineCourse, busOnsiteCourses = objOnsiteCourse, busPersonCourses = objPersonCourses }; return(View(lstAllCoursesOfPerson)); } }
static void Main(string[] args) { Table1 t1 = new Table1(); t1.Property1 = "p1"; t1.Property2 = "p2"; t1.Property3 = "p3"; db.Table1Set.Add(t1); db.SaveChanges(); var mf = db.Table1Set; foreach (var item in mf) { Console.WriteLine(item.Property1); } Console.WriteLine("*******************************"); var mf1 = db.Table21Set; foreach (var item in mf1) { Console.WriteLine(item.Property1); } Console.WriteLine("*******************************"); var mf2 = db.Table2Set; foreach (var item in mf2) { Console.WriteLine(item.Property1); } }
protected void Page_Load(object sender, EventArgs e) { DataTable tb = new DataTable(); tb.Load(DB.ExecuteReader(DB.connectionStringSqlServer, CommandType.Text, "Select * from usuario")); Table1.DataBind(); }
/// <summary> /// 新しい Table1 オブジェクトを作成します。 /// </summary> /// <param name="id">ID の初期値。</param> /// <param name="text">text の初期値。</param> public static Table1 CreateTable1(long id, string text) { Table1 table1 = new Table1(); table1.ID = id; table1.text = text; return(table1); }
public Table2 Table2WithUniqueColumn456(Table1 table1) { using var context = new Table1Context(); return(context.Entry(table1) .Collection(t1 => t1.Table2Objects) .Query() .FirstOrDefault(t2 => t2.UniqueColumnAtTable2ForGivenTable1Id == 456)); }
private Clients MapClient(Table1 clientRecord, SearchResults searchResult, int resultCount) { var client = MapRecord(clientRecord, searchResult, resultCount); client.BirthRegistrationNumber = clientRecord.CmpCode; client.OldStreet = clientRecord.column4; return(client); }
private void applyStyle() { Label1.ApplyStyle(primaryStyle); ListBox1.ApplyStyle(primaryStyle); Button1.ApplyStyle(primaryStyle); Table1.ApplyStyle(primaryStyle); TextBox1.ApplyStyle(primaryStyle); }
private Clients MapPartner(Table1 partnerRecord, SearchResults searchResult, int resultCount) { var partner = MapRecord(partnerRecord, searchResult, resultCount); partner.RegistrationNumber = partnerRecord.CmpCode; partner.OldStreet = partnerRecord.column1; return(partner); }
public ActionResult DeleteConfirmed(int id) { Table1 table1 = db.Table1.Find(id); db.Table1.Remove(table1); db.SaveChanges(); return(RedirectToAction("Index")); }
void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { // Add data to the borderColorList, // backColorList, and foreColorList controls. ListItemCollection colors = new ListItemCollection(); colors.Add(Color.Black.Name); colors.Add(Color.Blue.Name); colors.Add(Color.Green.Name); colors.Add(Color.Orange.Name); colors.Add(Color.Purple.Name); colors.Add(Color.Red.Name); colors.Add(Color.White.Name); colors.Add(Color.Yellow.Name); backColorList.DataSource = colors; backColorList.DataBind(); foreColorList.DataSource = colors; foreColorList.DataBind(); //<Snippet4> // Add data to the borderStyleList control. ListItemCollection styles = new ListItemCollection(); Type styleType = typeof(BorderStyle); foreach (string s in Enum.GetNames(styleType)) { styles.Add(s); } //</Snippet4> // Add data to the borderWidthList control. ListItemCollection widths = new ListItemCollection(); for (int i = 0; i < 11; i++) { widths.Add(i.ToString() + "px"); } // Add data to the fontNameList control. // Add data to the fontSizeList control. ListItemCollection fontSizes = new ListItemCollection(); fontSizes.Add("Small"); fontSizes.Add("Medium"); fontSizes.Add("Large"); fontSizes.Add("10pt"); fontSizes.Add("14pt"); fontSizes.Add("20pt"); fontSizeList.DataSource = fontSizes; fontSizeList.DataBind(); //Set primaryStyle as the style for each control. Label1.ApplyStyle(primaryStyle); ListBox1.ApplyStyle(primaryStyle); Button1.ApplyStyle(primaryStyle); Table1.ApplyStyle(primaryStyle); TextBox1.ApplyStyle(primaryStyle); } }
static void Main(string[] args) { var ihost = Host.CreateDefaultBuilder(args) .ConfigureServices((context, services) => { services.AddDbContext <ShawnDbContext>( options => options.UseNpgsql( "host=172.16.0.20;database=bank_cqm_test;username=cqm_app;password=SynyiCqm;PersistSecurityInfo=true;Maximum Pool Size=100;Connection Idle Lifetime=5;Connection Pruning Interval=5")); }).Build(); IServiceProvider provider = ihost.Services; ihost.Start(); using (var scope = provider.CreateScope()) { var tt = scope.ServiceProvider.GetRequiredService <ShawnDbContext>(); using (var trans = tt.Database.BeginTransaction()) { try { Table1 t1 = new Table1 { Id = 1, Name = "Shawn1", Score = 99 }; Table2 t2 = new Table2 { Id = 1, Name = "Shawn1", Age = 29 }; tt.Add(t1); tt.Add(t2); tt.SaveChanges(); trans.Commit(); } catch (Exception e) { trans.Rollback(); } } } Console.WriteLine("Hello World!"); }
private Clients TransformRecord(Table1 clientRecord, RestClient restClient, Func <Table1, SearchResults, int, Clients> mapFn) { var request = new RestRequest($"/api/v1/search/{clientRecord.column4 + " " + clientRecord.column2.Replace(" ", "")}", Method.GET); IRestResponse response; response = restClient.Execute(request); if (response.IsSuccessful) { JObject rss = JObject.Parse(response.Content.ToString()); IEnumerable <JToken> results = rss["searchResults"].Children(); IList <SearchResults> searchResults = new List <SearchResults>(); foreach (JToken result in results) { SearchResults searchResult = result.ToObject <SearchResults>(); searchResults.Add(searchResult); } var matches = searchResults.Count(); if (matches >= 1) { var searchResult = searchResults.FirstOrDefault(); return(mapFn(clientRecord, searchResult, matches)); } if (matches == 0) { try { var request_try = new RestRequest($"/api/v1/search/{clientRecord.column4}", Method.GET); IRestResponse response_try; response_try = restClient.Execute(request_try); JObject answer = JObject.Parse(response_try.Content.ToString()); IEnumerable <JToken> another_results = answer["searchResults"].Children(); IList <SearchResults> another_searchResults = new List <SearchResults>(); foreach (JToken result in another_results) { SearchResults searchResult = result.ToObject <SearchResults>(); another_searchResults.Add(searchResult); } var try_matches = another_results.Count(); var chosen = another_searchResults.FirstOrDefault(); return(mapFn(clientRecord, chosen, try_matches)); } catch (Exception ex) { Console.WriteLine(ex.Message); return(mapFn(clientRecord, null, 0)); } } } return(mapFn(clientRecord, null, 0)); }
// // GET: /DapperExt/ public ActionResult Get() { Table1 model = new Table1(); using (SqlConnection cn = new SqlConnection(DapperHelper.ConnStr)) { model = cn.Get <Table1>(1); } return(Content(model.name)); }
public ActionResult Edit([Bind(Include = "customerID,companyname,contactname")] Table1 table1) { if (ModelState.IsValid) { db.Entry(table1).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(table1)); }
public ActionResult Delete(int id, Table1 d1) { var data = cd.Database.ExecuteSqlCommand("delete from Table1 where Account_Number=@p0", id); if (data != 0) { return(RedirectToAction("Index")); } return(View()); }
protected void LinkButtonAdd_Click(object sender, EventArgs e) { String peopleid = LabelPeopleId.Text; People.add(peopleid, TextBoxName.Text.Trim(), TextBoxUrl.Text.Trim()); GridViewPeople.DataBind(); Table1.DataBind(); TextBoxName.Text = ""; TextBoxUrl.Text = ""; }
//</Snippet6> //<Snippet7> void ChangeForeColor(object sender, System.EventArgs e) { primaryStyle.ForeColor = Color.FromName(foreColorList.SelectedItem.Text); Label1.ApplyStyle(primaryStyle); ListBox1.ApplyStyle(primaryStyle); Button1.ApplyStyle(primaryStyle); Table1.ApplyStyle(primaryStyle); TextBox1.ApplyStyle(primaryStyle); }
/// <summary> /// スキーマの Table1 にはコメントがありません。 /// </summary> public void AddToTable1(Table1 table1) { base.AddObject("Table1", table1); }
/// <summary> /// 新しい Table1 オブジェクトを作成します。 /// </summary> /// <param name="id">ID の初期値。</param> /// <param name="text">text の初期値。</param> public static Table1 CreateTable1(long id, string text) { Table1 table1 = new Table1(); table1.ID = id; table1.text = text; return table1; }
/// <summary> /// 新しい Table1 オブジェクトを作成します。 /// </summary> /// <param name="id">ID の初期値。</param> public static Table1 CreateTable1(int id) { Table1 table1 = new Table1(); table1.ID = id; return table1; }