protected void Button1_Click(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); SQLiteConnection m_dbConnection; int index = 10; var showjudokas = (from j in dbContext.vwExportJS where j.competitionId == 1 orderby j.last ascending select j).ToList(); m_dbConnection = new SQLiteConnection("Data Source=c:\\iks\\KM-2015-4.shi;Version=3;"); m_dbConnection.Open(); foreach (vwExportJ j in showjudokas) { string sql = "insert into competitors ([index], last, first, birthyear, belt, regcategory, weight, visible, deleted," + " seeding, clubseeding) values ("+index+", '" + j.last+"', '" +j.name+"', " + j.birthyear +", " + (j.beltId-1) + ", 'KM', "+ (j.weight*10)+", 1, 0, 0,0)"; SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection); command.ExecuteNonQuery(); //TextBox1.Text = sql; index++; } m_dbConnection.Close(); }
protected void Page_Load(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); int cid = Convert.ToInt16(Page.RouteData.Values["CompetitionId"].ToString()); int jid = Convert.ToInt16(Page.RouteData.Values["JudokaId"].ToString()); int lid = Convert.ToInt16(Page.RouteData.Values["LinkId"].ToString()); if (!IsPostBack) { //LinkButton1.PostBackUrl = "~/AddJudoka/" + id.ToString(); var judoka = (from j in dbContext.judokas where j.id == jid select j).Single(); var competition= (from c in dbContext.competitions where c.id == cid select c).Single(); var clubb = (from k in dbContext.clubbs where k.id == judoka.clubbid select k).Single(); lblClub.Text = clubb.name; lblCompetition.Text = competition.name; lblJudoka.Text = judoka.last + ", " + judoka.name; } }
protected void Page_Load(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); int cid = Convert.ToInt16(Page.RouteData.Values["CompetitionId"].ToString()); int jid = Convert.ToInt16(Page.RouteData.Values["JudokaId"].ToString()); int lid = Convert.ToInt16(Page.RouteData.Values["LinkId"].ToString()); if (!IsPostBack) { //LinkButton1.PostBackUrl = "~/AddJudoka/" + id.ToString(); var judoka = (from j in dbContext.judokas where j.id == jid select j).Single(); var competition = (from c in dbContext.competitions where c.id == cid select c).Single(); var clubb = (from k in dbContext.clubbs where k.id == judoka.clubbid select k).Single(); lblClub.Text = clubb.name; lblCompetition.Text = competition.name; lblJudoka.Text = judoka.last + ", " + judoka.name; } }
protected void Button1_Click(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); SQLiteConnection m_dbConnection; int index = 10; var showjudokas = (from j in dbContext.vwExportJS where j.competitionId == 1 orderby j.last ascending select j).ToList(); m_dbConnection = new SQLiteConnection("Data Source=c:\\iks\\KM-2015-4.shi;Version=3;"); m_dbConnection.Open(); foreach (vwExportJ j in showjudokas) { string sql = "insert into competitors ([index], last, first, birthyear, belt, regcategory, weight, visible, deleted," + " seeding, clubseeding) values (" + index + ", '" + j.last + "', '" + j.name + "', " + j.birthyear + ", " + (j.beltId - 1) + ", 'KM', " + (j.weight * 10) + ", 1, 0, 0,0)"; SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection); command.ExecuteNonQuery(); //TextBox1.Text = sql; index++; } m_dbConnection.Close(); }
protected void Button1_Click(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); int lid = Convert.ToInt16(Page.RouteData.Values["LinkId"].ToString()); int cid = Convert.ToInt16(Page.RouteData.Values["CompetitionId"].ToString()); var competitionJudoka = (from c in dbContext.competitionJudokas where c.id == lid select c).Single(); var judoka = (from j in dbContext.judokas where j.id == competitionJudoka.judokaId select j).Single(); int weight = Convert.ToInt16(Convert.ToDecimal(txtWeight.Text) * 100); int beltId = Convert.ToInt16(ddlBelts.SelectedValue); competitionJudoka.weight = weight; competitionJudoka.beltId = beltId; dbContext.SaveChanges(); if (beltId != judoka.beltid) { judoka.beltid = beltId; dbContext.SaveChanges(); //Response.Redirect("~/ChangebeltJudoka/" + cid.ToString() + "/" + jid.ToString() + "/" + beltId.ToString()); } Response.Redirect("~/ShowJudokas/" + cid.ToString()); }
protected void Page_Load(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); int cid = Convert.ToInt16(Page.RouteData.Values["CompetitionId"].ToString()); int jid = Convert.ToInt16(Page.RouteData.Values["JudokaId"].ToString()); var judoka = (from j in dbContext.judokas where j.id == jid select j).Single(); if (!IsPostBack) { var belts = from b in dbContext.belts select new { b.id, b.name }; ddlBelts.DataSource = belts.ToList(); ddlBelts.DataBind(); ddlBelts.Focus(); string fullname = judoka.last + ", " + judoka.name; litJudoka.Text = fullname; ddlBelts.SelectedIndex = judoka.beltid - 1; } }
protected void Button1_Click(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); int cid = Convert.ToInt16(Page.RouteData.Values["CompetitionId"].ToString()); int jid = Convert.ToInt16(Page.RouteData.Values["JudokaId"].ToString()); var judoka = (from j in dbContext.judokas where j.id == jid select j).Single(); AddJudoka(judoka, jid, cid); int beltId= Convert.ToInt16(ddlBelts.SelectedValue); if (beltId != judoka.beltid) { judoka.beltid = beltId; dbContext.SaveChanges(); //Response.Redirect("~/ChangebeltJudoka/" + cid.ToString() + "/" + jid.ToString() + "/" + beltId.ToString()); } else { //Response.Redirect("~/ShowJudokas/" + cid.ToString()); } Response.Redirect("~/ShowJudokas/" + cid.ToString()); }
protected void Button1_Click(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); int cid = Convert.ToInt16(Page.RouteData.Values["CompetitionId"].ToString()); int jid = Convert.ToInt16(Page.RouteData.Values["JudokaId"].ToString()); var judoka = (from j in dbContext.judokas where j.id == jid select j).Single(); AddJudoka(judoka, jid, cid); int beltId = Convert.ToInt16(ddlBelts.SelectedValue); if (beltId != judoka.beltid) { judoka.beltid = beltId; dbContext.SaveChanges(); //Response.Redirect("~/ChangebeltJudoka/" + cid.ToString() + "/" + jid.ToString() + "/" + beltId.ToString()); } else { //Response.Redirect("~/ShowJudokas/" + cid.ToString()); } Response.Redirect("~/ShowJudokas/" + cid.ToString()); }
protected void Page_Load(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); if (!IsPostBack) { var competitions = from c in dbContext.vwListCompetitions orderby c.date descending select c; GridView1.DataSource = competitions.ToList(); GridView1.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); int lid = Convert.ToInt16(Page.RouteData.Values["LinkId"].ToString()); int cid = Convert.ToInt16(Page.RouteData.Values["CompetitionId"].ToString()); var competitionJudokas = (from c in dbContext.competitionJudokas where c.id == lid select c).Single(); dbContext.competitionJudokas.Remove(competitionJudokas); dbContext.SaveChanges(); Response.Redirect("~/ShowJudokas/" + cid.ToString()); }
protected void Page_Load(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); if (!IsPostBack) { var clubs = from c in dbContext.clubbs orderby c.name ascending select c; ddlClubb.DataSource = clubs.ToList(); ddlClubb.DataBind(); ddlClubb.Focus(); ViewState["cid"] = _cid; //ViewState["judoka"] = _judoka; } _cid = (int)ViewState["cid"]; //_judoka = (judoka)ViewState["judoka"]; }
protected void Page_Load(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); int id = Convert.ToInt16(Page.RouteData.Values["CompetitionId"].ToString()); if (!IsPostBack) { LinkButton1.PostBackUrl = "~/NewJudoka/" + id.ToString(); LinkButton2.PostBackUrl = "~/ShowJudokas/" + id.ToString(); var judokas = from j in dbContext.vwAddJudokas where !dbContext.competitionJudokas.Any(cj => j.id == cj.judokaId && cj.competitionId == id) select j; GridView1.DataSource = judokas.ToList(); GridView1.DataBind(); TextBox1.Focus(); } }
protected void Page_Load(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); int id = Convert.ToInt16(Page.RouteData.Values["CompetitionId"].ToString()); if (!IsPostBack) { LinkButton1.PostBackUrl = "~/NewJudoka/" + id.ToString(); LinkButton2.PostBackUrl = "~/ShowJudokas/" + id.ToString(); var judokas = from j in dbContext.vwAddJudokas where !dbContext.competitionJudokas.Any(cj=> j.id==cj.judokaId&&cj.competitionId==id) select j; GridView1.DataSource = judokas.ToList(); GridView1.DataBind(); TextBox1.Focus(); } }
protected void Page_Load(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); int id = Convert.ToInt16(Page.RouteData.Values["CompetitionId"].ToString()); if (!IsPostBack) { LinkButton1.PostBackUrl = "~/AddJudoka/"+id.ToString(); LinkButton3.PostBackUrl = "~/ExportJS/"+id.ToString(); var competition = (from c in dbContext.competitions where c.id == id select c).Single(); maxNumCompetitors = (int)competition.maxcompetitors; string maxText = ""; if(maxNumCompetitors!=0) { maxText = " av " + maxNumCompetitors.ToString(); } var showjudokas = from j in dbContext.vwShowJudokas where j.competitionId == id orderby j.last ascending select j; GridView1.DataSource = showjudokas.ToList(); GridView1.DataBind(); lblAntal.Text = " (" + showjudokas.Count().ToString() + " st" + maxText +")"; numCompetitors = showjudokas.Count(); } if ((maxNumCompetitors - numCompetitors) > 0) { LinkButton1.CssClass = "btn btn-success active"; } else { LinkButton1.CssClass = "btn btn-danger disabled"; } }
protected void Page_Load(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); int id = Convert.ToInt16(Page.RouteData.Values["CompetitionId"].ToString()); if (!IsPostBack) { LinkButton1.PostBackUrl = "~/AddJudoka/" + id.ToString(); LinkButton3.PostBackUrl = "~/ExportJS/" + id.ToString(); var competition = (from c in dbContext.competitions where c.id == id select c).Single(); maxNumCompetitors = (int)competition.maxcompetitors; string maxText = ""; if (maxNumCompetitors != 0) { maxText = " av " + maxNumCompetitors.ToString(); } var showjudokas = from j in dbContext.vwShowJudokas where j.competitionId == id orderby j.last ascending select j; GridView1.DataSource = showjudokas.ToList(); GridView1.DataBind(); lblAntal.Text = " (" + showjudokas.Count().ToString() + " st" + maxText + ")"; numCompetitors = showjudokas.Count(); } if ((maxNumCompetitors - numCompetitors) > 0) { LinkButton1.CssClass = "btn btn-success active"; } else { LinkButton1.CssClass = "btn btn-danger disabled"; } }
protected void Page_Load(object sender, EventArgs e) { dbContext = new judoshiaiEntities(); int cid = Convert.ToInt16(Page.RouteData.Values["CompetitionId"].ToString()); int jid = Convert.ToInt16(Page.RouteData.Values["JudokaId"].ToString()); int lid = Convert.ToInt16(Page.RouteData.Values["LinkId"].ToString()); if (!IsPostBack) { //LinkButton1.PostBackUrl = "~/AddJudoka/" + id.ToString(); var judoka = (from j in dbContext.judokas where j.id == jid select j).Single(); var competition = (from c in dbContext.competitions where c.id == cid select c).Single(); var clubb = (from k in dbContext.clubbs where k.id == judoka.clubbid select k).Single(); var competitionJudoka = (from c in dbContext.competitionJudokas where c.id == lid select c).Single(); var belts = from b in dbContext.belts select b; ddlBelts.DataSource = belts.ToList(); ddlBelts.DataBind(); ddlBelts.Focus(); lblClub.Text = clubb.name; lblCompetition.Text = competition.name; lblJudoka.Text = judoka.last + ", " + judoka.name; txtWeight.Text = (Convert.ToDecimal(competitionJudoka.weight) / 100).ToString("F"); ddlBelts.SelectedIndex = (int)competitionJudoka.beltId - 1; txtWeight.Focus(); } }