Zbiór zmian 611

Pokaż
Ignoruj:
Data:
2009-04-27 10:19:42 (17 years ago)
Autor:
marek
Opis:

re #160 - poprawa dodawania klienta

Lokalizacja:
trunk
Pliki:
1 dodane
12 zmodyfikowane

Legenda:

Bez zmian
Dodane
Usunięte
  • trunk/BazaReklam.Updater/FormUpdate.cs

    r597 r611  
    9999            { 
    100100                if (_args.Length < 2) 
    101                     throw new Exception("B³êdne wywo³anie programu!"); 
     101                    throw new ApplicationException("B³êdne wywo³anie programu!"); 
    102102 
    103103                _isBusy = true; 
  • trunk/BazaReklam/AddClient.Designer.cs

    r597 r611  
    10501050            this.Text = "Dodaj/modyfikuj klienta"; 
    10511051            this.Load += new System.EventHandler(this.AddClient_Load); 
     1052            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AddClient_FormClosing); 
    10521053            this.gbAddress.ResumeLayout(false); 
    10531054            this.gbAddress.PerformLayout(); 
  • trunk/BazaReklam/AddClient.cs

    r597 r611  
    246246            errorProvider.SetError(txtClientCode, sb.ToString()); 
    247247        } 
     248 
     249        private void AddClient_FormClosing(object sender, FormClosingEventArgs e) 
     250        { 
     251            rEKLAMADataSet.KLIENCI.RejectChanges(); 
     252        } 
    248253    } 
    249254} 
  • trunk/BazaReklam/Baza Reklam.csproj

    r602 r611  
    114114    <Compile Include="Classes\Helpers\StringHelper.cs" /> 
    115115    <Compile Include="Classes\Helpers\WebRequestHelper.cs" /> 
     116    <Compile Include="Classes\Interfaces\IInvoiceProvider.cs" /> 
    116117    <Compile Include="Classes\Interfaces\IForm.cs" /> 
    117118    <Compile Include="Classes\Model\Invoice.cs" /> 
  • trunk/BazaReklam/Classes/Helpers/PdfHelper.cs

    r607 r611  
    2424        public bool DisplayPdf() 
    2525        { 
    26             throw new System.Net.WebException("test"); 
    27  
    28  
    2926            string url = ConfigurationHelper.GetSettingByKey("Application.Pdf.Date") ?? 
    3027             "http://truck.pl/ogloszenia/_getFile.asp?pdfdate,{0},,"; 
  • trunk/BazaReklam/Classes/InvoiceProvider.cs

    r539 r611  
     1using Baza_Reklam.Classes.Interfaces; 
     2 
    13namespace Baza_Reklam 
    24{ 
    3     public class InvoiceProvider 
     5    public class InvoiceProvider : IInvoiceProvider 
    46    { 
    57        private string _city; 
  • trunk/BazaReklam/Classes/InvoiceProviderFactory.cs

    r539 r611  
    33using System.Data; 
    44using System.Data.SqlClient; 
     5using Baza_Reklam.Classes.Interfaces; 
    56 
    67namespace Baza_Reklam 
     
    910    { 
    1011        private static InvoiceProviderFactory _instance; 
    11         private readonly List<InvoiceProvider> _invoiceProviders = new List<InvoiceProvider>(); 
     12        private readonly List<IInvoiceProvider> _invoiceProviders = new List<IInvoiceProvider>(); 
    1213 
    1314        private InvoiceProviderFactory() 
     
    8081        } 
    8182 
    82         public static List<InvoiceProvider> GetInvoiceProviders() 
     83        public static List<IInvoiceProvider> GetInvoiceProviders() 
    8384        { 
    8485            return Instance._invoiceProviders; 
    8586        } 
    8687 
    87         public static InvoiceProvider GetInvoiceProviderById(int invoiceProviderId) 
     88        public static IInvoiceProvider GetInvoiceProviderById(int invoiceProviderId) 
    8889        { 
    8990            return 
    9091                Instance._invoiceProviders.Find( 
    91                     delegate(InvoiceProvider invoiceProvider) { return invoiceProvider.Id == invoiceProviderId; }); 
     92                    delegate(IInvoiceProvider invoiceProvider) { return invoiceProvider.Id == invoiceProviderId; }); 
    9293        } 
    9394 
    94         public static List<InvoiceProvider> GetInvoiceProvidersById(int invoiceProviderId) 
     95        public static List<IInvoiceProvider> GetInvoiceProvidersById(int invoiceProviderId) 
    9596        { 
    9697            return 
    9798                Instance._invoiceProviders.FindAll( 
    98                     delegate(InvoiceProvider invoiceProvider) { return invoiceProvider.Id == invoiceProviderId; }); 
     99                    delegate(IInvoiceProvider invoiceProvider) { return invoiceProvider.Id == invoiceProviderId; }); 
    99100        } 
    100101    } 
  • trunk/BazaReklam/Docs/versioninfo.html

    r604 r611  
    66<body> 
    77   <h1>Baza reklam - Informacje o wersji</h1> 
     8   <div> 
     9        <a id="1.1.6" /> 
     10        <h2>Wersja 1.1.6 (2009-04-27)</h2> 
     11        <p>Opis zmian wprowadzonych do wersji 1.1.6</p> 
     12        <ul> 
     13            <li>Zgłoszenie #160: Bieżące poprawki na podstawie logu błędów</li> 
     14            <li>Zgłoszenie #165: Naprawa błędów występujących podczas aktualizacji</li> 
     15        </ul> 
     16   </div> 
    817   <div> 
    918        <a id="1.1.5" /> 
  • trunk/BazaReklam/FakturowaniePoznanKatowice.cs

    r602 r611  
    594594            if (pozycjeFakturDlaKlientow.Rows.Count == 0 || naglowkiFakturDlaKlientow.Rows.Count == 0) 
    595595            { 
    596                 throw new Exception("Nie ma co fakturowaæ"); 
     596                //TODO: check is there is anythig to invoice before callind that method 
     597                throw new ApplicationException("Nie ma co fakturowaæ - Poznañ | Katowice"); 
    597598            } 
    598599 
  • trunk/BazaReklam/Properties/AssemblyInfo.cs

    r604 r611  
    3030// 
    3131[assembly: AssemblyVersion("1.0.0.0")] 
    32 [assembly: AssemblyFileVersion("1.1.5")] 
     32[assembly: AssemblyFileVersion("1.1.6")] 
  • trunk/BazaReklam/ZamowieniaForm.cs

    r603 r611  
    66using System.Windows.Forms; 
    77using Baza_Reklam.Classes.Helpers; 
     8using Baza_Reklam.Classes.Interfaces; 
    89 
    910namespace Baza_Reklam 
     
    294295            if (zamowieniaBindingSource.Current == null) return; 
    295296 
    296             if (rEKLAMADataSet.REKLAMA.Rows.Count <= 0) 
    297             { 
    298                 MessageBox.Show("Proszê dodaæ przynajmniej jedn¹ reklamê do zamówienia.", "Faktura"); 
    299                 return; 
    300             } 
    301              
    302             Cursor = Cursors.WaitCursor; 
    303  
    304             DataRowView z = (DataRowView) zamowieniaBindingSource.Current; 
    305             REKLAMADataSet.zamowieniaRow zamowienie = (REKLAMADataSet.zamowieniaRow) z.Row; 
    306  
    307             REKLAMADataSet.KLIENCIRow _klient = 
    308                 (REKLAMADataSet.KLIENCIRow) klienciTableAdapter.GetDataByCustomerId(zamowienie.idKlienta).Rows[0]; 
    309             string errorMessage = czyMoznaZafakturowac(zamowienie, _klient); 
    310  
    311             if (errorMessage != string.Empty) 
    312             { 
    313                 MessageBox.Show(errorMessage); 
     297            try 
     298            { 
     299                Cursor = Cursors.WaitCursor; 
     300 
     301                DataRowView z = (DataRowView) zamowieniaBindingSource.Current; 
     302                REKLAMADataSet.zamowieniaRow zamowienie = (REKLAMADataSet.zamowieniaRow) z.Row; 
     303 
     304                REKLAMADataSet.KLIENCIRow klientRow = 
     305                    (REKLAMADataSet.KLIENCIRow) klienciTableAdapter.GetDataByCustomerId(zamowienie.idKlienta).Rows[0]; 
     306 
     307                InitIssueTables(zamowienie); 
     308 
     309                string errorMessage = CzyMoznaZafakturowac(zamowienie, klientRow); 
     310 
     311                if (errorMessage != string.Empty) 
     312                { 
     313                    MessageBox.Show(errorMessage, "Fakturowanie"); 
     314                    Cursor = Cursors.Default; 
     315                    return; 
     316                } 
     317 
     318                WystawFakture(zamowienie, klientRow, false); 
     319 
     320                RestoreConnections(); 
     321 
     322                zamowieniaBindingSource.ResetBindings(false); 
     323 
     324                fAKTURYBindingSource.MoveLast(); 
     325            } 
     326            finally 
     327            { 
    314328                Cursor = Cursors.Default; 
    315                 return; 
    316             } 
    317  
    318             WystawFakture(zamowienie, _klient, false); 
    319  
    320             RestoreConnections(); 
    321  
    322             zamowieniaBindingSource.ResetBindings(false); 
    323  
    324             fAKTURYBindingSource.MoveLast(); 
    325  
    326             Cursor = Cursors.Default; 
     329            } 
    327330        } 
    328331 
     
    523526        } 
    524527 
    525         private void PobierzOznaczEmisje(REKLAMADataSet.zamowieniaRow zamowienie, REKLAMADataSet.FAKTURYRow naglowekFaktury) 
     528 
     529        private void InitIssueTables(REKLAMADataSet.zamowieniaRow zamowienie) 
    526530        { 
    527531            emisjeTableAdapter.ClearBeforeFill = false; 
    528532            datyWydanTableAdapter.ClearBeforeFill = false; 
     533            rEKLAMADataSet.UKAZE_SIE_W_NR.Clear(); 
     534            rEKLAMADataSet.DatyWydan.Clear(); 
    529535 
    530536            REKLAMADataSet.DatyWydanDataTable t = datyWydanTableAdapter.GetDataByPierwszaEmisjaWZamowieniu(zamowienie.idZamowienia); 
    531  
    532             if (t.Rows.Count == 0) 
    533             { 
    534                 //TODO: moze lepiej uzyc MessageBox'a i return niz wywalac wyjatek...? 
    535                 // wyjatki sa dosc kosztowne dla aplikacji 
    536                 throw new Exception("Nie ma co fakturowaæ!"); 
    537             } 
     537            if (t.Rows.Count <= 0) return; 
    538538 
    539539            DateTime d = t[0].DATA_W; 
     
    575575                reklama.EndEdit(); 
    576576            } 
    577  
    578             if (rEKLAMADataSet.UKAZE_SIE_W_NR.Rows.Count <= 0) 
    579                 throw new ApplicationException("Nie znaleziono ¿adnych emisji do zafakturowania! (" + 
    580                                                zamowienie.idZamowienia + ": " + StringHelper.ListToString(adIds, ",") + ")"); 
    581  
     577        } 
     578 
     579 
     580        private void PobierzOznaczEmisje(REKLAMADataSet.zamowieniaRow zamowienie, REKLAMADataSet.FAKTURYRow naglowekFaktury) 
     581        { 
     582            //InitIssueTables(zamowienie); 
    582583 
    583584            if (zamowienie.IsdataOstatniejZafakturowanejEmisjiNull()) 
     
    635636        { 
    636637            SLOWNIKDataSet.AGENCIRow agent = (SLOWNIKDataSet.AGENCIRow)agenciTableAdapter.GetDataByKodAgenta(zamowienie.kodAgenta).Rows[0]; 
    637             InvoiceProvider invoiceProvider = InvoiceProviderFactory.GetInvoiceProviderById(agent.InvoiceProviderId); 
     638            IInvoiceProvider invoiceProvider = InvoiceProviderFactory.GetInvoiceProviderById(agent.InvoiceProviderId); 
    638639 
    639640 
     
    709710                if (kurs.Count == 0) 
    710711                { 
    711                     throw new Exception("B³¹d przy pobieraniu kursu waluty."); 
     712                    throw new ApplicationException("B³¹d przy pobieraniu kursu waluty."); 
    712713                } 
    713714 
     
    730731         
    731732 
    732         private string czyMoznaZafakturowac(REKLAMADataSet.zamowieniaRow zamowienie, REKLAMADataSet.KLIENCIRow klientRow) 
     733        private string CzyMoznaZafakturowac(REKLAMADataSet.zamowieniaRow zamowienie, REKLAMADataSet.KLIENCIRow klientRow) 
    733734        { 
    734735            string errorMessage = string.Empty; 
     
    738739            errorMessage += zamowienie.IsidKontaNull() ? "Nie wybrano konta. \n" : ""; 
    739740            errorMessage += zamowienie.IssposobZaplatyNull() ? "Nie wybrano sposobu zap³aty. \n" : ""; 
    740             errorMessage += klientRow.IsCountryNull() || klientRow.Country == string.Empty ? "Brak pañstwa klienta. \n" : ""; 
    741             errorMessage += klientRow.IsAdres_FkaturaNull() || klientRow.Adres_Fkatura == string.Empty ? "Brak adresu faktury klienta. \n" : ""; 
    742             errorMessage += klientRow.IsNipNull() || klientRow.Nip == string.Empty ? "Brak nipu klienta. \n" : ""; 
     741            errorMessage += string.IsNullOrEmpty(klientRow.Country) ? "Brak pañstwa klienta. \n" : ""; 
     742            errorMessage += string.IsNullOrEmpty(klientRow.Adres_Fkatura) ? "Brak adresu faktury klienta. \n" : ""; 
     743            errorMessage +=  string.IsNullOrEmpty(klientRow.Nip) ? "Brak nipu klienta. \n" : ""; 
    743744 
    744745            if (klientRow.Country != "Polska") 
    745             { 
    746                 errorMessage += klientRow.IsnipKrajNull() || klientRow.nipKraj == string.Empty ? "Brak symbolu kraju w nipie klienta. \n" : ""; 
     746                errorMessage += string.IsNullOrEmpty(klientRow.nipKraj) ? "Brak symbolu kraju w nipie klienta. \n" : ""; 
     747 
     748            if (rEKLAMADataSet.REKLAMA.Rows.Count <= 0) 
     749            { 
     750                // try to load the ads once again in case something went wrong before... 
     751                rEKLAMATableAdapter.FillByIdZamowienia(rEKLAMADataSet.REKLAMA, zamowienie.idZamowienia); 
     752 
     753                if (rEKLAMADataSet.REKLAMA.Rows.Count <= 0) 
     754                    errorMessage += "Proszê dodaæ przynajmniej jedn¹ reklamê do zamówienia \n"; 
    747755            } 
    748756 
    749757            if (rEKLAMADataSet.REKLAMA.Select("[ZATWIERDZONO DO DRUKU] = 0").Length > 0) 
    750             { 
    751758                errorMessage += "W zamówieniu s¹ reklamy niezatwierdzone do druku \n"; 
    752             } 
     759 
     760            if (errorMessage.Length > 0) 
     761                return errorMessage; 
     762 
     763            if (rEKLAMADataSet.UKAZE_SIE_W_NR.Rows.Count <= 0) 
     764            { 
     765                errorMessage += "Nie znaleziono ¿adnych emisji do zafakturowania \n"; 
     766                return errorMessage; 
     767            } 
     768 
     769            REKLAMADataSet.DatyWydanDataTable t = datyWydanTableAdapter.GetDataByPierwszaEmisjaWZamowieniu(zamowienie.idZamowienia); 
     770            if (t.Rows.Count == 0) 
     771                errorMessage += "Nie znaleziono ¿adnych emisji do zafakturowania \n"; 
    753772 
    754773            return errorMessage; 
     
    13591378            if (zamowieniaBindingSource.Current == null) return; 
    13601379 
    1361             if (rEKLAMADataSet.REKLAMA.Rows.Count <= 0) 
    1362             { 
    1363                 MessageBox.Show("Proszê dodaæ przynajmniej jedn¹ reklamê do zamówienia.", "Faktura proforma"); 
    1364                 return; 
    1365             } 
    1366  
    13671380            Cursor = Cursors.WaitCursor; 
    13681381 
     
    13721385            REKLAMADataSet.KLIENCIRow _klient = 
    13731386                (REKLAMADataSet.KLIENCIRow) klienciTableAdapter.GetDataByCustomerId(zamowienie.idKlienta).Rows[0]; 
    1374             string errorMessage = czyMoznaZafakturowac(zamowienie, _klient); 
     1387 
     1388            InitIssueTables(zamowienie); 
     1389 
     1390            string errorMessage = CzyMoznaZafakturowac(zamowienie, _klient); 
    13751391 
    13761392            if (errorMessage != string.Empty) 
    13771393            { 
    1378                 MessageBox.Show(errorMessage); 
     1394                MessageBox.Show(errorMessage, "Fakturowanie - Proforma"); 
    13791395                Cursor = Cursors.Default; 
    13801396                return; 
     
    13911407            { 
    13921408                DataRow[] rows = rEKLAMADataSet.FAKTURY.Select("id_faktury=" + id); 
    1393                 usunFakture((REKLAMADataSet.FAKTURYRow) rows[0]); 
     1409                if (rows.Length > 0) 
     1410                    usunFakture((REKLAMADataSet.FAKTURYRow) rows[0]); 
     1411                 
    13941412                RestoreConnections(); 
    13951413                Cursor = Cursors.Default; 
  • trunk/BazaReklamSetup/BazaReklamSetup.vdproj

    r609 r611  
    725725        "Name" = "8:Microsoft Visual Studio" 
    726726        "ProductName" = "8:Baza Reklam" 
    727         "ProductCode" = "8:{DE903920-0572-4BA7-8623-E07D2868A25C}" 
    728         "PackageCode" = "8:{0E35FC2A-8DC5-4E25-8EF4-041C314C5E0B}" 
     727        "ProductCode" = "8:{E94CA729-B311-4DE5-BF21-DF116210CC02}" 
     728        "PackageCode" = "8:{724D56E2-C502-4EF3-9B3E-C5044DE7D117}" 
    729729        "UpgradeCode" = "8:{4E2DBBA4-3139-4790-8DDB-7AADFC963A7D}" 
    730730        "RestartWWWService" = "11:FALSE" 
     
    732732        "DetectNewerInstalledVersion" = "11:TRUE" 
    733733        "InstallAllUsers" = "11:TRUE" 
    734         "ProductVersion" = "8:1.1.5" 
     734        "ProductVersion" = "8:1.1.6" 
    735735        "Manufacturer" = "8:AACT" 
    736736        "ARPHELPTELEPHONE" = "8:"