protected void Button1Click(object sender, DirectEventArgs e) { SpacialDataSet sd = new SpacialDataSet(); sd.vehicule = vehicule.Text; sd.dateDepart = DateTime.Parse(dateDepart.Text) + TimeSpan.Parse(HD.Text); sd.dateArivee = DateTime.Parse(dateArivee.Text) + TimeSpan.Parse(HA.Text); if (pm.Checked == true) { SqlGeometry sqlG = SqlGeometry.Parse(trajet.Text); sd.trajet = DbGeometry.FromBinary(sqlG.STAsBinary().Buffer); } else if (pm.Checked == false) { SqlGeometry sqlG = SqlGeometry.Parse(trajet.Text); sd.trajet = DbGeometry.FromBinary(sqlG.STAsBinary().Buffer); } sd.active = (bool?)SqlBoolean.Parse(active.Text); db = new demoDB(); db.SpacialDataSets.Add(sd); db.SaveChanges(); X.Msg.Alert("INFO", "l'opération a été effectuée avec succès").Show(); ResetInputs(); Store1.Reload(); X.Call("resetMap"); }
protected void deleteRow(object sender, DirectEventArgs e) { db = new demoDB(); string varID = e.ExtraParams["Id"]; var ID = int.Parse(varID); SpacialDataSet sd = (from i in db.SpacialDataSets where i.Id == ID select i).SingleOrDefault(); sd.active = false; db.SaveChanges(); //ChargeGridPanel(); Store1.Reload(); }
protected void ChargeGridPanel() { db = new demoDB(); int x = 1; bool y = Convert.ToBoolean(x); var data = (from sd in db.SpacialDataSets where sd.active == y select sd); Store1.DataSource = data; Store1.DataBind(); }
public static SpacialDataSet GetSpacialDataSet(int id, demoDB db) { return(db.SpacialDataSets.Single(e => e.Id == id)); }
public static SpacialDataSet GetSpacialDataSet(int id) { demoDB db = new demoDB(); return(GetSpacialDataSet(id, db)); }