public static void DataInForStudent(string[] arg)//добавление { Dek TB = DataLoadSave.LoadXML(FilePath); //var student = TB.Students.First(x => x.ID == ID); StudentsTable StudentBlok = new StudentsTable ( arg[1] != "" ? GetGroupeIDByGroupeName(TB, arg[1]) : -1, arg[2] != "" ? GetRoomIdByRoomNumber(TB, arg[2]) : -1, arg[3], arg[4], arg[5], arg[6], arg[7], arg[8], arg[9], arg[10] != null ? arg[10] : null ); //StudentBlok.ID = TB.StudID++; TB.Students.Add(StudentBlok); Save(TB); //StudentsInGroupeCount(); //StudentsInRoomCount(); }
public ActionResult Create(StudentsTable st) { if (st != null) { db.StudentsTable.Add(st); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(st)); }
public ActionResult Edit(string id, StudentsTable std) { try { db.Entry(std).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception ex) { return(View()); } }
public static void DataInForStudent(string[] arg, int ID)//редактирование за айдишником дата грида { Dek TB = DataLoadSave.LoadXML(); int i = GetTrueItemID(TB, ID, For.Student); StudentsTable StudentBlok = new StudentsTable ( arg[1] != "" ? GetGroupeIDByGroupeName(TB, arg[1]) : -1, arg[2] != "" ? GetRoomIdByRoomNumber(TB, arg[2]) : -1, arg[3], arg[4], arg[5], arg[6], arg[7], arg[8], arg[9], arg[10] != null ? arg[10] : null ); StudentBlok.ID = TB.Students[i].ID; TB.Students[i] = StudentBlok; Save(TB); //Dek TB; //if (FileEx(FilePath)) // TB = DataLoadSave.LoadXML(FilePath); //else TB = new Dek(); //int i = GetTrueItemID(TB, ID, For.Student); //StudentsTable StudentBlok = new StudentsTable //{ // GroupeID = arg[1] != "" ? GetGroupeIDByGroupeName(TB, arg[1]) : -1, // RoomID = arg[2] != "" ? GetRoomIdByRoomNumber(TB, arg[2]) : -1, // ThirdName_1 = arg[3], // Name_2 = arg[4], // SurnameName_3 = arg[5], // TicetNumber = arg[6], // FormStudy = arg[7], // ContractBudget = arg[8], // Description = arg[9], // Bin = arg[10] != null ? File.ReadAllBytes(arg[10]) : TB.Students[i].Bin //}; //StudentBlok.ID = TB.Students[i].ID; //TB.Students[i] = StudentBlok; //Save(TB); //StudentsInGroupeCount(); //StudentsInRoomCount(); }
public ActionResult SearchGrade(StudentVM vm) { using (var context = new StudentsEntities()) { var st = context.StudentsTable .Where(s => s.StudentID == vm.StudentID) .FirstOrDefault(); if (st == null) { StudentsTable StudentNotFound = new StudentsTable(); StudentNotFound.GradeInEnglishCourse = null; st = StudentNotFound; } ViewData["student"] = st; return(View()); } }
private void DodajStudentaBtn_Click(object sender, RoutedEventArgs e) { int id = Int32.Parse(IndeksTb.Text); StudentsDBEntities SDE = new StudentsDBEntities(); StudentsTable ST = new StudentsTable(); var czy_istnieje = SDE.StudentsTable.Where(p => p.Id == id).FirstOrDefault(); if (czy_istnieje == null) { ST.Id = Int32.Parse(IndeksTb.Text); ST.StudentName = ImieTb.Text; ST.StudentSurname = NazwiskoTb.Text; ST.DateOfBirt = DataDp.SelectedDate.Value; SDE.StudentsTable.Add(ST); SDE.SaveChanges(); } else { MessageBox.Show("Istnieje już taki student"); } DialogResult = true; }
public EditStudent(StudentsTable row) { this.row = row; InitializeComponent(); }
public int AddStudent(StudentsTable model) { throw new NotImplementedException(); }
public static DataTable OpenDataForEdit(For @for, int ID) { Dek TB = DataLoadSave.LoadXML(FilePath); DataSet Ds = new DataSet("Students"); DataTable StudentTable = InitealDTStudentForEdit(); DataTable GroupesTable = InitealDTSGrope(); DataTable RoomTable = InitealDTRoom(); DataTable HostTable = InitealDTSHostel(); Ds.Tables.Add(StudentTable); Ds.Tables.Add(GroupesTable); Ds.Tables.Add(RoomTable); Ds.Tables.Add(HostTable); if (@for == For.Student) { int SitemID = GetTrueItemID(TB, ID, @for); //if (SitemID < TB.StudID) if (SitemID != -1) { StudentsTable StudentBlok = TB.Students[SitemID]; StudentTable.Rows.Add(new object[] { StudentBlok.ID, GetGroupeNameByID(TB, StudentBlok.GroupeID), GetRoomNumberByRoomID(TB, StudentBlok.RoomID), StudentBlok.ThirdName_1, StudentBlok.Name_2, StudentBlok.SurnameName_3, StudentBlok.TicetNumber, StudentBlok.FormStudy, StudentBlok.ContractBudget, StudentBlok.Description }); return(StudentTable); } } else if (@for == For.Groupe) { int GitemID = GetTrueItemID(TB, ID, @for); if (GitemID != -1) { GroupeTable GroupeBlok = TB.Groupes[GitemID]; GroupesTable.Rows.Add(new object[] { GroupeBlok.ID, GroupeBlok.GroupeNumber, GroupeBlok.StudentsInGroupe, GroupeBlok.Description }); return(GroupesTable); } } else if (@for == For.Room) { int RitemID = GetTrueItemID(TB, ID, @for); if (RitemID != -1) { RoomTable RoomBlok = TB.Roomes[RitemID]; RoomTable.Rows.Add(new object[] { RoomBlok.ID, GetHostelNameByID(TB, RoomBlok.HostelID), RoomBlok.RoomNumber, RoomBlok.AllPlace, RoomBlok.FreePlase, RoomBlok.Description }); return(RoomTable); } } else if (@for == For.Hostel) { int HitemID = GetTrueItemID(TB, ID, @for); if (HitemID != -1) { HostelNewTable HostelBlok = TB.HostelsN[HitemID]; HostTable.Rows.Add(new object[] { HostelBlok.ID, HostelBlok.Frame, HostelBlok.RoomsCount, HostelBlok.Decription }); return(HostTable); } } return(null); }