コード例 #1
0
        private void btn_indsæt_Click(object sender, EventArgs e)
        {
            worksOn = new WorksOnBLL(SagsID(), TotHours());

            beregn_hentData_btn_Click(sender, e);

            try
            {
                if (!WorksOnBLL.RecordExists(SagsID())) //if there is no record in the db then create new
                {
                    worksOn.IndsætTimer(worksOn);
                }
                else //else update the existing record
                {
                    worksOn.Update(worksOn);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            if (HandelDAL.HandelExists(SagsID()))                                                                 //if there is a handel record in the Handel tabel
            {
                result_txt.Text = worksOn.BeregnSalær(WorksOnBLL.HentSalgspris(SagsID().ToString()), TotHours()); //beregn salær med en procentsats af boligens salgspris
            }
            else
            {
                result_txt.Text = worksOn.BeregnSalær(0, TotHours()); //else beregn TotHours * 150 kr
            }
        }