private void Button_Click_2(object sender, RoutedEventArgs e) { //Добавить оценку string Id = ID.Text; string Datac = DataC.Text; string Tema = TEMA.Text; string Mark = MARK.Text; string ssql = $"INSERT INTO Marks (Id,Datac,Tema,Mark) VALUES ('{Id}','{Datac}','{Tema}','{Mark}')"; //ЗАпрос вставить данные в таблицу Table_1 - имя таблици string connectionString = @"Data Source=DESKTOP-CDQ6MB6\SQLEXPRESS;Initial Catalog=gnevnik;Integrated Security=True"; //prak - имя базы данных(Поменять на свою) SqlConnection conn = new SqlConnection(connectionString); // Подключение к БД conn.Open(); // Открытие Соединения SqlCommand command = new SqlCommand(ssql, conn); // Объект вывода запросов MessageBox.Show("Данные добавлены"); ID.Clear(); DataC.Clear(); TEMA.Clear(); MARK.Clear(); SqlDataReader reader = command.ExecuteReader(); // Выаолнение запроса вывод информации while (reader.Read()) //В цикле вывести всю информацию из таблици { InfoM.Text += reader[0] + " - Id студента " + "Дата: " + reader[1].ToString() + " Тема: " + reader[2].ToString() + " Оценка: " + reader[3].ToString() + "\n"; } reader.Close(); }
public void EditMark(int id, string name) { MARK slct_mark = db.MARKS.Find(id); slct_mark.NAME = name; db.SaveChanges(); }
private void Button_Click_9(object sender, RoutedEventArgs e) { //Изменить оценку по ID string ssql = @"UPDATE Marks SET [Mark] = @Mark WHERE Id = @Id"; string connectionString = @"Data Source=DESKTOP-CDQ6MB6\SQLEXPRESS;Initial Catalog=gnevnik;Integrated Security=True"; //prak - имя базы данных(Поменять на свою) SqlConnection conn = new SqlConnection(connectionString); // Подключение к БД conn.Open(); SqlCommand command = new SqlCommand(ssql, conn);// Объект вывода запросов command.Parameters.Add("@Id", SqlDbType.Int).Value = Convert.ToInt32(ID1.Text); command.Parameters.Add("@MArk", SqlDbType.NVarChar).Value = MARK.Text; SqlDataReader reader = command.ExecuteReader(); // Выаолнение запроса вывод информации while (reader.Read()) //В цикле вывести всю информацию из таблици { InfoM.Text += reader[0] + " - Id студента " + "Дата: " + reader[1].ToString() + " Тема: " + reader[2].ToString() + " Оценка: " + reader[3].ToString() + "\n"; } reader.Close(); MessageBox.Show("Оценка изменена"); MARK.Clear(); ID1.Clear(); InfoM.Clear(); InfoS.Clear(); }
public SquareFrame RandomAddPoint_Point(int number, MARK mark) { List <Vector> add_list = new List <Vector>(); Vector ran_v = new Vector(); while (number > 0) { do { ran_v.x = (float)Math.Round( ran.Next(0, (int)Math.Round(width_0 / DISPLAY_RESOLUTION_F)) * DISPLAY_RESOLUTION_F, 2); ran_v.y = (float)Math.Round( ran.Next(0, (int)Math.Round(height_0 / DISPLAY_RESOLUTION_F)) * DISPLAY_RESOLUTION_F, 2); } while (add_list.Contains(ran_v)); add_list.Add(ran_v); number--; } foreach (var item in add_list) { givenpoint_list.RemoveAll((item_l => item_l == item)); if (lattice_dic.ContainsKey(item)) { givenpoint_list.Add(item); lattice_dic[item].mark = mark; } } return(this); }
public void load(string file) { byte[] f = File.ReadAllBytes(file); BinaryReader br = new BinaryReader(new MemoryStream(f, 0, f.Length)); hdr.parseHeader(br); readEntries(br); for (int i = 0; i < amtaData.Count; i++) { f = amtaData[i]; br = new BinaryReader(new MemoryStream(f, 0, f.Length)); AMTA amta = new AMTA(); amta.parseAMTA(br); DATA data = new DATA(); data.parseDATA(br); MARK mark = new MARK(); mark.parseMARK(br); EXT_ ext = new EXT_(); ext.parseEXT_(br); STRG strg = new STRG(); strg.parseSTRG(br); strgList.Add(strg); br.Close(); } }
public ActionResult DeleteConfirmed(int id) { MARK mARK = db.MARKS.Find(id); db.MARKS.Remove(mARK); db.SaveChanges(); return(RedirectToAction("Index")); }
public IHttpActionResult GET([FromUri] MARK mark) { EMPLEADO empAnt = new EMPLEADO(); //INICIANDO DISPOSITIVO zkfp2.Init(); mDevHandle = zkfp2.OpenDevice(0); //CREANDO VECTOR QUE GUARDA HUELLA zkfp2.GetParameters(mDevHandle, 1, paramValue, ref size); zkfp2.ByteArray2Int(paramValue, ref mfpWidth); size = 4; zkfp2.GetParameters(mDevHandle, 2, paramValue, ref size); zkfp2.ByteArray2Int(paramValue, ref mfpHeight); //CREANDO BYTE PARA HUELLA FPBuffer = new byte[mfpWidth * mfpHeight]; //CREANDO VECTOR PARA DENSIDAD DE HUELLA size = 4; zkfp2.GetParameters(mDevHandle, 3, paramValue, ref size); zkfp2.ByteArray2Int(paramValue, ref mfpDpi); //INCIANDO BASE DE DATOS DEL LECTOR mDBHandle = zkfp2.DBInit(); ret = zkfp.ZKFP_ERR_FAIL; cbCapTmp = 2048; while (ret != zkfp.ZKFP_ERR_OK) { ret = zkfp2.AcquireFingerprint(mDevHandle, FPBuffer, CapTmp, ref cbCapTmp); } ret = zkfp2.DBIdentify(mDBHandle, CapTmp, ref fid, ref score); if (zkfp.ZKFP_ERR_OK == ret) { using (CICAMEntities entities = new CICAMEntities()) { empAnt = entities.EMPLEADO.Find(fid); mark.EMPE_IDENTITY = empAnt.ID; mark.FECHA = DateTime.Now.Date; mark.HORA = DateTime.Now.TimeOfDay; entities.MARK.Add(mark); entities.SaveChanges(); } return(Ok(new { status = "Registro encontrado", ID = fid })); } else { return(Ok(new { status = "Registro no encontrado" })); } }
public ActionResult Edit([Bind(Include = "OBJECTID,NAME")] MARK mARK) { if (ModelState.IsValid) { db.Entry(mARK).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(mARK)); }
public void AddMark(string name) { MARK new_mark = new MARK { NAME = name }; db.MARKS.Add(new_mark); db.SaveChanges(); }
public ActionResult Create([Bind(Include = "OBJECTID,NAME")] MARK mARK) { if (ModelState.IsValid) { db.MARKS.Add(mARK); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(mARK)); }
public SquareFrame AddGivenPoint(float x, float y, MARK mark) { x -= DISPLAY_RESOLUTION_F; y -= DISPLAY_RESOLUTION_F; givenpoint_list.RemoveAll((item_l => item_l.x == x && item_l.y == y)); givenpoint_list.Add(new Vector(x, y)); if (lattice_dic.ContainsKey(new Vector(x, y))) { lattice_dic[new Vector(x, y)].mark = mark; } return(this); }
// GET: AgroPark/MARKs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MARK mARK = db.MARKS.Find(id); if (mARK == null) { return(HttpNotFound()); } return(View(mARK)); }
public virtual void Start() { GUID = Guid.NewGuid(); marks = new List <MARK> (); MARK m = new MARK(); m.Owner = GUID; m.count = 4; marks.Add(m); Debug.Log(GUID); }
public SquareFrame Run_kNN(ushort k) { lattice_pointer = first_lattice; while (lattice_pointer != null) { if (lattice_pointer.mark == MARK.NULL) { List <Vector> distance_list = new List <Vector>(); foreach (var item in givenpoint_list) { distance_list.Add(item - lattice_pointer.coord); } if (distance_list.Count() >= k) { distance_list.Sort(); Dictionary <MARK, uint> mark_num_dic = new Dictionary <MARK, uint>(); for (int i = k - 1; i >= 0; i--) { Lattice l_target = lattice_dic[lattice_pointer.coord + distance_list[i]]; if (mark_num_dic.ContainsKey(l_target.mark)) { mark_num_dic[l_target.mark]++; } else { mark_num_dic.Add(l_target.mark, 1); } } MARK mark_max = MARK.NULL; uint mark_max_uint = 0; foreach (var item in mark_num_dic) { if (item.Value >= mark_max_uint) { mark_max_uint = item.Value; mark_max = item.Key; } } lattice_pointer.mark = (MARK)((int)(mark_max) + 2); } } lattice_pointer = lattice_pointer.next_lattice; } return(this); }
public SquareFrame RandomAddPoint_Oval( float fixed_points_distances_min, float fixed_points_distances_max, float r_min, float r_max, float probability, MARK mark) { float r = (float)ran.NextDouble() + (r_max - r_min) + r_min; float f_2 = (float)ran.NextDouble() * (fixed_points_distances_max - fixed_points_distances_min) + fixed_points_distances_min; if (ran.Next(0, 1) > 0) { f_2 *= -1; } Vector f1 = new Vector((float)ran.NextDouble() * width_0, (float)ran.NextDouble() * height_0); Vector f2 = new Vector(f1.x + f_2, f1.y); foreach (var item in lattice_dic) { if (((item.Key - f1).Length() + (item.Key - f2).Length()) < r * r) { if (givenpoint_list.Contains(item.Key)) { givenpoint_list.RemoveAll((item_l => item_l == item.Key)); } item.Value.mark = MARK.NULL; if ((float)ran.NextDouble() < probability) { givenpoint_list.Add(item.Key); item.Value.mark = mark; } } } return(this); }