Esempio n. 1
0
        private void ZavrsiBtn_Click(object sender, EventArgs e)
        {
            if (this.ValidateChildren())
            {
                HttpResponseMessage response = ServisiService.GetResponse(ServisID.ToString());

                if (response.IsSuccessStatusCode)
                {
                    ServisInfo_API.Models.Servisi servis = response.Content.ReadAsAsync <ServisInfo_API.Models.Servisi>().Result;
                    servis.DatumZavršetka = DateTime.Now;
                    servis.Cijena         = Convert.ToDecimal(CijenaTxt.Text);
                    servis.Opis           = opisTxt.Text;

                    servis.TrajanjeDani = DateTime.Now.DayOfYear - s.DatumPocetka.Value.DayOfYear;  // bug ako su 2 razlicite godine !

                    HttpResponseMessage response2 = ServisiService.PutResponse(ServisID, servis);
                    MessageBox.Show("Servis uspjesno završen");

                    if (MessageBox.Show("Da li zelite prikazati izvjestaj servisa?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        HttpResponseMessage r = ServisiService.GetActionResponse("GetIzvjestaj", ServisID.ToString());
                        if (r.IsSuccessStatusCode)
                        {
                            DetaljiServisa_Report detalji = r.Content.ReadAsAsync <DetaljiServisa_Report>().Result;

                            Reports.ReportViewForm frm = new Reports.ReportViewForm();
                            frm.detalji = detalji;
                            frm.Show();
                        }
                    }

                    Bind();
                }
            }
        }
Esempio n. 2
0
        private void ZapocniBtn_Click(object sender, EventArgs e)
        {
            HttpResponseMessage response = ServisiService.GetResponse(ServisID.ToString());

            if (response.IsSuccessStatusCode)
            {
                ServisInfo_API.Models.Servisi servis = response.Content.ReadAsAsync <ServisInfo_API.Models.Servisi>().Result;
                servis.DatumPocetka = DateTime.Now;
                HttpResponseMessage response2 = ServisiService.PutResponse(ServisID, servis);
                MessageBox.Show("Servis uspjesno zapocet");

                Bind();
            }
        }