| 1 | using System;
|
|---|
| 2 | using System.Data;
|
|---|
| 3 | using System.Configuration;
|
|---|
| 4 | using System.Collections;
|
|---|
| 5 | using System.Web;
|
|---|
| 6 | using System.Web.Security;
|
|---|
| 7 | using System.Web.UI;
|
|---|
| 8 | using System.Web.UI.WebControls;
|
|---|
| 9 | using System.Web.UI.WebControls.WebParts;
|
|---|
| 10 | using System.Web.UI.HtmlControls;
|
|---|
| 11 | using System.Net;
|
|---|
| 12 | using System.IO;
|
|---|
| 13 | using System.Data.SqlClient;
|
|---|
| 14 | using System.Threading;
|
|---|
| 15 | using System.Globalization;
|
|---|
| 16 |
|
|---|
| 17 | public partial class _Default : System.Web.UI.Page
|
|---|
| 18 | {
|
|---|
| 19 | protected override void InitializeCulture()
|
|---|
| 20 | {
|
|---|
| 21 | if (Session["culture"] != null)
|
|---|
| 22 | {
|
|---|
| 23 | UICulture = Session["culture"].ToString();
|
|---|
| 24 | Culture = Session["culture"].ToString();
|
|---|
| 25 |
|
|---|
| 26 | Thread.CurrentThread.CurrentCulture =
|
|---|
| 27 | CultureInfo.CreateSpecificCulture(Session["culture"].ToString());
|
|---|
| 28 | Thread.CurrentThread.CurrentUICulture =
|
|---|
| 29 | new CultureInfo(Session["culture"].ToString());
|
|---|
| 30 | }
|
|---|
| 31 | base.InitializeCulture();
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | protected void Page_Load(object sender, EventArgs e)
|
|---|
| 35 | {
|
|---|
| 36 | if (string.IsNullOrEmpty(Session["IdFaktury"].ToString())) Response.Redirect("login.aspx");
|
|---|
| 37 |
|
|---|
| 38 | if (!IsPostBack)
|
|---|
| 39 | {
|
|---|
| 40 | string connString = ConfigurationManager.ConnectionStrings["BazaReklamConn"].ConnectionString;
|
|---|
| 41 | string cmdText = "SELECT SystemKsiegowyId, FirstName, LastName, Address, PostalCode, City, nip, Nabywca_nip, Brutto, Data_Wystawienia, Termin_zaplaty, Sposob_zaplaty, Imie, Nazwisko, ulica, kod, miasto, telefon, waluta_brutto, waluta_miano FROM dbo.vDanePlatnosciEcard WHERE ID_Faktury=@idFaktury";
|
|---|
| 42 | //string nip = (string)Session["nip"];
|
|---|
| 43 | //string nrZlec = (string)Session["nrFaktury"];
|
|---|
| 44 | int idFaktury = Int32.Parse(Session["IdFaktury"].ToString());
|
|---|
| 45 | using (SqlConnection conn = new SqlConnection(connString))
|
|---|
| 46 | {
|
|---|
| 47 | SqlCommand cmd = new SqlCommand(cmdText, conn);
|
|---|
| 48 | //cmd.Parameters.Add("@nip", SqlDbType.NVarChar, 50).Value = nip;
|
|---|
| 49 | cmd.Parameters.Add("@idFaktury", SqlDbType.Int).Value = idFaktury;
|
|---|
| 50 |
|
|---|
| 51 | conn.Open();
|
|---|
| 52 | SqlDataReader reader = cmd.ExecuteReader();
|
|---|
| 53 | reader.Read();
|
|---|
| 54 |
|
|---|
| 55 | // formaPlatnosci i waluta
|
|---|
| 56 | string walBrutto = reader["waluta_brutto"].ToString(); //wartoscNaString(reader, 22, "double");
|
|---|
| 57 | string walMiano = reader["waluta_miano"].ToString(); // wartoscNaString(reader, 23, "string");
|
|---|
| 58 | string systemKsiegowy = reader["SystemKsiegowyId"].ToString(); // reader.GetByte(24).ToString();
|
|---|
| 59 | if (walMiano != "" && walBrutto != "")
|
|---|
| 60 | {
|
|---|
| 61 | WyborWaluty.Enabled = true;
|
|---|
| 62 | ArrayList values = new ArrayList();
|
|---|
| 63 | values.Add("PLN");
|
|---|
| 64 | values.Add(walMiano);
|
|---|
| 65 | WyborWaluty.DataSource = values;
|
|---|
| 66 | WyborWaluty.DataBind();
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 | FormaPlatnosci = "karta";
|
|---|
| 70 |
|
|---|
| 71 | string firstName = reader["FirstName"].ToString();
|
|---|
| 72 | string lastName = reader["LastName"].ToString();
|
|---|
| 73 | string adres = reader["Address"].ToString();
|
|---|
| 74 | string kod = reader["PostalCode"].ToString();
|
|---|
| 75 | string miasto = reader["City"].ToString();
|
|---|
| 76 | string tNIP = reader["Nabywca_nip"].ToString();
|
|---|
| 77 | string tNrFaktury = Session["NrFaktury"].ToString();
|
|---|
| 78 | string tDataWystawienia = DateTime.Parse(reader["Data_Wystawienia"].ToString()).ToString("yyyy-MM-dd");
|
|---|
| 79 | string tTerminPlatnosci = DateTime.Parse(reader["Termin_zaplaty"].ToString()).ToString("yyyy-MM-dd");
|
|---|
| 80 | string tBrutto = reader["Brutto"].ToString();
|
|---|
| 81 | // Amount
|
|---|
| 82 | string AmountPLN = Convert.ToInt32(Convert.ToDecimal(reader["Brutto"])*100).ToString();
|
|---|
| 83 | string AmountWaluta = Convert.ToInt32(Convert.ToDecimal(reader["waluta_brutto"]) * 100).ToString();
|
|---|
| 84 | // tIDFaktury
|
|---|
| 85 | string tIDFaktury = Session["IdFaktury"].ToString();
|
|---|
| 86 | string ImieHandlowca = reader["Imie"].ToString(); //wartoscNaString(reader, 15, "string");
|
|---|
| 87 | string NazwiskoHandlowca = reader["Nazwisko"].ToString(); //wartoscNaString(reader, 16, "string");
|
|---|
| 88 | string AdresBiuraUlica = reader["Ulica"].ToString(); //wartoscNaString(reader, 17, "string");
|
|---|
| 89 | string AdresBiuraKod = reader["Kod"].ToString(); //wartoscNaString(reader, 18, "string");
|
|---|
| 90 | string AdresBiuraMiasto = reader["Miasto"].ToString(); //wartoscNaString(reader, 19, "string");
|
|---|
| 91 | string AdresBiuraTelefony = reader["Telefon"].ToString(); //wartoscNaString(reader, 20, "string");
|
|---|
| 92 | string WalutaBrutto = reader["waluta_brutto"].ToString(); //wartoscNaString(reader, 22, "double");
|
|---|
| 93 | string WalutaMiano = reader["Waluta_Miano"].ToString(); //wartoscNaString(reader, 23, "string");
|
|---|
| 94 |
|
|---|
| 95 | // ------------- Ustawienie zmiennych -----------------------
|
|---|
| 96 | kwotaPLN = tBrutto;
|
|---|
| 97 | kwotaWaluta = WalutaBrutto;
|
|---|
| 98 | kwotaGroszePLN = AmountPLN;
|
|---|
| 99 | kwotaGroszeWaluta = AmountWaluta;
|
|---|
| 100 | // ------------ Dane do wyświetlenia ------------------------
|
|---|
| 101 |
|
|---|
| 102 | // --------- Nazwa
|
|---|
| 103 | string nazwa;
|
|---|
| 104 | if (firstName == "")
|
|---|
| 105 | {
|
|---|
| 106 | nazwa = lastName;
|
|---|
| 107 | }
|
|---|
| 108 | else
|
|---|
| 109 | {
|
|---|
| 110 | nazwa = firstName + " " + lastName;
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | Nazwa.Text = nazwa;
|
|---|
| 114 | // --------- Adres
|
|---|
| 115 | Adres.Text = adres + ", " + kod + " " + miasto;
|
|---|
| 116 | // --------- NIP
|
|---|
| 117 | NIP.Text = tNIP;
|
|---|
| 118 | // -------- NrFaktury
|
|---|
| 119 | NrFaktury.Text = tNrFaktury;
|
|---|
| 120 | // --------- DataWystawienia
|
|---|
| 121 | DataWystawienia.Text = tDataWystawienia;
|
|---|
| 122 | // --------- TerminPlatnosci
|
|---|
| 123 | TerminPlatnosci.Text = tTerminPlatnosci;
|
|---|
| 124 |
|
|---|
| 125 | //------------- Informacje do kontaktu z handlowcem
|
|---|
| 126 | Handlowiec.Text = ImieHandlowca + " " + NazwiskoHandlowca;
|
|---|
| 127 | BiuroAdres.Text = AdresBiuraUlica + ", " + AdresBiuraKod + " " + AdresBiuraMiasto;
|
|---|
| 128 | BiuroTelefon.Text = AdresBiuraTelefony;
|
|---|
| 129 |
|
|---|
| 130 | // ---------------------- Dane przekazywane do sesji ------------
|
|---|
| 131 |
|
|---|
| 132 | // -------------- ORDERDESCRIPTION
|
|---|
| 133 | string ORDERDESCRIPTION = (string) Session["nrFaktury"];
|
|---|
| 134 | Session["ORDERDESCRIPTION"] = ORDERDESCRIPTION;
|
|---|
| 135 | // ---------------- ORDERNUMBER
|
|---|
| 136 | string ORDERNUMBER = "1";
|
|---|
| 137 | Session["ORDERNUMBER"] = ORDERNUMBER;
|
|---|
| 138 | // ----------------- SESSIONID
|
|---|
| 139 | string SESSIONID = Session.SessionID;
|
|---|
| 140 | Session["SESSIONID"] = SESSIONID;
|
|---|
| 141 | // ------------- LANGUAGE PL - polski, EN - angielski, DE - niemiecki, FR - francuski, RU - rosyjski
|
|---|
| 142 | string LANGUAGE = "PL";
|
|---|
| 143 |
|
|---|
| 144 | Session["SystemKsiegowy"] = systemKsiegowy;
|
|---|
| 145 |
|
|---|
| 146 | if ((string) Session["CURRENCY"] == "978")
|
|---|
| 147 | {
|
|---|
| 148 | Session["CURRENCY"] = "978";
|
|---|
| 149 | Session["AMOUNT"] = kwotaGroszeWaluta;
|
|---|
| 150 | Brutto.Text = kwotaWaluta + " €";
|
|---|
| 151 | WyborWaluty.SelectedValue = "EUR";
|
|---|
| 152 | }
|
|---|
| 153 | else if ((string) Session["CURRENCY"] == "985")
|
|---|
| 154 | {
|
|---|
| 155 | Session["CURRENCY"] = "985";
|
|---|
| 156 | Session["AMOUNT"] = kwotaGroszePLN;
|
|---|
| 157 | Brutto.Text = kwotaPLN + " zł";
|
|---|
| 158 | WyborWaluty.SelectedValue = "PLN";
|
|---|
| 159 | }
|
|---|
| 160 | //else if ((string)Session["CURRENCY"] == "826")
|
|---|
| 161 | //{
|
|---|
| 162 | // Session["CURRENCY"] = "826";
|
|---|
| 163 | // Session["AMOUNT"] = kwotaGroszeWaluta;
|
|---|
| 164 | // Brutto.Text = kwotaWaluta + " £";
|
|---|
| 165 | // WyborWaluty.SelectedValue = "GBP";
|
|---|
| 166 | //}
|
|---|
| 167 | else
|
|---|
| 168 | {
|
|---|
| 169 | Session["CURRENCY"] = "985";
|
|---|
| 170 | Session["AMOUNT"] = kwotaGroszePLN;
|
|---|
| 171 | Brutto.Text = kwotaPLN + " zł";
|
|---|
| 172 | WyborWaluty.SelectedValue = "PLN";
|
|---|
| 173 | }
|
|---|
| 174 | if (Thread.CurrentThread.CurrentCulture.Name == "pl-PL")
|
|---|
| 175 | {
|
|---|
| 176 | Session["culture"] = "pl-PL";
|
|---|
| 177 | LANGUAGE = "PL";
|
|---|
| 178 | }
|
|---|
| 179 | else if (Thread.CurrentThread.CurrentCulture.Name == "en-US")
|
|---|
| 180 | {
|
|---|
| 181 | Session["culture"] = "en-US";
|
|---|
| 182 | LANGUAGE = "EN";
|
|---|
| 183 | }
|
|---|
| 184 | else if (Thread.CurrentThread.CurrentCulture.Name == "fr-FR")
|
|---|
| 185 | {
|
|---|
| 186 | Session["culture"] = "fr-FR";
|
|---|
| 187 | LANGUAGE = "FR";
|
|---|
| 188 | }
|
|---|
| 189 | else if (Thread.CurrentThread.CurrentCulture.Name == "it-IT")
|
|---|
| 190 | {
|
|---|
| 191 | Session["culture"] = "it-IT";
|
|---|
| 192 | LANGUAGE = "IT";
|
|---|
| 193 | }
|
|---|
| 194 | else if (Thread.CurrentThread.CurrentCulture.Name == "de-DE")
|
|---|
| 195 | {
|
|---|
| 196 | Session["culture"] = "de-DE";
|
|---|
| 197 | LANGUAGE = "DE";
|
|---|
| 198 | }
|
|---|
| 199 | else
|
|---|
| 200 | {
|
|---|
| 201 | Session["culture"] = "en-US";
|
|---|
| 202 | LANGUAGE = "EN";
|
|---|
| 203 | }
|
|---|
| 204 | Session["LANGUAGE"] = LANGUAGE;
|
|---|
| 205 | // ----------------- CHARSET
|
|---|
| 206 | string CHARSET = "ISO-8859-2";
|
|---|
| 207 | Session["CHARSET"] = CHARSET;
|
|---|
| 208 | // ---------------- COUNTRY 616 - Polska
|
|---|
| 209 | string COUNTRY = "616";
|
|---|
| 210 | Session["COUNTRY"] = COUNTRY;
|
|---|
| 211 | // ---------------- PAYMENTTYPE
|
|---|
| 212 | string PAYMENTTYPE = "CARDS";
|
|---|
| 213 | Session["PAYMENTTYPE"] = PAYMENTTYPE;
|
|---|
| 214 | // --------------- MERCHANTID
|
|---|
| 215 | Session["MERCHANTID"] = Int32.Parse(systemKsiegowy) == 1 ? "170906000" : "171485000";
|
|---|
| 216 | // ---------------- AUTODEPOSIT
|
|---|
| 217 | Session["AUTODEPOSIT"] = "1";
|
|---|
| 218 | // ---------------- IDFAKTURY
|
|---|
| 219 | Session["IdFaktury"] = tIDFaktury;
|
|---|
| 220 | reader.Close();
|
|---|
| 221 | conn.Close();
|
|---|
| 222 | }
|
|---|
| 223 | }
|
|---|
| 224 | else
|
|---|
| 225 | {
|
|---|
| 226 | string connString = ConfigurationManager.ConnectionStrings["BazaReklamConn"].ConnectionString;
|
|---|
| 227 | string cmdText = "SELECT SystemKsiegowyId, FirstName, LastName, Address, PostalCode, City, nip, Nabywca_nip, Brutto, Data_Wystawienia, Termin_zaplaty, Sposob_zaplaty, Imie, Nazwisko, ulica, kod, miasto, telefon, waluta_brutto, waluta_miano FROM dbo.vDanePlatnosciEcard WHERE ID_Faktury=@idFaktury";
|
|---|
| 228 | //string nip = (string)Session["nip"];
|
|---|
| 229 | //string nrZlec = (string)Session["nrFaktury"];
|
|---|
| 230 | int idFaktury = Int32.Parse(Session["IdFaktury"].ToString());
|
|---|
| 231 | using (SqlConnection conn = new SqlConnection(connString))
|
|---|
| 232 | {
|
|---|
| 233 | SqlCommand cmd = new SqlCommand(cmdText, conn);
|
|---|
| 234 | //cmd.Parameters.Add("@nip", SqlDbType.NVarChar, 50).Value = nip;
|
|---|
| 235 | //cmd.Parameters.Add("@nrFaktury", SqlDbType.NVarChar, 20).Value = nrZlec;
|
|---|
| 236 | cmd.Parameters.Add("@idFaktury", SqlDbType.Int).Value = idFaktury;
|
|---|
| 237 |
|
|---|
| 238 | conn.Open();
|
|---|
| 239 | SqlDataReader reader = cmd.ExecuteReader();
|
|---|
| 240 | reader.Read();
|
|---|
| 241 |
|
|---|
| 242 | // Wartości
|
|---|
| 243 | string tBrutto = reader["Brutto"].ToString();
|
|---|
| 244 | string WalutaBrutto = reader["Waluta_Brutto"].ToString();
|
|---|
| 245 | string AmountPLN = (Convert.ToInt32(reader["Brutto"]) * 100).ToString(); // reader[""].ToString(); //przeliczNaGrosze(reader, 10);
|
|---|
| 246 | string AmountWaluta = (Convert.ToInt32(reader["waluta_brutto"]) * 100).ToString(); //przeliczNaGrosze(reader, 22);
|
|---|
| 247 |
|
|---|
| 248 | // ------------- Ustawienie zmiennych -----------------------
|
|---|
| 249 | kwotaPLN = tBrutto;
|
|---|
| 250 | kwotaWaluta = WalutaBrutto;
|
|---|
| 251 | kwotaGroszePLN = AmountPLN;
|
|---|
| 252 | kwotaGroszeWaluta = AmountWaluta;
|
|---|
| 253 |
|
|---|
| 254 | reader.Close();
|
|---|
| 255 | conn.Close();
|
|---|
| 256 | }
|
|---|
| 257 | }
|
|---|
| 258 |
|
|---|
| 259 | }
|
|---|
| 260 |
|
|---|
| 261 | protected void WyborWaluty_SelectedIndexChanged(object sender, EventArgs e)
|
|---|
| 262 | {
|
|---|
| 263 | string waluta = WyborWaluty.SelectedItem.Value;
|
|---|
| 264 | string kwota = "";
|
|---|
| 265 | if (waluta == "PLN")
|
|---|
| 266 | {
|
|---|
| 267 | kwota = kwotaPLN + " zł";
|
|---|
| 268 | Session["CURRENCY"] = "985";
|
|---|
| 269 | Session["AMOUNT"] = kwotaGroszePLN;
|
|---|
| 270 | }
|
|---|
| 271 | if (waluta == "EUR")
|
|---|
| 272 | {
|
|---|
| 273 | kwota = kwotaWaluta + " €";
|
|---|
| 274 | Session["CURRENCY"] = "978";
|
|---|
| 275 | Session["AMOUNT"] = kwotaGroszeWaluta;
|
|---|
| 276 | }
|
|---|
| 277 | //if (waluta == "GBP")
|
|---|
| 278 | //{
|
|---|
| 279 | // kwota = kwotaWaluta + " £";
|
|---|
| 280 | // Session["CURRENCY"] = "826";
|
|---|
| 281 | // Session["AMOUNT"] = kwotaGroszeWaluta;
|
|---|
| 282 | //}
|
|---|
| 283 | Session["kwotaBrutto"] = kwota;
|
|---|
| 284 | Brutto.Text = kwota;
|
|---|
| 285 | }
|
|---|
| 286 |
|
|---|
| 287 | protected void PlaceButton_Click(object sender, EventArgs e)
|
|---|
| 288 | {
|
|---|
| 289 | // ------------------ NAME
|
|---|
| 290 | string NAME = ImieTextBox.Text;
|
|---|
| 291 | Session["NAME"] = NAME;
|
|---|
| 292 | // ------------------ SURNAME
|
|---|
| 293 | string SURNAME = NazwiskoTextBox.Text;
|
|---|
| 294 | Session["SURNAME"] = SURNAME;
|
|---|
| 295 | // -------------- Przekierowanie
|
|---|
| 296 | Response.Redirect("Merchant.aspx");
|
|---|
| 297 | }
|
|---|
| 298 |
|
|---|
| 299 | protected void ZamknijButton_Click(object sender, EventArgs e)
|
|---|
| 300 | {
|
|---|
| 301 | FormsAuthentication.SignOut();
|
|---|
| 302 | Server.Transfer("login.aspx");
|
|---|
| 303 | }
|
|---|
| 304 |
|
|---|
| 305 | private string forma;
|
|---|
| 306 | public string FormaPlatnosci
|
|---|
| 307 | {
|
|---|
| 308 | get
|
|---|
| 309 | {
|
|---|
| 310 | return forma;
|
|---|
| 311 | }
|
|---|
| 312 | set
|
|---|
| 313 | {
|
|---|
| 314 | forma = value;
|
|---|
| 315 | if (forma == "karta")
|
|---|
| 316 | {
|
|---|
| 317 | forma = "karta";
|
|---|
| 318 | }
|
|---|
| 319 | else
|
|---|
| 320 | {
|
|---|
| 321 | forma = "";
|
|---|
| 322 | }
|
|---|
| 323 | }
|
|---|
| 324 | }
|
|---|
| 325 |
|
|---|
| 326 | private bool czyWyswietlicWyborWaluty;
|
|---|
| 327 | public bool WyswietlicWyborWaluty
|
|---|
| 328 | {
|
|---|
| 329 | get
|
|---|
| 330 | {
|
|---|
| 331 | return czyWyswietlicWyborWaluty;
|
|---|
| 332 | }
|
|---|
| 333 | set
|
|---|
| 334 | {
|
|---|
| 335 | czyWyswietlicWyborWaluty = value;
|
|---|
| 336 | }
|
|---|
| 337 | }
|
|---|
| 338 |
|
|---|
| 339 | private string kwotaPLN;
|
|---|
| 340 | public string kwotaBruttoPLN
|
|---|
| 341 | {
|
|---|
| 342 | get
|
|---|
| 343 | {
|
|---|
| 344 | return kwotaPLN;
|
|---|
| 345 | }
|
|---|
| 346 | set
|
|---|
| 347 | {
|
|---|
| 348 | kwotaPLN = value;
|
|---|
| 349 | if (kwotaPLN == "") { kwotaPLN = "0"; }
|
|---|
| 350 | }
|
|---|
| 351 | }
|
|---|
| 352 |
|
|---|
| 353 | private string kwotaWaluta;
|
|---|
| 354 | public string kwotaBruttoWaluta
|
|---|
| 355 | {
|
|---|
| 356 | get
|
|---|
| 357 | {
|
|---|
| 358 | return kwotaWaluta;
|
|---|
| 359 | }
|
|---|
| 360 | set
|
|---|
| 361 | {
|
|---|
| 362 | kwotaWaluta = value;
|
|---|
| 363 | if (kwotaWaluta == "") { kwotaWaluta = "0"; }
|
|---|
| 364 | }
|
|---|
| 365 | }
|
|---|
| 366 |
|
|---|
| 367 | private string amPLN;
|
|---|
| 368 | public string kwotaGroszePLN
|
|---|
| 369 | {
|
|---|
| 370 | get
|
|---|
| 371 | {
|
|---|
| 372 | return amPLN;
|
|---|
| 373 | }
|
|---|
| 374 | set
|
|---|
| 375 | {
|
|---|
| 376 | amPLN = value;
|
|---|
| 377 | if (amPLN == "") { kwotaGroszePLN = "0"; }
|
|---|
| 378 | }
|
|---|
| 379 | }
|
|---|
| 380 |
|
|---|
| 381 | private string amWaluta;
|
|---|
| 382 | public string kwotaGroszeWaluta
|
|---|
| 383 | {
|
|---|
| 384 | get
|
|---|
| 385 | {
|
|---|
| 386 | return amWaluta;
|
|---|
| 387 | }
|
|---|
| 388 | set
|
|---|
| 389 | {
|
|---|
| 390 | amWaluta = value;
|
|---|
| 391 | if (amWaluta == "") { kwotaGroszeWaluta = "0"; }
|
|---|
| 392 | }
|
|---|
| 393 | }
|
|---|
| 394 |
|
|---|
| 395 |
|
|---|
| 396 | }
|
|---|