edItem) .SubjectID;
} void button2_Click (object sender, EventArgs e)
{textGetter; .FormatTexts.RemoveRange (db.FormatTexts) ;. SaveChanges () ;. Clear () ;. Value=0; (checkBox1.Checked)
{file=new WorkingProgrammsFile () ;. Stream=File.ReadAllBytes (fileName) ;. FileName= asdf raquo ;;. SubjectID=subjectID; .WorkingProgrammsFiles.Add (file) ;. SaveChanges ( );=new PhysicParser (DocX.Load (fileName));
}
{file=db.WorkingProgrammsFiles.FirstOrDefault (f= gt; f.WorkingProgramFileID == ((WorkingProgrammsFile) comboBox2.SelectedItem) .WorkingProgramFileID); stream=new MemoryStream (file.Stream);=new PhysicParser (DocX.Load (stream));
} subjectName=textGetter.GetSubjectName (); formatText=new FormatText
{= subjectID,= SubjectName ,=subjectName
} ;. FormatTexts.Add (formatText) ;. Text +=string.Format ( SubjectName={0} {1} raquo ;, subjectName, Environment.NewLine) ;. Value ++; subjectNameCipher =textGetter.GetSubjectNameCipher ();=new FormatText
{= subjectID,= SubjectNameCipher ,=subjectNameCipher
} ;. FormatTexts.Add (formatText) ;. Text +=string.Format ( SubjectNameCipher={0} {1} raquo ;, subjectNameCipher, Environment.NewLine) ;. Value ++; degree =textGetter.GetDegree ();=new FormatText {SubjectID=subjectID, Name= Degree raquo ;, Value=degree} ;. FormatTexts.Add (formatText) ;. Text +=string.Format ( Degree={0} {1} raquo ;, degree, Environment.NewLine) ;. Value ++; specialtyCipher=textGetter.GetSpecialtyCipher ();=new FormatText {SubjectID=subjectID, Name= SpecialtyCipher raquo ;, Value=specialtyCipher} ;. FormatTexts.Add (formatText ) ;. Text +=string.Format ( SpecialtyCipher={0} {1} raquo ;, specialtyCipher, Environment.NewLine) ;. Value ++; specialtyName=textGetter.GetSpecialityName ();=new FormatText {SubjectID=subjectID, Name = SpecialtyName raquo ;, Value=specialtyName} ;. FormatTexts.Add (formatText) ;. Text +=string.Format ( SpecialtyName={0} {1} raquo ;, specialtyName, Environment.NewLine) ;. Value ++; trainingProfile=textGetter.GetTrainingProfile ();=new FormatText {SubjectID=subjectID, Name= TrainingProfile raquo ;, Value=trainingProfile} ;. FormatTexts.Add (formatText) ;. Text +=string.Format ( TrainingProfile={0 } {1} raquo ;, trainingProfile, Environment.NewLine) ;. Value ++; degree2=textGetter.GetDegree2 (specialtyCipher);=new FormatText {SubjectID=subjectID, Name= Degree2 raquo ;, Value=degree2} ;. FormatTexts.Add (formatText) ;. Text +=string.Format ( Degree2={0} {1} raquo ;, degree2, Environment.NewLine) ;. Value ++ ;. SaveChanges ();
} void checkBox1_CheckedChanged (object sender, EventArgs e)
{. Visible=checkBox1.Checked; .Visible =! checkBox1.Checked;
} void generateButton_Click (object sender, EventArgs e)
{selectedSubject=((Subject) subjectsComboBox.SelectedItem); templateFile=db.TemplateFiles.FirstOrDefault (tf= gt; tf.SubjectID == selectedSubject.SubjectID);
if (templateFile == null)
{. Show ( Для даного предмета відсутній шаблон! );
return;
}. ShowDialog (); (! string.IsNullOrEmpty (saveFileDialog1.FileName))
{stream=new MemoryStream (templateFile.Stream); fileToSave=DocX.Load (stream); lt; FormatText gt; formatTexts=db.FormatTexts.Where (ft= gt; ft.SubjectID == selectedSubject.SubjectID) .ToList () ;. ReplaceText ( SubjectNameCipher raquo ;, formatTexts.FirstOrDefault (ft= gt; ft.Name == SubjectNameCipher raquo ;). Value) ;. ReplaceText ( SubjectName raquo ;, formatTexts.FirstOrDefault (ft= gt; ft.Name == SubjectName ). Value) ;. ReplaceText ( Degree2 raquo ;, formatTexts.FirstOrDefault (ft= gt; ft.Name == Degree2 ). Value) ;. ReplaceText ( Degree raquo ;, formatTexts.FirstOrDefault (ft= gt; ft.Name == Degree ). Value) ;. ReplaceText ( laquo ; SpecialtyCipher raquo ;, formatTexts.FirstOrDefault (ft= gt; ft.Name == SpecialtyCipher ). Value) ;. ReplaceText ( SpecialtyName raquo ;, formatTexts.FirstOrDefault (ft= gt; ft.Name == SpecialtyName raquo ;). Value) ;. ReplaceText ( TrainingProfile raquo ;, formatTexts.FirstOrDefault (ft= gt; ft.Name == TrainingProfile ). Value) ;. SaveAs (saveFileDialog1.FileName);
//File.WriteAllBytes (saveFileDialog1.FileName, templateFile.Stream);
MessageBox.Show ( Програма успішно збережено! );
} void uploadTemplateButton_Click (object sender, EventArgs e)
{subjectID=((Subject) subjectsForAdminComboBox.SelectedItem) .SubjectID; templateFile=db.TemplateFiles.FirstOrDefault (tf= gt; tf.SubjectID == subjectID); (templateFile == null)
<...