public static String generate(long temp) { List <Vraboten> vraboteni = VrabotenController.getVraboteniFromFirmaId(temp); Firma firma = FirmaController.GetFirmaById(temp); StringBuilder sb = new StringBuilder(); sb.AppendLine(firma.ime + " - " + firma.edb); sb.AppendLine("Ime;DatumPriem;EMBG;TransakciskaSmetka;BrutoPlata"); foreach (Vraboten v in vraboteni) { DateTime date = v.datumPriem; sb.AppendLine(v.ime + ";" + date.ToString("MM/dd/yyyy") + ";" + v.embg + ";" + v.transakciskaSmetka + ";" + v.brutoPlata); } String finalStr = sb.ToString(); return(finalStr); }
internal static void Save(TextBox txtFirmaId, TextBox txtImePrezime, ComboBox cmbPol, TextBox txtEmbg, TextBox txtAdresa2, ComboBox cmbOpstina, TextBox txtTransak, ComboBox cmbPodracna, TextBox txtEmail2, TextBox txtBruto, TextBox txtNeto, ComboBox cmbSifra, TextBox txtSkrateno, DateTimePicker dateTimePicker1, CheckBox chbOtkaz, DateTimePicker dateTimePicker2) { String pol = cmbPol.SelectedItem.ToString(); String opstina = cmbOpstina.SelectedItem.ToString(); String podracna = cmbPodracna.SelectedItem.ToString(); String sifra = cmbSifra.SelectedItem.ToString(); DateTime?date2 = null; if (chbOtkaz.Checked) { date2 = dateTimePicker2.Value; } long id = long.Parse(txtFirmaId.Text); Firma firma = FirmaController.GetFirmaById(id); DateTime date1 = dateTimePicker1.Value; Vraboten vraboten = new Vraboten(txtImePrezime.Text, date1, date2, pol, txtEmbg.Text, txtAdresa2.Text, opstina, txtTransak.Text, podracna, txtEmail2.Text, int.Parse(txtBruto.Text), int.Parse(txtNeto.Text), sifra, int.Parse(txtSkrateno.Text), firma.id); db.vraboteni.Add(vraboten); db.SaveChanges(); }