public static void DisplayInExcel(SertificateDTO sertificate) { var excelApp = new Excel.Application(); // Make the object visible. excelApp.Visible = true; // Create a new, empty workbook and add it to the collection returned // by property Workbooks. The new workbook becomes the active workbook. // Add has an optional parameter for specifying a praticular template. // Because no argument is sent in this example, Add creates a new workbook. string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); Excel.Workbook workBook = excelApp.Workbooks.Open(path+"/target.xls"); // This example uses a single workSheet. The explicit type casting is // removed in a later procedure. Excel._Worksheet workSheet = (Excel.Worksheet)excelApp.ActiveSheet; // Establish column headings in cells A1 and B1. workSheet.Cells[13, "C"] = sertificate.MySertificateId; workSheet.Cells[15, "E"] = sertificate.Name; workSheet.Cells[15, "G"] = sertificate.SertificateTag; workSheet.Cells[20, "C"] = sertificate.Creator; workSheet.Cells[22, "C"] = sertificate.Owner; workSheet.Cells[26, "B"] = sertificate.QualityDocument; workSheet.Cells[34, "G"] = sertificate.Validator; workSheet.Cells[36, "G"] = sertificate.ValidateTime; }
public CreateForm(SertificateDTO stf) { InitializeComponent(); idTB.Text = stf.MySertificateId; EstTimeTB.Text = stf.EstimatedTime; NameTB.Text = stf.Name; TagTB.Text = stf.SertificateTag; CreatorTB.Text = stf.Creator; OwnerTB.Text = stf.Owner; DocTB.Text = stf.QualityDocument; ItemsTB.Text = stf.Items; ValidatorTB.Text = stf.Validator; ValidTimeTB.Text = stf.ValidateTime; }
private void createBtn_Click(object sender, EventArgs e) { SertificateDTO stf = new SertificateDTO { MySertificateId = idTB.Text.ToString(), EstimatedTime = EstTimeTB.Text.ToString(), Name = NameTB.Text.ToString(), SertificateTag = TagTB.Text.ToString(), Creator = CreatorTB.Text.ToString(), Owner = OwnerTB.Text.ToString(), QualityDocument = DocTB.Text.ToString(), Items = ItemsTB.Text.ToString(), Validator = ValidatorTB.Text.ToString(), ValidateTime = ValidTimeTB.Text.ToString() }; Data.CreateEventHandler(stf); this.Close(); }
public void MakeSertificate(SertificateDTO sertificateDTO) { Sertificate sertificate = Database.Sertificates.Get(sertificateDTO.MySertificateId); if (sertificate == null) { Sertificate newSertificate = new Sertificate { MySertificateId = sertificateDTO.MySertificateId, EstimatedTime = sertificateDTO.EstimatedTime, Name = sertificateDTO.Name, SertificateTag = sertificateDTO.SertificateTag, Creator = sertificateDTO.Creator, Owner = sertificateDTO.Owner, Validator = sertificateDTO.Validator, QualityDocument = sertificateDTO.QualityDocument, Items = sertificateDTO.Items, ValidateTime = sertificateDTO.ValidateTime }; Database.Sertificates.Create(newSertificate); } else { sertificate.EstimatedTime = sertificateDTO.EstimatedTime; sertificate.Name = sertificateDTO.Name; sertificate.SertificateTag = sertificateDTO.SertificateTag; sertificate.Creator = sertificateDTO.Creator; sertificate.Owner = sertificateDTO.Owner; sertificate.Validator = sertificateDTO.Validator; sertificate.QualityDocument = sertificateDTO.QualityDocument; sertificate.Items = sertificateDTO.Items; sertificate.ValidateTime = sertificateDTO.ValidateTime; Database.Sertificates.Update(sertificate); } Database.Save(); }