Index: trunk/BazaReklam/Docs/versioninfo.html
===================================================================
--- trunk/BazaReklam/Docs/versioninfo.html (revision 457)
+++ trunk/BazaReklam/Docs/versioninfo.html (revision 467)
@@ -6,4 +6,14 @@
 <body>
   <h1>Baza reklam - Informacje o wersji</h1>
+
+    <div>
+    <a id="1.0.0.85" />
+    <h2>Wersja 1.0.0.85 (2009-03-19)</h2>
+
+    <p>Opis zmian wprowadzonych do wersji 1.0.0.85</p>
+    <ul>
+        <li>Zgłoszenie #128: Poprawiono błąd przy dodawaniu kontaktu gdy klient nie posiada jeszcze żadnego kontaktu</li>
+    </ul>
+  </div>
 
     <div>
Index: trunk/BazaReklam/app.config
===================================================================
--- trunk/BazaReklam/app.config (revision 457)
+++ trunk/BazaReklam/app.config (revision 467)
@@ -12,6 +12,6 @@
     <add name="BAZA_REKLAM" connectionString="Data Source=sql.ct.com.pl;Initial Catalog=BAZA_REKLAM;Persist Security Info=True"
       providerName="System.Data.SqlClient" />
-    <add name="BAZA_REKLAM_TEST" connectionString="Data Source=sql.ct.com.pl;Initial Catalog=BAZA_REKLAM_TEST;Persist Security Info=True"
-      providerName="System.Data.SqlClient" />
+    <!--<add name="BAZA_REKLAM_TEST" connectionString="Data Source=sql.ct.com.pl;Initial Catalog=BAZA_REKLAM_TEST;Persist Security Info=True"
+      providerName="System.Data.SqlClient" />-->
   </connectionStrings>
   <applicationSettings>
Index: trunk/BazaReklam/Properties/AssemblyInfo.cs
===================================================================
--- trunk/BazaReklam/Properties/AssemblyInfo.cs (revision 457)
+++ trunk/BazaReklam/Properties/AssemblyInfo.cs (revision 467)
@@ -30,3 +30,3 @@
 //
 [assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.84")]
+[assembly: AssemblyFileVersion("1.0.0.85")]
Index: trunk/BazaReklam/ClientsForm.cs
===================================================================
--- trunk/BazaReklam/ClientsForm.cs (revision 457)
+++ trunk/BazaReklam/ClientsForm.cs (revision 467)
@@ -1101,8 +1101,11 @@
                 
                 DataRowView r = datatable.AddNew();
-                r["customerId"] = custId;
-                r["data"] = DateTime.Now;
-                r["symbol_agenta"] = User.getUser().Login;
-                r["KontaktTypId"] = (byte)cbTypKontaktu.SelectedValue;
+
+                AddUpdateKontakt(r, custId);
+                //r["customerId"] = custId;
+                //r["data"] = DateTime.Now;
+                //r["symbol_agenta"] = User.getUser().Login;
+                //if (cbTypKontaktu.Enabled)
+                //    r["KontaktTypId"] = (byte) cbTypKontaktu.SelectedValue;
 
                 kONTAKTYBindingSource.MoveLast();
@@ -1230,6 +1233,15 @@
             if (kONTAKTYBindingSource.Current == null) return;
 
+            if(cbTypKontaktu.SelectedValue == null)
+            {
+                MessageBox.Show("Proszê wybraæ tytu³");
+                return;
+            }
+            DataRowView klientRow = (DataRowView) kLIENCIBindingSource.Current;
+            REKLAMADataSet.KLIENCIRow klient = (REKLAMADataSet.KLIENCIRow)klientRow.Row;
+
             DataRowView r = (DataRowView)kONTAKTYBindingSource.Current;
-            r.Row["KontaktTypId"] = (byte)cbTypKontaktu.SelectedValue;
+            AddUpdateKontakt(r, klient.CustomerID);
+
             kONTAKTYBindingSource.EndEdit();
             kONTAKTYTableAdapter.Update(rEKLAMADataSet.KONTAKTY);
@@ -1560,4 +1572,5 @@
                     MessageBoxIcon.Question) == DialogResult.Yes)
                 {
+                    AddUpdateKontakt();
                     kONTAKTYTableAdapter.Update(rEKLAMADataSet.KONTAKTY);
                 }
@@ -2481,8 +2494,11 @@
 
                     DataRowView r = datatable.AddNew();
-                    r["customerId"] = custId;
-                    r["data"] = DateTime.Now.AddMonths(-1);
-                    r["symbol_agenta"] = User.getUser().Login;
-                    r["KontaktTypId"] = (byte)cbTypKontaktu.SelectedValue;
+                    AddUpdateKontakt(r, custId);
+                    
+                    //r["customerId"] = custId;
+                    //r["data"] = DateTime.Now.AddMonths(-1);
+                    //r["symbol_agenta"] = User.getUser().Login;
+                    //if (cbTypKontaktu.Enabled)
+                    //    r["KontaktTypId"] = (byte) cbTypKontaktu.SelectedValue;
 
                     kONTAKTYBindingSource.MoveLast();
@@ -2593,5 +2609,23 @@
         }
 
-    
+
+        private void AddUpdateKontakt(DataRowView r, int customerId)
+        {
+            r["customerId"] = customerId;
+            r["data"] = DateTime.Now.AddMonths(-1);
+            r["symbol_agenta"] = User.getUser().Login;
+            if (cbTypKontaktu.Enabled && cbTypKontaktu.SelectedValue != null)
+                r["KontaktTypId"] = (byte) cbTypKontaktu.SelectedValue;
+            else
+                r["KontaktTypId"] = 1;
+        }
+
+        private void AddUpdateKontakt()
+        {
+            //DataRowView r, int customerId
+            if (kLIENCIBindingSource.Current == null || kONTAKTYBindingSource.Current == null) return;
+            DataRowView row = (DataRowView)kLIENCIBindingSource.Current;
+            AddUpdateKontakt((DataRowView)kONTAKTYBindingSource.Current, Int32.Parse(row["CustomerId"].ToString()));
+        }
         
         //dodanie CTR + A do textboxow
Index: trunk/BazaReklamSetup/BazaReklamSetup.vdproj
===================================================================
--- trunk/BazaReklamSetup/BazaReklamSetup.vdproj (revision 315)
+++ trunk/BazaReklamSetup/BazaReklamSetup.vdproj (revision 467)
@@ -167,4 +167,16 @@
         {
         "MsmKey" = "8:_UNDEFINED"
+        "OwnerKey" = "8:_D15FD85A8EA74B8CA30CC438F895CAED"
+        "MsmSig" = "8:_UNDEFINED"
+        }
+        "Entry"
+        {
+        "MsmKey" = "8:_UNDEFINED"
+        "OwnerKey" = "8:_CC2D346B584D9209A0B0C23E19E16393"
+        "MsmSig" = "8:_UNDEFINED"
+        }
+        "Entry"
+        {
+        "MsmKey" = "8:_UNDEFINED"
         "OwnerKey" = "8:_6C6DB793A8DA3CF4F3943CD8BBC6D521"
         "MsmSig" = "8:_UNDEFINED"
@@ -204,16 +216,4 @@
         "MsmKey" = "8:_UNDEFINED"
         "OwnerKey" = "8:_135B2D9B7FCFB80D465861D39A152401"
-        "MsmSig" = "8:_UNDEFINED"
-        }
-        "Entry"
-        {
-        "MsmKey" = "8:_UNDEFINED"
-        "OwnerKey" = "8:_D15FD85A8EA74B8CA30CC438F895CAED"
-        "MsmSig" = "8:_UNDEFINED"
-        }
-        "Entry"
-        {
-        "MsmKey" = "8:_UNDEFINED"
-        "OwnerKey" = "8:_CC2D346B584D9209A0B0C23E19E16393"
         "MsmSig" = "8:_UNDEFINED"
         }
@@ -762,18 +762,18 @@
         "Name" = "8:Microsoft Visual Studio"
         "ProductName" = "8:Baza Reklam"
-        "ProductCode" = "8:{D601CC28-5EE8-4C51-A8FE-9C2D0AC9F495}"
-        "PackageCode" = "8:{DF616496-A597-46AA-866A-978D30743570}"
+        "ProductCode" = "8:{1F493BF2-537C-4B2C-B8DC-FE3DD5A38CC1}"
+        "PackageCode" = "8:{CFB556B3-88B7-4358-B831-23BAB85F7B37}"
         "UpgradeCode" = "8:{4E2DBBA4-3139-4790-8DDB-7AADFC963A7D}"
         "RestartWWWService" = "11:FALSE"
         "RemovePreviousVersions" = "11:TRUE"
         "DetectNewerInstalledVersion" = "11:TRUE"
-        "InstallAllUsers" = "11:FALSE"
-        "ProductVersion" = "8:1.0.72"
-        "Manufacturer" = "8:HP"
+        "InstallAllUsers" = "11:TRUE"
+        "ProductVersion" = "8:1.0.85"
+        "Manufacturer" = "8:AACT"
         "ARPHELPTELEPHONE" = "8:"
         "ARPHELPLINK" = "8:"
         "Title" = "8:Baza Reklam"
         "Subject" = "8:"
-        "ARPCONTACT" = "8:HP"
+        "ARPCONTACT" = "8:AACT"
         "Keywords" = "8:"
         "ARPCOMMENTS" = "8:"
