Line 1: #pragma checksum "C:\octopus\https\current\dsp_system.aspx" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "87B0670336B3755B3D838344C2C176EA3EC1CB45"
Line 2: //------------------------------------------------------------------------------
Line 3: // <auto-generated>
Line 4: // This code was generated by a tool.
Line 5: // Runtime Version:4.0.30319.42000
Line 6: //
Line 7: // Changes to this file may cause incorrect behavior and will be lost if
Line 8: // the code is regenerated.
Line 9: // </auto-generated>
Line 10: //------------------------------------------------------------------------------
Line 11:
Line 12: namespace ASP {
Line 13:
Line 14: #line 337 "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config"
Line 15: using System.Web.Security;
Line 16:
Line 17: #line default
Line 18: #line hidden
Line 19:
Line 20: #line 14 "C:\octopus\http\current\shared\_library.aspx"
Line 21: using System.Web.Mail;
Line 22:
Line 23: #line default
Line 24: #line hidden
Line 25:
Line 26: #line 12 "C:\octopus\http\current\shared\_library.aspx"
Line 27: using System.Web;
Line 28:
Line 29: #line default
Line 30: #line hidden
Line 31:
Line 32: #line 336 "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config"
Line 33: using System.Web.SessionState;
Line 34:
Line 35: #line default
Line 36: #line hidden
Line 37:
Line 38: #line 14 "C:\octopus\http\current\shared\zen_library.aspx"
Line 39: using System.Threading.Tasks;
Line 40:
Line 41: #line default
Line 42: #line hidden
Line 43:
Line 44: #line 343 "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config"
Line 45: using System.Xml.Linq;
Line 46:
Line 47: #line default
Line 48: #line hidden
Line 49:
Line 50: #line 4 "C:\octopus\http\current\shared\_library.aspx"
Line 51: using System.Data;
Line 52:
Line 53: #line default
Line 54: #line hidden
Line 55:
Line 56: #line 11 "C:\octopus\http\current\shared\_library.aspx"
Line 57: using System.Text;
Line 58:
Line 59: #line default
Line 60: #line hidden
Line 61:
Line 62: #line 18 "C:\octopus\http\current\shared\_library.aspx"
Line 63: using Newtonsoft.Json.Linq;
Line 64:
Line 65: #line default
Line 66: #line hidden
Line 67:
Line 68: #line 7 "C:\octopus\http\current\shared\_library.aspx"
Line 69: using System.Linq;
Line 70:
Line 71: #line default
Line 72: #line hidden
Line 73:
Line 74: #line 2 "C:\octopus\http\current\shared\_library.aspx"
Line 75: using System.Collections;
Line 76:
Line 77: #line default
Line 78: #line hidden
Line 79:
Line 80: #line 327 "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config"
Line 81: using System.Collections.Specialized;
Line 82:
Line 83: #line default
Line 84: #line hidden
Line 85:
Line 86: #line 340 "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config"
Line 87: using System.Web.UI.WebControls;
Line 88:
Line 89: #line default
Line 90: #line hidden
Line 91:
Line 92: #line 8 "C:\octopus\http\current\shared\_library.aspx"
Line 93: using System.IO;
Line 94:
Line 95: #line default
Line 96: #line hidden
Line 97:
Line 98: #line 9 "C:\octopus\http\current\shared\_library.aspx"
Line 99: using System.Net;
Line 100:
Line 101: #line default
Line 102: #line hidden
Line 103:
Line 104: #line 3 "C:\octopus\http\current\shared\_library.aspx"
Line 105: using System.ComponentModel;
Line 106:
Line 107: #line default
Line 108: #line hidden
Line 109:
Line 110: #line 5 "C:\octopus\http\current\shared\_library.aspx"
Line 111: using System.Data.OleDb;
Line 112:
Line 113: #line default
Line 114: #line hidden
Line 115:
Line 116: #line 341 "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config"
Line 117: using System.Web.UI.WebControls.WebParts;
Line 118:
Line 119: #line default
Line 120: #line hidden
Line 121:
Line 122: #line 13 "C:\octopus\http\current\shared\zen_library.aspx"
Line 123: using System.Configuration;
Line 124:
Line 125: #line default
Line 126: #line hidden
Line 127:
Line 128: #line 16 "C:\octopus\http\current\shared\_library.aspx"
Line 129: using AjaxPro;
Line 130:
Line 131: #line default
Line 132: #line hidden
Line 133:
Line 134: #line 1 "C:\octopus\http\current\shared\_library.aspx"
Line 135: using System;
Line 136:
Line 137: #line default
Line 138: #line hidden
Line 139:
Line 140: #line 326 "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config"
Line 141: using System.Collections.Generic;
Line 142:
Line 143: #line default
Line 144: #line hidden
Line 145:
Line 146: #line 13 "C:\octopus\http\current\shared\_library.aspx"
Line 147: using System.Web.Caching;
Line 148:
Line 149: #line default
Line 150: #line hidden
Line 151:
Line 152: #line 339 "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config"
Line 153: using System.Web.UI;
Line 154:
Line 155: #line default
Line 156: #line hidden
Line 157:
Line 158: #line 342 "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config"
Line 159: using System.Web.UI.HtmlControls;
Line 160:
Line 161: #line default
Line 162: #line hidden
Line 163:
Line 164: #line 17 "C:\octopus\http\current\shared\_library.aspx"
Line 165: using Newtonsoft.Json;
Line 166:
Line 167: #line default
Line 168: #line hidden
Line 169:
Line 170: #line 328 "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config"
Line 171: using System.ComponentModel.DataAnnotations;
Line 172:
Line 173: #line default
Line 174: #line hidden
Line 175:
Line 176: #line 10 "C:\octopus\http\current\shared\_library.aspx"
Line 177: using System.Security.Cryptography;
Line 178:
Line 179: #line default
Line 180: #line hidden
Line 181:
Line 182: #line 335 "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config"
Line 183: using System.Web.DynamicData;
Line 184:
Line 185: #line default
Line 186: #line hidden
Line 187:
Line 188: #line 15 "C:\octopus\http\current\shared\_library.aspx"
Line 189: using System.Xml;
Line 190:
Line 191: #line default
Line 192: #line hidden
Line 193:
Line 194: #line 338 "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config"
Line 195: using System.Web.Profile;
Line 196:
Line 197: #line default
Line 198: #line hidden
Line 199:
Line 200: #line 6 "C:\octopus\http\current\shared\_library.aspx"
Line 201: using System.Data.SqlClient;
Line 202:
Line 203: #line default
Line 204: #line hidden
Line 205:
Line 206: #line 9 "C:\octopus\http\current\shared\zen_library.aspx"
Line 207: using System.Text.RegularExpressions;
Line 208:
Line 209: #line default
Line 210: #line hidden
Line 211:
Line 212:
Line 213: [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
Line 214: public class dsp_system_aspx : global::System.Web.UI.Page, System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler {
Line 215:
Line 216: private static bool @__initialized;
Line 217:
Line 218: private static object @__stringResource;
Line 219:
Line 220: private static object @__fileDependencies;
Line 221:
Line 222:
Line 223: #line 15 "C:\octopus\http\current\shared\zen_library.aspx"
Line 224: Line 225: public class ZenTools {Line 226: Line 227: //--( VBScript )----------------------------------------------------------------Line 228: public static char Chr(int n) {Line 229: return Convert.ToChar(n);Line 230: }Line 231: Line 232: public static string Left(string s, int h) {Line 233: string output = s.Substring(0, h);Line 234: return output;Line 235: }Line 236: Line 237: public static string Mid(string s, int a, int h) {Line 238: string output = "";Line 239: if(s.Length>h)output=s.Substring(a, h);Line 240: else output=s.Substring(a);Line 241: return output;Line 242: }Line 243: public static string Mid(string s, int a) {Line 244: string output = s.Substring(a);Line 245: return output;Line 246: }Line 247: Line 248: public static string Right(string s, int h) {Line 249: string output = s.Substring(s.Length-h, h);Line 250: return output;Line 251: }Line 252: Line 253: //--( Form validations )--------------------------------------------------------Line 254: public static bool isEmail(string email) {Line 255: Regex regex = new Regex(@"^[a-z0-9._%-]+@[a-z0-9.-]+\.[a-z]{2,4}$");Line 256: Match match = regex.Match(email);Line 257: if (match.Success)Line 258: return true;Line 259: elseLine 260: return false;Line 261: }Line 262: Line 263: public static bool isCPF(string cpf) {Line 264: int[] m1 = new int[9] { 10, 9, 8, 7, 6, 5, 4, 3, 2 };Line 265: int[] m2 = new int[10] { 11, 10, 9, 8, 7, 6, 5, 4, 3, 2 };Line 266: string tempCpf, d;Line 267: int r, s;Line 268: Line 269: cpf = cpf.Trim();Line 270: if (cpf.Length != 11)Line 271: return false;Line 272: Line 273: tempCpf = cpf.Substring(0, 9);Line 274: s = 0;Line 275: Line 276: for(int i=0; i<9; i++) s += int.Parse(tempCpf[i].ToString()) * m1[i];Line 277: Line 278: r = s % 11;Line 279: if ( r < 2 ) r = 0; else r = 11 - r;Line 280: Line 281: d = r.ToString();Line 282: tempCpf = tempCpf + d;Line 283: Line 284: s = 0;Line 285: for(int i=0; i<10; i++) s += int.Parse(tempCpf[i].ToString()) * m2[i];Line 286: Line 287: r = s % 11;Line 288: if (r < 2) r = 0; else r = 11 - r;Line 289: Line 290: d += r.ToString();Line 291: return cpf.EndsWith(d);Line 292: }Line 293: Line 294: public static bool isCNPJ(string cnpj) {Line 295: int[] m1 = new int[12] {5,4,3,2,9,8,7,6,5,4,3,2};Line 296: int[] m2 = new int[13] {6,5,4,3,2,9,8,7,6,5,4,3,2};Line 297: int s, r;Line 298: string d, tempCnpj;Line 299: Line 300: cnpj = cnpj.Trim();Line 301: if (cnpj.Length != 14)Line 302: return false;Line 303: Line 304: tempCnpj = cnpj.Substring(0, 12);Line 305: s = 0;Line 306: for(int i=0; i<12; i++) s += int.Parse(tempCnpj[i].ToString()) * m1[i];Line 307: Line 308: r = (s % 11);Line 309: if ( r < 2) r = 0; else r = 11 - r;Line 310: Line 311: d = r.ToString();Line 312: tempCnpj += d;Line 313: Line 314: s = 0;Line 315: for (int i = 0; i < 13; i++) s += int.Parse(tempCnpj[i].ToString()) * m2[i];Line 316: Line 317: r = (s % 11);Line 318: if (r < 2) r = 0; else r = 11 - r;Line 319: Line 320: d += r.ToString();Line 321: return cnpj.EndsWith(d);Line 322: }Line 323: Line 324: //--( String )------------------------------------------------------------------Line 325: public static string[] Split(string strInput, char chSeparator) {Line 326: ArrayList alOutput = new ArrayList();Line 327: char[] inputArray = strInput.ToCharArray();Line 328: string subStr = "";Line 329: for(int i=0;i<inputArray.Length;i++) {Line 330: if(inputArray[i]!=chSeparator) {Line 331: subStr += inputArray[i];Line 332: } else {Line 333: alOutput.Add(subStr);Line 334: subStr = "";Line 335: }Line 336: }Line 337: //alOutput.Add(subStr); comment is only for old compatibilityLine 338: return (string[])alOutput.ToArray(typeof(string));Line 339: }Line 340: public static string[] Split(string strInput, string strSeparator) {Line 341: if( strSeparator == null ) return ( new string[1] { strInput } );Line 342: if( strInput == null ) throw new Exception("Param strInput is null");Line 343: Regex re = new Regex(strSeparator);Line 344: return re.Split(strInput);Line 345: }Line 346: Line 347: /**Line 348: * Utility to generate the body of a paging object.Line 349: * @param p: Actual pageLine 350: * @param t: Total recordsLine 351: * @param r: Records per pageLine 352: * @param h: Total page occurenciesLine 353: * @param id: Parent IdLine 354: * @param href: Content mask to be used in the anchor hrefLine 355: * @param onclick: Content mask to be used in the event onclickLine 356: * @param words: ["View all", "Previous", "Next", "Go to"] equivalentsLine 357: */Line 358: public static string Paging(int p, int t, int r, int h, string id, string href, string onclick, string[] words) {Line 359: string output = "";Line 360: int a, b; a = b = 1;Line 361: int tp = (int)Math.Ceiling((double)t/(double)r);Line 362: if(tp > 0) {Line 363: if(p <= (int)Math.Floor((double)h/(double)2)) {Line 364: a = 1;Line 365: b = (int)Math.Min(h, tp);Line 366: } else if((p+(int)Math.Floor((double)h/(double)2)) > tp) {Line 367: a = (int)Math.Max((tp - h + 1), 1);Line 368: b = tp;Line 369: } else {Line 370: if(h%2==0) {Line 371: a = p - ((int)Math.Floor((double)h/(double)2) - 1);Line 372: } else {Line 373: a = p - (int)Math.Floor((double)h/(double)2);Line 374: }Line 375: b = p + (int)Math.Floor((double)h/(double)2);Line 376: }Line 377: }Line 378: output += "<ul class='paginator'>\r\n";Line 379: output += " <li class=\"paginator-view-all "+ id +"_view_all\">";Line 380: if(p == 0) output += words[0];Line 381: else output += "<a href=\""+ href.Replace("[? p ?]", "0") +"\" onclick=\""+ onclick.Replace("[? p ?]", "0") +"\" onmouseover=\"window.status='"+ words[0] +"';return true;\" onmouseout=\"window.status='';return true;\">"+ words[0] +"</a>";Line 382: output += " </li>\r\n";Line 383: if(p != 0 && p > 1)output += " <li class=\"paginator-previous "+ id +"_previous\"><a rel='prev' href=\""+ href.Replace("[? p ?]", Convert.ToString(p - 1)) +"\" onclick=\""+ onclick.Replace("[? p ?]", Convert.ToString(p - 1)) +"\" onmouseover=\"window.status='"+ words[1] +"';return true;\" onmouseout=\"window.status='';return true;\">"+ words[1] +"</a></li>\r\n";Line 384: for(int i = a; i <= b; i++) {Line 385: if(i == p)output += " <li class=\"paginator-index selected "+ id +"_number\">"+ i +"</li>\r\n";Line 386: else output += " <li class=\"paginator-index "+ id +"_number\"><a href=\""+ href.Replace("[? p ?]", Convert.ToString(i)) +"\" onclick=\""+ onclick.Replace("[? p ?]", Convert.ToString(i)) +"\" onmouseover=\"window.status='"+ words[3] + " " + Convert.ToString(i) +"';return true;\" onmouseout=\"window.status='';return true;\">"+ Convert.ToString(i) +"</a></li>\r\n";Line 387: }Line 388: if(p != 0 && p < tp)output += " <li class=\"paginator-next "+ id +"_next\"><a rel='next' href=\""+ href.Replace("[? p ?]", Convert.ToString(p + 1)) +"\" onclick=\""+ onclick.Replace("[? p ?]", Convert.ToString(p + 1)) +"\" onmouseover=\"window.status='"+ words[2] +"';return true;\" onmouseout=\"window.status='';return true;\">"+ words[2] +"</a></li>\r\n";Line 389: output += "</ul>\r\n";Line 390: return output;Line 391: }Line 392: Line 393: //--( DateTime )-------------------------------------------------------------------------Line 394: public static int GetMonthDays(int mm, int yyyy) {Line 395: int[] defaultMonthDays = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};Line 396: return ((mm==1)&&((yyyy%400==0)||((yyyy%4==0)&&(yyyy%100!=0))))?29:defaultMonthDays[mm];Line 397: }Line 398: Line 399: //--( Dictionary )-----------------------------------------------------------------------Line 400: public static StringDictionary PopulateDictionary(string hashInput) {Line 401: return ZenTools.PopulateDictionary(hashInput, "[$]&", "[$]=");Line 402: }Line 403: public static StringDictionary PopulateDictionary(string hashInput, string separatorEntry, string separatorPair) {Line 404: StringDictionary sd = new StringDictionary();Line 405: string[] straNodes = ZenTools.Split(hashInput, separatorEntry);Line 406: string[] straPair = null;Line 407: foreach(string strNode in straNodes) {Line 408: straPair = ZenTools.Split(strNode, separatorPair);Line 409: sd.Add(straPair[0], straPair[1]);Line 410: }Line 411: return sd;Line 412: }Line 413: Line 414: //--( Order notes )-----------------------------------------------------------//Line 415: public static string getNote(string key, string notes) {Line 416: string[] arr = notes.Split('\n');Line 417: string output = "";Line 418: Regex Re = new Regex("\\[" + key + ":?\\](.+)");Line 419: Line 420: for(int i = 0; i <= arr.Length - 1; i++) {Line 421: if( Re.IsMatch(arr[i]) ) {Line 422: output = Convert.ToString( Re.Match(arr[i]) );Line 423: break;Line 424: }Line 425: }Line 426: Line 427: if( output.Length > 0 ) {Line 428: Re = new Regex("\\[" + key + ":?\\]");Line 429: output = Re.Replace(output, "");Line 430: output = output.Trim();Line 431: }Line 432: Line 433: return output;Line 434: }Line 435: Line 436: //--( Security )-------------------------------------------------------------------------//Line 437: public static byte[] Encrypt(byte[] inputData, byte[] key, byte[] iv) {Line 438: MemoryStream ms = new MemoryStream();Line 439: Line 440: Rijndael alg = Rijndael.Create();Line 441: alg.Key = key;Line 442: alg.IV = iv;Line 443: Line 444: CryptoStream cs = new CryptoStream(ms, alg.CreateEncryptor(), CryptoStreamMode.Write);Line 445: cs.Write(inputData, 0, inputData.Length);Line 446: cs.Close();Line 447: Line 448: byte[] output = ms.ToArray();Line 449: return output;Line 450: }Line 451: Line 452: public static byte[] Decrypt(byte[] inputData, byte[] key, byte[] iv) {Line 453: MemoryStream ms = new MemoryStream();Line 454: Line 455: Rijndael alg = Rijndael.Create();Line 456: alg.Key = key;Line 457: alg.IV = iv;Line 458: Line 459: CryptoStream cs = new CryptoStream(ms, alg.CreateDecryptor(), CryptoStreamMode.Write);Line 460: cs.Write(inputData, 0, inputData.Length);Line 461: cs.Close();Line 462: Line 463: byte[] output = ms.ToArray();Line 464: return output;Line 465: }Line 466: Line 467: public static string Encrypt(string inputText, string password) {Line 468: byte[] inputBytes = System.Text.Encoding.Unicode.GetBytes(inputText);Line 469: PasswordDeriveBytes pdb = new PasswordDeriveBytes(password, new byte[] {0x49,0x76,0x61,0x6e,0x20,0x4d,0x65,0x64,0x76,0x65,0x64,0x65,0x76});Line 470: byte[] output = Encrypt(inputBytes, pdb.GetBytes(32), pdb.GetBytes(16));Line 471: return Convert.ToBase64String(output);Line 472: }Line 473: Line 474: public static string Decrypt(string inputText, string password) {Line 475: byte[] inputBytes = Convert.FromBase64String(inputText);Line 476: PasswordDeriveBytes pdb = new PasswordDeriveBytes(password, new byte[] {0x49,0x76,0x61,0x6e,0x20,0x4d,0x65,0x64,0x76,0x65,0x64,0x65,0x76});Line 477: byte[] output = Decrypt(inputBytes, pdb.GetBytes(32), pdb.GetBytes(16));Line 478: return System.Text.Encoding.Unicode.GetString(output);Line 479: }Line 480: Line 481: public static string CriticalAJAXEncryption(string hash) {Line 482: return HttpUtility.UrlEncode(ZenTools.Encrypt("dtRequest="+ DateTime.Now.ToOADate() +"&"+ hash, "Z&n$3cR&qu3$t")).Replace("%", "[@percent]");Line 483: }Line 484: Line 485: public static string CriticalAJAXDecryption(string data) {Line 486: return ZenTools.Decrypt(HttpUtility.UrlDecode(data.Replace("[@percent]", "%")), "Z&n$3cR&qu3$t");Line 487: }Line 488: Line 489: public static byte[] StringToByteArray(string hex) {Line 490: return Enumerable.Range(0, hex.Length)Line 491: .Where(x => x % 2 == 0)Line 492: .Select(x => Convert.ToByte(hex.Substring(x, 2), 16))Line 493: .ToArray();Line 494: }Line 495: Line 496: //--( Internet )----------------------------------------------------------------Line 497: public static bool isMobile(string ua) {Line 498: Regex b = new Regex(@"(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino", RegexOptions.IgnoreCase | RegexOptions.Multiline);Line 499: Regex v = new Regex(@"1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-", RegexOptions.IgnoreCase | RegexOptions.Multiline);Line 500: if ((b.IsMatch(ua) || v.IsMatch(ua.Substring(0, 4)))) {Line 501: return true;Line 502: } else {Line 503: return false;Line 504: }Line 505: }Line 506: Line 507: public static string SyncWebRequest(string url) { return SyncWebRequest(url, "", Encoding.UTF8); }Line 508: public static string SyncWebRequest(string url, string postdata) { return SyncWebRequest(url, postdata, Encoding.Default); }Line 509: public static string SyncWebRequest(string url, string postdata, Encoding encoding) {Line 510: string output = "";Line 511: Line 512: try {Line 513: HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);Line 514: req.UserAgent=".NET HttpWebRequest";Line 515: req.MaximumAutomaticRedirections = 4;Line 516: req.MaximumResponseHeadersLength = 4;Line 517: req.Credentials = CredentialCache.DefaultCredentials;Line 518: Line 519: ASCIIEncoding enc = new ASCIIEncoding();Line 520: byte[] buffer = enc.GetBytes(postdata);Line 521: Line 522: req.Method = "POST";Line 523: req.ContentType = "application/x-www-form-urlencoded";Line 524: req.ContentLength = buffer.Length;Line 525: Line 526: Stream s = req.GetRequestStream();Line 527: s.Write(buffer, 0, buffer.Length);Line 528: s.Close();Line 529: Line 530: HttpWebResponse res = (HttpWebResponse)req.GetResponse();Line 531: Stream reStream = res.GetResponseStream();Line 532: StreamReader readStream = new StreamReader(reStream, encoding);Line 533: output = readStream.ReadToEnd();Line 534: readStream.Close();Line 535: res.Close();Line 536: } catch(Exception e) {Line 537: output = String.Format("url: {0}<br/>postdata: {1}<br/>error: {2}", url, postdata, e.Message);Line 538: }Line 539: Line 540: return output;Line 541: }Line 542: Line 543: public static string WebMail(string from, string to, string subject, string body) {Line 544: return WebMail(from, to, "", subject, body);Line 545: }Line 546: public static string WebMail(string from, string to, string bcc, string subject, string body) {Line 547: string output = "Success";Line 548: Line 549: string header = "";Line 550: header += "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>\r\n";Line 551: header += "<HTML>\r\n";Line 552: header += " <HEAD>\r\n";Line 553: header += " <META http-equiv=Content-Type content='text/html; charset=utf-8'>\r\n";Line 554: header += " </HEAD>\r\n";Line 555: header += " <BODY>\r\n";Line 556: Line 557: string footer = "";Line 558: footer += " </BODY>\r\n";Line 559: footer += "</HTML>\r\n";Line 560: Line 561: try {Line 562: MailMessage mail = new MailMessage();Line 563: mail.BodyFormat = MailFormat.Html;Line 564: mail.From = from;Line 565: mail.To = to;Line 566: if( bcc != "" ) {Line 567: mail.Bcc = bcc;Line 568: }Line 569: mail.Subject = subject;Line 570: mail.Body = header + body.Replace("\n","\r\n") + footer;Line 571: mail.Headers.Add("Reply-To", from);Line 572: SmtpMail.Send(mail);Line 573: } catch(Exception e) {Line 574: output = e.ToString();Line 575: output += "<hr />" + from + "," + to + "," + subject + "," + body;Line 576: }Line 577: Line 578: return output;Line 579: }Line 580: Line 581: //DeprecatedLine 582: public static string WebReq(string url) {Line 583: return SyncWebRequest(url);Line 584: }Line 585: Line 586: //DeprecatedLine 587: public static string PageIndex(int p, int tp, int ipp, string link) {Line 588: return PageIndex(p, tp, ipp, link, false);Line 589: }Line 590: Line 591: public static string PageIndex(int p, int tp, int ipp, string link, bool viewAll) {Line 592: string output = "";Line 593: int pa, pb;Line 594: Line 595: if(tp>0) {Line 596: if(p<=ipp/2) {Line 597: pa = 1;Line 598: pb = ipp;Line 599: if(pb>tp) pb = tp;Line 600: } else if(p+ipp/2>tp) {Line 601: pa = tp - ipp;Line 602: pb = tp;Line 603: if(pa<1) pa = 1;Line 604: } else {Line 605: pa = p - ipp/2;Line 606: pb = p + ipp/2;Line 607: }Line 608: Line 609: if( viewAll ) {Line 610: if(p==0)output += "<li class='paginator-view-all'><span>Ver todos</span></li>";Line 611: else output += "<li class='paginator-view-all'><a href='"+ link +"&p=0'><span>Ver todos</span></a></li>";Line 612: }Line 613: Line 614: if(p != 0 && p > 1) output += "<li class='paginator-previous'><a href='"+ link +"&p="+ (p-1) +"' rel='prev'><span>Anterior</span></a></li>";Line 615: for(int i=pa; i<=pb; i++) {Line 616: if(i==p) {Line 617: output += "<li class='paginator-index selected'><span>" + i + "</span></li>";Line 618: } else {Line 619: output += "<li class='paginator-index'><a href='" + link +"&p="+ i + "'><span>" + i + "</span></a></li>";Line 620: }Line 621: }Line 622: if(p!=0&&p<tp) output += "<li class='paginator-next'><a href='" + link +"&p="+ (p+1) + "' rel='next'><span>Próximo</span></a></li>";Line 623: }Line 624: return "<ul class='paginator'>" + output + "</ul>";Line 625: }Line 626: Line 627: //DeprecatedLine 628: public static bool Mail(string from, string to, string subject, string body) {Line 629: string output = WebMail(from, to, subject, body);Line 630: if(output.Equals("Success"))return true;Line 631: else return false;Line 632: }Line 633: Line 634: public static string FilterSQLI(string input) {Line 635: string output = input;Line 636: if(output.Length>0) {Line 637: output = output.Replace("<","");Line 638: output = output.Replace(">","");Line 639: output = output.Replace("(","(");Line 640: output = output.Replace(")",")");Line 641: output = output.Replace("'","");Line 642: }Line 643: return output;Line 644: }Line 645: Line 646: public static string PrintDate(DateTime input) {Line 647: string output = "";Line 648: output += input.ToString("dd/MM/yyyy");Line 649: return output;Line 650: }Line 651: Line 652: public static string PrintTime(DateTime input) {Line 653: string output = "";Line 654: output += input.ToString("t");Line 655: return output;Line 656: }Line 657: Line 658: public static string SafeEncode(string input) {Line 659: if(null==input)return "";Line 660: Line 661: string output = input;Line 662: output = HttpUtility.UrlEncode(output);Line 663: output = output.Replace("%","@-@");Line 664: return output;Line 665: }Line 666: Line 667: public static string SafeDecode(string input) {Line 668: if(null==input)return "";Line 669: Line 670: string output = input;Line 671: output = output.Replace("@-@","%");Line 672: output = HttpUtility.UrlDecode(output);Line 673: return output;Line 674: }Line 675: Line 676: public static string HtmlEncode(string input) {Line 677: string output = input;Line 678: Line 679: if( output.Length > 0 ) {Line 680: output = output.Replace("à","à");Line 681: output = output.Replace("â","â");Line 682: output = output.Replace("ä","ä");Line 683: output = output.Replace("á","á");Line 684: output = output.Replace("ã","ã");Line 685: output = output.Replace("À","À");Line 686: output = output.Replace("Â","Â");Line 687: output = output.Replace("Ä","Ä");Line 688: output = output.Replace("Á","Á");Line 689: output = output.Replace("Ã","Ã");Line 690: Line 691: output = output.Replace("è","è");Line 692: output = output.Replace("ê","ê");Line 693: output = output.Replace("ë","ë");Line 694: output = output.Replace("é","é");Line 695: output = output.Replace("È","È");Line 696: output = output.Replace("Ê","Ê");Line 697: output = output.Replace("Ë","Ë");Line 698: output = output.Replace("É","É");Line 699: Line 700: output = output.Replace("ì","ì");Line 701: output = output.Replace("î","î");Line 702: output = output.Replace("ï","ï");Line 703: output = output.Replace("í","í");Line 704: output = output.Replace("Ì","Ì");Line 705: output = output.Replace("Î","Î");Line 706: output = output.Replace("Ï","Ï");Line 707: output = output.Replace("Í","Í");Line 708: Line 709: output = output.Replace("ò","ò");Line 710: output = output.Replace("ô","ô");Line 711: output = output.Replace("ö","ö");Line 712: output = output.Replace("ó","ó");Line 713: output = output.Replace("õ","õ");Line 714: output = output.Replace("Ò","Ò");Line 715: output = output.Replace("Ô","Ô");Line 716: output = output.Replace("Ö","Ö");Line 717: output = output.Replace("Ó","Ó");Line 718: output = output.Replace("Õ","õ");Line 719: Line 720: output = output.Replace("ù","ù");Line 721: output = output.Replace("û","û");Line 722: output = output.Replace("ü","ü");Line 723: output = output.Replace("ú","ú");Line 724: output = output.Replace("Ù","Ù");Line 725: output = output.Replace("Û","Û");Line 726: output = output.Replace("Ü","Ü");Line 727: output = output.Replace("Ú","Ú");Line 728: Line 729: output = output.Replace("ç","ç");Line 730: output = output.Replace("Ç","Ç");Line 731: Line 732: output = output.Replace("ñ","ñ");Line 733: output = output.Replace("Ñ","Ñ");Line 734: Line 735: output = output.Replace("ÿ","ÿ");Line 736: output = output.Replace("ý","ý");Line 737: output = output.Replace("Ý","Ý");Line 738: }Line 739: Line 740: return output;Line 741: }Line 742: Line 743: public static string unlatinize(string value) {Line 744: string sChar = "ÀÁÂÃÄÅÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÇÑÝàáâãäåèéêëìíîïòóôõöùúûüçñýÿ&/";Line 745: string sRepl = "AAAAAAEEEEIIIIOOOOOUUUUCNYaaaaaaeeeeiiiiooooouuuucnyye_";Line 746: for (int p = 0; p < sChar.Length; p++) {Line 747: value = value.Replace(sChar.Substring(p, 1), sRepl.Substring(p, 1));Line 748: }Line 749: return value;Line 750: }Line 751: Line 752: public static string urlize(string v) {Line 753: if( v == null ) return "";Line 754: string ret = v.Trim().ToLower();Line 755: ret = unlatinize(ret);Line 756: ret = Regex.Replace(ret, @"[^0-9a-z\s&_]", "");Line 757: ret = ret.Replace(" ", "-");Line 758: return HttpUtility.UrlEncode(ret);Line 759: }Line 760: Line 761: public static string idize(string v) {Line 762: if( v == null ) return "";Line 763: string ret = ( v != null ? v.Trim().ToLower() : "" );Line 764: ret = unlatinize(ret);Line 765: ret = Regex.Replace(ret, @"[^0-9a-z\s_]", "");Line 766: ret = ret.Replace(" ", "_");Line 767: return ret;Line 768: }Line 769: Line 770: public static string idize2(string v) {Line 771: if( v == null ) return "";Line 772: string ret = ( v != null ? v.Trim().ToLower() : "" );Line 773: ret = unlatinize(ret);Line 774: ret = Regex.Replace(ret, @"[^0-9a-z\s_-]", "");Line 775: ret = ret.Replace(" ", "_");Line 776: return ret;Line 777: }Line 778: Line 779: public static string filenameize(string value) {Line 780: string[] invalids = {"\\","/",":","*","?","\"","<",">"};Line 781: string ret = value;Line 782: for(int i = 0; i < invalids.Length; i++ ) {Line 783: ret = ret.Replace(invalids[i], "");Line 784: }Line 785: return ret;Line 786: }Line 787: Line 788: public static string md5(string input) {Line 789: System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();Line 790: byte[] bs = System.Text.Encoding.UTF8.GetBytes(input);Line 791: bs = x.ComputeHash(bs);Line 792: System.Text.StringBuilder s = new System.Text.StringBuilder();Line 793: Line 794: foreach (byte b in bs) {Line 795: s.Append(b.ToString("x2").ToLower());Line 796: }Line 797: Line 798: string password = s.ToString();Line 799: return password;Line 800: }Line 801: Line 802: public static string getListController(string type) {Line 803: string output = "";Line 804: Line 805: switch( type ) {Line 806: case "wedding":Line 807: output = "~~weddingRegistry.asp";Line 808: break;Line 809: Line 810: default:Line 811: output = "~~wishlistRegistry.asp";Line 812: break;Line 813: }Line 814: Line 815: return output;Line 816: }Line 817: Line 818: public static string nameize(string name) {Line 819: return strFilter(name);Line 820: }Line 821: Line 822: public static string urlLatin1Encode(string txt) {Line 823: return HttpUtility.UrlEncode(txt, System.Text.Encoding.GetEncoding("utf-8"));Line 824: }Line 825: Line 826: public static string stripHtml(string text) {Line 827: if( text == null ) {Line 828: return "";Line 829: } else {Line 830: return Regex.Replace(text, @"<(.|\n)*?>", string.Empty).Replace(Environment.NewLine, " ");Line 831: }Line 832: }Line 833: Line 834: public static bool isNumeric(string v) {Line 835: decimal val = 0;Line 836: try {Line 837: val = Convert.ToDecimal(v);Line 838: } catch(Exception Ex) {Line 839: return false;Line 840: }Line 841: return true;Line 842: }Line 843: Line 844: public static bool isCreditCardNumber(string ccNum) {Line 845: /*Line 846: * Luhn test of credit card numbers.Line 847: * See more @: http://rosettacode.org/wiki/Luhn_test_of_credit_card_numbersLine 848: */Line 849: Line 850: if ( ccNum == null || ccNum == "" ) {Line 851: return false;Line 852: }Line 853: Line 854: int i = 0;Line 855: int even = 0;Line 856: int odd = 0;Line 857: int len = ccNum.Length;Line 858: int digit = 0;Line 859: int[] ccNumArr = new int[len];Line 860: Line 861: for( i = 0; i <= len - 1; i++ ) {Line 862: ccNumArr[i] = Convert.ToInt32( ccNum.Substring(i, 1) );Line 863: }Line 864: Line 865: Array.Reverse(ccNumArr);Line 866: Line 867: for( i = 1; i < ccNumArr.Length + 1; i++ ) {Line 868: digit = ccNumArr[i - 1];Line 869: Line 870: if( i % 2 == 0 ) {Line 871: even += digit * 2;Line 872: if( digit >= 5 ) {Line 873: even -= 9;Line 874: }Line 875: } else {Line 876: odd += digit;Line 877: }Line 878: }Line 879: Line 880: return (even + odd) % 10 == 0;Line 881: }Line 882: Line 883: public static string strFilter(string v) {Line 884: if( v == null ) return "";Line 885: if( v.Replace(" ", "") == "" ) return "";Line 886: Line 887: string c = "";Line 888: StringBuilder Sb = new StringBuilder();Line 889: Regex Re = new Regex(@"[a-z0-9çàáéíóúâêîôûãõ/\\-]|\s", RegexOptions.IgnoreCase);Line 890: Line 891: for( int i = 0; i < v.Length; i++ ) {Line 892: c = v.Substring(i, 1);Line 893: if( Re.IsMatch(c) ) {Line 894: Sb.Append( c );Line 895: } else {Line 896: Sb.Append( "" );Line 897: }Line 898: }Line 899: Line 900: return Sb.ToString();Line 901: }Line 902: Line 903: public static string addrFilter(string s) {Line 904: return strFilter(s).Replace("-", " ").Replace(",", " ");Line 905: }Line 906: Line 907: public static string convertToCharset(string v, string charset) {Line 908: MemoryStream stream = new MemoryStream();Line 909: StreamWriter writer = new StreamWriter(stream, Encoding.GetEncoding( charset ));Line 910: writer.Write(v);Line 911: writer.Flush();Line 912: stream.Position = 0;Line 913: StreamReader reader = new StreamReader(stream);Line 914: return reader.ReadToEnd();Line 915: }Line 916: Line 917: public static string solrize(string v) {Line 918: if( v == null ) return "";Line 919: string c = "";Line 920: StringBuilder Sb = new StringBuilder();Line 921: Regex Re = new Regex(@"[\+\-\&\|\!\(\)\{\}\[\]\^\""\~\*\?\:\\\/]", RegexOptions.IgnoreCase);Line 922: Line 923: for( int i = 0; i < v.Length; i++ ) {Line 924: c = v.Substring(i, 1);Line 925: Sb.Append( ( Re.IsMatch(c) ? "\\" + c : c ) );Line 926: }Line 927: Line 928: return Sb.ToString();Line 929: }Line 930: Line 931: public static string xml2str(XmlDocument xml) {Line 932: StringWriter sw = new StringWriter();Line 933: XmlTextWriter tx = new XmlTextWriter(sw);Line 934: xml.WriteTo(tx);Line 935: return sw.ToString();Line 936: }Line 937: Line 938: public static string get_rating_stars(decimal rating){Line 939: StringBuilder Sb = new StringBuilder();Line 940: for(int i = 1; i <= 5; i++) {Line 941: if( i <= (int)rating ) {Line 942: Sb.Append(Line 943: "<svg viewBox='0 0 576 512' class='star'><path d='M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z'></path></svg>"Line 944: );Line 945: } else if( (decimal)i - 1 <= rating && rating <= (decimal)i ) {Line 946: Sb.Append(Line 947: "<svg viewBox='0 0 576 512' class='half-star'><path d='M528.1 171.5L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6zM405.8 317.9l27.8 162L288 403.5 142.5 480l27.8-162L52.5 203.1l162.7-23.6L288 32l72.8 147.5 162.7 23.6-117.7 114.8z'></path><path d='M288 0c-11.4 0-22.8 5.9-28.7 17.8L194 150.2 47.9 171.4c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.1 23 46 46.4 33.7L288 439.6V0z'></path></svg>"Line 948: );Line 949: } else {Line 950: Sb.Append(Line 951: "<svg viewBox='0 0 576 512' class='empty-star'><path d='M528.1 171.5L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6zM405.8 317.9l27.8 162L288 403.5 142.5 480l27.8-162L52.5 203.1l162.7-23.6L288 32l72.8 147.5 162.7 23.6-117.7 114.8z'></path></svg>"Line 952: );Line 953: }Line 954: }Line 955: return Sb.ToString();Line 956: }Line 957: Line 958: }Line 959:
Line 960: #line default
Line 961: #line hidden
Line 962:
Line 963:
Line 964: #line 19 "C:\octopus\http\current\shared\_library.aspx"
Line 965: Line 966: Line 967: public int SID() {Line 968: string output = "0";Line 969: if (null != Request.QueryString["sid"] && !Request.QueryString["sid"].Equals("")) output = Request.QueryString["sid"];Line 970: return Convert.ToInt32(output);Line 971: }Line 972: Line 973: public string CID() {Line 974: string output = System.Guid.NewGuid().ToString("N");Line 975: if ( null != Request.QueryString["cid"] )Line 976: output = Request.QueryString["cid"];Line 977: if ( null != Request.Cookies["cid"] )Line 978: output = Request.Cookies["cid"].Value;Line 979: Response.Cookies["cid"].Value = output;Line 980: Response.Cookies["cid"].Expires = DateTime.Today.AddDays(60d);Line 981: Response.Cookies["cid"].Secure = true;Line 982: return output;Line 983: }Line 984: Line 985: public int WLID() {Line 986: int output = 0;Line 987: try {Line 988: if ( Request.Cookies["OCTOPUS_WLID"] != null && Request.Cookies["OCTOPUS_WLID"].Value != "" )Line 989: output = Convert.ToInt32( Request.Cookies["OCTOPUS_WLID"].Value );Line 990: if ( Request.QueryString["wlid"] != null && Request.QueryString["wlid"] != "")Line 991: output = Convert.ToInt32( Request.QueryString["wlid"] );Line 992: if( output > 0 )Line 993: Response.Cookies["OCTOPUS_WLID"].Value = Convert.ToString(output);Line 994: return output;Line 995: } catch (Exception E) {Line 996: return 0;Line 997: }Line 998: }Line 999: Line 1000: public string LTYPE() {Line 1001: return "none";Line 1002: }Line 1003: Line 1004: public int UID() {Line 1005: int output = 0;Line 1006: if ( null != Request.Cookies["uid"] && Request.Cookies["uid"].Value != "" ) {Line 1007: if ( Convert.ToInt32(Request.Cookies["uid"].Value) > 0 ) {Line 1008: output = Convert.ToInt32(Request.Cookies["uid"].Value);Line 1009: }Line 1010: }Line 1011: if ( null != Request.Cookies["OCTOPUS_UID"] && Request.Cookies["OCTOPUS_UID"].Value != "" ) {Line 1012: if ( Convert.ToInt32(Request.Cookies["OCTOPUS_UID"].Value) > 0 ) {Line 1013: output = Convert.ToInt32(Request.Cookies["OCTOPUS_UID"].Value);Line 1014: }Line 1015: }Line 1016: Line 1017: if ( output == 0 ) {Line 1018: if ( null != Request.QueryString["uid"] && !Request.QueryString["uid"].Equals("") && Request.QueryString["uid"].Split(',').Length == 1 ) {Line 1019: output = Convert.ToInt32(Request.QueryString["uid"]);Line 1020: if ( output > 0 ) {Line 1021: Response.Cookies["uid"].Value = Convert.ToString(output);Line 1022: Response.Cookies["uid"].Expires = DateTime.Now.AddYears(99);Line 1023: }Line 1024: }Line 1025: }Line 1026: Line 1027: return output;Line 1028: }Line 1029: Line 1030: public bool LOGGED(int shopId, int userId) {Line 1031: bool output = false;Line 1032: Line 1033: string key = "lgd" + shopId + userId;Line 1034: try {Line 1035: if ( null != Request.Cookies[key] && Request.Cookies[key].Value != "" ) {Line 1036: if ( Convert.ToBoolean(Request.Cookies[key].Value) ) {Line 1037: output = Convert.ToBoolean(Request.Cookies[key].Value);Line 1038: }Line 1039: }Line 1040: } catch (Exception E) {Line 1041: output = false;Line 1042: }Line 1043: Line 1044: return output;Line 1045: }Line 1046: Line 1047: public string HTTP2HTTPS(string thisConfig) {Line 1048: StringBuilder Sb = new StringBuilder();Line 1049: Line 1050: // discount couponLine 1051: if ( Request.Cookies["octopus-dc"] != null && Request.Cookies["octopus-dc"].Value != "" && thisConfig.IndexOf("&dc=") == -1 ) {Line 1052: Sb.Append("&dc=" + Request.Cookies["octopus-dc"].Value);Line 1053: }Line 1054: Line 1055: // recovery by quotationLine 1056: if ( Request.Cookies["octopus-fqtn"] != null && Request.Cookies["octopus-fqtn"].Value == "true" && thisConfig.IndexOf("&fqtn=") == -1 ) {Line 1057: Sb.Append("&fqtn=1");Line 1058: }Line 1059: Line 1060: // custom price groupLine 1061: try {Line 1062: if ( Request.Cookies["octopus-upg"] != null && Request.Cookies["octopus-upg"].Value != "" && thisConfig.IndexOf("&upg=") == -1 ) {Line 1063: Sb.Append("&upg=" + Request.Cookies["octopus-upg"].Value);Line 1064: }Line 1065: } catch (Exception ex) {Line 1066: // nothing to doLine 1067: }Line 1068: Line 1069: // UTMsLine 1070: if ( Request.Cookies["p_source"] != null && Request.Cookies["p_source"].Value != "" && thisConfig.IndexOf("&utm_source=") == -1 ) {Line 1071: Sb.Append("&utm_source=" + Request.Cookies["p_source"].Value);Line 1072: }Line 1073: if ( Request.Cookies["p_medium"] != null && Request.Cookies["p_medium"].Value != "" && thisConfig.IndexOf("&utm_medium=") == -1 ) {Line 1074: Sb.Append("&utm_medium=" + Request.Cookies["p_medium"].Value);Line 1075: }Line 1076: if ( Request.Cookies["p_campaign"] != null && Request.Cookies["p_campaign"].Value != "" && thisConfig.IndexOf("&utm_campaign=") == -1 ) {Line 1077: Sb.Append("&utm_campaign=" + Request.Cookies["p_campaign"].Value);Line 1078: }Line 1079: Line 1080: return thisConfig + Sb.ToString();Line 1081: }Line 1082: Line 1083: Line 1084: Line 1085: Line 1086: Line 1087: Line 1088: Line 1089: Line 1090: Line 1091: Line 1092: public class ShopSetup {Line 1093: private static int sid;Line 1094: Line 1095: private static string sOwner, sPath, sHttp, sHttps;Line 1096: private static int sType, useFC;Line 1097: private static bool useCC, useET, useEF, useBB, useBD, useIO;Line 1098: private static bool useSC, useDDM, useQS, useFS, useBN, useNL, useSL, useRVI, useEP, usePS, useTF, useCS, useGR, useASQ, useEG, useDC, useAD, usePD, useDG, useCM, useCN, useEbit, useHackerSafe, useClearSale, useTracker;Line 1099: Line 1100: private static string title, description, keywords, titleProdDetail, titleCategory, wds, url, phone, email, currType, imgSizes, encryptPass;Line 1101: private static int ndd, bbExp, irpp, trpp, ipp, capd, cadd;Line 1102: private static decimal minOrder;Line 1103: private static bool retail, thirdExp, useZoom, usePopMsg, locked, nologo;Line 1104: Line 1105: public StringDictionary dic = new StringDictionary();Line 1106: Line 1107: public ShopSetup(int shopId) {Line 1108: sid = shopId;Line 1109: nologo = false;Line 1110: }Line 1111: Line 1112: public void FillVars() {Line 1113: SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["coreConn"]);Line 1114: conn.Open();Line 1115: Line 1116: string query = "sp_corevars";Line 1117: SqlCommand cmd = new SqlCommand(query, conn);Line 1118: cmd.CommandType = CommandType.StoredProcedure;Line 1119: cmd.Parameters.Add(new SqlParameter("@idShop", SqlDbType.Int));Line 1120: cmd.Parameters["@idShop"].Value = sid;Line 1121: Line 1122: SqlDataReader rdr = cmd.ExecuteReader();Line 1123: if (rdr.Read()) {Line 1124: sOwner = (string)rdr["owner"]; // shop ownerLine 1125: sPath = (string)rdr["sPath"]; // shop pathLine 1126: sHttp = (string)rdr["sHttp"]; // shop http urlLine 1127: sHttps = (string)rdr["sHttps"]; // shop https urlLine 1128: sType = (int)rdr["sType"]; // shop typeLine 1129: Line 1130: useCC = (bool)rdr["useCC"]; // credit cardLine 1131: useET = (bool)rdr["useET"]; // eletronic transferLine 1132: useEF = (bool)rdr["useEF"]; // eletronic financingLine 1133: useBB = (bool)rdr["useBB"]; // bank billetLine 1134: useBD = (bool)rdr["useBD"]; // bank depositLine 1135: useIO = (bool)rdr["useIO"]; // invoiced orderLine 1136: Line 1137: useSC = (bool)rdr["useSC"]; // stock control?Line 1138: Line 1139: useDDM = (bool)rdr["useDDM"]; // drop down menu?Line 1140: useFC = (int)rdr["useFC"]; // floating cart?Line 1141: useQS = (bool)rdr["useQS"]; // quick search?Line 1142: useFS = (bool)rdr["useFS"]; // filter search?Line 1143: useBN = (bool)rdr["useBN"]; // banners?Line 1144: useNL = (bool)rdr["useNL"]; // newsletter?Line 1145: useSL = (bool)rdr["useSL"]; // spotlight?Line 1146: useRVI = (bool)rdr["useRVI"]; // recent viewed items?Line 1147: Line 1148: useEP = (bool)rdr["useEP"]; // extra pictures?Line 1149: usePS = (bool)rdr["usePS"]; // product selects?Line 1150: useTF = (bool)rdr["useTF"]; // tell a friendLine 1151: useCS = (bool)rdr["useCS"]; // cross selling?Line 1152: useGR = (bool)rdr["useGR"]; // guest reviews?Line 1153: useASQ = (bool)rdr["useASQ"]; // ask seller a question?Line 1154: Line 1155: useEG = (bool)rdr["useEG"]; // extra gifts?Line 1156: Line 1157: useDC = (bool)rdr["useDC"]; // discount coupon?Line 1158: useAD = (bool)rdr["useAD"]; // additional data?Line 1159: usePD = (bool)rdr["usePD"]; // personal delivery?Line 1160: Line 1161: useDG = (bool)rdr["useDG"]; // deliver as gift?Line 1162: useCM = (bool)rdr["useCM"]; // card message?Line 1163: useCN = (bool)rdr["useCN"]; // cellphone notification?Line 1164: Line 1165: useEbit = (bool)rdr["useEbit"]; // ebit rate system?Line 1166: useHackerSafe = (bool)rdr["useHackerSafe"]; // ScanAlert HackerSafe?Line 1167: useClearSale = (bool)rdr["useClearSale"]; // ClearSale?Line 1168: useTracker = (bool)rdr["useTracker"]; // enable Tracker?Line 1169: }Line 1170: rdr.Close();Line 1171: conn.Close();Line 1172: Line 1173: conn = new SqlConnection(sPath);Line 1174: conn.Open();Line 1175: Line 1176: query = "SELECT sys_setup.* FROM sys_setup WITH (NOLOCK)";Line 1177: cmd = new SqlCommand(query, conn);Line 1178: rdr = cmd.ExecuteReader();Line 1179: if (rdr.Read()) {Line 1180: title = (string)rdr["title"];Line 1181: description = (string)rdr["description"];Line 1182: keywords = (string)rdr["keywords"];Line 1183: titleProdDetail = (string)rdr["titleProdDetail"];Line 1184: titleCategory = (string)rdr["titleCategory"];Line 1185: wds = (string)rdr["wds"]; // window default statusLine 1186: url = (string)rdr["url"]; // uniform resource locatorLine 1187: phone = (string)rdr["phone"];Line 1188: email = (string)rdr["email"];Line 1189: currType = (string)rdr["currType"]; // currency typeLine 1190: imgSizes = (string)rdr["imgSizes"]; // image sizes: eg. zWxzH;bWxbH;mWxmH;sWxsH;tWxtH;Line 1191: ndd = (int)rdr["ndd"]; // number of decimal digitsLine 1192: bbExp = (int)rdr["bbExp"]; // bank billet expiration stated periodLine 1193: irpp = (int)rdr["irpp"]; // image records per pageLine 1194: trpp = (int)rdr["trpp"]; // text records per pageLine 1195: ipp = (int)rdr["ipp"]; // indexes per pageLine 1196: capd = (int)rdr["capd"]; // chars @ product descriptionLine 1197: cadd = (int)rdr["cadd"]; // chars @ details descriptionLine 1198: minOrder = (decimal)rdr["minOrder"]; // minimun orderLine 1199: retail = (bool)rdr["retail"]; // is retail?Line 1200: thirdExp = (bool)rdr["3rdExp"]; // use 3rd expansion?Line 1201: useZoom = (bool)rdr["useZoom"]; // zoom products?Line 1202: usePopMsg = (bool)rdr["usePopMsg"]; // pop message for new orders? [adm]Line 1203: locked = (bool)rdr["locked"]; // shop locked?Line 1204: }Line 1205: rdr.Close();Line 1206: Line 1207: query = "SELECT sys_dic.* FROM sys_dic WITH (NOLOCK)";Line 1208: cmd = new SqlCommand(query, conn);Line 1209: rdr = cmd.ExecuteReader();Line 1210: while(rdr.Read()) {Line 1211: if (!dic.ContainsKey((string)rdr["key"]))dic.Add((string)rdr["key"], (string)rdr["value"]);Line 1212: }Line 1213: rdr.Close();Line 1214: Line 1215: conn.Close();Line 1216: Line 1217: encryptPass = "l0jc0mm";Line 1218: }Line 1219: Line 1220: public string Owner {get{return sOwner;}set{sOwner = value;}}Line 1221: public string Path {get{return sPath;}set{sPath = value;}}Line 1222: public string Http {get{return sHttp;}set{sHttp = value;}}Line 1223: public string Https {get{return sHttps;}set{sHttps = value;}}Line 1224: public int Type {get{return sType;}set{sType = value;}}Line 1225: Line 1226: public bool UseCC {get{return useCC;}set{useCC = value;}}Line 1227: public bool UseET {get{return useET;}set{useET = value;}}Line 1228: public bool UseEF {get{return useEF;}set{useEF = value;}}Line 1229: public bool UseBB {get{return useBB;}set{useBB = value;}}Line 1230: public bool UseBD {get{return useBD;}set{useBD = value;}}Line 1231: public bool UseIO {get{return useIO;}set{useIO = value;}}Line 1232: public bool UseSC {get{return useSC;}set{useSC = value;}}Line 1233: public bool UseDDM{get{return useDDM;}set{useDDM = value;}}Line 1234: public int UseFC {get{return useFC;}set{useFC = value;}}Line 1235: public bool UseQS {get{return useQS;}set{useQS = value;}}Line 1236: public bool UseFS {get{return useFS;}set{useFS = value;}}Line 1237: public bool UseBN {get{return useBN;}set{useBN = value;}}Line 1238: public bool UseNL {get{return useNL;}set{useNL = value;}}Line 1239: public bool UseSL {get{return useSL;}set{useSL = value;}}Line 1240: public bool UseRVI {get{return useRVI;}set{useRVI = value;}}Line 1241: Line 1242: public bool UseEP {get{return useEP;}set{useEP = value;}}Line 1243: public bool UsePS {get{return usePS;}set{usePS = value;}}Line 1244: public bool UseTF {get{return useTF;}set{useTF = value;}}Line 1245: public bool UseCS {get{return useCS;}set{useCS = value;}}Line 1246: public bool UseGR {get{return useGR;}set{useGR = value;}}Line 1247: public bool UseASQ {get{return useASQ;}set{useASQ = value;}}Line 1248: Line 1249: public bool UseEG {get{return useEG;}set{useEG = value;}}Line 1250: Line 1251: public bool UseDC {get{return useDC;}set{useDC = value;}}Line 1252: public bool UseAD {get{return useAD;}set{useAD = value;}}Line 1253: public bool UsePD {get{return usePD;}set{usePD = value;}}Line 1254: Line 1255: public bool UseDG {get{return useDG;}set{useDG = value;}}Line 1256: public bool UseCM {get{return useCM;}set{useCM = value;}}Line 1257: public bool UseCN {get{return useCN;}set{useCN = value;}}Line 1258: Line 1259: public bool UseEbit {get{return useEbit;}set{useEbit = value;}}Line 1260: public bool UseHackerSafe {get{return useHackerSafe;}set{useHackerSafe = value;}}Line 1261: public bool UseClearSale {get{return useClearSale;}set{useClearSale = value;}}Line 1262: public bool UseTracker {get{return useTracker;}set{useTracker = value;}}Line 1263: Line 1264: public string Title {get{return title;}set{title = value;}}Line 1265: public string Description {get{return description;}set{description = value;}}Line 1266: public string Keywords {get{return keywords;}set{keywords = value;}}Line 1267: public string TitleProdDetail {get{return titleProdDetail;}set{titleProdDetail = value;}}Line 1268: public string TitleCategory {get{return titleCategory;}set{titleCategory = value;}}Line 1269: public string WDS {get{return wds;}set{wds = value;}}Line 1270: public string URL {get{return url;}set{url = value;}}Line 1271: public string Phone {get{return phone;}set{phone = value;}}Line 1272: public string Email {get{return email;}set{email = value;}}Line 1273: public string CurrType {get{return currType;}set{currType = value;}}Line 1274: public string ImgSizes {get{return imgSizes;}set{imgSizes = value;}}Line 1275: public int NDD {get{return ndd;}set{ndd = value;}}Line 1276: public int BBExp {get{return bbExp;}set{bbExp = value;}}Line 1277: public int IRPP {get{return irpp;}set{irpp = value;}}Line 1278: public int TRPP {get{return trpp;}set{trpp = value;}}Line 1279: public int IPP {get{return ipp;}set{ipp = value;}}Line 1280: public int CAPD {get{return capd;}set{capd = value;}}Line 1281: public int CADD {get{return cadd;}set{cadd = value;}}Line 1282: public decimal MinOrder {get{return minOrder;}set{minOrder = value;}}Line 1283: public bool isRetail {get{return retail;}set{retail = value;}}Line 1284: public bool Use3rdExp {get{return thirdExp;}set{thirdExp = value;}}Line 1285: public bool UseZoom {get{return useZoom;}set{useZoom = value;}}Line 1286: public bool UsePopMsg {get{return usePopMsg;}set{usePopMsg = value;}}Line 1287: public bool isLocked {get{return locked;}set{locked = value;}}Line 1288: public string EncryptPass {get{return encryptPass;}set{encryptPass = value;}}Line 1289: public bool NoLogo {get{return nologo;}set{nologo = value;}}Line 1290: Line 1291: public int CartKpbHistGo {Line 1292: get {Line 1293: int output = -1;Line 1294: Line 1295: if ( getConfig("CartKpb.history.go").Length > 0 )Line 1296: output = Convert.ToInt32(getConfig("CartKpb.history.go"));Line 1297: Line 1298: return output;Line 1299: }Line 1300: }Line 1301: Line 1302: public bool useLazyLoad {Line 1303: get {Line 1304: bool output = false;Line 1305: if ( getConfig("UseLazyLoad").ToLower() == "true" )Line 1306: output = true;Line 1307: Line 1308: return output;Line 1309: }Line 1310: }Line 1311: Line 1312: public bool useST {Line 1313: get {Line 1314: bool output = false;Line 1315: if ( getConfig("UseST") != "" ) {Line 1316: output = true;Line 1317: }Line 1318: return output;Line 1319: }Line 1320: }Line 1321: Line 1322: Line 1323: public bool useGridCache {Line 1324: get {Line 1325: string v = getConfig("UseGridCache");Line 1326: return (v != "" ? Convert.ToBoolean(v) : true);Line 1327: }Line 1328: }Line 1329: Line 1330: public dynamic Next {Line 1331: get {Line 1332: dynamic output = JsonConvert.DeserializeObject<JObject>("{}");Line 1333: string config = getConfig("Next");Line 1334: if( config != "" )Line 1335: output = JsonConvert.DeserializeObject<JObject>(config);Line 1336: return output;Line 1337: }Line 1338: }Line 1339: Line 1340: public dynamic Search {Line 1341: get {Line 1342: dynamic output = JsonConvert.DeserializeObject<JObject>("{}");Line 1343: string config = getConfig("Search");Line 1344: if( config != "" )Line 1345: output = JsonConvert.DeserializeObject<JObject>(config);Line 1346: return output;Line 1347: }Line 1348: }Line 1349: Line 1350: public bool setConfig(string idModule, string config) {Line 1351: bool output = false;Line 1352: Line 1353: SqlConnection Conn = new SqlConnection(sPath);Line 1354: Conn.Open();Line 1355: string query = "UPDATE sys_configs SET [config] = @config WHERE [idModule] = @idModule";Line 1356: SqlCommand cmd = new SqlCommand(query, Conn);Line 1357: cmd.Parameters.Add(new SqlParameter("@config", SqlDbType.NText));Line 1358: cmd.Parameters.Add(new SqlParameter("@idModule", SqlDbType.NVarChar));Line 1359: cmd.Parameters["@config"].Value = config;Line 1360: cmd.Parameters["@idModule"].Value = idModule;Line 1361: output = Convert.ToInt32(cmd.ExecuteNonQuery()) > 0;Line 1362: Conn.Close();Line 1363: Line 1364: return output;Line 1365: }Line 1366: Line 1367: public string getConfig(string idModule) {Line 1368: string output = "";Line 1369: Line 1370: SqlConnection Conn = new SqlConnection(sPath);Line 1371: Conn.Open();Line 1372: Line 1373: string query = @"Line 1374: SELECT [config]Line 1375: FROM sys_configs WITH (NOLOCK)Line 1376: WHERE (idModule = @idModule) AND (NOT [config] IS NULL)Line 1377: ";Line 1378: SqlCommand cmd = new SqlCommand(query, Conn);Line 1379: cmd.Parameters.Add(new SqlParameter("@idModule", SqlDbType.NVarChar));Line 1380: cmd.Parameters["@idModule"].Value = idModule;Line 1381: Line 1382: output = Convert.ToString(cmd.ExecuteScalar());Line 1383: Line 1384: Conn.Close();Line 1385: return output;Line 1386: }Line 1387: Line 1388: public string getStatus(int id) {Line 1389: string output = "";Line 1390: SqlConnection conn = new SqlConnection(sPath);Line 1391: conn.Open();Line 1392: string query = "SELECT name FROM sys_ordersStatus WITH (NOLOCK) WHERE id = " + id;Line 1393: SqlCommand cmd = new SqlCommand(query, conn);Line 1394: SqlDataReader rdr = cmd.ExecuteReader();Line 1395: Line 1396: if (rdr.Read()) {Line 1397: output = (string)rdr[0];Line 1398: }Line 1399: Line 1400: rdr.Close();Line 1401: conn.Close();Line 1402: Line 1403: return output;Line 1404: }Line 1405: Line 1406: public string ShopTags(string input) {Line 1407: if (input.Length<=0)return "";Line 1408: string output = input;Line 1409: Line 1410: DateTime dateTime = new DateTime();Line 1411: dateTime = DateTime.Now;Line 1412: Line 1413: output = output.Replace("[? title ?]",title);Line 1414: Line 1415: output = output.Replace( "[? domain ?]", sHttp.Replace( "/octopus/", "" ) );Line 1416: Line 1417: output = output.Replace("[? url ?]","<a href='" + url + "'>" + url + "</a>");Line 1418: output = output.Replace("[? email ?]",email);Line 1419: output = output.Replace("[? phone ?]",phone);Line 1420: output = output.Replace("[? bbExp ?]",Convert.ToString(bbExp));Line 1421: Line 1422: output = output.Replace("[? day ?]",dateTime.ToString("dd"));Line 1423: output = output.Replace("[? month ?]",dateTime.ToString("MM"));Line 1424: output = output.Replace("[? year ?]",dateTime.ToString("yyyy"));Line 1425: Line 1426: output = output.Replace("[? shop_banks ?]",bankAccounts(false));Line 1427: Line 1428: output = output.Replace("[?b ","<b>");Line 1429: output = output.Replace("[?i ","<i>");Line 1430: output = output.Replace("[?u ","<u>");Line 1431: output = output.Replace("[?help ","<a href='" + sHttp.Replace( "/octopus/", "" ) + "/duvidas'>");Line 1432: Line 1433: output = output.Replace(" b?]","</b>");Line 1434: output = output.Replace(" i?]","</i>");Line 1435: output = output.Replace(" u?]","</u>");Line 1436: output = output.Replace(" help?]","</a>");Line 1437: Line 1438: return output;Line 1439: }Line 1440: Line 1441: public string bankAccounts(bool nonStatic) {Line 1442: string output = "";Line 1443: output += "<table>\n";Line 1444: Line 1445: SqlConnection conn = new SqlConnection(sPath);Line 1446: conn.Open();Line 1447: Line 1448: string query = "SELECT COUNT(*) FROM sys_bd_list WITH (NOLOCK)";Line 1449: SqlCommand cmd = new SqlCommand(query, conn);Line 1450: int i = Convert.ToInt32(cmd.ExecuteScalar());Line 1451: Line 1452: if (!nonStatic) {Line 1453: output += " <tr>\n";Line 1454: query = "SELECT sys_bd_list.* FROM sys_bd_list WITH (NOLOCK)";Line 1455: cmd = new SqlCommand(query, conn);Line 1456: SqlDataReader rdr = cmd.ExecuteReader();Line 1457: while(rdr.Read()) {Line 1458: output += " <td width='" + Convert.ToInt32(100/i) + "%'><b>" + rdr["bank"] + "</b><br />" + rdr["owner"] + "<br />AG.: " + rdr["ag"] + "<br />CC.: " + rdr["cc"] + "<br /></td>\n";Line 1459: }Line 1460: rdr.Close();Line 1461: output += " </tr>\n";Line 1462: }Line 1463: Line 1464: conn.Close();Line 1465: Line 1466: if (nonStatic) {Line 1467: output += " <tr>\n";Line 1468: output += " <td"; if (i > 1)output+=" colspan='" + i + "'";output+=">\n";Line 1469: output += " <font class='title' color='red'><strong>NOTA I:</strong> </font>Não esqueça de anotar os dados do banco desejado para efetuar o depósito.<br />\n";Line 1470: output += " <font class='title' color='red'><strong>NOTA II:</strong> </font>O pedido só será entregue quando o pagamento estiver disponível na conta.<br />\n";Line 1471: output += " <font class='title' color='red'><strong>NOTA III:</strong> </font>Você dever enviar o comprovante de depósito, juntamente com a referência do pedido, via email.<br />\n";Line 1472: output += " </td>\n";Line 1473: output += " </tr>\n";Line 1474: output += " <tr><td"; if (i > 1)output+=" colspan='" + i + "'";output+=" align='right'>";Line 1475: output += " <input data-mode='BD' class='click_once' id='billing-submit-bd' type='image' src='/octopus/design/images/" + sid + "/form_prc_bd.png' />";Line 1476: output += "</td></tr>\n";Line 1477: }Line 1478: Line 1479: output += "</table>\n";Line 1480: return output;Line 1481: }Line 1482: Line 1483: public bool dynamicFlagExists(string flag, int codGroup) {Line 1484: bool output = false;Line 1485: Line 1486: SqlConnection conn = new SqlConnection(sPath);Line 1487: conn.Open();Line 1488: Line 1489: string query = @"Line 1490: SELECT ccFlagLine 1491: FROM sys_parcels WITH (NOLOCK)Line 1492: WHERE (ccFlag = @ccFlag) AND (priceGroup = @priceGroup)Line 1493: ";Line 1494: SqlCommand cmd = new SqlCommand(query, conn);Line 1495: cmd.Parameters.Add(new SqlParameter("@ccFlag", SqlDbType.NVarChar));Line 1496: cmd.Parameters["@ccFlag"].Value = flag;Line 1497: cmd.Parameters.Add(new SqlParameter("@priceGroup", SqlDbType.Int));Line 1498: cmd.Parameters["@priceGroup"].Value = codGroup;Line 1499: SqlDataReader rdr = cmd.ExecuteReader();Line 1500: Line 1501: if (rdr.Read()) output = true;Line 1502: Line 1503: rdr.Close();Line 1504: conn.Close();Line 1505: Line 1506: return output;Line 1507: }Line 1508: Line 1509: public int getAccess(string user, string resource) {Line 1510: int output = 0;Line 1511: Line 1512: SqlConnection conn = new SqlConnection(sPath);Line 1513: conn.Open();Line 1514: Line 1515: string query = @"Line 1516: SELECT acl_roles.roleLine 1517: FROM acl_users WITH (NOLOCK)Line 1518: INNER JOIN acl_roles WITH (NOLOCK) ON acl_users.idRole = acl_roles.idLine 1519: WHERE acl_users.[user] = @userLine 1520: ";Line 1521: SqlCommand cmd = new SqlCommand(query, conn);Line 1522: cmd.Parameters.Add(new SqlParameter("@user", SqlDbType.NVarChar));Line 1523: cmd.Parameters["@user"].Value = user;Line 1524: Line 1525: string role = Convert.ToString(cmd.ExecuteScalar());Line 1526: Line 1527: query = "SP_acl_getAccess";Line 1528: cmd = new SqlCommand(query, conn);Line 1529: cmd.CommandType = CommandType.StoredProcedure;Line 1530: cmd.Parameters.Add(new SqlParameter("@role", SqlDbType.NVarChar));Line 1531: cmd.Parameters.Add(new SqlParameter("@resource", SqlDbType.NVarChar));Line 1532: cmd.Parameters["@role"].Value = role;Line 1533: cmd.Parameters["@resource"].Value = resource;Line 1534: Line 1535: output = Convert.ToInt32(cmd.ExecuteScalar());Line 1536: Line 1537: conn.Close();Line 1538: Line 1539: return output;Line 1540: }Line 1541: Line 1542: public string[] getImgSize(string size) {Line 1543: string[] output = new string[2];Line 1544: string[] sizes = ImgSizes.Split(';');Line 1545: string[] s = null;Line 1546: Line 1547: if ( sizes.Length >= 5 ) {Line 1548: switch(size) {Line 1549: case "Z":Line 1550: s = sizes[0].Split('x');Line 1551: break;Line 1552: Line 1553: case "B":Line 1554: s = sizes[1].Split('x');Line 1555: break;Line 1556: Line 1557: case "M":Line 1558: s = sizes[2].Split('x');Line 1559: break;Line 1560: Line 1561: case "S":Line 1562: s = sizes[3].Split('x');Line 1563: break;Line 1564: Line 1565: case "T":Line 1566: s = sizes[4].Split('x');Line 1567: break;Line 1568: Line 1569: default:Line 1570: s[0] = "";Line 1571: s[1] = "";Line 1572: break;Line 1573: }Line 1574: Line 1575: output[0] = s[0];Line 1576: output[1] = s[1];Line 1577: }Line 1578: Line 1579: return output;Line 1580: }Line 1581: Line 1582: // public bool useST(int userId) {Line 1583: // bool output = false;Line 1584: Line 1585: // if ( getConfig("UseST").Length > -1 ) {Line 1586: // string utp = "";Line 1587: // string id2 = "";Line 1588: Line 1589: // SqlConnection conn = new SqlConnection(sPath);Line 1590: // conn.Open();Line 1591: Line 1592: // string query = "SELECT userType, id2 FROM sys_users WITH (NOLOCK) WHERE (codUser = @codUser)";Line 1593: // SqlCommand cmd = new SqlCommand(query, conn);Line 1594: // cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));Line 1595: // cmd.Parameters["@codUser"].Value = userId;Line 1596: // SqlDataReader rdr = cmd.ExecuteReader();Line 1597: Line 1598: // if ( rdr.Read() ) {Line 1599: Line 1600: // //--( Regras para aplicao de substituio tributria )--------Line 1601: Line 1602: // utp = Convert.ToString(rdr[0]);Line 1603: // if ( rdr[0] != DBNull.Value && Convert.ToString(rdr[1]) != "" ) {Line 1604: // id2 = Convert.ToString(rdr[1]);Line 1605: // }Line 1606: Line 1607: // }Line 1608: Line 1609: // rdr.Close();Line 1610: // conn.Close();Line 1611: Line 1612: // switch( getConfig("UseST") ) {Line 1613: // case "F": // Somente para pessoa fsicaLine 1614: // if ( utp == "F" ) {Line 1615: // output = true;Line 1616: // }Line 1617: // break;Line 1618: Line 1619: // case "J": // Somente para pessoa jurdicaLine 1620: // if ( utp == "J" ) {Line 1621: // output = true;Line 1622: // }Line 1623: // break;Line 1624: Line 1625: // case "JI": // Somente pessoa juridica com iseno de I.ELine 1626: // if ( utp == "J" && id2 == "" ) {Line 1627: // output = true;Line 1628: // }Line 1629: // break;Line 1630: Line 1631: // case "FJI": // Somente pessoa fsica ou juridica com iseno de I.ELine 1632: // if ( id2 == "" ) {Line 1633: // output = true;Line 1634: // }Line 1635: // break;Line 1636: Line 1637: // default: // Todos os casosLine 1638: // output = true;Line 1639: // break;Line 1640: // }Line 1641: Line 1642: // }Line 1643: Line 1644: // return output;Line 1645: // }Line 1646: Line 1647: public string mappingErrors(string code) {Line 1648: return mappingErrors(code, 0);Line 1649: }Line 1650: Line 1651: public string mappingErrors(string code, int index) {Line 1652: switch(code) {Line 1653: case "bll-00001":Line 1654: return "Dados de entrega inválidos. Por favor confira os dados digitados e tente novamente.";Line 1655: Line 1656: case "bll-00002":Line 1657: return "Confirme os Termos e Condições para o fechamento do pedido.";Line 1658: Line 1659: case "prc_op1-00001":Line 1660: return "[CARTÃO DE CRÉDITO]: Selecione uma das bandeiras disponíveis.";Line 1661: Line 1662: case "prc_op1-00002":Line 1663: return "[CARTÃO DE CRÉDITO]: Preencha o Nome impresso no cartão.";Line 1664: Line 1665: case "prc_op1-00003":Line 1666: return "[CARTÃO DE CRÉDITO]: Número do cartão inválido. Verifique o número digitado e tente novamente.";Line 1667: Line 1668: case "prc_op1-00004":Line 1669: return "[CARTÃO DE CRÉDITO]: Data de validade expirada. Verifique a data selecionada e tente novamente.";Line 1670: Line 1671: case "prc_op1-00005":Line 1672: return "[CARTÃO DE CRÉDITO]: Código de segurança inválido. Verifique o código digitado e tente novamente.";Line 1673: Line 1674: case "prc_op1-00006":Line 1675: return "[CARTÃO DE CRÉDITO]: Por favor selecione uma opção de parcelamento.";Line 1676: Line 1677: case "prc_op2-00001":Line 1678: return "[TRANSFERÊNCIA ELETRÔNICA]: Por favor selecione um dos bancos disponíveis.";Line 1679: Line 1680: case "prc_op3-00001":Line 1681: return "[FINANCIAMENTO ELETRÔNICO]: Por favor selecione um dos bancos disponíveis.";Line 1682: Line 1683: case "prc_op6-00001":Line 1684: return "[FATURADO EMPRESA]: Por favor selecione uma das opes de pagamento disponíveis.";Line 1685: Line 1686: case "prc_op13-00001":Line 1687: return "[CARTÃO DE DÉBITO]: Selecione uma das bandeiras disponíveis.";Line 1688: Line 1689: case "prc_op13-00002":Line 1690: return "[CARTÃO DE DÉBITO]: Preencha o Nome impresso no cartão.";Line 1691: Line 1692: case "prc_op13-00003":Line 1693: return "[CARTÃO DE DÉBITO]: Número do cartão inválido. Verifique o número digitado e tente novamente.";Line 1694: Line 1695: case "prc_op13-00004":Line 1696: return "[CARTÃO DE DÉBITO]: Data de validade expirada. Verifique a data selecionada e tente novamente.";Line 1697: Line 1698: case "prc_op13-00005":Line 1699: return "[CARTÃO DE DÉBITO]: Código de segurança inválido. Verifique o código digitado e tente novamente.";Line 1700: Line 1701: default:Line 1702: return "";Line 1703: }Line 1704: }Line 1705: Line 1706: }Line 1707: Line 1708: Line 1709: Line 1710: Line 1711: Line 1712: Line 1713: Line 1714: Line 1715: Line 1716: Line 1717: public class UserSetup {Line 1718: public UserSetup() {}Line 1719: Line 1720: public static string UserEmail(string path, int userId) {Line 1721: SqlConnection conn = new SqlConnection(path);Line 1722: conn.Open();Line 1723: string query = "SELECT email FROM sys_users WITH (NOLOCK) WHERE (codUser = @codUser) AND (active = 1);";Line 1724: SqlCommand cmd = new SqlCommand(query, conn);Line 1725: cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));Line 1726: cmd.Parameters["@codUser"].Value = userId;Line 1727: return Convert.ToString(cmd.ExecuteScalar());Line 1728: conn.Close();Line 1729: }Line 1730: Line 1731: public static int UserGroup(string path, int userId) {Line 1732: if (userId == 0)return 1;Line 1733: int output = 1;Line 1734: Line 1735: SqlConnection conn = new SqlConnection(path);Line 1736: conn.Open();Line 1737: Line 1738: string query = "SELECT codGroup FROM sys_users WITH (NOLOCK) WHERE (codUser = @codUser);";Line 1739: SqlCommand cmd = new SqlCommand(query, conn);Line 1740: cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));Line 1741: cmd.Parameters["@codUser"].Value = userId;Line 1742: Line 1743: SqlDataReader rdr = cmd.ExecuteReader();Line 1744: if (rdr.Read()) {Line 1745: output = (int)rdr[0];Line 1746: }Line 1747: Line 1748: rdr.Close();Line 1749: conn.Close();Line 1750: Line 1751: return output;Line 1752: }Line 1753: Line 1754: public static decimal UserMinOrder(string path, int codGroup) {Line 1755: decimal output = 0;Line 1756: Line 1757: SqlConnection conn = new SqlConnection(path);Line 1758: conn.Open();Line 1759: Line 1760: string query = "SELECT minOrder FROM tbl_priceGroups WITH (NOLOCK) WHERE (codGroup = @codGroup);";Line 1761: SqlCommand cmd = new SqlCommand(query, conn);Line 1762: cmd.Parameters.Add(new SqlParameter("@codGroup", SqlDbType.Int));Line 1763: cmd.Parameters["@codGroup"].Value = codGroup;Line 1764: Line 1765: SqlDataReader rdr = cmd.ExecuteReader();Line 1766: if (rdr.Read()) {Line 1767: output = (decimal)rdr[0];Line 1768: }Line 1769: Line 1770: rdr.Close();Line 1771: conn.Close();Line 1772: Line 1773: return output;Line 1774: }Line 1775: Line 1776: public static string UserData(string path, int userId) {Line 1777: string output = "";Line 1778: Line 1779: SqlConnection conn = new SqlConnection(path);Line 1780: conn.Open();Line 1781: Line 1782: string query = @"Line 1783: SELECTLine 1784: name,Line 1785: email,Line 1786: id1,Line 1787: id2,Line 1788: address,Line 1789: district,Line 1790: city,Line 1791: state,Line 1792: zipcode,Line 1793: phone1,Line 1794: phone2Line 1795: FROM sys_users WITH (NOLOCK)Line 1796: WHERE (codUser = @codUser)Line 1797: ";Line 1798: Line 1799: SqlCommand cmd = new SqlCommand(query, conn);Line 1800: cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));Line 1801: cmd.Parameters["@codUser"].Value = userId;Line 1802: Line 1803: SqlDataReader rdr = cmd.ExecuteReader();Line 1804: if (rdr.Read()) {Line 1805: output += rdr["name"] + " [" + rdr["email"] + "]\n";Line 1806: output += "CPF/CNPJ: " + rdr["id1"] + "\n";Line 1807: output += "RG/IE: " + rdr["id2"] + "\n";Line 1808: output += "\n";Line 1809: output += rdr["address"] + "\n";Line 1810: output += rdr["district"] + "\n";Line 1811: output += rdr["city"] + "-" + rdr["state"] + "\n";Line 1812: output += rdr["zipcode"] + "\n";Line 1813: output += "\n";Line 1814: output += "T.Residencial: " + rdr["phone1"] + "\n";Line 1815: output += "T.Comercial: " + rdr["phone2"] + "\n";Line 1816: }Line 1817: Line 1818: rdr.Close();Line 1819: conn.Close();Line 1820: Line 1821: return output;Line 1822: }Line 1823: Line 1824: public static void setActive(string path, int userId, int active) {Line 1825: SqlConnection conn = new SqlConnection(path);Line 1826: conn.Open();Line 1827: string query = "UPDATE sys_users SET active = @active WHERE (codUser = @codUser)";Line 1828: SqlCommand cmd = new SqlCommand(query, conn);Line 1829: cmd.Parameters.Add(new SqlParameter("@active", SqlDbType.TinyInt));Line 1830: cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));Line 1831: cmd.Parameters["@active"].Value = active;Line 1832: cmd.Parameters["@codUser"].Value = userId;Line 1833: cmd.ExecuteNonQuery();Line 1834: conn.Close();Line 1835: }Line 1836: Line 1837: public static void setLogin(string path, int userId, bool key) {Line 1838: SqlConnection conn = new SqlConnection(path);Line 1839: conn.Open();Line 1840: string query = "UPDATE sys_users SET logged = @logged WHERE (codUser = @codUser)";Line 1841: SqlCommand cmd = new SqlCommand(query, conn);Line 1842: cmd.Parameters.Add(new SqlParameter("@logged", SqlDbType.Bit));Line 1843: cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));Line 1844: cmd.Parameters["@logged"].Value = key;Line 1845: cmd.Parameters["@codUser"].Value = userId;Line 1846: cmd.ExecuteNonQuery();Line 1847: conn.Close();Line 1848: }Line 1849: Line 1850: public static void appendToNotes(string path, int userId, string note) {Line 1851: string notes = "";Line 1852: SqlConnection conn = new SqlConnection(path);Line 1853: conn.Open();Line 1854: Line 1855: string query = "SELECT notes FROM sys_users WITH (NOLOCK) WHERE (codUser = @codUser) AND (NOT notes IS NULL)";Line 1856: SqlCommand cmd = new SqlCommand(query, conn);Line 1857: cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));Line 1858: cmd.Parameters["@codUser"].Value = userId;Line 1859: notes = Convert.ToString(cmd.ExecuteScalar());Line 1860: notes = (notes != "" ? notes + "\n" + note : note);Line 1861: Line 1862: query = "UPDATE sys_users SET notes = @notes WHERE (codUser = @codUser)";Line 1863: cmd = new SqlCommand(query, conn);Line 1864: cmd.Parameters.Add(new SqlParameter("@notes", SqlDbType.NText));Line 1865: cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));Line 1866: cmd.Parameters["@notes"].Value = notes;Line 1867: cmd.Parameters["@codUser"].Value = userId;Line 1868: cmd.ExecuteNonQuery();Line 1869: Line 1870: conn.Close();Line 1871: }Line 1872: Line 1873: public static bool isLogged(string path, int userId) {Line 1874: bool output = false;Line 1875: Line 1876: SqlConnection conn = new SqlConnection(path);Line 1877: conn.Open();Line 1878: Line 1879: string query = "SELECT logged FROM sys_users WITH (NOLOCK) WHERE (codUser = @codUser)";Line 1880: SqlCommand cmd = new SqlCommand(query, conn);Line 1881: cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));Line 1882: cmd.Parameters["@codUser"].Value = userId;Line 1883: if ( cmd.ExecuteScalar() != DBNull.Value ) {Line 1884: output = Convert.ToBoolean( cmd.ExecuteScalar() );Line 1885: }Line 1886: Line 1887: conn.Close();Line 1888: Line 1889: return output;Line 1890: }Line 1891: Line 1892: public static bool loginCheck(string path, string login) {Line 1893: bool output = false;Line 1894: Line 1895: SqlConnection conn = new SqlConnection(path);Line 1896: conn.Open();Line 1897: Line 1898: string query = "SELECT codUser FROM sys_users WITH (NOLOCK) WHERE (email = @login) OR (id1 = @login)";Line 1899: SqlCommand cmd = new SqlCommand(query, conn);Line 1900: cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar));Line 1901: cmd.Parameters["@login"].Value = login;Line 1902: if ( Convert.ToInt32( cmd.ExecuteScalar() ) > 0 ) {Line 1903: output = true;Line 1904: }Line 1905: conn.Close();Line 1906: Line 1907: return output;Line 1908: }Line 1909: Line 1910: public static decimal getOrdersTotalAcumulated(string path, int userId) {Line 1911: return getOrdersTotalAcumulated(path, userId, "");Line 1912: }Line 1913: Line 1914: public static decimal getOrdersTotalAcumulated(string path, int userId, string ordersColl) {Line 1915: decimal output = 0;Line 1916: // if ( userId > 0 ) {Line 1917: // SqlConnection conn;Line 1918: // SqlCommand cmd;Line 1919: // conn = new SqlConnection(path);Line 1920: // conn.Open();Line 1921: // cmd = new SqlCommand(@"Line 1922: // SELECT TOP 100 ISNULL( SUM( Oi.prc * Oi.qt ), 0 ) AS total_salesLine 1923: // FROM sys_orders OLine 1924: // JOIN sys_ordersBodies Oi ON Oi.[codOrder] = O.[codOrder]Line 1925: // WHERE O.codUser = @codUser AND O.status > 2Line 1926: // ", conn);Line 1927: // cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));Line 1928: // cmd.Parameters["@codUser"].Value = userId;Line 1929: // output = Convert.ToDecimal( cmd.ExecuteScalar() );Line 1930: // conn.Close();Line 1931: // }Line 1932: return output;Line 1933: }Line 1934: Line 1935: public static int getOrderStatus(string path, int orderId) {Line 1936: int output = -1;Line 1937: Line 1938: SqlConnection conn = new SqlConnection(path);Line 1939: conn.Open();Line 1940: SqlCommand cmd = new SqlCommand( "SELECT status FROM sys_orders WITH (NOLOCK) WHERE codOrder = " + orderId, conn);Line 1941: output = Convert.ToInt32(cmd.ExecuteScalar());Line 1942: conn.Close();Line 1943: Line 1944: return output;Line 1945: }Line 1946: Line 1947: public static decimal getOrderItemsTotal(string path, int orderId) {Line 1948: decimal output = 0;Line 1949: Line 1950: SqlConnection conn = new SqlConnection(path);Line 1951: conn.Open();Line 1952: SqlCommand cmd = new SqlCommand( "SELECT SUM(qt * prc) FROM sys_ordersBodies WITH (NOLOCK) WHERE (codOrder) = " + orderId, conn );Line 1953: output = Convert.ToDecimal(cmd.ExecuteScalar());Line 1954: conn.Close();Line 1955: Line 1956: return output;Line 1957: }Line 1958: Line 1959: public static decimal getDiscountCouponValue(string path, int orderId) {Line 1960: decimal output = 0;Line 1961: Line 1962: SqlConnection conn = new SqlConnection(path);Line 1963: conn.Open();Line 1964: Line 1965: SqlCommand cmd = new SqlCommand( "SELECT [value] FROM rel_ordersWdc_n_gc WITH (NOLOCK) WHERE codOrder = " + orderId, conn );Line 1966: SqlDataReader rdr = cmd.ExecuteReader();Line 1967: while( rdr.Read() ) {Line 1968: output = output + Convert.ToDecimal(rdr[0]);Line 1969: }Line 1970: rdr.Close();Line 1971: conn.Close();Line 1972: Line 1973: return output;Line 1974: }Line 1975: Line 1976: }Line 1977: Line 1978: Line 1979: Line 1980: Line 1981: Line 1982: Line 1983: Line 1984: Line 1985: Line 1986: Line 1987: public class Generics {Line 1988: public Generics() {}Line 1989: Line 1990: public static string MainFooter(string path, string thisConfig) {Line 1991: string output = "";Line 1992: Line 1993: SqlConnection conn = new SqlConnection(path);Line 1994: conn.Open();Line 1995: Line 1996: string query = "SELECT [value] FROM sys_footers WITH (NOLOCK) WHERE pKey = 1;";Line 1997: SqlCommand cmd = new SqlCommand(query, conn);Line 1998: Line 1999: SqlDataReader rdr = cmd.ExecuteReader();Line 2000: if (rdr.Read()) {Line 2001: DateTime dateTime = new DateTime();Line 2002: dateTime = DateTime.Now;Line 2003: Line 2004: output = "<div id='main_footer'><div class='pad'>" + Convert.ToString(rdr["value"]).Replace("[? thisConfig ?]",thisConfig) + "</div></div>";Line 2005: output = output.Replace("[? day ?]",dateTime.ToString("dd"));Line 2006: output = output.Replace("[? month ?]",dateTime.ToString("MM"));Line 2007: output = output.Replace("[? year ?]",dateTime.ToString("yyyy"));Line 2008: }Line 2009: Line 2010: rdr.Close();Line 2011: conn.Close();Line 2012: Line 2013: return output;Line 2014: }Line 2015: Line 2016: public static string ContainerFooter(string path, string thisConfig) {Line 2017: string output = "";Line 2018: Line 2019: output += "<div id='container_footer'><div class='pad'><span>";Line 2020: Line 2021: SqlConnection conn = new SqlConnection(path);Line 2022: conn.Open();Line 2023: Line 2024: string query = "SELECT [value] FROM sys_footers WITH (NOLOCK) WHERE pKey = 2;";Line 2025: SqlCommand cmd = new SqlCommand(query, conn);Line 2026: Line 2027: SqlDataReader rdr = cmd.ExecuteReader();Line 2028: if (rdr.Read()) {Line 2029: DateTime dateTime = new DateTime();Line 2030: dateTime = DateTime.Now;Line 2031: Line 2032: output += Convert.ToString(rdr["value"]).Replace("[? thisConfig ?]",thisConfig);Line 2033: output = output.Replace("[? day ?]",dateTime.ToString("dd"));Line 2034: output = output.Replace("[? month ?]",dateTime.ToString("MM"));Line 2035: output = output.Replace("[? year ?]",dateTime.ToString("yyyy"));Line 2036: }Line 2037: Line 2038: rdr.Close();Line 2039: conn.Close();Line 2040: Line 2041: output += "</span></div></div>";Line 2042: Line 2043: Regex wr_pattern = new Regex(@"\[\? wr=(?<url>.+) \?\]");Line 2044: MatchCollection Ms = wr_pattern.Matches(output);Line 2045: Line 2046: foreach(Match M in Ms) {Line 2047: output = output.Replace(M.ToString(), ZenTools.SyncWebRequest(M.Groups["url"].ToString()).Replace("$","$ "));Line 2048: }Line 2049: Line 2050: return output;Line 2051: }Line 2052: Line 2053: public static string MobileFooter(string path, string thisConfig) {Line 2054: string output = "";Line 2055: Line 2056: SqlConnection conn = new SqlConnection(path);Line 2057: conn.Open();Line 2058: Line 2059: string query = "SELECT [value] FROM sys_footers WITH (NOLOCK) WHERE pKey = 3;";Line 2060: SqlCommand cmd = new SqlCommand(query, conn);Line 2061: Line 2062: SqlDataReader rdr = cmd.ExecuteReader();Line 2063: if (rdr.Read()) {Line 2064: DateTime dateTime = new DateTime();Line 2065: dateTime = DateTime.Now;Line 2066: Line 2067: output = "<div id='mobile_footer'><div class='pad'>" + Convert.ToString(rdr["value"]).Replace("[? thisConfig ?]",thisConfig) + "</div></div>";Line 2068: output = output.Replace("[? day ?]",dateTime.ToString("dd"));Line 2069: output = output.Replace("[? month ?]",dateTime.ToString("MM"));Line 2070: output = output.Replace("[? year ?]",dateTime.ToString("yyyy"));Line 2071: }Line 2072: Line 2073: rdr.Close();Line 2074: conn.Close();Line 2075: Line 2076: return output;Line 2077: }Line 2078: Line 2079: public static bool FilterBanner(string mainInclude, string querystring, string permission, string filter) {Line 2080: if ( permission.IndexOf(mainInclude) > -1 ) {Line 2081: if ( filter.Length == 0 ) {Line 2082: return true;Line 2083: } else {Line 2084: if ( querystring.IndexOf(filter) > -1 ) {Line 2085: return true;Line 2086: } else {Line 2087: return false;Line 2088: }Line 2089: }Line 2090: } else {Line 2091: return false;Line 2092: }Line 2093: }Line 2094: Line 2095: public static string OfflineTags(string input) {Line 2096: if (input.Length <= 0)return "";Line 2097: string output = input;Line 2098: Line 2099: output = output.Replace("[?b ","<b>");Line 2100: output = output.Replace("[?i ","<i>");Line 2101: output = output.Replace("[?u ","<u>");Line 2102: output = output.Replace(" b?]","</b>");Line 2103: output = output.Replace(" i?]","</i>");Line 2104: output = output.Replace(" u?]","</u>");Line 2105: output = output.Replace("\n","<br />");Line 2106: Line 2107: return output;Line 2108: }Line 2109: Line 2110: public static string GridDescription(string path, string codComp) {Line 2111: string output = "";Line 2112: string[] options = ZenTools.Split(codComp,';');Line 2113: Line 2114: string query = "";Line 2115: SqlCommand cmd = null;Line 2116: SqlDataReader rdr = null;Line 2117: Line 2118: SqlConnection conn = new SqlConnection(path);Line 2119: conn.Open();Line 2120: Line 2121: try {Line 2122: query = "SELECT [desc] AS DescOption FROM tbl_selectOptions WITH (NOLOCK) WHERE (codOption = @option)";Line 2123: cmd = new SqlCommand(query, conn);Line 2124: cmd.Parameters.Add(new SqlParameter("@option", SqlDbType.Int));Line 2125: Line 2126: foreach(string option in options) {Line 2127: cmd.Parameters["@option"].Value = option;Line 2128: rdr = cmd.ExecuteReader();Line 2129: Line 2130: if (rdr.Read())Line 2131: output += (string)rdr["DescOption"] + " ";Line 2132: Line 2133: rdr.Close();Line 2134: }Line 2135: } catch( Exception ex ) {Line 2136: /* handle error */Line 2137: } finally {Line 2138: conn.Close();Line 2139: }Line 2140: Line 2141: return "[ " + output + "]";Line 2142: }Line 2143: Line 2144: public static string ClosePointer(int shopId, int highlight) {Line 2145: string output = "";Line 2146: string imgSrc = "";Line 2147: int i = 0;Line 2148: Line 2149: output += "<div id='closePointer'>\n";Line 2150: output += "<table>\n";Line 2151: output += " <tr>\n";Line 2152: Line 2153: for(i = 1; i <= 4; i++ ) {Line 2154: imgSrc = "/octopus/design/images/" + Convert.ToString(shopId) + "/close_step" + i + "_" + ( highlight == i ? "1" : "0" );Line 2155: if ( File.Exists( HttpContext.Current.Server.MapPath( imgSrc + ".png" ) ) ) {Line 2156: imgSrc += ".png";Line 2157: } else {Line 2158: imgSrc += ".gif";Line 2159: }Line 2160: output += " <td><img src='" + imgSrc + "' alt='' /></td>\n";Line 2161: }Line 2162: Line 2163: output += " </tr>\n";Line 2164: output += "</table>\n";Line 2165: output += "</div>\n";Line 2166: Line 2167: return output;Line 2168: }Line 2169: Line 2170: public static string getPerfectGiftNode(string path, int idNode) {Line 2171: string output = "";Line 2172: string query = "";Line 2173: Line 2174: SqlConnection conn = new SqlConnection(path);Line 2175: conn.Open();Line 2176: Line 2177: query = "SELECT name FROM tbl_perfectGiftNodes WITH (NOLOCK) WHERE id = @idNode";Line 2178: Line 2179: SqlCommand cmd = new SqlCommand(query, conn);Line 2180: cmd.Parameters.Add(new SqlParameter("@idNode", SqlDbType.Int));Line 2181: cmd.Parameters["@idNode"].Value = idNode;Line 2182: Line 2183: SqlDataReader rdr = cmd.ExecuteReader();Line 2184: Line 2185: if (rdr.Read()) {Line 2186: output = Convert.ToString(rdr[0]);Line 2187: }Line 2188: Line 2189: rdr.Close();Line 2190: conn.Close();Line 2191: Line 2192: return output;Line 2193: }Line 2194: Line 2195: public static string menuAnchorHref(string urlBase, string mn1, string mn2, string mn3, int sid, int cod1st, int cod2nd, int cod3rd, string thisConfig) {Line 2196: string output = urlBase.Replace("/octopus/", "");Line 2197: thisConfig = Regex.Replace(thisConfig, @"\?sid=\d+", "");Line 2198: thisConfig = Regex.Replace(thisConfig, @"\&m=\w?\w", "");Line 2199: thisConfig = Regex.Replace(thisConfig, @"\&cm1=\d+", "");Line 2200: thisConfig = Regex.Replace(thisConfig, @"\&cm2=\d+", "");Line 2201: thisConfig = Regex.Replace(thisConfig, @"\&cm3=\d+", "");Line 2202: Line 2203: if (mn1.Length > 0) output += "/" + mn1;Line 2204: if (mn2.Length > 0) output += "/" + mn2;Line 2205: if (mn3.Length > 0) output += "/" + mn3;Line 2206: Line 2207: if (thisConfig.Length > 0) {Line 2208: output += ( thisConfig.Substring(0, 1) == "&" ? "?" + thisConfig.Substring(1) : thisConfig );Line 2209: }Line 2210: Line 2211: return output;Line 2212: }Line 2213: Line 2214: public static string getMenuName(string path, int level, int codMenu) {Line 2215: string output = "";Line 2216: string query = "";Line 2217: Line 2218: switch(level) {Line 2219: case 3:Line 2220: query = "SELECT [desc] FROM tbl_menu3rd WITH (NOLOCK) WHERE cod3rdMenu = @codMenu";Line 2221: break;Line 2222: case 2:Line 2223: query = "SELECT [desc] FROM tbl_menu2nd WITH (NOLOCK) WHERE cod2ndMenu = @codMenu";Line 2224: break;Line 2225: default:Line 2226: query = "SELECT [desc] FROM tbl_menu1st WITH (NOLOCK) WHERE cod1stMenu = @codMenu";Line 2227: break;Line 2228: }Line 2229: Line 2230: SqlConnection conn = new SqlConnection(path);Line 2231: conn.Open();Line 2232: SqlCommand cmd = new SqlCommand(query, conn);Line 2233: cmd.Parameters.Add(new SqlParameter("@codMenu", SqlDbType.Int));Line 2234: cmd.Parameters["@codMenu"].Value = codMenu;Line 2235: output = Convert.ToString(cmd.ExecuteScalar()).TrimStart().TrimEnd();Line 2236: conn.Close();Line 2237: return output;Line 2238: }Line 2239: Line 2240: public static string getProdImgs(string path, int codGrid) {Line 2241: string output = "";Line 2242: Line 2243: SqlConnection conn = new SqlConnection(path);Line 2244: conn.Open();Line 2245: Line 2246: string query = "SELECT imgSrc FROM tbl_pictures WITH (NOLOCK) WHERE (codGrid = @codGrid) ORDER BY link DESC";Line 2247: Line 2248: SqlCommand cmd = new SqlCommand(query, conn);Line 2249: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 2250: cmd.Parameters["@codGrid"].Value = codGrid;Line 2251: SqlDataReader rdr = cmd.ExecuteReader();Line 2252: Line 2253: StringBuilder Sb = new StringBuilder();Line 2254: Line 2255: while( rdr.Read() ) {Line 2256: Sb.Append( "|" + Convert.ToString(rdr[0]) + "" );Line 2257: }Line 2258: Line 2259: rdr.Close();Line 2260: conn.Close();Line 2261: Line 2262: output = "{ \"imgs\": \"" + Sb.ToString().Substring(1) + "\" }";Line 2263: Line 2264: return output;Line 2265: }Line 2266: Line 2267: public static int getCodGridByRef(string path, string itemRef) {Line 2268: int output = 0;Line 2269: Line 2270: SqlConnection conn = new SqlConnection(path);Line 2271: conn.Open();Line 2272: Line 2273: string query = "SELECT codGrid FROM tbl_grid WITH (NOLOCK) WHERE (ref = @itemRef)";Line 2274: SqlCommand cmd = new SqlCommand(query, conn);Line 2275: cmd.Parameters.Add(new SqlParameter("@itemRef", SqlDbType.NVarChar));Line 2276: cmd.Parameters["@itemRef"].Value = itemRef;Line 2277: output = Convert.ToInt32(cmd.ExecuteScalar());Line 2278: conn.Close();Line 2279: Line 2280: return output;Line 2281: }Line 2282: Line 2283: public static void loadMetaData(Line 2284: string sJsonLine 2285: , ref string pageTitleLine 2286: , ref string pageDescriptionLine 2287: , ref string keyWordsLine 2288: , ref string remarketingLine 2289: , ref string creative_titleLine 2290: , ref string creative_imageLine 2291: , ref string creative_aboutLine 2292: , ref string creative_about2Line 2293: ) {Line 2294: try {Line 2295: object oJson = JavaScriptDeserializer.DeserializeFromJson(sJson, typeof(NameValueCollection));Line 2296: Line 2297: // meta tagsLine 2298: if (Line 2299: ((NameValueCollection)oJson)["title"] != nullLine 2300: && ((NameValueCollection)oJson)["title"] != ""Line 2301: && ((NameValueCollection)oJson)["title"] != "undefined"Line 2302: ) {Line 2303: pageTitle = ((NameValueCollection)oJson)["title"];Line 2304: }Line 2305: Line 2306: if (Line 2307: ((NameValueCollection)oJson)["description"] != nullLine 2308: && ((NameValueCollection)oJson)["description"] != ""Line 2309: && ((NameValueCollection)oJson)["description"] != "undefined"Line 2310: ) {Line 2311: pageDescription = ((NameValueCollection)oJson)["description"];Line 2312: }Line 2313: Line 2314: if (Line 2315: ((NameValueCollection)oJson)["keyWords"] != nullLine 2316: && ((NameValueCollection)oJson)["keyWords"] != ""Line 2317: && ((NameValueCollection)oJson)["keyWords"] != "undefined"Line 2318: ) {Line 2319: keyWords = ((NameValueCollection)oJson)["keyWords"];Line 2320: }Line 2321: Line 2322: if (Line 2323: ((NameValueCollection)oJson)["remarketing"] != nullLine 2324: && ((NameValueCollection)oJson)["remarketing"] != ""Line 2325: && ((NameValueCollection)oJson)["remarketing"] != "undefined"Line 2326: ) {Line 2327: remarketing = ((NameValueCollection)oJson)["remarketing"];Line 2328: }Line 2329: Line 2330: // creativeLine 2331: if (Line 2332: ((NameValueCollection)oJson)["creative_title"] != null &&Line 2333: ((NameValueCollection)oJson)["creative_title"] != "" &&Line 2334: ((NameValueCollection)oJson)["creative_title"] != "undefined"Line 2335: ) {Line 2336: creative_title = ((NameValueCollection)oJson)["creative_title"];Line 2337: }Line 2338: Line 2339: if (Line 2340: ((NameValueCollection)oJson)["creative_img"] != null &&Line 2341: ((NameValueCollection)oJson)["creative_img"] != "" &&Line 2342: ((NameValueCollection)oJson)["creative_img"] != "undefined"Line 2343: ) {Line 2344: creative_image = ((NameValueCollection)oJson)["creative_img"];Line 2345: }Line 2346: Line 2347: if (Line 2348: ((NameValueCollection)oJson)["creative_about"] != null &&Line 2349: ((NameValueCollection)oJson)["creative_about"] != "" &&Line 2350: ((NameValueCollection)oJson)["creative_about"] != "undefined"Line 2351: ) {Line 2352: creative_about = ((NameValueCollection)oJson)["creative_about"];Line 2353: }Line 2354: Line 2355: if (Line 2356: ((NameValueCollection)oJson)["creative_about2"] != null &&Line 2357: ((NameValueCollection)oJson)["creative_about2"] != "" &&Line 2358: ((NameValueCollection)oJson)["creative_about2"] != "undefined"Line 2359: ) {Line 2360: creative_about2 = ((NameValueCollection)oJson)["creative_about2"];Line 2361: }Line 2362: } catch (Exception ex) {}Line 2363: }Line 2364: Line 2365: public static void setNote(string path, int orderId, string key, string note) {Line 2366: string notes = "";Line 2367: string entry = "";Line 2368: Line 2369: SqlConnection conn = new SqlConnection(path);Line 2370: conn.Open();Line 2371: Line 2372: // get order notesLine 2373: SqlCommand cmd = new SqlCommand( "SELECT [notes] FROM sys_orders WITH (NOLOCK) WHERE [codOrder] = @codOrder", conn );Line 2374: cmd.Parameters.Add(new SqlParameter("@codOrder", SqlDbType.Int));Line 2375: cmd.Parameters["@codOrder"].Value = orderId;Line 2376: notes = Convert.ToString( cmd.ExecuteScalar() );Line 2377: Line 2378: // handle new entryLine 2379: entry = string.Format( "[{0}:] {1}", key, note );Line 2380: if ( notes.IndexOf( string.Format( "[{0}:]", key ) ) > -1 ) {Line 2381: notes = Regex.Replace( notes, string.Format( @"\[{0}:\]\s.*", key ), entry );Line 2382: } else {Line 2383: if ( notes == "" ) {Line 2384: notes = entry;Line 2385: } else {Line 2386: notes += "\n" + entry;Line 2387: }Line 2388: }Line 2389: Line 2390: // update order notesLine 2391: cmd = new SqlCommand( "UPDATE sys_orders SET [notes] = @notes WHERE [codOrder] = @codOrder", conn );Line 2392: cmd.Parameters.Add(new SqlParameter("@notes", SqlDbType.NText));Line 2393: cmd.Parameters.Add(new SqlParameter("@codOrder", SqlDbType.Int));Line 2394: cmd.Parameters["@notes"].Value = notes;Line 2395: cmd.Parameters["@codOrder"].Value = orderId;Line 2396: cmd.ExecuteNonQuery();Line 2397: Line 2398: conn.Close();Line 2399: }Line 2400: Line 2401: /* ITEM BOX [BEGIN] */Line 2402: Line 2403: public static string print_item_promotion(dynamic store) {Line 2404: if ( store.item_promotion != null && store.item_promotion.id != null ) {Line 2405: string thumb = "";Line 2406: if ( store.item_promotion.thumbnail != "imgNotAvailable" )Line 2407: thumb = string.Format(Line 2408: "<img src='/octopus/design/images/{0}/{1}' class='product_promotion_thumbnail' />",Line 2409: store.shopId, store.item_promotion.thumbnailLine 2410: );Line 2411: return string.Format(Line 2412: @"Line 2413: <div class='product_promotion'>Line 2414: <span class='product_promotion_name'>{0}</span>Line 2415: <span class='product_promotion_description'>{1}</span>Line 2416: {2}Line 2417: </div>Line 2418: ",Line 2419: store.item_promotion.name,Line 2420: store.item_promotion.description,Line 2421: thumbLine 2422: );Line 2423: } else {Line 2424: return "";Line 2425: }Line 2426: }Line 2427: Line 2428: public static string print_item_colors(dynamic store) {Line 2429: if ( store.item_colors != null && store.item_colors.Count > 0 ) {Line 2430: StringBuilder Sb = new StringBuilder();Line 2431: for( int i = 0; i < store.item_colors.Count; i++ ) {Line 2432: Sb.Append(Line 2433: string.Format( "<li class='color-option-{0}'><span></span></li>", store.item_colors[i] )Line 2434: );Line 2435: Line 2436: }Line 2437: return string.Format(Line 2438: @"Line 2439: <div class='item_colors'>Line 2440: <ul>{0}</ul>Line 2441: </div>Line 2442: ",Line 2443: Sb.ToString()Line 2444: );Line 2445: } else {Line 2446: return "";Line 2447: }Line 2448: }Line 2449: Line 2450: public static string print_item_free_shipping(dynamic store) {Line 2451: try {Line 2452: StringBuilder Sb = new StringBuilder();Line 2453: Line 2454: if ( store.item_price_json.freeShipping != null && Convert.ToBoolean( store.item_price_json.freeShipping ) ) {Line 2455: if ( store.item_price_json.freeShippingType == "RESTRICTED" ) {Line 2456: Sb.Append(Line 2457: @"Line 2458: <span class='free_shipping_restricted'>Line 2459: <span class='free_shipping_restricted_inner_reference'></span>Line 2460: </span>Line 2461: "Line 2462: );Line 2463: Line 2464: string[] ranges = Convert.ToString(store.item_price_json.freeShippingRanges).Split(';');Line 2465: if ( ranges.Length > 0 && ranges[0] != "" ) {Line 2466: Sb.Append(Line 2467: @"Line 2468: <div class='item_free_shipping_restricted'>Line 2469: "Line 2470: );Line 2471: Line 2472: if ( store.item_price_json.freeShippingLabel != null && store.item_price_json.freeShippingLabel != "" ) {Line 2473: Sb.Append( string.Format(Line 2474: @"Line 2475: <span class='item_free_shipping_restricted_label'>{0}</span>Line 2476: ", store.item_price_json.freeShippingLabelLine 2477: ) );Line 2478: } else {Line 2479: Sb.Append(Line 2480: @"Line 2481: <span class='item_free_shipping_restricted_label'>Frete Grátis</span>Line 2482: <div>Line 2483: <ul>Line 2484: "Line 2485: );Line 2486: Line 2487: foreach(string sRange in ranges) {Line 2488: string[] r = sRange.Split(',');Line 2489: Sb.Append( string.Format(Line 2490: @"Line 2491: <li><font class='free_shipping_name'>{0}</font></li>Line 2492: ", r[2]Line 2493: ) );Line 2494: }Line 2495: Sb.Append(Line 2496: @" Line 2497: </ul>Line 2498: </div>Line 2499: "Line 2500: );Line 2501: }Line 2502: Line 2503: Sb.Append(Line 2504: @"Line 2505: </div>Line 2506: "Line 2507: );Line 2508: Line 2509: }Line 2510: } else {Line 2511: Sb.Append(Line 2512: @"Line 2513: <span class='free_shipping'>Line 2514: <span class='free_shipping_inner_reference'></span>Line 2515: </span>Line 2516: "Line 2517: );Line 2518: }Line 2519: Line 2520: return Sb.ToString();Line 2521: } else {Line 2522: return "";Line 2523: }Line 2524: } catch (Exception ex) {Line 2525: return "";Line 2526: }Line 2527: Line 2528: }Line 2529: Line 2530: public static string print_item_prices(ShopSetup shop, dynamic store) {Line 2531: StringBuilder Sb = new StringBuilder();Line 2532: Line 2533: if (Line 2534: !Convert.ToBoolean( store.onOutOfStockHidePrice ) ||Line 2535: ( store.item_codAvailability == 1 && store.item_price > 0 )Line 2536: ) {Line 2537: Sb.Append(Line 2538: @"Line 2539: <div class='item_prices'>Line 2540: "Line 2541: );Line 2542: Line 2543: if ( store.item_discRate > 0) {Line 2544: Sb.Append( string.Format(Line 2545: @"Line 2546: <span class='item_listPrice'>Line 2547: <label>{0}</label>Line 2548: <span>{1}</span>Line 2549: </span>Line 2550: ",Line 2551: store.priceLabels[0],Line 2552: shop.CurrType + string.Format( "{0:0." + store.ndd + "}", store.item_price )Line 2553: ) );Line 2554: }Line 2555: Line 2556: Sb.Append( string.Format(Line 2557: @"Line 2558: <span class='item_ourPrice'>Line 2559: <label>{1}</label>Line 2560: <span>{2}</span>Line 2561: </span>Line 2562: ",Line 2563: string.Format("{0:0." + store.ndd + "}", store.item_ourPrice).Replace(",", "."),Line 2564: ( store.item_codStatus == 4 ? store.priceLabels[4] : store.priceLabels[1] ),Line 2565: shop.CurrType + string.Format( "{0:0." + store.ndd + "}", store.item_ourPrice )Line 2566: ) );Line 2567: Line 2568: if ( store.item_discRate > 0 ) {Line 2569: Sb.Append( string.Format(Line 2570: @"Line 2571: <span class='item_save'>Line 2572: <label>{0}</label>Line 2573: <span>{1}</span>Line 2574: </span>Line 2575: ",Line 2576: store.priceLabels[2],Line 2577: shop.CurrType + string.Format(Line 2578: "{0:0.00}", Math.Round(Line 2579: Convert.ToDecimal(store.item_price) - (1 - Convert.ToDecimal(store.item_discRate) / 100 ) * Convert.ToDecimal(store.item_price), 2Line 2580: )Line 2581: )Line 2582: ) );Line 2583: }Line 2584: Line 2585: if ( store.item_parcelTimes > 1 ) {Line 2586: Sb.Append( string.Format(Line 2587: @"Line 2588: <span class='item_or'>Line 2589: <label>{0}</label>Line 2590: <span>{1}x {2}</span>Line 2591: </span>Line 2592: ",Line 2593: store.priceLabels[3],Line 2594: store.item_parcelTimes,Line 2595: shop.CurrType + string.Format( "{0:0.00}", Math.Round( Convert.ToDecimal(store.item_ourPrice) / Convert.ToInt32(store.item_parcelTimes), 2 ) )Line 2596: ) );Line 2597: }Line 2598: Line 2599: if ( store.paymentInfos.Count > 0 ) {Line 2600: Sb.Append( string.Format(Line 2601: @"Line 2602: <div class='item_prices_payment_conditions'>Line 2603: "Line 2604: ) );Line 2605: Line 2606: for( int i = 0; i < store.paymentInfos.Count; i++ ) {Line 2607: dynamic payment = store.paymentInfos[i];Line 2608: Line 2609: Sb.Append( string.Format(Line 2610: @"Line 2611: <span class='products-text-price-final-label'>ou</span>Line 2612: <span class='products-text-price-final'>{0} à vista</span>Line 2613: ",Line 2614: shop.CurrType + string.Format(Line 2615: "{0:0."+ store.ndd +"}",Line 2616: ( Convert.ToDecimal( store.item_ourPrice ) * Convert.ToDecimal(payment.factor) ) + Convert.ToDecimal(payment.vtransl)Line 2617: )Line 2618: ) );Line 2619: Line 2620: if ( payment.factor > 1 ) {Line 2621: Sb.Append( string.Format(Line 2622: @"Line 2623: <span class='products-text-price-factor-increase'>com {0}% de acréscimo</span>Line 2624: ",Line 2625: Convert.ToInt32( ( Convert.ToDecimal( payment.factor ) - 1 ) * 100 )Line 2626: ) );Line 2627: }Line 2628: Line 2629: if ( payment.factor < 1 ) {Line 2630: Sb.Append( string.Format(Line 2631: @"Line 2632: <span class='products-text-price-factor-discount'>com {0}% de desconto</span>Line 2633: ",Line 2634: Convert.ToInt32( (1 - Convert.ToDecimal( payment.factor ) ) * 100 )Line 2635: ) );Line 2636: }Line 2637: Line 2638: if ( payment.vtransl > 0 ) {Line 2639: Sb.Append( string.Format(Line 2640: @"Line 2641: <span class='products-text-price-vtransl-increase'>mais {0} de acréscimo</span>Line 2642: ",Line 2643: shop.CurrType + string.Format( "{0:0.00}", Convert.ToDecimal( payment.vtransl ) )Line 2644: ) );Line 2645: }Line 2646: Line 2647: if ( payment.vtransl < 0 ) {Line 2648: Sb.Append( string.Format(Line 2649: @"Line 2650: <span class='products-text-price-vtransl-discount'>menos {0} de desconto</span>Line 2651: ",Line 2652: shop.CurrType + string.Format( "{0:0.00}", Math.Abs( Convert.ToDecimal( payment.vtransl ) ) )Line 2653: ) );Line 2654: }Line 2655: Line 2656: Sb.Append( string.Format(Line 2657: @"Line 2658: <span class='products-text-price-payment'>para {0}</span>Line 2659: ",Line 2660: payment.nameLine 2661: ) );Line 2662: }Line 2663: Line 2664: Sb.Append(Line 2665: @"Line 2666: </div>Line 2667: "Line 2668: );Line 2669: }Line 2670: Line 2671: if ( store.item_discRate > 0 ) {Line 2672: Sb.Append( string.Format(Line 2673: @"Line 2674: <div class='item_discount'>Line 2675: <span class='item_discount_label'>{0}</span>Line 2676: <span class='item_discount_percentage'>{1}%</span>Line 2677: </div>Line 2678: ",Line 2679: ( store.productDiscountLabel != null ? store.productDiscountLabel : "Desconto de:" ),Line 2680: Math.Round( Convert.ToDecimal( store.item_discRate ) )Line 2681: ) );Line 2682: }Line 2683: Line 2684: Sb.Append(Line 2685: @"Line 2686: </div>Line 2687: "Line 2688: );Line 2689: Line 2690: return Sb.ToString();Line 2691: } else {Line 2692: return "";Line 2693: }Line 2694: }Line 2695: Line 2696: public static string print_item_qtInput(ShopSetup shop, dynamic store) {Line 2697: StringBuilder Sb = new StringBuilder();Line 2698: Line 2699: if ( !shop.UsePS && store.item_codStatus != 4 && store.item_codAvailability == 1 && store.item_ourPrice > 0 ) {Line 2700: string item_input_qt_name = System.Guid.NewGuid().ToString("N").Substring(0, 15) + Convert.ToString(store.item_codGrid);Line 2701: Line 2702: if ( shop.isRetail ) {Line 2703: Sb.Append( string.Format( "<input type='hidden' name='ir_{0}' value='1' />", item_input_qt_name ) );Line 2704: } else {Line 2705: string qtStep = "1";Line 2706: try{Line 2707: if ( store.item_price_json.qtIncrement != null )Line 2708: qtStep = Convert.ToString(store.item_price_json.qtIncrement);Line 2709: } catch ( Exception ex ) {}Line 2710: Line 2711: Sb.Append( string.Format(Line 2712: "<input type='number' step='{0}' min='0' class='n' size='3' name='ir_{1}' value='0' onclick='select()' />",Line 2713: qtStep, item_input_qt_nameLine 2714: ) );Line 2715: }Line 2716: Line 2717: if ( Convert.ToBoolean(store.useItemAddedModal) ) {Line 2718: Line 2719: Sb.Append( string.Format(Line 2720: @"Line 2721: <span class='item_btn_buy'>Line 2722: <a href=""{0}"" aria-label='comprar'></a>Line 2723: </span>Line 2724: ",Line 2725: string.Format(Line 2726: "javascript:req_add2cart('{0}',{1},'{2}',{3},'ir_{4}','{5}',{6},0,null);",Line 2727: shop.Http + store.thisConfig,Line 2728: store.shopId,Line 2729: store.cartId,Line 2730: store.item_codGrid,Line 2731: item_input_qt_name,Line 2732: Convert.ToString(shop.UseEG).ToLower(),Line 2733: shop.UseFCLine 2734: )Line 2735: ) );Line 2736: Line 2737: } else {Line 2738: Line 2739: Sb.Append( string.Format(Line 2740: @"Line 2741: <span class='item_btn_buy'>Line 2742: <a href=""{0}"" aria-label='comprar'></a>Line 2743: </span>Line 2744: ",Line 2745: string.Format(Line 2746: "javascript:req_addItem('{0}', {1}, '{2}', {3}, 'ir_{4}', '{5}', {6}, {7});",Line 2747: shop.Http + store.thisConfig,Line 2748: store.shopId,Line 2749: store.cartId,Line 2750: store.item_codGrid,Line 2751: item_input_qt_name,Line 2752: Convert.ToString(shop.UseEG).ToLower(),Line 2753: shop.UseFC,Line 2754: store.userIdLine 2755: )Line 2756: ) );Line 2757: }Line 2758: Line 2759: return Sb.ToString();Line 2760: Line 2761: } else {Line 2762: Line 2763: return "";Line 2764: Line 2765: }Line 2766: }Line 2767: Line 2768: public static string print_aggregateRating(ShopSetup shop, dynamic store) {Line 2769: if ( Convert.ToBoolean(store.useDetailsAggregateRating) ) {Line 2770: return Details.aggregateRating( Convert.ToInt32(store.shopId), Convert.ToInt32(store.item_codProd), shop.Path );Line 2771: } else {Line 2772: return "";Line 2773: }Line 2774: }Line 2775: Line 2776: public static string print_quickView(dynamic store) {Line 2777: if (Line 2778: !Convert.ToBoolean(store.isMobile) &&Line 2779: Convert.ToBoolean(store.useQuickView) &&Line 2780: store.item_codAvailability == 1Line 2781: ) {Line 2782: return string.Format(Line 2783: @"Line 2784: <button class='product_quickview' name='productQuickView' onclick='quickView({0}, event)'>Line 2785: compra rápidaLine 2786: </button>Line 2787: ",Line 2788: store.item_codGridLine 2789: );Line 2790: } else {Line 2791: return "";Line 2792: }Line 2793: }Line 2794: Line 2795: public static string print_item_btnInfo(dynamic store) {Line 2796: if ( store.item_codStatus == 4 || store.item_codAvailability != 2 ) {Line 2797: return string.Format(Line 2798: @"Line 2799: <span class='item_btn_info'>Line 2800: <a href='{0}' aria-label='mais detalhes'></a>Line 2801: </span>Line 2802: ",Line 2803: store.item_hrefLine 2804: );Line 2805: } else {Line 2806: return "";Line 2807: }Line 2808: }Line 2809: Line 2810: public static string print_item_similars(ShopSetup shop, dynamic store) {Line 2811: if ( store.mode != "H" )Line 2812: return "";Line 2813: Line 2814: string output = "";Line 2815: SqlConnection conn = new SqlConnection( shop.Path );Line 2816: conn.Open();Line 2817: SqlCommand cmd = new SqlCommand(Line 2818: @"Line 2819: SELECTLine 2820: M1.[cod1stMenu],Line 2821: M1.[desc] AS menu1stDesc,Line 2822: R.[cod2ndMenu],Line 2823: M2.[desc] AS menu2ndDescLine 2824: FROM rel_menusWprod R WITH (NOLOCK)Line 2825: INNER JOIN tbl_menu1st M1 WITH (NOLOCK) ON M1.[cod1stMenu] = R.[cod1stMenu]Line 2826: LEFT JOIN tbl_menu2nd M2 WITH (NOLOCK) ON M2.[cod2ndMenu] = R.[cod2ndMenu]Line 2827: WHERE [codProd] = @codProdLine 2828: ",Line 2829: conn );Line 2830: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 2831: cmd.Parameters["@codProd"].Value = Convert.ToInt32(store.item_codProd);Line 2832: SqlDataReader rdr = cmd.ExecuteReader();Line 2833: if ( rdr.Read() ) {Line 2834: string name = "";Line 2835: string href = "";Line 2836: Line 2837: if ( DBNull.Value != rdr["cod2ndMenu"] ) {Line 2838: name = (string)rdr["menu2ndDesc"];Line 2839: href = menuAnchorHref(Line 2840: shop.Http,Line 2841: ZenTools.urlize( (string)rdr["menu1stDesc"] ),Line 2842: ZenTools.urlize( (string)rdr["menu2ndDesc"] ),Line 2843: "",Line 2844: Convert.ToInt32(store.shopId),Line 2845: Convert.ToInt32( rdr["cod1stMenu"] ),Line 2846: Convert.ToInt32( rdr["cod2ndMenu"] ),Line 2847: 0,Line 2848: Convert.ToString(store.thisConfig)Line 2849: );Line 2850: } else {Line 2851: name = (string)rdr["menu1stDesc"];Line 2852: href = menuAnchorHref(Line 2853: shop.Http,Line 2854: ZenTools.urlize( (string)rdr["menu1stDesc"] ),Line 2855: "",Line 2856: "",Line 2857: Convert.ToInt32(store.shopId),Line 2858: Convert.ToInt32(rdr["cod1stMenu"]),Line 2859: 0,Line 2860: 0,Line 2861: Convert.ToString(store.thisConfig)Line 2862: );Line 2863: }Line 2864: Line 2865: output = string.Format(Line 2866: @"Line 2867: <div class='item_similars'>Line 2868: <a href='{0}' itemprop='name' >{1}</a>Line 2869: </div>Line 2870: ",Line 2871: href, nameLine 2872: );Line 2873: }Line 2874: rdr.Close();Line 2875: conn.Close();Line 2876: Line 2877: return output;Line 2878: }Line 2879: Line 2880: public static string print_item_brand(dynamic store) {Line 2881: if ( Convert.ToBoolean( store.useShowProductBrandLink ) ) {Line 2882: return string.Format(Line 2883: @"Line 2884: <div class='item_brand'>Line 2885: <a href='/{0}'>{1}</a>Line 2886: </div>Line 2887: ",Line 2888: ZenTools.urlize( Convert.ToString(store.item_brand) ), store.item_brandLine 2889: );Line 2890: } else {Line 2891: return "";Line 2892: }Line 2893: }Line 2894: Line 2895: public static dynamic getReviewRating(string path, int codProd) {Line 2896: dynamic reviewRating = JsonConvert.DeserializeObject<JObject>("{}");Line 2897: Line 2898: SqlConnection conn = new SqlConnection(path);Line 2899: conn.Open();Line 2900: Line 2901: SqlCommand cmd = new SqlCommand(Line 2902: @"Line 2903: SELECT TOP 1Line 2904: CAST( G.[rating] AS decimal(6,2) ),Line 2905: U.[name]Line 2906: FROM sys_GR G WITH (NOLOCK)Line 2907: INNER JOIN sys_users U ON G.[idUser] = U.[codUser]Line 2908: WHERE ([idProduct] = @codProd) AND ([publish] = 1)Line 2909: ORDER BY [rating] DESCLine 2910: "Line 2911: ,conn);Line 2912: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 2913: cmd.Parameters["@codProd"].Value = codProd;Line 2914: SqlDataReader rdr = cmd.ExecuteReader();Line 2915: if (rdr.Read()) {Line 2916: reviewRating.ratingValue = Convert.ToString( Details.getRating( Convert.ToDecimal( rdr[0]) ) );Line 2917: reviewRating.author = Convert.ToString(rdr[1]);Line 2918: }Line 2919: rdr.Close();Line 2920: conn.Close();Line 2921: Line 2922: return reviewRating;Line 2923: }Line 2924: Line 2925: public static dynamic getAggregateRating(string path, int codProd) {Line 2926: dynamic aggregateRating = JsonConvert.DeserializeObject<JObject>("{}");Line 2927: Line 2928: SqlConnection conn = new SqlConnection(path);Line 2929: conn.Open();Line 2930: Line 2931: SqlCommand cmd = new SqlCommand(Line 2932: @"Line 2933: SELECTLine 2934: CAST( SUM( CAST( rating AS decimal(6,2) ) ) / COUNT(idProduct) AS decimal(6,1) ) AS ratingValue,Line 2935: COUNT(idProduct) as reviewsLine 2936: FROM sys_GR WITH (NOLOCK)Line 2937: WHERE (idProduct = @codProd) AND (publish = 1) GROUP BY idProductLine 2938: "Line 2939: ,conn);Line 2940: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 2941: cmd.Parameters["@codProd"].Value = codProd;Line 2942: SqlDataReader rdr = cmd.ExecuteReader();Line 2943: if (rdr.Read()) {Line 2944: aggregateRating.ratingValue = Convert.ToString( Details.getRating(Convert.ToDecimal(rdr[0])) );Line 2945: aggregateRating.reviewCount = Convert.ToString(rdr[1]);Line 2946: }Line 2947: rdr.Close();Line 2948: conn.Close();Line 2949: Line 2950: return aggregateRating;Line 2951: }Line 2952: Line 2953: public static string print_item_json_ld(ShopSetup shop, dynamic store){Line 2954: dynamic product = JsonConvert.DeserializeObject<JObject>("{}");Line 2955: Line 2956: // See more @ https://developers.google.com/search/docs/data-types/productLine 2957: product["@context"] = "https://schema.org/";Line 2958: product["@type"] = "Product";Line 2959: Line 2960: product.name = store.item_name;Line 2961: Line 2962: product.image = JsonConvert.DeserializeObject<JArray>("[]");Line 2963: product.image.Add(Line 2964: ( Convert.ToString(store.item_imgSrc).Substring(0, 4) == "http" ? "" : shop.Http.Replace("/octopus/", "") ) + store.item_imgSrcLine 2965: );Line 2966: Line 2967: product.description = ZenTools.stripHtml( Convert.ToString( store.item_description ) );Line 2968: product.sku = store.item_sku;Line 2969: Line 2970: // product.mpn = "";Line 2971: Line 2972: product.brand = JsonConvert.DeserializeObject<JObject>("{}");Line 2973: product.brand["@type"] = "Thing";Line 2974: product.brand.name = store.item_brand;Line 2975: Line 2976: dynamic reviewRating = getReviewRating(shop.Path, Convert.ToInt32(store.item_codProd));Line 2977: if ( reviewRating.ratingValue != null ) {Line 2978: product.review = JsonConvert.DeserializeObject<JObject>("{}");Line 2979: product.review["@type"] = "Review";Line 2980: product.review.reviewRating = JsonConvert.DeserializeObject<JObject>("{}");Line 2981: product.review.reviewRating["@type"] = "Rating";Line 2982: product.review.reviewRating.ratingValue = reviewRating.ratingValue;Line 2983: Line 2984: product.review.author = JsonConvert.DeserializeObject<JObject>("{}");Line 2985: product.review.author["@type"] = "Person";Line 2986: product.review.author.name = reviewRating.author;Line 2987: }Line 2988: Line 2989: dynamic aggregateRating = getAggregateRating(shop.Path, Convert.ToInt32(store.item_codProd));Line 2990: if ( aggregateRating.ratingValue != null && aggregateRating.reviewCount != null ) {Line 2991: product.aggregateRating = JsonConvert.DeserializeObject<JObject>("{}");Line 2992: product.aggregateRating["@type"] = "AggregateRating";Line 2993: product.aggregateRating.ratingValue = aggregateRating.ratingValue;Line 2994: product.aggregateRating.reviewCount = aggregateRating.reviewCount;Line 2995: }Line 2996: Line 2997: product.offers = JsonConvert.DeserializeObject<JObject>("{}");Line 2998: product.offers["@type"] = "Offer";Line 2999: product.offers.url = store.item_href;Line 3000: product.offers.priceCurrency = "BRL";Line 3001: product.offers.price = string.Format("{0:0." + store.ndd + "}", store.item_ourPrice).Replace(",", ".");Line 3002: Line 3003: DateTime priceValidUntil = DateTime.Now;Line 3004: product.offers.priceValidUntil = priceValidUntil.AddDays(7).ToString("yyyy-MM-dd");Line 3005: Line 3006: product.offers.itemCondition = "https://schema.org/NewCondition";Line 3007: product.offers.availability = ( store.item_codAvailability != 1 ? "https://schema.org/OutOfStock" : "https://schema.org/InStock" );Line 3008: Line 3009: product.offers.seller = JsonConvert.DeserializeObject<JObject>("{}");Line 3010: product.offers.seller["@type"] = "Organization";Line 3011: product.offers.seller.name = shop.Title;Line 3012: Line 3013: return "<script type='application" +"/" + "ld+json'>\n"Line 3014: + product.ToString(Newtonsoft.Json.Formatting.None)Line 3015: + "\n</" + "script>";Line 3016: }Line 3017: Line 3018: public static string print_wishlist_item_actions(dynamic wishlist, dynamic store) {Line 3019: int qtd = Convert.ToInt32(store.wishlist_props.desired);Line 3020: int qtr = Convert.ToInt32(store.wishlist_props.received);Line 3021: int qta = qtd - qtr;Line 3022: bool fulfilled = ( qta <= 0 ? true : false );Line 3023: Line 3024: // check stockLine 3025: if( qta > Convert.ToInt32(store.item_stock_qt) )Line 3026: qta = Convert.ToInt32(store.item_stock_qt);Line 3027: Line 3028: if( Convert.ToBoolean(wishlist.owner_access) ) {Line 3029: Line 3030: return string.Format(Line 3031: @"Line 3032: <div class='wishlist_item_actions {5}'>Line 3033: <form id='frm-update-item-{1}' name='frmUpdateItem' method='POST' action='/wishlist/update-item/'>Line 3034: <input type='hidden' name='idWishlist' value='{0}' />Line 3035: <input type='hidden' name='idVariant' value='{1}' />Line 3036: <label>Desejados<input type='number' name='desired' value='{2}' onchange='wl_update_item({1})' /></label>Line 3037: <label>Recebidos<input type='number' name='received' value='{3}' readonly='true' /></label>Line 3038: <button name='btnWishlistUpdateItem'>OK</button>Line 3039: </form>Line 3040: {4}Line 3041: <p id='item-alert-{1}' class='alert'></p>Line 3042: </div>Line 3043: ", wishlist.id, store.item_codGridLine 3044: , qtdLine 3045: , qtrLine 3046: , ( fulfilled ? "" : string.Format(Line 3047: "<a class='button' href='/wishlist/remove-item/?idWishlist={0}&idVariant={1}'>x</a>",Line 3048: wishlist.id, store.item_codGridLine 3049: ) )Line 3050: , ( fulfilled ? "fulfilled" : "" )Line 3051: );Line 3052: Line 3053: } else {Line 3054: if( Convert.ToBoolean(wishlist.is_expired) )Line 3055: return "";Line 3056: Line 3057: string item_status = "available";Line 3058: if( store.item_availability == 2 )Line 3059: item_status = "out_of_stock";Line 3060: if( fulfilled )Line 3061: item_status = "fulfilled";Line 3062: Line 3063: if( item_status != "available" ) {Line 3064: return string.Format( "<div class='wishlist_item_{0}'></div>", item_status );Line 3065: } else {Line 3066: StringBuilder options = new StringBuilder();Line 3067: for(int i = 1; i <= qta; i++ ) {Line 3068: options.Append( string.Format( "<option value='{0}'>{0}</option>", i ) );Line 3069: }Line 3070: Line 3071: return string.Format(Line 3072: @"Line 3073: <div class='wishlist_item_buy'>Line 3074: <form id='frm-buy-item-{0}' name='frmBuyItem' method='POST' action='/cart/add-wishlist/'>Line 3075: <input type='hidden' name='idVariant' value='{0}' />Line 3076: <input type='hidden' name='idWishlist' value='{1}' />Line 3077: <label>Quantidade desejada<select name='qt'>{2}</select></label>Line 3078: <button name='btnWishlistBuyItem'>comprar</button>Line 3079: </form>Line 3080: </div>Line 3081: ", store.item_codGrid, wishlist.id, options.ToString()Line 3082: );Line 3083: Line 3084: }Line 3085: }Line 3086: }Line 3087: Line 3088: public static string print_item_variant(ShopSetup shop, dynamic store) {Line 3089: string[] options = ZenTools.Split( Convert.ToString(store.item_composition) ,';');Line 3090: Line 3091: StringBuilder Sb = new StringBuilder();Line 3092: SqlConnection conn = new SqlConnection(shop.Path);Line 3093: conn.Open();Line 3094: Line 3095: for( int i = 0; i < options.Length;i++ ) {Line 3096: SqlCommand cmd = new SqlCommand(@"Line 3097: SELECT [codOption], [desc] AS DescOptionLine 3098: FROM tbl_selectOptions WITH (NOLOCK)Line 3099: WHERE [codOption] = @codOptionLine 3100: ORDER BY [dspOrder], [desc]Line 3101: ", conn);Line 3102: cmd.Parameters.Add(new SqlParameter("@codOption", SqlDbType.Int));Line 3103: cmd.Parameters["@codOption"].Value = options[i];Line 3104: SqlDataReader rdr = cmd.ExecuteReader();Line 3105: if (rdr.Read())Line 3106: Sb.Append( (string)rdr["DescOption"] + " " );Line 3107: rdr.Close();Line 3108: }Line 3109: conn.Close();Line 3110: Line 3111: return Sb.ToString();Line 3112: }Line 3113: Line 3114: public static string print_item_box( ShopSetup shop, int index, dynamic store, dynamic wishlist ) {Line 3115: int qtd = Convert.ToInt32(store.wishlist_props.desired);Line 3116: int qtr = Convert.ToInt32(store.wishlist_props.received);Line 3117: Line 3118: bool fulfilled = ( (qtd - qtr) <= 0 ? true : false );Line 3119: store.item_class = store.item_class + ( fulfilled ? " fulfilled" : "" );Line 3120: Line 3121: string item_description = Convert.ToString(store.item_description);Line 3122: if ( item_description.Length > shop.CAPD)Line 3123: item_description = item_description.Substring(0, shop.CAPD) + "...";Line 3124: Line 3125: return string.Format(Line 3126: @"Line 3127: <li class='{0} mOut' onmouseover='{1}' onmouseout='{2}'>Line 3128: <div class='item_box'>Line 3129: <div class='item_img'>Line 3130: <a href='{3}'>Line 3131: <img src='{4}' alt='{5}' width='{6}' height='{7}' />Line 3132: </a>Line 3133: </div>Line 3134: {8}Line 3135: {9}Line 3136: <div class='item_txt'>Line 3137: <span class='item_status item_status_{10}'>Line 3138: <label>{11}</label>Line 3139: </span>Line 3140: <span class='item_ref'>{12}</span>Line 3141: <a class='item_name' href='{3}'>Line 3142: <strong>{13}</strong>Line 3143: <span class='item_variant'>{14}</span>Line 3144: </a>Line 3145: <span class='item_description'>{15}</span>Line 3146: {16}Line 3147: <span class='item_availability item_availability_{17}'>Line 3148: <label>Disponibilidade: </label>{18}Line 3149: </span>Line 3150: </div>Line 3151: {19}Line 3152: {20}Line 3153: </div>Line 3154: </li>Line 3155: ",Line 3156: store.item_class, // {0}Line 3157: string.Format( "this.className=\"{0} mOver\"", store.item_class ), // {1}Line 3158: string.Format( "this.className=\"{0} mOut\"", store.item_class ), // {2}Line 3159: store.item_href, // {3}Line 3160: store.item_imgSrc, // {4}Line 3161: store.item_imgAlt, // {5}Line 3162: store.item_imgWidth, // {6}Line 3163: store.item_imgHeight, // {7}Line 3164: print_item_colors( store ), // {8}Line 3165: print_item_promotion( store ), // {9}Line 3166: store.item_codStatus, // {10}Line 3167: store.item_status, // {11}Line 3168: store.item_sku, // {12}Line 3169: store.item_name, // {13}Line 3170: print_item_variant( shop, store ), // {14}Line 3171: item_description, // {15}Line 3172: print_item_prices( shop, store ), // {16}Line 3173: store.item_codAvailability, // {17}Line 3174: store.item_availability, // {18}Line 3175: print_item_brand( store ), // {19}Line 3176: print_wishlist_item_actions( wishlist, store ) // {20}Line 3177: );Line 3178: }Line 3179: Line 3180: public static string print_item_box( ShopSetup shop, int index, dynamic store ) {Line 3181: string item_description = Convert.ToString(store.item_description);Line 3182: if ( item_description.Length > shop.CAPD)Line 3183: item_description = item_description.Substring(0, shop.CAPD) + "...";Line 3184: Line 3185: return string.Format(Line 3186: @"Line 3187: <li class='{0} mOut' onmouseover='{1}' onmouseout='{2}'>Line 3188: <div class='item_box'>Line 3189: <div class='item_img'>Line 3190: <a href='{3}'>Line 3191: <img src='{4}' alt='{5}' width='{6}' height='{7}' />Line 3192: </a>Line 3193: </div>Line 3194: {8}Line 3195: {9}Line 3196: <div class='item_txt'>Line 3197: <span class='item_status item_status_{10}'>Line 3198: <label>{11}</label>Line 3199: </span>Line 3200: {12}Line 3201: <span class='item_ref'>{13}</span>Line 3202: <a class='item_name' href='{3}'>Line 3203: <strong>{14}</strong>Line 3204: </a>Line 3205: <span class='item_description'>{15}</span>Line 3206: {16}Line 3207: <span class='item_availability item_availability_{17}'>Line 3208: <label>Disponibilidade: </label>{18}Line 3209: </span>Line 3210: </div>Line 3211: {19}Line 3212: {20}Line 3213: <div class='item_buttons'>Line 3214: {21}Line 3215: {22}Line 3216: </div>Line 3217: {23}Line 3218: {24}Line 3219: </div>Line 3220: {25}Line 3221: </li>Line 3222: ",Line 3223: store.item_class, // {0}Line 3224: string.Format( "this.className=\"{0} mOver\"", store.item_class ), // {1}Line 3225: string.Format( "this.className=\"{0} mOut\"", store.item_class ), // {2}Line 3226: store.item_href, // {3}Line 3227: store.item_imgSrc, // {4}Line 3228: store.item_imgAlt, // {5}Line 3229: store.item_imgWidth, // {6}Line 3230: store.item_imgHeight, // {7}Line 3231: print_item_colors( store ), // {8}Line 3232: print_item_promotion( store ), // {9}Line 3233: store.item_codStatus, // {10}Line 3234: store.item_status, // {11}Line 3235: print_item_free_shipping( store ), // {12}Line 3236: store.item_sku, // {13}Line 3237: store.item_name, // {14}Line 3238: item_description, // {15}Line 3239: print_item_prices( shop, store ), // {16}Line 3240: store.item_codAvailability, // {17}Line 3241: store.item_availability, // {18}Line 3242: print_aggregateRating( shop, store ), // {19}Line 3243: print_quickView( store ), // {20}Line 3244: print_item_btnInfo( store ), // {21}Line 3245: print_item_qtInput( shop, store ), // {22}Line 3246: print_item_similars( shop, store ), // {23}Line 3247: print_item_brand( store ), // {24}Line 3248: Line 3249: ( store.hgsd != null && Convert.ToBoolean(store.hgsd) ? "" : print_item_json_ld( shop, store ) ) // {25} Hide Google Structured DataLine 3250: Line 3251: );Line 3252: Line 3253: }Line 3254: Line 3255: /* ITEM BOX [END] */Line 3256: Line 3257: }Line 3258: Line 3259: Line 3260: Line 3261: Line 3262: Line 3263: Line 3264: Line 3265: Line 3266: Line 3267: Line 3268: public class Details {Line 3269: public Details() {}Line 3270: Line 3271: public static decimal getRating(decimal dRating) {Line 3272: int iRating = (int)dRating;Line 3273: decimal rest = dRating - iRating;Line 3274: return ( (decimal).3 <= rest && rest <= (decimal).7 ? Convert.ToDecimal(iRating) + (decimal).5 : Convert.ToDecimal( Convert.ToInt32( dRating ) ) );Line 3275: }Line 3276: Line 3277: public static string[] getGRData(string path, int codGrid) {Line 3278: string[] arr = new string[2];Line 3279: arr[0] = "0"; // ratingValueLine 3280: arr[1] = "0"; // reviewCountLine 3281: Line 3282: SqlConnection conn = new SqlConnection(path);Line 3283: conn.Open();Line 3284: Line 3285: string query = @"Line 3286: SELECTLine 3287: CAST( SUM( CAST( rating AS decimal(6,2) ) ) / COUNT(idProduct) AS decimal(6,1) ) AS ratingValue,Line 3288: COUNT(idProduct) as reviewsLine 3289: FROM sys_GR WITH (NOLOCK)Line 3290: WHERE (idProduct = (Line 3291: SELECT codProdLine 3292: FROM tbl_grid WITH (NOLOCK)Line 3293: WHERE (codGrid = @codGrid)Line 3294: ) ) AND (publish = 1) GROUP BY idProductLine 3295: ";Line 3296: SqlCommand cmd = new SqlCommand(query, conn);Line 3297: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 3298: cmd.Parameters["@codGrid"].Value = codGrid;Line 3299: SqlDataReader rdr = cmd.ExecuteReader();Line 3300: if (rdr.Read()) {Line 3301: arr[0] = Convert.ToString( getRating(Convert.ToDecimal(rdr[0])) );Line 3302: arr[1] = Convert.ToString(rdr[1]);Line 3303: }Line 3304: rdr.Close();Line 3305: conn.Close();Line 3306: Line 3307: return arr;Line 3308: }Line 3309: Line 3310: public static string aggregateRating(int shopId, int idGrid, ShopSetup shop) {Line 3311: string[] arr = getGRData(shop.Path, idGrid);Line 3312: decimal rating = Convert.ToDecimal(arr[0]);Line 3313: int reviews = Convert.ToInt32(arr[1]);Line 3314: StringBuilder Sb = new StringBuilder();Line 3315: Line 3316: if ( reviews > 0 ) {Line 3317: Sb.Append( "<div id='details_texts_aggregateRating'>\n" );Line 3318: Sb.Append( " <div class='rating'>\n" );Line 3319: Line 3320: //Sb.Append( " <img src='/octopus/design/images/" + shopId + "/agr_" + Convert.ToString(rating).Replace(",", "_") + ".gif' title='" + rating + " star rating'>\n" );Line 3321: Line 3322: Sb.Append( ZenTools.get_rating_stars(rating) );Line 3323: Line 3324: Sb.Append(Line 3325: String.Format(Line 3326: "<span id='details-aggregate-rating'>Avaliação geral: <span>{0}</span></span>\n",Line 3327: String.Format("{0:0.0}", Convert.ToString(rating).Replace(",", "."))Line 3328: )Line 3329: );Line 3330: Line 3331: Sb.Append( " <span> | </span>" );Line 3332: Sb.Append( "<a href='#GR_header'><span>" + reviews + "</span> " + ( reviews > 1 ? "Avaliações" : "Avaliação" ) + "</a>\n" );Line 3333: Sb.Append( " <span> | </span>" );Line 3334: Sb.Append( " <a id='details-gr-link' href='/review/?id=" + idGrid + "' rel='nofollow'>Escreva sua opnião</a>\n" );Line 3335: Sb.Append( " </div>\n");Line 3336: Sb.Append( "</div>\n");Line 3337: }Line 3338: Line 3339: return Sb.ToString();Line 3340: }Line 3341: Line 3342: public static string aggregateRating(int shopId, int idProd, string path) {Line 3343: StringBuilder Sb = new StringBuilder();Line 3344: decimal rating = 0;Line 3345: int reviews = 0;Line 3346: Line 3347: SqlConnection conn = new SqlConnection(path);Line 3348: conn.Open();Line 3349: Line 3350: string query = @"Line 3351: SELECTLine 3352: CAST( SUM( CAST( rating AS decimal(6,2) ) ) / COUNT(idProduct) AS decimal(6,1) ) AS ratingValue,Line 3353: COUNT(idProduct) as reviewsLine 3354: FROM sys_GR WITH (NOLOCK)Line 3355: WHERE (idProduct = @idProd) AND (publish = 1)Line 3356: GROUP BY idProductLine 3357: ";Line 3358: SqlCommand cmd = new SqlCommand(query, conn);Line 3359: cmd.Parameters.Add(new SqlParameter("@idProd", SqlDbType.Int));Line 3360: cmd.Parameters["@idProd"].Value = idProd;Line 3361: SqlDataReader rdr = cmd.ExecuteReader();Line 3362: Line 3363: if ( rdr.Read() ) {Line 3364: rating = getRating( Convert.ToDecimal(rdr[0]) );Line 3365: Sb.Append( "<div class='item_aggregateRating'>\n" );Line 3366: Sb.Append( " <div class='rating'>\n" );Line 3367: Line 3368: //Sb.Append( " <img src='/octopus/design/images/" + shopId + "/agr_prd_" + Convert.ToString(rating).Replace(",", "_") + ".gif' title='" + rating + " star rating'>\n" );Line 3369: Line 3370: Sb.Append( ZenTools.get_rating_stars(rating) );Line 3371: Line 3372: Sb.Append( " </div>\n");Line 3373: Sb.Append( "</div>\n");Line 3374: }Line 3375: Line 3376: rdr.Close();Line 3377: conn.Close();Line 3378: Line 3379: return Sb.ToString();Line 3380: }Line 3381: Line 3382: public static string getProductImgSrc(int shopId, int codGrid, ShopSetup shop) {Line 3383: string alt = "";Line 3384: return getProductImgSrc(shopId, codGrid, shop, out alt);Line 3385: }Line 3386: public static string getProductImgSrc(int shopId, int codGrid, ShopSetup shop, out string alt) {Line 3387: string src_base = string.Format("/octopus/design/images/{0}/products/{{size}}/", shopId);Line 3388: string src = src_base + "imgNotAvailable.jpg";Line 3389: alt = "";Line 3390: Line 3391: SqlConnection conn = new SqlConnection(shop.Path);Line 3392: conn.Open();Line 3393: SqlCommand cmd = new SqlCommand(Line 3394: @"Line 3395: SELECT TOP 1 [imgSrc], ISNULL([alt], '') AS imgAltLine 3396: FROM tbl_pictures WITH (NOLOCK)Line 3397: WHERE (codGrid = @codGrid) AND (NOT [imgSrc] IS NULL) AND [imgSrc] <> ''Line 3398: ORDER BY link DESCLine 3399: ", connLine 3400: );Line 3401: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 3402: cmd.Parameters["@codGrid"].Value = codGrid;Line 3403: SqlDataReader rdr = cmd.ExecuteReader();Line 3404: if ( rdr.Read() ) {Line 3405: src = Convert.ToString(rdr["imgSrc"]);Line 3406: if ( src.Length < 4 || src.ToLower().Substring(0, 4) != "http" )Line 3407: src = string.Format("{0}{1}.jpg", src_base, src);Line 3408: alt = Convert.ToString(rdr["imgAlt"]);Line 3409: }Line 3410: rdr.Close();Line 3411: conn.Close();Line 3412: Line 3413: return src;Line 3414: }Line 3415: Line 3416: public static string Images(int shopId, int codGrid, int userGroup, ShopSetup shop) {Line 3417: string output = "";Line 3418: string codGridColl = "";Line 3419: string useZoomGrid = shop.getConfig("ZoomGrid");Line 3420: string img_src = "";Line 3421: string img_alt = "";Line 3422: string[] img_sizes = shop.getImgSize("B");Line 3423: Line 3424: SqlConnection conn = new SqlConnection(shop.Path);Line 3425: conn.Open();Line 3426: Line 3427: string query = @"Line 3428: SELECTLine 3429: tbl_prod.codProd,Line 3430: tbl_prod.[desc],Line 3431: tbl_prod.jsonLine 3432: FROM tbl_grid WITH (NOLOCK)Line 3433: INNER JOIN tbl_prod WITH (NOLOCK) ON tbl_grid.codProd = tbl_prod.codProdLine 3434: WHERE tbl_grid.codGrid = @codGrid"Line 3435: ;Line 3436: Line 3437: SqlCommand cmd = new SqlCommand(query, conn);Line 3438: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 3439: cmd.Parameters["@codGrid"].Value = codGrid;Line 3440: SqlDataReader rdr = cmd.ExecuteReader();Line 3441: Line 3442: StringBuilder Sb = new StringBuilder();Line 3443: Line 3444: if (rdr.Read()) {Line 3445: if ( shop.getConfig("UsePicturesByProd").ToLower() == "true" )Line 3446: codGridColl = getCodGridColl(shop.Path, Convert.ToInt32(rdr["codProd"]));Line 3447: Line 3448: img_src = Details.getProductImgSrc(shopId, codGrid, shop, out img_alt);Line 3449: if ( img_alt == "" )Line 3450: img_alt = Convert.ToString(rdr["desc"]);Line 3451: Line 3452: Sb.Append(Line 3453: string.Format(Line 3454: @"Line 3455: <div id='details_images_big'>Line 3456: <a href='{0}'>Line 3457: <img id='details_images_big_img' src='{1}' alt='{2}' width='{3}' height='{4}' />Line 3458: </a>Line 3459: </div>Line 3460: ",Line 3461: (Line 3462: shop.UseZoom ? string.Format(Line 3463: "javascript:popZoom({0}, {1}, {2});",Line 3464: shopId, codGrid, (useZoomGrid.Length > 0 ? useZoomGrid : "\"\"")Line 3465: ) : "javascript:void(0);"Line 3466: ),Line 3467: img_src.Replace("{size}", "b"),Line 3468: img_alt,Line 3469: img_sizes[0],Line 3470: img_sizes[1]Line 3471: )Line 3472: );Line 3473: Line 3474: if (shop.UseZoom) {Line 3475: Sb.Append(Line 3476: string.Format(Line 3477: @"Line 3478: <div id='details_images_zoom'>Line 3479: <a href='javascript:popZoom({0}, {1}, {2});'>Line 3480: <img src='/octopus/design/images/{0}/details_zoom.gif' alt='' />Line 3481: </a>Line 3482: </div>Line 3483: ",Line 3484: shopId, codGrid, ( useZoomGrid.Length > 0 ? useZoomGrid : "\"\"" )Line 3485: )Line 3486: );Line 3487: }Line 3488: Line 3489: if (shop.UseEP) {Line 3490: Sb.Append( Details.Thumbnails(shopId, shop.Path, codGridColl, codGrid, userGroup, shop) );Line 3491: }Line 3492: Line 3493: Sb.Append("<script type='text/javascript'>zoomSrc = '" + img_src + "';<"+'/'+"script>\n" );Line 3494: }Line 3495: Line 3496: rdr.Close();Line 3497: conn.Close();Line 3498: Line 3499: return Sb.ToString();Line 3500: }Line 3501: Line 3502: public static string Images(int shopId, int codProd, string codCompApproach, int userGroup, ShopSetup shop) {Line 3503: string output = Details.Images(shopId, CodProdCodCompApproach2CodGrid(shopId, codProd, codCompApproach, shop), userGroup, shop);Line 3504: return output;Line 3505: }Line 3506: Line 3507: public static string Texts(int shopId, int codGrid, int userGroup, ShopSetup shop, Promotion P) {Line 3508: int i=0;string ndd="";for(i=0; i<shop.NDD; i++)ndd+="0";Line 3509: Line 3510: // deprecated 2014-08-18 (details cache)Line 3511: // int userGroup = 1; if (userId>0)userGroup=UserSetup.UserGroup(shop.Path, userId);Line 3512: Line 3513: decimal thisPrice = 0;Line 3514: decimal thisDiscRate = 0;Line 3515: string query = "";Line 3516: string promotion_sJson = "{}";Line 3517: StringBuilder Sb = new StringBuilder();Line 3518: Line 3519: SqlConnection conn = new SqlConnection(shop.Path);Line 3520: conn.Open();Line 3521: Line 3522: query = @"Line 3523: SELECTLine 3524: sys_prodStatus.[desc] AS StatusDesc,Line 3525: tbl_details.[desc] AS DetDesc,Line 3526: tbl_grid.codProd,Line 3527: tbl_grid.codGrid,Line 3528: tbl_grid.codComp,Line 3529: tbl_grid.vX,Line 3530: tbl_grid.vY,Line 3531: tbl_grid.vZ,Line 3532: tbl_grid.weight,Line 3533: tbl_brands.codBrand,Line 3534: tbl_brands.name AS Brand,Line 3535: tbl_prices.prc,Line 3536: tbl_prices.object,Line 3537: tbl_prices.discRate,Line 3538: tbl_prices.codStatus,Line 3539: tbl_prod.imgDepth,Line 3540: tbl_prod.json AS clob,Line 3541: sys_prodStatus.codStatus,Line 3542: sys_prodAvailability.codAvailability,Line 3543: sys_prodAvailability.[desc] AS AvailDescLine 3544: FROM tbl_prod WITH (NOLOCK)Line 3545: INNER JOIN tbl_grid WITH (NOLOCK) ON tbl_prod.codProd = tbl_grid.codProdLine 3546: INNER JOIN tbl_prices WITH (NOLOCK) ON tbl_grid.codGrid = tbl_prices.codGridLine 3547: INNER JOIN sys_prodAvailability WITH (NOLOCK) ON tbl_prices.codAvailability = sys_prodAvailability.codAvailabilityLine 3548: INNER JOIN sys_prodStatus WITH (NOLOCK) ON tbl_prices.codStatus = sys_prodStatus.codStatusLine 3549: INNER JOIN tbl_details WITH (NOLOCK) ON tbl_prod.codProd = tbl_details.codProdLine 3550: INNER JOIN tbl_brands WITH (NOLOCK) ON tbl_prod.codBrand = tbl_brands.codBrandLine 3551: WHERE (tbl_grid.active = 1) AND (tbl_details.codTitle = 1) AND (tbl_grid.codGrid = @codGrid) AND (tbl_prices.codGroup = @userGroup)Line 3552: ";Line 3553: Line 3554: SqlCommand cmd = new SqlCommand(query, conn);Line 3555: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 3556: cmd.Parameters.Add(new SqlParameter("@userGroup", SqlDbType.Int));Line 3557: cmd.Parameters["@codGrid"].Value = codGrid;Line 3558: cmd.Parameters["@userGroup"].Value = userGroup;Line 3559: SqlDataReader rdr = cmd.ExecuteReader();Line 3560: if (rdr.Read()) {Line 3561: Sb.Append(" <div id='details_texts_status' class='" + ZenTools.unlatinize( (string)rdr["StatusDesc"] ) + "'><span>" + (string)rdr["StatusDesc"] + "</span></div>\n");Line 3562: Sb.Append(" <div id='details_texts_description'>");Line 3563: Line 3564: if (Convert.ToString(rdr["DetDesc"]).Length>shop.CADD) {Line 3565: Sb.Append(Generics.OfflineTags(Line 3566: ZenTools.Mid((string)rdr["DetDesc"],0,shop.CADD)) + " <a href='#details_fixed' title='veja mais'>...veja mais</a>"Line 3567: );Line 3568: } else {Line 3569: Sb.Append(Generics.OfflineTags((string)rdr["DetDesc"]));Line 3570: }Line 3571: Line 3572: Sb.Append(" </div>\n");Line 3573: Sb.Append(" <div id='details_texts_additional'>\n");Line 3574: Sb.Append(" <span class='size'><label>Dimensões (LxAxP): </label><span>" + (int)rdr["vX"] + "</span>x<span>" + (int)rdr["vY"] + "</span>x<span>" + (int)rdr["vZ"] + "</span> cm</span>\n");Line 3575: Sb.Append(" <span class='weight'><label>Peso: </label><span>" + (int)rdr["weight"] + "g</span></span>\n");Line 3576: Line 3577: Sb.Append(Line 3578: String.Format(Line 3579: "<span class='brand'><label>Fabricante: </label><span><a href='/{0}'>{1}</a></span></span>",Line 3580: ZenTools.urlize( Convert.ToString(rdr["brand"]) ),Line 3581: Convert.ToString(rdr["brand"])Line 3582: )Line 3583: );Line 3584: Line 3585: Sb.Append(" </div>\n");Line 3586: Line 3587: if ( shop.getConfig("DetailsAggregateRating").Length > 0 ) {Line 3588: Sb.Append( aggregateRating(shopId, codGrid, shop) );Line 3589: }Line 3590: Line 3591: if ((int)rdr["codAvailability"] < 2) {Line 3592: thisPrice = Convert.ToDecimal(rdr["prc"]);Line 3593: thisDiscRate = Convert.ToDecimal(rdr["discRate"]);Line 3594: Line 3595: Line 3596: Line 3597: // check promotionsLine 3598: try {Line 3599: promotion_sJson = P.getEffect(Line 3600: Convert.ToInt32(rdr["codBrand"]),Line 3601: Details.getProductMenus(shop.Path, Convert.ToInt32(rdr["codProd"])),Line 3602: codGrid,Line 3603: 0,Line 3604: ""Line 3605: );Line 3606: object oJson = JavaScriptDeserializer.DeserializeFromJson( promotion_sJson, typeof(NameValueCollection) );Line 3607: Line 3608: if ( Convert.ToInt32(((NameValueCollection)oJson)["id"]) > 0 ) {Line 3609: switch( Convert.ToString(((NameValueCollection)oJson)["discountType"]) ) {Line 3610: case "percent":Line 3611: thisDiscRate += Convert.ToDecimal(((NameValueCollection)oJson)["discountValue"]);Line 3612: break;Line 3613: case "fixed" : break;Line 3614: case "freeShipping": break;Line 3615: }Line 3616: Line 3617: // display active promotionLine 3618: Sb.Append( "\n<div class='details_promotion'>\n" );Line 3619: Sb.Append( " <span class='details_promotion_name'>" + Convert.ToString(((NameValueCollection)oJson)["name"]) + "</span>\n" );Line 3620: Sb.Append( " <span class='details_promotion_description'>" + Convert.ToString(((NameValueCollection)oJson)["description"]) + "</span>\n" );Line 3621: if ( ((NameValueCollection)oJson)["thumbnail"] != "imgNotAvailable" ) {Line 3622: Sb.Append( " <img src='/octopus/design/images/" + shopId + "/" + ((NameValueCollection)oJson)["thumbnail"] + "' class='details_promotion_thumbnail' />\n" );Line 3623: }Line 3624: Sb.Append( "</div>\n\n" );Line 3625: }Line 3626: } catch ( Exception e ) {Line 3627: thisPrice = Convert.ToDecimal(rdr["prc"]);Line 3628: promotion_sJson = "{}";Line 3629: }Line 3630: Line 3631: Line 3632: Line 3633: Sb.Append(" <div class='details_texts_prices_" + (int)rdr["codStatus"] + "' id='details_texts_prices'>\n");Line 3634: Sb.Append( Details.Prices(shopId, (int)rdr["codGrid"], thisPrice, thisDiscRate, (int)rdr["codStatus"], userGroup, shop) );Line 3635: Sb.Append(" </div>\n");Line 3636: Sb.Append( Details.Parcels(shopId, (int)rdr["codGrid"], thisPrice, thisDiscRate, shop) );Line 3637: }Line 3638: Line 3639: if (shop.UsePS && DBNull.Value!=rdr["codComp"] && !Convert.ToString(rdr["codComp"]).Equals("")) {Line 3640: Sb.Append(" <div id='details_texts_selects'>\n");Line 3641: Line 3642: string[,] selects = Details.Selects(shop.Path,Convert.ToString(rdr["codComp"]));Line 3643: string[] options = ZenTools.Split(Convert.ToString(rdr["codComp"]),';');Line 3644: string codCompApproach = "";Line 3645: string iSelects = "";Line 3646: Line 3647: for(i=0; i<selects.GetLength(0); i++) {Line 3648: iSelects += selects[i,0] + ";";Line 3649: }Line 3650: Line 3651: for(i=0; i<selects.GetLength(0); i++) {Line 3652: codCompApproach = "";Line 3653: for(int u = 0; u < i; u++) {Line 3654: codCompApproach += options[u] + ";";Line 3655: }Line 3656: Sb.Append(" <span class='selects'><h2>" + selects[i,1] + ":</h2><span id='s" + i + "P'>" + Details.Select(shopId, shop.Path, iSelects, Convert.ToInt32(options[i]), (int)rdr["codProd"], codCompApproach, (int)rdr["imgDepth"], selects.GetLength(0), i, userGroup, shop) + "</span></span>\n");Line 3657: }Line 3658: Line 3659: Sb.Append(" </div>\n");Line 3660: }Line 3661: Line 3662: if ( (int)rdr["codStatus"] != 4 ) {Line 3663: Sb.Append(" <div id='details_texts_availability'>\n");Line 3664: Line 3665: Line 3666: Line 3667: //--( Using AjaxPro.dll to deserialize a json from tbl_prices )Line 3668: string sJson = Convert.ToString(rdr["object"]);Line 3669: Line 3670: try {Line 3671: object oJson = JavaScriptDeserializer.DeserializeFromJson(sJson, typeof(NameValueCollection));Line 3672: if ( Convert.ToBoolean(((NameValueCollection)oJson)["freeShipping"]) ) {Line 3673: if ( Convert.ToString(((NameValueCollection)oJson)["freeShippingType"]) == "RESTRICTED" ) {Line 3674: Sb.Append( "<div id='details_texts_availability_shipping_restricted'><span></span></div>\n" );Line 3675: Line 3676: string[] ranges = (((NameValueCollection)oJson)["freeShippingRanges"]).Split(';');Line 3677: if ( ranges.Length > 0 && ranges[0] != "" ) {Line 3678: Sb.Append( "<div id='free-shipping-restricted'>\n" );Line 3679: Line 3680: if (Line 3681: ( (NameValueCollection)oJson )["freeShippingLabel"] != null &&Line 3682: Convert.ToString(((NameValueCollection)oJson)["freeShippingLabel"]).Length > 0Line 3683: ) {Line 3684: Sb.Append( " <font class='free-shipping-restricted-title'>" + Convert.ToString(((NameValueCollection)oJson)["freeShippingLabel"]) + "</font>\n" );Line 3685: } else {Line 3686: Sb.Append( " <font class='free-shipping-restricted-title'>Frete Grátis:</font>\n" );Line 3687: Sb.Append( " <ul>\n" );Line 3688: Line 3689: foreach(string sRange in ranges) {Line 3690: string[] r = sRange.Split(',');Line 3691: Sb.Append( " <li><font class='free_shipping_name'>" + r[2] + "</font></li>\n" );Line 3692: }Line 3693: Line 3694: Sb.Append( " </ul>\n" );Line 3695: }Line 3696: Line 3697: Sb.Append( "</div>\n" );Line 3698: }Line 3699: } else {Line 3700: Sb.Append( "<div id='details_texts_availability_shipping'><span></span></div>" );Line 3701: }Line 3702: }Line 3703: } catch (Exception e) {}Line 3704: Line 3705: Line 3706: Line 3707: dynamic clob = JsonConvert.DeserializeObject<JObject>("{}");Line 3708: try {Line 3709: clob = JsonConvert.DeserializeObject<JObject>( Convert.ToString( rdr["clob"] ) );Line 3710: } catch( Exception ex ) {}Line 3711: Line 3712: if( (int)rdr["codAvailability"] < 3 && clob != null && clob.plano_funeral != null ) {Line 3713: Sb.Append( string.Format(Line 3714: @"Line 3715: <a id='plano-funeral-anchor' href='/plano-funeral/titular?id={0}'>Line 3716: <span>Contratar</span>Line 3717: </a>Line 3718: ", Convert.ToInt32(rdr["codGrid"])Line 3719: ) );Line 3720: } else {Line 3721: Sb.Append( Details.Availability(shopId, (int)rdr["codGrid"], userGroup, shop, promotion_sJson) );Line 3722: }Line 3723: Line 3724: Line 3725: Line 3726: Sb.Append(" </div>\n");Line 3727: }Line 3728: Line 3729: // item shipping costLine 3730: if ( (int)rdr["codAvailability"] < 2 && shop.getConfig("UseItemShippingCostModal") != "" ) {Line 3731: Sb.Append(Line 3732: String.Format(Line 3733: "<div class='details_texts_shipping_cost'><h2><a href='#' onclick='item_shipping_cost_modal({0})'>{1}</a></h2></div>\n"Line 3734: , codGrid, shop.getConfig("UseItemShippingCostModal")Line 3735: )Line 3736: );Line 3737: }Line 3738: Line 3739: }Line 3740: rdr.Close();Line 3741: Line 3742: Sb.Append(" <div id='details_texts_others'>\n");Line 3743: Line 3744: if( shop.Next.favorites != null ) {Line 3745: Sb.Append( string.Format(Line 3746: @"Line 3747: <div class='favorites_add_item'>Line 3748: <a href='/wishlist/save-favorite-item/?id={0}' onclick='fav_add(event, {0})'><span>ADD_TO_FAVORITES</span></a>Line 3749: </div>Line 3750: ", codGridLine 3751: ) );Line 3752: }Line 3753: Line 3754: if (shop.UseTF) {Line 3755: query = "SELECT title, popWidth, popHeight FROM sys_tf_setup WITH (NOLOCK)";Line 3756: cmd = new SqlCommand(query, conn);Line 3757: rdr = cmd.ExecuteReader();Line 3758: if (rdr.Read())Sb.Append(" <span id='TF_lnkDTL'><a href=\"javascript:window.open('/octopus/ext_tellFriend.aspx?sid=" + shopId + "&cg=" + codGrid + "','tellFriend','top=0,left=0,width=" + (int)rdr["popWidth"] + ",height=" + (int)rdr["popHeight"] + ",location=no,menubar=no,directories=no,toolbar=no,scrollbars=yes,status=no');void(0);\"><img src='/octopus/design/images/" + shopId + "/tf_link.gif' alt='' rel='nofollow' /></a></span>\n");Line 3759: rdr.Close();Line 3760: }Line 3761: if (shop.UseGR) {Line 3762: Sb.Append( string.Format( @"Line 3763: <span id='GR_lnkDTL'>Line 3764: <a href='/review/?id={0}' rel='nofollow'>Line 3765: <img src='/octopus/design/images/{1}/GR_lnkDTL.gif' alt='' />Line 3766: </a>Line 3767: </span>Line 3768: ", codGrid, shopId ) );Line 3769: }Line 3770: Line 3771: if (shop.UseASQ) {Line 3772: Sb.Append( string.Format( @"Line 3773: <span id='ASQ_lnkDTL'>Line 3774: <a href='/questions-answers/?id={0}'>Line 3775: <img src='/octopus/design/images/{1}/ASQ_lnkDTL.gif' alt='' />Line 3776: </a>Line 3777: </span>Line 3778: ", codGrid, shopId ) );Line 3779: }Line 3780: Line 3781: if (shop.getConfig("FoundCheap").Length > 0) {Line 3782: string sJson = Convert.ToString( shop.getConfig("FoundCheap") );Line 3783: try {Line 3784: object oJson = JavaScriptDeserializer.DeserializeFromJson(sJson, typeof(NameValueCollection));Line 3785: Sb.Append(" <span id='FC_lnkDTL'><a href=\"javascript:window.open('/octopus/ext_foundCheap.aspx?sid=" + shopId + "&cg=" + codGrid + "&title=" + ((NameValueCollection)oJson)["popTitle"] + "','foundCheaper','top=0,left=0,width=" + ((NameValueCollection)oJson)["popWidth"] + ",height=" + ((NameValueCollection)oJson)["popHeight"] + ",location=no,menubar=no,directories=no,toolbar=no,status=no');void(0);\"><img src='/octopus/design/images/" + shopId + "/fc_link.gif' alt='Achou mais barato' /></a></span>\n");Line 3786: } catch (Exception e) {}Line 3787: }Line 3788: Line 3789: if ( shop.getConfig("WeddingRegistry").Length > 0 )Line 3790: Sb.Append(" <div id='weeding-registry-add-trigger'><a href='" + shop.Https + "{$thisConfig}&mi=WR&action=addItem&rmi=DTL&idG=" + codGrid + "<p=wedding' rel='nofollow'><img src='/octopus/design/images/" + shopId + "/WR_lnkDTL.gif' alt='wedding registry' title='wedding registry' /></a></div>");Line 3791: if ( shop.getConfig("WishListRegistry").Length > 0 )Line 3792: Sb.Append(" <div id='wishlist-registry-add-trigger'><a href='" + shop.Https + "{$thisConfig}&mi=WL&action=addItem&rmi=DTL&idG=" + codGrid + "<p=wishlist' rel='nofollow'><img src='/octopus/design/images/" + shopId + "/WL_lnkDTL.gif' alt='wishlist registry' title='wishlist registry' /></a></div>");Line 3793: if ( shop.getConfig("BabyListRegistry").Length > 0 )Line 3794: Line 3795: Line 3796: Sb.Append(" <div id='babylist-registry-add-trigger'><a href='" + shop.Https + "{$thisConfig}&mi=BL&action=addItem&rmi=DTL&idG=" + codGrid + "<p=babylist' rel='nofollow'><img src='/octopus/design/images/" + shopId + "/BL_lnkDTL.gif' alt='babylist registry' title='babylist registry' /></a></div>");Line 3797: Sb.Append(" </div>\n");Line 3798: Line 3799: conn.Close();Line 3800: Line 3801: return Sb.ToString();Line 3802: }Line 3803: public static string Texts(int shopId, int codProd, string codComp, int userGroup, ShopSetup shop, Promotion P) {Line 3804: string output = Details.Texts(shopId, CodProdCodCompApproach2CodGrid(shopId, codProd, codComp, shop), userGroup, shop, P);Line 3805: return output;Line 3806: }Line 3807: Line 3808: public static string Thumbnails(int shopId, string path, string codGridColl, int codGrid, int userGroup, ShopSetup shop) {Line 3809: StringBuilder Sb = new StringBuilder();Line 3810: string img_src = "";Line 3811: string img_thumb_fn = "";Line 3812: Line 3813: Sb.Append("<div id='details_images_thumbs'>\n");Line 3814: Sb.Append(" <ul>\n");Line 3815: Line 3816: SqlConnection conn = new SqlConnection(path);Line 3817: conn.Open();Line 3818: Line 3819: string query = string.Format(Line 3820: @" Line 3821: SELECT DISTINCTLine 3822: Pi.[imgSrc],Line 3823: Pi.[relatedGrid],Line 3824: P.[desc]Line 3825: FROM tbl_pictures Pi WITH (NOLOCK)Line 3826: INNER JOIN tbl_grid G WITH (NOLOCK) ON Pi.[codGrid] = G.[codGrid]Line 3827: INNER JOIN tbl_prod P WITH (NOLOCK) ON G.[codProd] = P.[codProd]Line 3828: WHERE {0} AND (NOT Pi.[imgSrc] IS NULL) AND (Pi.[imgSrc] <> '')Line 3829: ORDER BY Pi.[imgSrc]Line 3830: ",Line 3831: (codGridColl == "" ? "(Pi.[codGrid] = @codGrid)" : "(Pi.[codGrid] IN(" + codGridColl + ") )" )Line 3832: );Line 3833: Line 3834: SqlCommand cmd = new SqlCommand(query, conn);Line 3835: if ( codGridColl == "" ) {Line 3836: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 3837: cmd.Parameters["@codGrid"].Value = codGrid;Line 3838: }Line 3839: SqlDataReader rdr = cmd.ExecuteReader();Line 3840: Line 3841: while(rdr.Read()) {Line 3842: img_src = Convert.ToString(rdr["imgSrc"]);Line 3843: if ( img_src.Length < 4 || img_src.ToLower().Substring(0, 4) != "http" )Line 3844: img_src = string.Format("/octopus/design/images/{0}/products/{{size}}/{1}.jpg", shopId, img_src);Line 3845: img_thumb_fn = string.Format( "javascript:setBigImage({0},\"{1}\");", shopId, img_src );Line 3846: Line 3847: if ( rdr["relatedGrid"] != DBNull.Value && Convert.ToInt32(rdr["relatedGrid"]) > 0 ) {Line 3848: if ( isActive(path, Convert.ToInt32(rdr["relatedGrid"])) ) {Line 3849: img_thumb_fn = string.Format(Line 3850: "javascript:getGrid({0}, 0, {1},\"{{$thisConfig}}\")", shopId, Convert.ToString(rdr["relatedGrid"])Line 3851: );Line 3852: } else {Line 3853: img_src = "";Line 3854: }Line 3855: }Line 3856: Line 3857: if ( img_src != "" ) {Line 3858: Sb.Append( Environment.NewLine );Line 3859: Sb.Append(Line 3860: string.Format(Line 3861: @"Line 3862: <li>Line 3863: <a href='{0}'>Line 3864: <img src='{1}' alt='{2}' />Line 3865: </a>Line 3866: </li>Line 3867: ",Line 3868: img_thumb_fn, img_src.Replace("{size}", "t"), Convert.ToString(rdr["desc"])Line 3869: )Line 3870: );Line 3871: Sb.Append( Environment.NewLine );Line 3872: }Line 3873: }Line 3874: Line 3875: rdr.Close();Line 3876: conn.Close();Line 3877: Line 3878: Sb.Append(" </ul>\n");Line 3879: Sb.Append("</div>\n");Line 3880: Line 3881: return Sb.ToString();Line 3882: }Line 3883: Line 3884: public static string Prices(int shopId, int codGrid, decimal price, decimal discRate, int codStatus, ShopSetup shop) {Line 3885: return Prices(shopId, codGrid, price, discRate, codStatus, 1, shop);Line 3886: }Line 3887: Line 3888: public static string Prices(int shopId, int codGrid, decimal price, decimal discRate, int codStatus, int codGroup, ShopSetup shop) {Line 3889: int i=0;string ndd="";for(i=0; i<shop.NDD; i++)ndd+="0";Line 3890: Line 3891: StringBuilder Sb = new StringBuilder();Line 3892: Line 3893: int thisStockQt = 1;Line 3894: if (shop.UseSC)thisStockQt=Stock.Qt(shop.Path,codGrid);Line 3895: Line 3896: if (thisStockQt>0) {Line 3897: Line 3898: string iMembers;Line 3899: string iClass = "";Line 3900: string iValue = "";Line 3901: string payments = "";Line 3902: Line 3903: SqlConnection conn = new SqlConnection(shop.Path);Line 3904: SqlConnection hConn = new SqlConnection(shop.Path);Line 3905: SqlCommand hCmd = null;Line 3906: SqlDataReader hRdr = null;Line 3907: Line 3908: conn.Open();Line 3909: string query = @"Line 3910: SELECTLine 3911: tbl_acronyms.[desc] AS acroDesc,Line 3912: tbl_acronyms.acronymLine 3913: FROM tbl_grid WITH (NOLOCK)Line 3914: INNER JOIN tbl_prod WITH (NOLOCK) ON tbl_prod.codProd = tbl_grid.codProdLine 3915: INNER JOIN tbl_acronyms WITH (NOLOCK) ON tbl_prod.codUn = tbl_acronyms.codUnLine 3916: WHERE tbl_grid.codGrid = @codGridLine 3917: ";Line 3918: Line 3919: SqlCommand cmd = new SqlCommand(query, conn);Line 3920: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 3921: cmd.Parameters["@codGrid"].Value = codGrid;Line 3922: SqlDataReader rdr = cmd.ExecuteReader();Line 3923: Line 3924: string acroDesc = "";Line 3925: string acronym = "";Line 3926: Line 3927: if (rdr.Read()) {Line 3928: acroDesc = (string)rdr[0];Line 3929: acronym = (string)rdr[1];Line 3930: }Line 3931: Line 3932: rdr.Close();Line 3933: Line 3934: Sb.Append(" <div id='details-text'>\n");Line 3935: Sb.Append(" <div id='details-text-price'>\n");Line 3936: Sb.Append(" <div id='details-text-price-base'>\n");Line 3937: Line 3938: if (discRate != 0) {Line 3939: Sb.Append(" <span id='details-text-price-list'><span class='label'>de:</span><span class='price'>"+ shop.CurrType + string.Format("{0:0."+ ndd +"}",price) + "</span><acronym title="+ acroDesc +"> / "+ acronym +" </acronym></span>\n");Line 3940: }Line 3941: Line 3942: decimal ourPrc = ( 1 - discRate / 100 ) * price;Line 3943: Sb.Append(Line 3944: String.Format(Line 3945: @"Line 3946: <span id='details-text-price-our'>Line 3947: <span class='label'>{0}</span>Line 3948: <span>{1}</span>Line 3949: <span id='variant-anchor-prc' class='price'>{3}</span>Line 3950: <acronym title='{4}'> / {5} </acronym></span>Line 3951: ",Line 3952: ( codStatus == 4 ? "a partir de:" : "por:" ),Line 3953: shop.CurrType,Line 3954: string.Format("{0:0."+ ndd +"}", ourPrc).Replace(",", "."),Line 3955: string.Format("{0:0."+ ndd +"}", ourPrc),Line 3956: acroDesc,Line 3957: acroDescLine 3958: )Line 3959: ); //(A - B)Line 3960: Line 3961: if (discRate != 0) {Line 3962: Sb.Append( " <span id='details-text-price-save'>" );Line 3963: Sb.Append( " <span class='label'>economize:</span>" );Line 3964: Sb.Append( " <span class='price'> " + shop.CurrType + string.Format("{0:0.00}",price - ((1-discRate/100)*price)) +"</span>" ); //(A - B)Line 3965: Sb.Append( " </span>\n" );Line 3966: Sb.Append( " <div id='details-text-price-discount'>\n");Line 3967: Sb.Append( " <span class='discount_label'>"+ ( shop.getConfig("ProductDiscountLabel") != "" ? shop.getConfig("ProductDiscountLabel") : "Desconto de:" ) +"</span>\n");Line 3968: Sb.Append( " <span class='discount_percentage'>" + Convert.ToInt32(Math.Round(discRate, 2)) + "%</span>\n");Line 3969: Sb.Append( " </div>\n");Line 3970: }Line 3971: Line 3972: query = @"Line 3973: SELECT TOP 1Line 3974: times,Line 3975: interest,Line 3976: vtransl AS ccvtransl,Line 3977: ( SELECT name FROM sys_payInfos WITH (NOLOCK) WHERE codPayment = 1 ) AS name,Line 3978: ( SELECT factor FROM sys_payInfos WITH (NOLOCK) WHERE codPayment = 1 ) AS factor,Line 3979: ( SELECT vtransl FROM sys_payInfos WITH (NOLOCK) WHERE codPayment = 1 ) AS vtranslLine 3980: FROM sys_parcels WITH (NOLOCK)Line 3981: WHERE [value] <= @price AND times > 1 AND [priceGroup] = @priceGroupLine 3982: ORDER BY times DESCLine 3983: ";Line 3984: cmd = new SqlCommand(query, conn);Line 3985: cmd.Parameters.Add(new SqlParameter("@price", SqlDbType.Real));Line 3986: cmd.Parameters["@price"].Value = (1-discRate/100)*price;Line 3987: cmd.Parameters.Add(new SqlParameter("@priceGroup", SqlDbType.Int));Line 3988: cmd.Parameters["@priceGroup"].Value = codGroup;Line 3989: rdr = cmd.ExecuteReader();Line 3990: if (rdr.Read()) {Line 3991: if ((decimal)rdr["interest"] > 0) {Line 3992: iValue = (int)rdr["times"] +"x de "+ shop.CurrType + string.Format( "{0:0.00}",Line 3993: Juros_Composto(( (1 - discRate / 100) * price * (decimal)rdr["factor"] + (decimal)rdr["vtransl"] ), (decimal)rdr["interest"] / 100, (int)rdr["times"]) + (decimal)rdr["ccvtransl"]Line 3994: ) +" c/juros <span class='tax'>(taxa de "+ string.Format("{0:0.00}", (decimal)rdr["interest"]) +"% a.m.)</span>";Line 3995: } else {Line 3996: iValue = (int)rdr["times"] +"x de "+ shop.CurrType + string.Format( "{0:0.00}",Line 3997: ( ( (1 - discRate / 100) * price * (decimal)rdr["factor"] + (decimal)rdr["vtransl"] ) / (int)rdr["times"] ) + (decimal)rdr["ccvtransl"]Line 3998: );Line 3999: }Line 4000: Line 4001: Sb.Append(" <span id='details-text-price-or'><span class='label'>ou:</span><span class='price'>"+ iValue +"</span></span>\n");Line 4002: }Line 4003: rdr.Close();Line 4004: Sb.Append(" </div>\n");Line 4005: Sb.Append(" <div id='details-text-price-exception'>\n");Line 4006: Line 4007: query = "SELECT DISTINCT factor, vtransl FROM sys_payInfos WITH (NOLOCK) WHERE active = 1";Line 4008: cmd = new SqlCommand(query, conn);Line 4009: rdr = cmd.ExecuteReader();Line 4010: StringBuilder Builder = new StringBuilder();Line 4011: Line 4012: while( rdr.Read() ) {Line 4013: if ((decimal)rdr["factor"] != 1 || (decimal)rdr["vtransl"] != 0) {Line 4014: Sb.Append( " <p>\n");Line 4015: if ( (decimal)rdr["factor"] > 1 ) {Line 4016: Sb.Append (Line 4017: "<span class='details-text-price-factor-increase'>" + Convert.ToInt32(((decimal)rdr["factor"] - 1) * 100) + "% de acréscimo</span>\n"Line 4018: );Line 4019: }Line 4020: Line 4021: if ( (decimal)rdr["factor"] < 1 ) {Line 4022: Sb.Append (Line 4023: "<span class='details-text-price-factor-discount'>" + Convert.ToInt32((1-(decimal)rdr["factor"]) * 100) +"% de desconto</span>\n"Line 4024: );Line 4025: }Line 4026: Line 4027: if ( (decimal)rdr["vtransl"] > 0 ) {Line 4028: Sb.Append(Line 4029: "<span class='details-text-price-vtransl-increase'>mais "Line 4030: + shop.CurrType + string.Format( "{0:0.00}", (decimal)rdr["vtransl"] )Line 4031: + " de acréscimo</span>\n"Line 4032: );Line 4033: }Line 4034: Line 4035: if ( (decimal)rdr["vtransl"] < 0 ) {Line 4036: Sb.Append(Line 4037: "<span class='details-text-price-vtransl-discount'>menos "Line 4038: + shop.CurrType + string.Format( "{0:0.00}", Math.Abs( (decimal)rdr["vtransl"] ) )Line 4039: + " de desconto</span>\n"Line 4040: );Line 4041: }Line 4042: Line 4043: hConn.Open();Line 4044: query = "SELECT name FROM sys_payInfos WITH (NOLOCK) WHERE (factor = @factor) AND (vtransl = @vtransl) ORDER BY payment";Line 4045: hCmd = new SqlCommand(query, hConn);Line 4046: hCmd.Parameters.Add(new SqlParameter("@factor", SqlDbType.Decimal));Line 4047: hCmd.Parameters.Add(new SqlParameter("@vtransl", SqlDbType.Decimal));Line 4048: hCmd.Parameters["@factor"].Value = (decimal)rdr["factor"];Line 4049: hCmd.Parameters["@vtransl"].Value = (decimal)rdr["vtransl"];Line 4050: hRdr = hCmd.ExecuteReader();Line 4051: Line 4052: payments = "";Line 4053: Line 4054: while( hRdr.Read() ) {Line 4055: payments += ", " + (string)hRdr["name"];Line 4056: }Line 4057: Line 4058: hRdr.Close();Line 4059: hConn.Close();Line 4060: Line 4061: Sb.Append( " <span class='details-text-price-payment'>para " + payments.Substring(1, payments.Length - 1) + "</span> \n" );Line 4062: Sb.Append( " <span class='details-text-price-final'>" + shop.CurrType + string.Format("{0:0."+ ndd +"}",(((1-discRate/100) * price) * (decimal)rdr["factor"]) + (decimal)rdr["vtransl"]) + "</span>\n" );Line 4063: Sb.Append( " </p>\n" );Line 4064: }Line 4065: }Line 4066: Line 4067: rdr.Close();Line 4068: conn.Close();Line 4069: Line 4070: Sb.Append(" </div>\n");Line 4071: Line 4072: Line 4073: Sb.Append(" </div>\n");Line 4074: Line 4075: Sb.Append(" </div>\n");Line 4076: }Line 4077: Line 4078: return Sb.ToString();Line 4079: }Line 4080: Line 4081: public static string Availability(int shopId, int codGrid, int userGroup, ShopSetup shop, string promotion_sJson) {Line 4082: StringBuilder Sb = new StringBuilder();Line 4083: Line 4084: int i = 0;Line 4085: int maxQt = 100;Line 4086: int iStockQt = 10;Line 4087: int codAvailability = 0;Line 4088: int qtStep = 1;Line 4089: Line 4090: decimal iPrice = 0;Line 4091: string[] thisAvailability = new string[3];Line 4092: string sJson = "";Line 4093: Line 4094: SqlConnection conn = new SqlConnection(shop.Path);Line 4095: conn.Open();Line 4096: Line 4097: string query = "SELECT prc, codAvailability, object FROM tbl_prices WITH (NOLOCK) WHERE codGroup = @userGroup AND codGrid = @codGrid";Line 4098: SqlCommand cmd = new SqlCommand(query, conn);Line 4099: cmd.Parameters.Add(new SqlParameter("@userGroup", SqlDbType.Int));Line 4100: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 4101: cmd.Parameters["@userGroup"].Value = userGroup;Line 4102: cmd.Parameters["@codGrid"].Value = codGrid;Line 4103: SqlDataReader rdr = cmd.ExecuteReader();Line 4104: if (rdr.Read()) {Line 4105: iPrice = (decimal)rdr["prc"];Line 4106: codAvailability = (int)rdr["codAvailability"];Line 4107: sJson = Convert.ToString(rdr["object"]);Line 4108: }Line 4109: rdr.Close();Line 4110: Line 4111: query = "SELECT [desc] FROM sys_prodAvailability WITH (NOLOCK) ORDER BY codAvailability";Line 4112: cmd = new SqlCommand(query,conn);Line 4113: rdr = cmd.ExecuteReader();Line 4114: while(rdr.Read())thisAvailability[i++]=(string)rdr["desc"];Line 4115: rdr.Close();Line 4116: Line 4117: conn.Close();Line 4118: Line 4119: if (shop.UseSC)iStockQt=Stock.Qt(shop.Path, codGrid);Line 4120: Line 4121: if ( null != shop.getConfig("StockMaxQt") && !shop.getConfig("StockMaxQt").Equals("") )Line 4122: maxQt = Convert.ToInt32(shop.getConfig("StockMaxQt"));Line 4123: if ( iStockQt < maxQt )Line 4124: maxQt = iStockQt;Line 4125: Line 4126: if (codAvailability==1 && iPrice<=0)codAvailability=2;Line 4127: Sb.Append( " <div id='details_texts_availability_label'><label>Disponibilidade: </label>" + thisAvailability[codAvailability-1] + "</div>\n" );Line 4128: Line 4129: switch(codAvailability) {Line 4130: case 1:Line 4131: Sb.Append( " <div id='details_texts_availability_field'><span class='item_qt_buy'><label for='r_0'><font>Quantidade:</font></label>" );Line 4132: Line 4133: if (shop.isRetail) {Line 4134: Sb.Append( "<select id='r_0' name='r_0'>" );Line 4135: Line 4136: Line 4137: Line 4138: // set product quantity by promotionLine 4139: if ( promotion_sJson != "{}" ) {Line 4140: try {Line 4141: object oJson = JavaScriptDeserializer.DeserializeFromJson(promotion_sJson, typeof(NameValueCollection));Line 4142: if ( ((NameValueCollection)oJson)["products"] != "" ) {Line 4143: string[] products = Convert.ToString(((NameValueCollection)oJson)["products"]).Split(',');Line 4144: foreach( string product in products ) {Line 4145: string[] arr = product.Split('_');Line 4146: if ( codGrid == Convert.ToInt32(arr[0]) && Convert.ToInt32(arr[1]) > 0 ) {Line 4147: if ( maxQt > Convert.ToInt32(arr[1]) ) {Line 4148: maxQt = Convert.ToInt32(arr[1]);Line 4149: }Line 4150: }Line 4151: }Line 4152: }Line 4153: } catch ( Exception e ) {}Line 4154: }Line 4155: Line 4156: Line 4157: Line 4158: for( i = 1; ( i <= maxQt ); i++ ) {Line 4159: Sb.Append( "<option value='" + i + "'>" + i + "</option>" );Line 4160: }Line 4161: Sb.Append( "</select>" );Line 4162: Line 4163: Line 4164: Line 4165: } else {Line 4166: try{Line 4167: object oJson = JavaScriptDeserializer.DeserializeFromJson(sJson, typeof(NameValueCollection));Line 4168: if ( ((NameValueCollection)oJson)["qtIncrement"] != null && ((NameValueCollection)oJson)["qtIncrement"] != "" ) {Line 4169: qtStep = Convert.ToInt32(((NameValueCollection)oJson)["qtIncrement"]);Line 4170: }Line 4171: } catch ( Exception ex ) {}Line 4172: Line 4173: Sb.Append(Line 4174: String.Format(Line 4175: "<input type='number' step='{0}' min='0' class='n' size='3' id='r_0' name='r_0' value='0' onclick='select()'/>"Line 4176: , qtStepLine 4177: )Line 4178: );Line 4179: }Line 4180: Line 4181: Sb.Append( "</span>" );Line 4182: Line 4183: if ( shop.getConfig("UseItemAddedModal") == "true" ) {Line 4184: Sb.Append( "<span class='item_btn_buy'><a href=\"javascript:req_add2cart('" + shop.Http + "{$thisConfig}'," + shopId + ",'{$cartId}'," + codGrid + ",'r_0'," + Convert.ToString(shop.UseEG).ToLower() + "," + shop.UseFC + ",0, null);\"><img src='/octopus/design/images/" + shopId + "/cart_buy.gif' alt='' /></a></span>" );Line 4185: } else {Line 4186: Sb.Append( "<span class='item_btn_buy'><a href=\"javascript:req_addItem('" + shop.Http + "{$thisConfig}'," + shopId + ",'{$cartId}'," + codGrid + ",'r_0'," + Convert.ToString(shop.UseEG).ToLower() + "," + shop.UseFC + ",0);\"><img src='/octopus/design/images/" + shopId + "/cart_buy.gif' alt='' /></a></span>" );Line 4187: }Line 4188: Line 4189: Sb.Append( "</div>\n" );Line 4190: Line 4191: if( shop.Next.wishlist != null ) {Line 4192: Sb.Append( string.Format(Line 4193: @"Line 4194: <div class='wishlist_add_item'>Line 4195: <a href='/wishlist/add-item/?id={0}' onclick='wl_add(event, {0})'><span>ADD_TO_WISHLIST</span></a>Line 4196: </div>Line 4197: ", codGridLine 4198: ) );Line 4199: }Line 4200: break;Line 4201: Line 4202: Line 4203: Line 4204: case 2:Line 4205: Sb.Append(" <div id='inStockNotification'>\n");Line 4206: Sb.Append(" <table>\n");Line 4207: Sb.Append(" <tr><th colspan='2'><a id='selflink_inStockNotification'>Avise-me ao chegar</a></th></tr>\n");Line 4208: Sb.Append(" <tr><td colspan='2'>Preencha os campos abaixo para receber um email notificando que este produto está disponível.</td></tr>\n");Line 4209: Sb.Append(" <tr><td align='right'><b>Nome:</b></td><td><input name='nome' type='text' class='a' /></td></tr>\n");Line 4210: Sb.Append(" <tr><td align='right'><b>Email:</b></td><td><input name='email' type='text' class='a' /></td></tr>\n");Line 4211: Sb.Append(" <tr><td align='right'><b>Telefone:</b></td><td><input name='phone' type='text' class='a' /></td></tr>\n");Line 4212: Sb.Append(" <tr><td colspan='2' align='right'><a href='javascript:inStockNotification(" + shopId + "," + codGrid + ");'><img src='/octopus/design/images/" + shopId + "/form_send.gif' alt='' /></a></td></tr>\n");Line 4213: Sb.Append(" </table>\n");Line 4214: Sb.Append(" </div>\n");Line 4215: break;Line 4216: Line 4217: Line 4218: Line 4219: case 3:Line 4220: Sb.Append(" <p id='onRequestMessage'>Para maiores detalhes sobre a aquisição deste produto, entre em contato via <span class='phone'>telefone: " + shop.Phone + " ou</span> <a href='/octopus/{$thisConfig}&mi=CNT'>email</a>.</p>\n");Line 4221: Line 4222: Line 4223: break;Line 4224: }Line 4225: Line 4226: return Sb.ToString();Line 4227: }Line 4228: Line 4229: // VER TAMBEM __parcels.aspxLine 4230: public static decimal Juros_Composto(decimal Vp, decimal j, int n) {Line 4231: //return Vp / n * (decimal)Math.Pow( Convert.ToDouble( 1 + j ), Convert.ToDouble(n ) );Line 4232: //return Vp * ( ( j * (decimal)Math.Pow( Convert.ToDouble( 1 + j ), Convert.ToDouble(n) ) ) / ( (decimal)Math.Pow( Convert.ToDouble( 1 + j ), Convert.ToDouble(n) ) - 1 ) );Line 4233: return Vp * j / ( 1 - 1 / (decimal)Math.Pow(Convert.ToDouble(1 + j), Convert.ToDouble(n)) );Line 4234: }Line 4235: Line 4236: public static string Parcels(int shopId, int codGrid, decimal price, decimal discRate, ShopSetup shop) {Line 4237: int i=0;string ndd="";for(i=0;i<shop.NDD;i++)ndd+="0";Line 4238: Line 4239: StringBuilder Sb = new StringBuilder();Line 4240: Line 4241: int thisStockQt = 1;Line 4242: if (shop.UseSC)thisStockQt=Stock.Qt(shop.Path,codGrid);Line 4243: Line 4244: if (thisStockQt>0) {Line 4245: string iValue = "";Line 4246: string query = "";Line 4247: Line 4248: Sb.Append(" <div id='details-text-parcels'> \n");Line 4249: Sb.Append(" <h4 class='details-parcels-title'>Parcelamento no cartão de crédito.</h4>");Line 4250: Sb.Append(" <ul class='details-parcels-body'> \n");Line 4251: Line 4252: SqlConnection conn = new SqlConnection(shop.Path);Line 4253: conn.Open();Line 4254: Line 4255: query = @"Line 4256: SELECT DISTINCTLine 4257: times,Line 4258: interest,Line 4259: vtransl AS ccvtransl,Line 4260: ( SELECT name FROM sys_payInfos WITH (NOLOCK) WHERE codPayment = 1 ) AS name,Line 4261: ( SELECT factor FROM sys_payInfos WITH (NOLOCK) WHERE codPayment = 1 ) AS factor,Line 4262: ( SELECT vtransl FROM sys_payInfos WITH (NOLOCK) WHERE codPayment = 1 ) AS vtranslLine 4263: FROM sys_parcels WITH (NOLOCK)Line 4264: WHERE [value] <= @priceLine 4265: ORDER BY times ASCLine 4266: ";Line 4267: Line 4268: i = 0;Line 4269: Line 4270: SqlCommand cmd = new SqlCommand(query, conn);Line 4271: cmd.Parameters.Add(new SqlParameter("@price", SqlDbType.Real));Line 4272: cmd.Parameters["@price"].Value = (1-discRate/100)*price;Line 4273: SqlDataReader rdr = cmd.ExecuteReader();Line 4274: while(rdr.Read()) {Line 4275: Line 4276: if ((decimal)rdr["interest"] > 0) {Line 4277: iValue = (int)rdr["times"] +"x de "+ shop.CurrType + string.Format( "{0:0.00}"Line 4278: , Juros_Composto( ( (1 - discRate / 100) * price * (decimal)rdr["factor"] + (decimal)rdr["vtransl"] ), (decimal)rdr["interest"] / 100, (int)rdr["times"]) + (decimal)rdr["ccvtransl"] ) + " c/juros (taxa de "+ string.Format( "{0:0.00}", (decimal)rdr["interest"] ) +"% a.m.)";Line 4279: } else {Line 4280: iValue = (int)rdr["times"] +"x de "+ shop.CurrType + string.Format(Line 4281: "{0:0.00}"Line 4282: , ( (1 - discRate / 100) * price * (decimal)rdr["factor"] + (decimal)rdr["vtransl"] ) / (int)rdr["times"] + (decimal)rdr["ccvtransl"]Line 4283: );Line 4284: if ( (int)rdr["times"] > 1 ) {Line 4285: iValue += "<em class='no-interest'></em>";Line 4286: }Line 4287: }Line 4288: Sb.Append(" <li class='" + ( (i++%2 == 0)?"even":"odd" ) + "'>" + iValue + "</li> \n");Line 4289: }Line 4290: rdr.Close();Line 4291: conn.Close();Line 4292: Line 4293: Sb.Append(" </ul> \n");Line 4294: Sb.Append(" </div> \n");Line 4295: }Line 4296: return Sb.ToString();Line 4297: }Line 4298: Line 4299: public static string[,] Selects(string path, string codComp) {Line 4300: string[] options = ZenTools.Split(ZenTools.Left(codComp, codComp.Length),';');Line 4301: string[,] output = new string[options.Length,2];Line 4302: Line 4303: string query = "";Line 4304: SqlCommand cmd = null;Line 4305: SqlDataReader rdr = null;Line 4306: Line 4307: SqlConnection conn = new SqlConnection(path);Line 4308: conn.Open();Line 4309: Line 4310: query = @"Line 4311: SELECTLine 4312: tbl_selects.codSelect,Line 4313: tbl_selects.[desc] AS SelectDescLine 4314: FROM tbl_selects WITH (NOLOCK)Line 4315: INNER JOIN tbl_selectOptions ON tbl_selects.codSelect = tbl_selectOptions.codSelectLine 4316: WHERE (tbl_selectOptions.codOption = @codOption)Line 4317: ";Line 4318: cmd = new SqlCommand(query, conn);Line 4319: cmd.Parameters.Add(new SqlParameter("@codOption", SqlDbType.Int));Line 4320: Line 4321: for(int i=0; i<options.Length; i++) {Line 4322: cmd.Parameters["@codOption"].Value = options[i];Line 4323: rdr = cmd.ExecuteReader();Line 4324: if (rdr.Read()) {Line 4325: output[i,0] = Convert.ToString(rdr["codSelect"]);Line 4326: output[i,1] = Convert.ToString(rdr["SelectDesc"]);Line 4327: }Line 4328: rdr.Close();Line 4329: }Line 4330: Line 4331: conn.Close();Line 4332: Line 4333: return output;Line 4334: }Line 4335: Line 4336: Line 4337: public static string Select(Line 4338: int shopId,Line 4339: string path,Line 4340: string selectsList,Line 4341: int codOption,Line 4342: int codProd,Line 4343: string codCompApproach,Line 4344: int imageDepth,Line 4345: int levels,Line 4346: int level,Line 4347: int userGroup,Line 4348: ShopSetup shopLine 4349: ) {Line 4350: string[] selects = ZenTools.Split(selectsList,';');Line 4351: string[] availability;Line 4352: string iFunction = "";Line 4353: bool useSelsCtrl = false;Line 4354: StringBuilder Sb = new StringBuilder();Line 4355: Line 4356: if ( shop.getConfig("UseSelectsControl") != "" && shop.getConfig("UseSelectsControl").ToLower() == "true" ) {Line 4357: useSelsCtrl = true;Line 4358: }Line 4359: Line 4360: iFunction = "getNextSelect(" + shopId + ", '" + selectsList + "', " + codProd + ", " + imageDepth + ", " + levels + ", " + (level + 1) + ", 0, '{$thisConfig}', " + ( useSelsCtrl ? "true" : "false" ) + ");";Line 4361: Line 4362: if ( levels == (level + 1) ) iFunction = "getApproach(" +shopId+ ", " +codProd+ ", " +imageDepth+ ", " +levels+ ", 0, '{$thisConfig}');";Line 4363: Line 4364: // set zoom image srcLine 4365: iFunction += "(function(){var b=$('details_images_big_img');if (b && zoomSrc)zoomSrc=b.src.replace('/b/', '/z/');})();";Line 4366: Line 4367: if ( useSelsCtrl ) {Line 4368: Sb.Append( "<select class='a _selectsctrl_' name='s" + level + "' onchange=\"javascript:" + iFunction + "\"><option value='0'>Selecione</option>" );Line 4369: } else {Line 4370: Sb.Append( "<select class='a' name='s" + level + "' onchange=\"javascript:" + iFunction + "\">" );Line 4371: }Line 4372: Line 4373: SqlConnection conn = new SqlConnection(path);Line 4374: conn.Open();Line 4375: Line 4376: string query = @"Line 4377: SELECTLine 4378: codOption,Line 4379: [desc] AS DescOption,Line 4380: ( SELECT count(codGrid) FROM tbl_grid G WITH (NOLOCK) WHERE G.active = 1 AND G.codProd = @codProd AND codComp LIKE @codApproach + CAST(SO.codOption AS nvarchar(32)) + ';%' ) AS boolLine 4381: FROM tbl_selectOptions SO WITH (NOLOCK)Line 4382: WHERE (codSelect = @codSelect)Line 4383: ORDER BY dspOrder, [desc]Line 4384: ";Line 4385: Line 4386: string codOptionCollection = "";Line 4387: Line 4388: SqlCommand cmd = new SqlCommand(query, conn);Line 4389: Line 4390: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 4391: cmd.Parameters["@codProd"].Value = codProd;Line 4392: Line 4393: cmd.Parameters.Add(new SqlParameter("@codApproach", SqlDbType.NVarChar));Line 4394: cmd.Parameters["@codApproach"].Value = codCompApproach;Line 4395: Line 4396: cmd.Parameters.Add(new SqlParameter("@codSelect", SqlDbType.Int));Line 4397: cmd.Parameters["@codSelect"].Value = selects[level];Line 4398: Line 4399: SqlDataReader rdr = cmd.ExecuteReader();Line 4400: while(rdr.Read()) {Line 4401: // if ( Details.CodCompApproachExist(path, codProd, codCompApproach + (int)rdr["codOption"] + ";") ) {Line 4402: if ( (int)rdr["bool"] > 0 ) {Line 4403: Sb.Append( "<option data-cp='" + codProd + "' data-cca='" + codCompApproach + "' value='" + (int)rdr["codOption"] + "'" );Line 4404: Line 4405: if (codOption==(int)rdr["codOption"])Line 4406: Sb.Append( " selected='selected'" );Line 4407: Line 4408: Sb.Append( ">" + Convert.ToString(rdr["DescOption"]) );Line 4409: Line 4410: availability = availabilityStatus( path, CodProdCodCompApproach2CodGrid( shopId, codProd, codCompApproach + Convert.ToString(rdr["codOption"]), shop ), userGroup );Line 4411: if ( (levels == (level + 1)) && (Convert.ToInt32(availability[0]) > 1) ) Sb.Append( " ( " + availability[1] + " ) ");Line 4412: Line 4413: Sb.Append( "</option>" );Line 4414: }Line 4415: }Line 4416: Line 4417: rdr.Close();Line 4418: conn.Close();Line 4419: Line 4420: Sb.Append( "</select>" );Line 4421: Line 4422: return Sb.ToString();Line 4423: }Line 4424: Line 4425: public static bool CodCompApproachExist(string path, int codProd, string codCompApproach) {Line 4426: bool output = false;Line 4427: Line 4428: SqlConnection conn = new SqlConnection(path);Line 4429: conn.Open();Line 4430: Line 4431: string query = "SELECT count(*) FROM tbl_grid WITH (NOLOCK) WHERE (codProd = @codProd) AND (codComp LIKE @codCompApproach)";Line 4432: SqlCommand cmd = new SqlCommand(query, conn);Line 4433: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 4434: cmd.Parameters.Add(new SqlParameter("@codCompApproach", SqlDbType.NVarChar));Line 4435: cmd.Parameters["@codProd"].Value = codProd;Line 4436: cmd.Parameters["@codCompApproach"].Value = codCompApproach + "%";Line 4437: int t = Convert.ToInt32(cmd.ExecuteScalar());Line 4438: Line 4439: conn.Close();Line 4440: Line 4441: if ( t > 0 ) output = true;Line 4442: return output;Line 4443: }Line 4444: Line 4445: public static int CodProdCodCompApproach2CodGrid(int shopId, int codProd, string codCompApproach, ShopSetup shop) {Line 4446: SqlConnection conn = new SqlConnection(shop.Path);Line 4447: conn.Open();Line 4448: Line 4449: string query = "SELECT TOP 1 codGrid FROM tbl_grid WITH (NOLOCK) WHERE (active = 1) AND (codProd = @codProd) AND (codComp LIKE @codCompApproach) ORDER BY codComp;";Line 4450: SqlCommand cmd = new SqlCommand(query, conn);Line 4451: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 4452: cmd.Parameters.Add(new SqlParameter("@codCompApproach", SqlDbType.NVarChar));Line 4453: cmd.Parameters["@codProd"].Value = codProd;Line 4454: cmd.Parameters["@codCompApproach"].Value = codCompApproach + "%";Line 4455: int output = Convert.ToInt32(cmd.ExecuteScalar());Line 4456: Line 4457: conn.Close();Line 4458: Line 4459: return output;Line 4460: }Line 4461: Line 4462: public static string[] availabilityStatus(string path, int codGrid, int userGroup) {Line 4463: string[] output = new string[2];Line 4464: Line 4465: SqlConnection conn = new SqlConnection(path);Line 4466: conn.Open();Line 4467: Line 4468: string query = @"Line 4469: SELECTLine 4470: tbl_prices.codAvailability,Line 4471: sys_prodAvailability.[desc]Line 4472: FROM tbl_prices WITH (NOLOCK)Line 4473: INNER JOIN sys_prodAvailability WITH (NOLOCK) ON tbl_prices.codAvailability = sys_prodAvailability.codAvailabilityLine 4474: WHERE (codGrid = @codGrid) AND (codGroup = @codGroup)Line 4475: ";Line 4476: Line 4477: SqlCommand cmd = new SqlCommand(query, conn);Line 4478: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 4479: cmd.Parameters.Add(new SqlParameter("@codGroup", SqlDbType.Int));Line 4480: cmd.Parameters["@codGrid"].Value = codGrid;Line 4481: cmd.Parameters["@codGroup"].Value = userGroup;Line 4482: SqlDataReader rdr = cmd.ExecuteReader();Line 4483: Line 4484: if ( rdr.Read() ) {Line 4485: output[0] = Convert.ToString(rdr[0]);Line 4486: output[1] = Convert.ToString(rdr[1]);Line 4487: }Line 4488: Line 4489: rdr.Close();Line 4490: conn.Close();Line 4491: Line 4492: return output;Line 4493: }Line 4494: Line 4495: public static dynamic getBrand(string path, int codBrand) {Line 4496: dynamic output = JsonConvert.DeserializeObject<JObject>("{}");Line 4497: Line 4498: SqlConnection conn = new SqlConnection(path);Line 4499: conn.Open();Line 4500: SqlCommand cmd = new SqlCommand("SELECT * FROM tbl_brands WHERE codBrand = @codBrand", conn);Line 4501: cmd.Parameters.Add(new SqlParameter("@codBrand", SqlDbType.Int));Line 4502: cmd.Parameters["@codBrand"].Value = codBrand;Line 4503: SqlDataReader rdr = cmd.ExecuteReader();Line 4504: if( rdr.Read() ) {Line 4505: for( int i = 0; i < rdr.FieldCount; i++ ) {Line 4506: switch( rdr.GetName(i) ) {Line 4507: case "clob":Line 4508: output[rdr.GetName(i)] = JsonConvert.DeserializeObject<JObject>( Convert.ToString(rdr[i]) );Line 4509: break;Line 4510: default:Line 4511: output[rdr.GetName(i)] = Convert.ToString(rdr[i]);Line 4512: break;Line 4513: }Line 4514: }Line 4515: }Line 4516: rdr.Close();Line 4517: conn.Close();Line 4518: return output;Line 4519: }Line 4520: Line 4521: // DEPRECATEDLine 4522: public static string getBrandName(string path, int codBrand) {Line 4523: string output = "";Line 4524: Line 4525: SqlConnection conn = new SqlConnection(path);Line 4526: conn.Open();Line 4527: Line 4528: string query = "SELECT name FROM tbl_brands WITH (NOLOCK) WHERE codBrand = @codBrand";Line 4529: Line 4530: SqlCommand cmd = new SqlCommand(query, conn);Line 4531: cmd.Parameters.Add(new SqlParameter("@codBrand", SqlDbType.Int));Line 4532: cmd.Parameters["@codBrand"].Value = codBrand;Line 4533: Line 4534: output = Convert.ToString(cmd.ExecuteScalar());Line 4535: Line 4536: conn.Close();Line 4537: Line 4538: return output;Line 4539: }Line 4540: Line 4541: public static string getCodGridColl(string path, int codProd) {Line 4542: string output = "";Line 4543: StringBuilder Sb = new StringBuilder();Line 4544: Line 4545: SqlConnection conn = new SqlConnection(path);Line 4546: conn.Open();Line 4547: Line 4548: SqlCommand cmd = new SqlCommand(Line 4549: "SELECT codGrid FROM tbl_grid WITH (NOLOCK) WHERE (codProd = " + codProd + ") AND active = 1",Line 4550: connLine 4551: );Line 4552: SqlDataReader rdr = cmd.ExecuteReader();Line 4553: Line 4554: while( rdr.Read() ) {Line 4555: Sb.Append( "," + Convert.ToString(rdr["codGrid"]) );Line 4556: }Line 4557: Line 4558: output = Sb.ToString();Line 4559: Line 4560: rdr.Close();Line 4561: conn.Close();Line 4562: Line 4563: return ( output.Length > 0 ? output.Substring(1) : "" );Line 4564: }Line 4565: Line 4566: private static bool isActive(string path, int codGrid) {Line 4567: bool output = false;Line 4568: Line 4569: SqlConnection conn = new SqlConnection(path);Line 4570: conn.Open();Line 4571: Line 4572: string query = "SELECT active FROM tbl_grid WITH (NOLOCK) WHERE codGrid = @codGrid";Line 4573: Line 4574: SqlCommand cmd = new SqlCommand(query, conn);Line 4575: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 4576: cmd.Parameters["@codGrid"].Value = codGrid;Line 4577: Line 4578: output = Convert.ToBoolean(cmd.ExecuteScalar());Line 4579: Line 4580: conn.Close();Line 4581: Line 4582: return output;Line 4583: }Line 4584: Line 4585: public static string getBreadCrumb(int shopId, int idProd, string thisConfig, ShopSetup shop) {Line 4586: string menuHref = "";Line 4587: string menu1st = "";Line 4588: string menu2nd = "";Line 4589: string menu3rd = "";Line 4590: string jsonLd = "";Line 4591: Line 4592: int cod1stMenu = 0;Line 4593: int cod2ndMenu = 0;Line 4594: int cod3rdMenu = 0;Line 4595: Line 4596: StringBuilder Sb = new StringBuilder();Line 4597: Line 4598: SqlConnection conn = new SqlConnection(shop.Path);Line 4599: conn.Open();Line 4600: Line 4601: string query = @"Line 4602: SELECT TOP 1Line 4603: R.cod1stMenu,Line 4604: R.cod2ndMenu,Line 4605: R.cod3rdMenu,Line 4606: M1.[desc] AS menu1st,Line 4607: M2.[desc] AS menu2nd,Line 4608: M3.[desc] AS menu3rdLine 4609: FROM rel_menusWprod R WITH (NOLOCK)Line 4610: INNER JOIN tbl_menu1st M1 WITH (NOLOCK) ON R.cod1stMenu = M1.cod1stMenuLine 4611: LEFT OUTER JOIN tbl_menu2nd M2 WITH (NOLOCK) ON R.cod2ndMenu = M2.cod2ndMenu AND M2.dspOrder < 9999Line 4612: LEFT OUTER JOIN tbl_menu3rd M3 WITH (NOLOCK) ON R.cod3rdMenu = M3.cod3rdMenu AND M3.dspOrder < 9999Line 4613: WHERE (R.codProd = @codProd) AND (M1.dspOrder < 9999)Line 4614: ORDER BYLine 4615: CASE WHEN NOT R.cod3rdMenu IS NULL THEN 0 ELSE 1 END,Line 4616: CASE WHEN NOT R.cod2ndMenu IS NULL THEN 0 ELSE 1 ENDLine 4617: ";Line 4618: Line 4619: SqlCommand cmd = new SqlCommand(query, conn);Line 4620: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 4621: cmd.Parameters["@codProd"].Value = idProd;Line 4622: SqlDataReader rdr = cmd.ExecuteReader();Line 4623: Line 4624: if ( rdr.Read() ) {Line 4625: menu1st = Convert.ToString(rdr["menu1st"]);Line 4626: cod1stMenu = Convert.ToInt32(rdr["cod1stMenu"]);Line 4627: if ( rdr["cod2ndMenu"] != DBNull.Value && Convert.ToInt32(rdr["cod2ndMenu"]) > 0 ) {Line 4628: menu2nd = Convert.ToString(rdr["menu2nd"]);Line 4629: cod2ndMenu = Convert.ToInt32(rdr["cod2ndMenu"]);Line 4630: Line 4631: if ( rdr["cod3rdMenu"] != DBNull.Value && Convert.ToInt32(rdr["cod3rdMenu"]) > 0 ) {Line 4632: menu3rd = Convert.ToString(rdr["menu3rd"]);Line 4633: cod3rdMenu = Convert.ToInt32(rdr["cod3rdMenu"]);Line 4634: }Line 4635: }Line 4636: Line 4637: jsonLd = @"Line 4638: {Line 4639: '@context': 'http://schema.org',Line 4640: '@type': 'BreadcrumbList',Line 4641: 'itemListElement': [Line 4642: {$0}Line 4643: {$1}Line 4644: {$2}Line 4645: {$3}Line 4646: ]Line 4647: }Line 4648: ";Line 4649: Line 4650: string sName = shop.Http.Replace("http://", "").Replace("/octopus/", "");Line 4651: string sUrl = shop.Http.Replace("/octopus/", "");Line 4652: string listItem = @"Line 4653: {Line 4654: '@type': 'ListItem',Line 4655: 'position': '{$pos}',Line 4656: 'item': {Line 4657: '@id': '{$url}',Line 4658: 'name': '{$name}'Line 4659: }Line 4660: }Line 4661: ";Line 4662: jsonLd = jsonLd.Replace( "{$0}", listItem.Replace( "{$name}", sName ).Replace( "{$pos}", "1" ).Replace( "{$url}", sUrl ) );Line 4663: Line 4664: menuHref = Generics.menuAnchorHref( shop.Http, ZenTools.urlize(menu1st), "", "", shopId, cod1stMenu, 0, 0, thisConfig );Line 4665: Sb.Append( "<div class='breadcrumb'>" + Environment.NewLine );Line 4666: Sb.Append( "<a href='" + sUrl + "'><span>" + sName + "</span></a>" + Environment.NewLine );Line 4667: Sb.Append( "<a href='" + menuHref + "'><span>" + menu1st + "</span></a>" + Environment.NewLine );Line 4668: jsonLd = jsonLd.Replace( "{$1}", "," + listItem.Replace( "{$name}", menu1st ).Replace( "{$pos}", "2" ).Replace( "{$url}", menuHref ) );Line 4669: Line 4670: if ( cod2ndMenu > 0 ) {Line 4671: menuHref = Generics.menuAnchorHref( shop.Http, ZenTools.urlize(menu1st), ZenTools.urlize(menu2nd), "", shopId, cod1stMenu, cod2ndMenu, 0, thisConfig );Line 4672: Sb.Append( "<a href='" + menuHref + "'><span>" + menu2nd + "</span></a>" + Environment.NewLine );Line 4673: jsonLd = jsonLd.Replace( "{$2}", "," + listItem.Replace( "{$name}", menu2nd ).Replace( "{$pos}", "3" ).Replace( "{$url}", menuHref ) );Line 4674: Line 4675: if ( cod3rdMenu > 0 ) {Line 4676: menuHref = Generics.menuAnchorHref(Line 4677: shop.Http,Line 4678: ZenTools.urlize(menu1st),Line 4679: ZenTools.urlize(menu2nd),Line 4680: ZenTools.urlize(menu3rd),Line 4681: shopId,Line 4682: cod1stMenu,Line 4683: cod2ndMenu,Line 4684: cod3rdMenu,Line 4685: thisConfigLine 4686: );Line 4687: Sb.Append( "<a href='" + menuHref + "'><span>" + menu3rd + "</span></a>" + Environment.NewLine );Line 4688: jsonLd = jsonLd.Replace( "{$3}", "," + listItem.Replace( "{$name}", menu3rd ).Replace( "{$pos}", "4" ).Replace( "{$url}", menuHref ) );Line 4689: }Line 4690: }Line 4691: Sb.Append( "</div>" );Line 4692: Line 4693: jsonLd = jsonLd.Replace("{$2}", "").Replace("{$3}", "").Replace("{$4}", "");Line 4694: Line 4695: Sb.Append( Environment.NewLine );Line 4696: Sb.Append( "<script type='application/ld+json'>" );Line 4697: Sb.Append( jsonLd.Replace("\'", "\"") );Line 4698: Sb.Append( "</script" + ">" );Line 4699: Sb.Append( Environment.NewLine );Line 4700: }Line 4701: Line 4702: rdr.Close();Line 4703: conn.Close();Line 4704: Line 4705: return Sb.ToString();Line 4706: }Line 4707: Line 4708: public static string getProductMenu(string path, int idProd) {Line 4709: string output = "";Line 4710: Line 4711: SqlConnection conn = new SqlConnection(path);Line 4712: conn.Open();Line 4713: Line 4714: string query = @"Line 4715: SELECT TOP 1Line 4716: R.cod1stMenu,Line 4717: R.cod2ndMenu,Line 4718: R.cod3rdMenu,Line 4719: M1.[desc] AS menu1st,Line 4720: M2.[desc] AS menu2nd,Line 4721: M3.[desc] AS menu3rdLine 4722: FROM rel_menusWprod R WITH (NOLOCK)Line 4723: INNER JOIN tbl_menu1st M1 WITH (NOLOCK) ON R.cod1stMenu = M1.cod1stMenuLine 4724: LEFT OUTER JOIN tbl_menu2nd M2 WITH (NOLOCK) ON R.cod2ndMenu = M2.cod2ndMenuLine 4725: LEFT OUTER JOIN tbl_menu3rd M3 WITH (NOLOCK) ON R.cod3rdMenu = M3.cod3rdMenuLine 4726: WHERE (R.codProd = @codProd)Line 4727: ORDER BYLine 4728: CASE WHEN NOT R.cod3rdMenu IS NULL THEN 0 ELSE 1 END,Line 4729: CASE WHEN NOT R.cod2ndMenu IS NULL THEN 0 ELSE 1 ENDLine 4730: ";Line 4731: Line 4732: SqlCommand cmd = new SqlCommand(query, conn);Line 4733: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 4734: cmd.Parameters["@codProd"].Value = idProd;Line 4735: SqlDataReader rdr = cmd.ExecuteReader();Line 4736: Line 4737: if ( rdr.Read() ) {Line 4738: output = Convert.ToString(rdr["menu1st"]).Trim();Line 4739: if ( rdr["cod2ndMenu"] != DBNull.Value && Convert.ToInt32(rdr["cod2ndMenu"]) > 0 ) {Line 4740: output = Convert.ToString(rdr["menu2nd"]).Trim();Line 4741: if ( rdr["cod3rdMenu"] != DBNull.Value && Convert.ToInt32(rdr["cod3rdMenu"]) > 0 ) {Line 4742: output = Convert.ToString(rdr["menu3rd"]).Trim();Line 4743: }Line 4744: }Line 4745: }Line 4746: rdr.Close();Line 4747: conn.Close();Line 4748: Line 4749: return output;Line 4750: }Line 4751: Line 4752: public static string getProductMenus(string path, int idProd) {Line 4753: string output = "";Line 4754: Line 4755: StringBuilder Sb = new StringBuilder();Line 4756: SqlConnection conn = new SqlConnection(path);Line 4757: conn.Open();Line 4758: Line 4759: string query = @"Line 4760: SELECTLine 4761: rel_menusWprod.cod1stMenu,Line 4762: rel_menusWprod.cod2ndMenu,Line 4763: rel_menusWprod.cod3rdMenuLine 4764: FROM rel_menusWprod WITH (NOLOCK)Line 4765: WHERE (rel_menusWprod.codProd = @codProd)Line 4766: ";Line 4767: Line 4768: SqlCommand cmd = new SqlCommand(query, conn);Line 4769: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 4770: cmd.Parameters["@codProd"].Value = idProd;Line 4771: SqlDataReader rdr = cmd.ExecuteReader();Line 4772: Line 4773: while( rdr.Read() ) {Line 4774: if ( rdr["cod1stMenu"] != DBNull.Value ) {Line 4775: Sb.Append( "," + Convert.ToString(rdr["cod1stMenu"]) );Line 4776: Line 4777: if ( rdr["cod2ndMenu"] != DBNull.Value ) {Line 4778: Sb.Append( "_" + Convert.ToString(rdr["cod2ndMenu"]) );Line 4779: Line 4780: if ( rdr["cod3rdMenu"] != DBNull.Value ) {Line 4781: Sb.Append( "_" + Convert.ToString(rdr["cod3rdMenu"]) );Line 4782: }Line 4783: }Line 4784: }Line 4785: }Line 4786: Line 4787: rdr.Close();Line 4788: conn.Close();Line 4789: Line 4790: output = Sb.ToString();Line 4791: if ( output.Length > 0 ) {Line 4792: output = output.Substring(1);Line 4793: }Line 4794: return output;Line 4795: }Line 4796: Line 4797: }Line 4798: Line 4799: Line 4800: Line 4801: Line 4802: Line 4803: Line 4804: Line 4805: Line 4806: Line 4807: Line 4808: public class ExtDetails {Line 4809: public ExtDetails() {}Line 4810: Line 4811: public static string Images(int shopId, int codGrid, string imgSize, string prodDesc, ShopSetup shop) {Line 4812: string[] img_sizes = shop.getImgSize(imgSize.ToUpper());Line 4813: string img_src = "";Line 4814: string img_alt = "";Line 4815: string img_zoom_fn = "";Line 4816: StringBuilder Sb = new StringBuilder();Line 4817: Line 4818: img_src = Details.getProductImgSrc(shopId, codGrid, shop, out img_alt);Line 4819: if ( img_alt == "" )Line 4820: img_alt = prodDesc;Line 4821: Line 4822: img_zoom_fn = "javascript:void(0);";Line 4823: if ( shop.UseZoom )Line 4824: img_zoom_fn = string.Format("javascript:_popZoom({0}, {1}, \"{2}\")", shopId, codGrid, img_src.Replace("{size}", "z"));Line 4825: Line 4826: Sb.Append(Line 4827: string.Format(Line 4828: @"Line 4829: <a href='{0}'>Line 4830: <img id='extra_details_{1}_image' src='{2}' alt='{3}' width='{4}' height='{5}' />Line 4831: </a>Line 4832: ",Line 4833: img_zoom_fn,Line 4834: imgSize,Line 4835: img_src.Replace("{size}", imgSize),Line 4836: img_alt,Line 4837: img_sizes[0],Line 4838: img_sizes[1]Line 4839: )Line 4840: );Line 4841: Line 4842: if ( shop.UseZoom ) {Line 4843: Sb.Append(Line 4844: string.Format(Line 4845: @"Line 4846: <div id='{0}'>Line 4847: <a href='{1}'>Line 4848: <img src='/octopus/design/images/{2}/{3}.gif' alt='' />Line 4849: </a>Line 4850: </div>Line 4851: ",Line 4852: (imgSize.Equals("b") ? "details_images_zoom" : "extra-details-images-zoom"),Line 4853: img_zoom_fn,Line 4854: shopId,Line 4855: (imgSize.Equals("b") ? "details_zoom" : "extra_details_zoom")Line 4856: )Line 4857: );Line 4858: }Line 4859: Line 4860: if ( imgSize.Equals("b") )Line 4861: Sb.Append( "<script type='text/javascript'>zoomSrc = '" + img_src + "';</" + "script>\n");Line 4862: Line 4863: return Sb.ToString();Line 4864: }Line 4865: Line 4866: public static string Texts(int shopId, int codGrid, int userGroup, string codComp, ShopSetup shop, string userAgent, Promotion P) {Line 4867: int i=0;string ndd="";for(i=0; i<shop.NDD; i++)ndd+="0";Line 4868: Line 4869: // deprecated 2014-08-18 (extra details cache)Line 4870: //int userGroup = 1; if (userId>0)userGroup=UserSetup.UserGroup(shop.Path, userId);Line 4871: Line 4872: int iCodGrid = 0;Line 4873: int iStockQt = 0;Line 4874: int maxQt = 100;Line 4875: decimal thisPrice = 0;Line 4876: decimal thisDiscRate = 0;Line 4877: Line 4878: StringBuilder Sb = new StringBuilder();Line 4879: Line 4880: SqlConnection conn = new SqlConnection(shop.Path);Line 4881: conn.Open();Line 4882: Line 4883: string query = @"Line 4884: SELECTLine 4885: sys_prodStatus.[desc] AS StatusDesc,Line 4886: tbl_details.[desc] AS DetDesc,Line 4887: tbl_grid.codGrid,Line 4888: tbl_grid.codProd,Line 4889: tbl_prices.prc,Line 4890: tbl_prices.object,Line 4891: tbl_prices.discRate,Line 4892: tbl_grid.codProd,Line 4893: tbl_prod.imgDepth,Line 4894: tbl_prod.codBrand,Line 4895: sys_prodStatus.codStatus,Line 4896: sys_prodAvailability.codAvailability,Line 4897: sys_prodAvailability.[desc] AS AvailDesc,Line 4898: sys_stock.qtLine 4899: FROM tbl_prod WITH (NOLOCK)Line 4900: INNER JOIN tbl_grid WITH (NOLOCK) ON tbl_prod.codProd = tbl_grid.codProdLine 4901: INNER JOIN tbl_prices WITH (NOLOCK) ON tbl_grid.codGrid = tbl_prices.codGridLine 4902: INNER JOIN sys_prodAvailability WITH (NOLOCK) ON tbl_prices.codAvailability = sys_prodAvailability.codAvailabilityLine 4903: INNER JOIN sys_prodStatus WITH (NOLOCK) ON tbl_prices.codStatus = sys_prodStatus.codStatusLine 4904: INNER JOIN tbl_details WITH (NOLOCK) ON tbl_prod.codProd = tbl_details.codProdLine 4905: INNER JOIN sys_stock WITH (NOLOCK) ON tbl_grid.codGrid = sys_stock.codGridLine 4906: WHERE (tbl_grid.active = 1) AND (tbl_details.codTitle = 1) AND (tbl_grid.codGrid = @codGrid) AND (tbl_prices.codGroup = @userGroup)Line 4907: ";Line 4908: Line 4909: SqlCommand cmd = new SqlCommand(query, conn);Line 4910: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 4911: cmd.Parameters.Add(new SqlParameter("@userGroup", SqlDbType.Int));Line 4912: cmd.Parameters["@codGrid"].Value = codGrid;Line 4913: cmd.Parameters["@userGroup"].Value = userGroup;Line 4914: Line 4915: SqlDataReader rdr = cmd.ExecuteReader();Line 4916: Line 4917: if (rdr.Read()) {Line 4918: iCodGrid = (int)rdr["codGrid"];Line 4919: Line 4920: if ( (int)rdr["codStatus"] != 4 ) {Line 4921: Sb.Append( " <div class='extra_details_text_availability'>\n" );Line 4922: Line 4923: if ( (int)rdr["codAvailability"] < 2 && (decimal)rdr["prc"] > 0 ) {Line 4924: Sb.Append( " <span class='item_qt_buy'><label for='qt_" + iCodGrid + "'><font>Quantidade:</font></label></span>" );Line 4925: Sb.Append( " <select size='1' id='qt_" + iCodGrid + "' class='extra_details_qt' name='r_1' data-shopId='" + shopId + "' data-userGroup='" + userGroup + "' data-gridId='" + iCodGrid + "'>\n" );Line 4926: Sb.Append( " <option value='0'>0</option>\n" );Line 4927: Line 4928: iStockQt = Convert.ToInt32( rdr["qt"] );Line 4929: if ( null != shop.getConfig("StockMaxQt") && !shop.getConfig("StockMaxQt").Equals("") )Line 4930: maxQt = Convert.ToInt32(shop.getConfig("StockMaxQt"));Line 4931: if ( iStockQt < maxQt )Line 4932: maxQt = iStockQt;Line 4933: Line 4934: Line 4935: Line 4936: // check promotionsLine 4937: try {Line 4938: object oJson = JavaScriptDeserializer.DeserializeFromJson(Line 4939: P.getEffect(Line 4940: Convert.ToInt32(rdr["codBrand"]),Line 4941: Details.getProductMenus(shop.Path, Convert.ToInt32(rdr["codProd"])),Line 4942: codGrid,Line 4943: 0,Line 4944: ""Line 4945: ),Line 4946: typeof(NameValueCollection)Line 4947: );Line 4948: Line 4949: // set product quantity by promotionLine 4950: if ( Convert.ToInt32(((NameValueCollection)oJson)["id"]) > 0 && ((NameValueCollection)oJson)["products"] != "" ) {Line 4951: string[] products = Convert.ToString(((NameValueCollection)oJson)["products"]).Split(',');Line 4952: foreach( string product in products ) {Line 4953: string[] arr = product.Split('_');Line 4954: if ( iCodGrid == Convert.ToInt32(arr[0]) && Convert.ToInt32(arr[1]) > 0 ) {Line 4955: if ( maxQt > Convert.ToInt32(arr[1]) ) {Line 4956: maxQt = Convert.ToInt32(arr[1]);Line 4957: }Line 4958: }Line 4959: }Line 4960: }Line 4961: } catch ( Exception e ) {}Line 4962: Line 4963: Line 4964: Line 4965: for( i = 1;i <= maxQt; i++ ) {Line 4966: Sb.Append( " <option value='" + iCodGrid + ";" + i + "'>" + i + "</option>\n" );Line 4967: }Line 4968: Line 4969: Sb.Append( " </select>\n" );Line 4970: }Line 4971: Line 4972: Sb.Append( " <div class='extra_details_text_availability_label'>" + (string)rdr["AvailDesc"] + "</div>\n" );Line 4973: Sb.Append( " </div>\n" );Line 4974: }Line 4975: Line 4976: if ( null != codComp && !codComp.Equals("") ) {Line 4977: Sb.Append( " <div class='extra_details_text_product'>\n" );Line 4978: Sb.Append( " <h3>" + Select(shopId, shop.Path, codComp, (int)rdr["codProd"]) + "</h3>\n" );Line 4979: Sb.Append( " </div>\n" );Line 4980: }Line 4981: Line 4982: if ((int)rdr["codAvailability"] < 2 && (decimal)rdr["prc"] > 0) {Line 4983: thisPrice = Convert.ToDecimal(rdr["prc"]);Line 4984: thisDiscRate = Convert.ToDecimal(rdr["discRate"]);Line 4985: Line 4986: Line 4987: Line 4988: // check promotionsLine 4989: try {Line 4990: object oJson = JavaScriptDeserializer.DeserializeFromJson(Line 4991: P.getEffect(Line 4992: Convert.ToInt32(rdr["codBrand"]),Line 4993: Details.getProductMenus(shop.Path, Convert.ToInt32(rdr["codProd"])),Line 4994: codGrid,Line 4995: 0,Line 4996: ""Line 4997: ),Line 4998: typeof(NameValueCollection)Line 4999: );Line 5000: Line 5001: if ( Convert.ToInt32(((NameValueCollection)oJson)["id"]) > 0 ) {Line 5002: switch( Convert.ToString(((NameValueCollection)oJson)["discountType"]) ) {Line 5003: case "percent":Line 5004: thisDiscRate += Convert.ToDecimal(((NameValueCollection)oJson)["discountValue"]);Line 5005: break;Line 5006: case "fixed" : break;Line 5007: case "freeShipping": break;Line 5008: }Line 5009: Line 5010: // display active promotionLine 5011: Sb.Append( "\n<div class='extra_details_promotion'>\n" );Line 5012: Sb.Append( " <span class='extra_details_promotion_name'>" + Convert.ToString(((NameValueCollection)oJson)["name"]) + "</span>\n" );Line 5013: Sb.Append( " <span class='extra_details_promotion_description'>" + Convert.ToString(((NameValueCollection)oJson)["description"]) + "</span>\n" );Line 5014: Sb.Append( "</div>\n\n" );Line 5015: }Line 5016: Line 5017: } catch ( Exception e ) {Line 5018: thisPrice = Convert.ToDecimal(rdr["prc"]);Line 5019: }Line 5020: Line 5021: Line 5022: Line 5023: Sb.Append( Prices(shopId, (int)rdr["codGrid"], thisPrice, thisDiscRate, shop) );Line 5024: }Line 5025: Line 5026: if ( (int)rdr["codAvailability"] == 2 || (decimal)rdr["prc"] == 0 ) {Line 5027: Sb.Append( " <div class='extra_details_in_stock_notification'>\n" );Line 5028: Line 5029: if (shop.getConfig("InStockNotification").Length > 0) {Line 5030: string sJson = Convert.ToString( shop.getConfig("InStockNotification") );Line 5031: try {Line 5032: object oJson = JavaScriptDeserializer.DeserializeFromJson(sJson, typeof(NameValueCollection));Line 5033: Sb.Append( " <a href='#' onclick=\"javascript:popInStockNotification(" + shopId + "," + codGrid + "," + ((NameValueCollection)oJson)["popWidth"] + "," + ((NameValueCollection)oJson)["popHeight"] + "); return false;\" class='in_stock_notification'><font >Avise-me ao chegar</font></a>\n" );Line 5034: } catch (Exception e) {}Line 5035: }Line 5036: Line 5037: Sb.Append( " </div>\n" );Line 5038: }Line 5039: }Line 5040: Line 5041: rdr.Close();Line 5042: conn.Close();Line 5043: Line 5044: return Sb.ToString();Line 5045: }Line 5046: Line 5047: public static string Prices(int shopId, int codGrid, decimal price, decimal discRate, ShopSetup shop) {Line 5048: int i=0;string ndd="";for(i=0; i<shop.NDD; i++)ndd+="0";Line 5049: Line 5050: StringBuilder Sb = new StringBuilder();Line 5051: Line 5052: int thisStockQt = 1;Line 5053: if (shop.UseSC)thisStockQt=Stock.Qt(shop.Path,codGrid);Line 5054: Line 5055: if (thisStockQt>0) {Line 5056: Line 5057: SqlConnection conn = new SqlConnection(shop.Path);Line 5058: conn.Open();Line 5059: Line 5060: string query = @"Line 5061: SELECTLine 5062: tbl_acronyms.[desc] AS acroDesc,Line 5063: tbl_acronyms.acronymLine 5064: FROM tbl_grid WITH (NOLOCK)Line 5065: INNER JOIN tbl_prod WITH (NOLOCK) ON tbl_prod.codProd = tbl_grid.codProdLine 5066: INNER JOIN tbl_acronyms WITH (NOLOCK) ON tbl_prod.codUn = tbl_acronyms.codUnLine 5067: WHERE tbl_grid.codGrid = @codGridLine 5068: ";Line 5069: SqlCommand cmd = new SqlCommand(query, conn);Line 5070: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 5071: cmd.Parameters["@codGrid"].Value = codGrid;Line 5072: SqlDataReader rdr = cmd.ExecuteReader();Line 5073: Line 5074: string acroDesc = "";Line 5075: string acronym = "";Line 5076: Line 5077: if (rdr.Read()) {Line 5078: acroDesc = (string)rdr[0];Line 5079: acronym = (string)rdr[1];Line 5080: }Line 5081: Line 5082: rdr.Close();Line 5083: Line 5084: Sb.Append( " <div class='extra_details_text_price'>\n" );Line 5085: Sb.Append( "<span class='label'>por:</span><span id='variant-" + codGrid + "-prc' class='price'>"+ shop.CurrType + string.Format("{0:0."+ ndd +"}",((1-discRate/100)*price)) + "</span><acronym title="+ acroDesc +"> / "+ acronym +" </acronym>\n" ); //(A - B)Line 5086: Sb.Append( " </div>\n" );Line 5087: Line 5088: conn.Close();Line 5089: Line 5090: if( shop.Next.wishlist != null ) {Line 5091: Sb.Append( string.Format(Line 5092: @"Line 5093: <div class='wishlist_add_item'>Line 5094: <a href='/wishlist/add-item/?id={0}' onclick='wl_add(event, {0})'><span>ADD_TO_WISHLIST</span></a>Line 5095: </div>Line 5096: ", codGridLine 5097: ) );Line 5098: }Line 5099: Line 5100: if( shop.Next.favorites != null ) {Line 5101: Sb.Append( string.Format(Line 5102: @"Line 5103: <div class='favorites_add_item'>Line 5104: <a href='/wishlist/save-favorite-item/?id={0}' onclick='fav_add(event, {0})'><span>ADD_TO_FAVORITES</span></a>Line 5105: </div>Line 5106: ", codGridLine 5107: ) );Line 5108: }Line 5109: Line 5110: }Line 5111: Line 5112: return Sb.ToString();Line 5113: }Line 5114: Line 5115: public static string Select(int shopId, string path, string codComp, int codProd) {Line 5116: string[] options = ZenTools.Split(codComp,';');Line 5117: Line 5118: StringBuilder Sb = new StringBuilder();Line 5119: Line 5120: SqlConnection conn = new SqlConnection(path);Line 5121: conn.Open();Line 5122: Line 5123: for( int i = 0; i < options.Length;i++ ) {Line 5124: string query = "SELECT codOption, [desc] AS DescOption FROM tbl_selectOptions WITH (NOLOCK) WHERE (codOption = @codOption) ORDER BY dspOrder, [desc]";Line 5125: SqlCommand cmd = new SqlCommand(query, conn);Line 5126: cmd.Parameters.Add(new SqlParameter("@codOption", SqlDbType.Int));Line 5127: cmd.Parameters["@codOption"].Value = options[i];Line 5128: SqlDataReader rdr = cmd.ExecuteReader();Line 5129: Line 5130: if (rdr.Read()) {Line 5131: Sb.Append( (string)rdr["DescOption"] + " " );Line 5132: }Line 5133: Line 5134: rdr.Close();Line 5135: }Line 5136: Line 5137: conn.Close();Line 5138: Line 5139: return Sb.ToString();Line 5140: }Line 5141: Line 5142: public static void GVariants(ref SqlConnection conn, ref dynamic GProduct) {Line 5143: string composition = Convert.ToString(GProduct.composition);Line 5144: if( composition == "" )Line 5145: return;Line 5146: Line 5147: composition = composition.Replace(";", ",").Substring( 0, composition.Length - 1 );Line 5148: Line 5149: SqlCommand cmd = new SqlCommand( string.Format(Line 5150: @"Line 5151: SELECTLine 5152: S.[desc] AS variant,Line 5153: SO.[desc] AS valueLine 5154: FROM tbl_selectOptions SO WITH (NOLOCK)Line 5155: JOIN tbl_selects S ON SO.[codSelect] = S.[codSelect]Line 5156: WHERE SO.[codOption] IN ({0})Line 5157: ", composition ), conn );Line 5158: SqlDataReader rdr = cmd.ExecuteReader();Line 5159: while( rdr.Read() ) {Line 5160: switch( Convert.ToString(rdr["variant"]).ToLower().Split(' ')[0] ) {Line 5161: case "cor":Line 5162: case "cores":Line 5163: GProduct.color = Convert.ToString(rdr["value"]);Line 5164: break;Line 5165: Line 5166: // case "tamanho":Line 5167: // case "tamanhos":Line 5168: // GProduct.size = Convert.ToString(rdr["value"]);Line 5169: // break;Line 5170: Line 5171: default:Line 5172: /* Nothing to do. */Line 5173: break;Line 5174: }Line 5175: }Line 5176: rdr.Close();Line 5177: }Line 5178: Line 5179: }Line 5180: Line 5181: Line 5182: Line 5183: Line 5184: Line 5185: Line 5186: Line 5187: Line 5188: Line 5189: Line 5190: public class QuickView {Line 5191: public QuickView(){}Line 5192: Line 5193: public static string Select(Line 5194: int shopId,Line 5195: string path,Line 5196: string selectsList,Line 5197: int codOption,Line 5198: int codProd,Line 5199: string codCompApproach,Line 5200: int imageDepth,Line 5201: int levels,Line 5202: int level,Line 5203: int userGroup,Line 5204: ShopSetup shopLine 5205: ) {Line 5206: string[] selects = ZenTools.Split(selectsList,';');Line 5207: string[] availability;Line 5208: Line 5209: string fn = "";Line 5210: int iCodGrid = 0;Line 5211: bool useSelsCtrl = false;Line 5212: Line 5213: StringBuilder Sb = new StringBuilder();Line 5214: Line 5215: if ( levels > 1 ) {Line 5216: fn = String.Format(Line 5217: "getNextSelect({0}, {1}, {2})"Line 5218: , codProd, levels, (level + 1)Line 5219: );Line 5220: } else {Line 5221: fn = "getApproach(this.value)";Line 5222: }Line 5223: Line 5224: if ( shop.getConfig("UseSelectsControl") != "" && shop.getConfig("UseSelectsControl").ToLower() == "true" ) {Line 5225: useSelsCtrl = true;Line 5226: }Line 5227: Line 5228: if ( useSelsCtrl ) {Line 5229: Sb.Append("<select class='a _selectsctrl_ quickview_select' name='s" + level + "' onchange='" + fn + "'><option value='0'>Selecione</option>" );Line 5230: } else {Line 5231: Sb.Append( "<select class='a quickview_select' name='s" + level + "' onchange='" + fn + "'>" );Line 5232: }Line 5233: Line 5234: SqlConnection conn = new SqlConnection(path);Line 5235: conn.Open();Line 5236: Line 5237: string query = @"Line 5238: SELECTLine 5239: codOption,Line 5240: [desc] AS DescOption,Line 5241: ( SELECT count(codGrid) FROM tbl_grid G WITH (NOLOCK) WHERE G.active = 1 AND G.codProd = @codProd AND codComp LIKE @codApproach + CAST(SO.codOption AS nvarchar(32)) + ';%' ) AS boolLine 5242: FROM tbl_selectOptions SO WITH (NOLOCK)Line 5243: WHERE (codSelect = @codSelect)Line 5244: ORDER BY dspOrder, [desc]Line 5245: ";Line 5246: Line 5247: string codOptionCollection = "";Line 5248: Line 5249: SqlCommand cmd = new SqlCommand(query, conn);Line 5250: Line 5251: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 5252: cmd.Parameters["@codProd"].Value = codProd;Line 5253: Line 5254: cmd.Parameters.Add(new SqlParameter("@codApproach", SqlDbType.NVarChar));Line 5255: cmd.Parameters["@codApproach"].Value = codCompApproach;Line 5256: Line 5257: cmd.Parameters.Add(new SqlParameter("@codSelect", SqlDbType.Int));Line 5258: cmd.Parameters["@codSelect"].Value = selects[level];Line 5259: Line 5260: SqlDataReader rdr = cmd.ExecuteReader();Line 5261: Line 5262: while(rdr.Read()) {Line 5263: if ( (int)rdr["bool"] > 0 ) {Line 5264: iCodGrid = Details.CodProdCodCompApproach2CodGrid( shopId, codProd, codCompApproach + Convert.ToString(rdr["codOption"]), shop );Line 5265: availability = Details.availabilityStatus( path, iCodGrid, userGroup );Line 5266: Line 5267: Sb.Append(Line 5268: String.Format(Line 5269: "<option value='{0}' {1}>{2} {3}</option>{4}"Line 5270: , ( levels > 1 ? (int)rdr["codOption"] : iCodGrid )Line 5271: , ( codOption == (int)rdr["codOption"] ? "selected='selected'" : "" )Line 5272: , Convert.ToString(rdr["DescOption"])Line 5273: , ( (levels == (level + 1)) && (Convert.ToInt32(availability[0]) > 1) ? "( " + availability[1] + " )" : "" )Line 5274: , Environment.NewLineLine 5275: )Line 5276: );Line 5277: Line 5278: }Line 5279: }Line 5280: Line 5281: rdr.Close();Line 5282: conn.Close();Line 5283: Line 5284: Sb.Append( "</select>" );Line 5285: Line 5286: return Sb.ToString();Line 5287: }Line 5288: Line 5289: public static string Availability(int shopId, int codGrid, int userGroup, ShopSetup shop, string promotion_sJson) {Line 5290: StringBuilder Sb = new StringBuilder();Line 5291: Line 5292: int i = 0;Line 5293: int maxQt = 100;Line 5294: int iStockQt = 10;Line 5295: int codAvailability = 0;Line 5296: int qtStep = 1;Line 5297: Line 5298: decimal iPrice = 0;Line 5299: string[] thisAvailability = new string[3];Line 5300: string sJson = "";Line 5301: Line 5302: SqlConnection conn = new SqlConnection(shop.Path);Line 5303: conn.Open();Line 5304: Line 5305: string query = "SELECT prc, codAvailability, object FROM tbl_prices WITH (NOLOCK) WHERE codGroup = @userGroup AND codGrid = @codGrid";Line 5306: SqlCommand cmd = new SqlCommand(query, conn);Line 5307: cmd.Parameters.Add(new SqlParameter("@userGroup", SqlDbType.Int));Line 5308: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 5309: cmd.Parameters["@userGroup"].Value = userGroup;Line 5310: cmd.Parameters["@codGrid"].Value = codGrid;Line 5311: SqlDataReader rdr = cmd.ExecuteReader();Line 5312: if (rdr.Read()) {Line 5313: iPrice = (decimal)rdr["prc"];Line 5314: codAvailability = (int)rdr["codAvailability"];Line 5315: sJson = Convert.ToString(rdr["object"]);Line 5316: }Line 5317: rdr.Close();Line 5318: Line 5319: query = "SELECT [desc] FROM sys_prodAvailability WITH (NOLOCK) ORDER BY codAvailability";Line 5320: cmd = new SqlCommand(query,conn);Line 5321: rdr = cmd.ExecuteReader();Line 5322: while(rdr.Read())thisAvailability[i++]=(string)rdr["desc"];Line 5323: rdr.Close();Line 5324: Line 5325: conn.Close();Line 5326: Line 5327: if (shop.UseSC)iStockQt=Stock.Qt(shop.Path, codGrid);Line 5328: Line 5329: if ( null != shop.getConfig("StockMaxQt") && !shop.getConfig("StockMaxQt").Equals("") )Line 5330: maxQt = Convert.ToInt32(shop.getConfig("StockMaxQt"));Line 5331: if ( iStockQt < maxQt )Line 5332: maxQt = iStockQt;Line 5333: Line 5334: if (codAvailability==1 && iPrice<=0)codAvailability=2;Line 5335: Line 5336: Sb.Append( "<div id='quickview-texts-availability-label-" + codAvailability + "'><label>Disponibilidade: </label>" + thisAvailability[codAvailability-1] + "</div>\n" );Line 5337: Line 5338: if ( codAvailability == 1 ) {Line 5339: Sb.Append( "<div id='quickview-texts-availability-field'><span class='item_qt_buy'><label for='r_0'><font>Quantidade:</font></label>" );Line 5340: Line 5341: if (shop.isRetail) {Line 5342: Sb.Append( "<select id='r_0' name='r_0'>" );Line 5343: Line 5344: Line 5345: Line 5346: // set product quantity by promotionLine 5347: if ( promotion_sJson != "{}" ) {Line 5348: try {Line 5349: object oJson = JavaScriptDeserializer.DeserializeFromJson(promotion_sJson, typeof(NameValueCollection));Line 5350: if ( ((NameValueCollection)oJson)["products"] != "" ) {Line 5351: string[] products = Convert.ToString(((NameValueCollection)oJson)["products"]).Split(',');Line 5352: foreach( string product in products ) {Line 5353: string[] arr = product.Split('_');Line 5354: if ( codGrid == Convert.ToInt32(arr[0]) && Convert.ToInt32(arr[1]) > 0 ) {Line 5355: if ( maxQt > Convert.ToInt32(arr[1]) ) {Line 5356: maxQt = Convert.ToInt32(arr[1]);Line 5357: }Line 5358: }Line 5359: }Line 5360: }Line 5361: } catch ( Exception e ) {}Line 5362: }Line 5363: Line 5364: Line 5365: Line 5366: for( i = 1; ( i <= maxQt ); i++ ) {Line 5367: Sb.Append( "<option value='" + i + "'>" + i + "</option>" );Line 5368: }Line 5369: Sb.Append( "</select>" );Line 5370: } else {Line 5371: try {Line 5372: object oJson = JavaScriptDeserializer.DeserializeFromJson(sJson, typeof(NameValueCollection));Line 5373: if ( ((NameValueCollection)oJson)["qtIncrement"] != null && ((NameValueCollection)oJson)["qtIncrement"] != "" ) {Line 5374: qtStep = Convert.ToInt32(((NameValueCollection)oJson)["qtIncrement"]);Line 5375: }Line 5376: } catch ( Exception ex ) {}Line 5377: Line 5378: Sb.Append(Line 5379: String.Format(Line 5380: "<input type='number' step='{0}' min='0' class='n' size='3' id='r_0' name='r_0' value='' onclick='select()' />"Line 5381: , qtStepLine 5382: )Line 5383: );Line 5384: }Line 5385: Line 5386: Sb.Append( "</span>" );Line 5387: Sb.Append( "<button id='quickview-add2cart' class='item_btn_buy' onclick='req_addItem(" + codGrid + ")'>comprar</button>" );Line 5388: Sb.Append( "</div>\n" );Line 5389: }Line 5390: Line 5391: return Sb.ToString();Line 5392: }Line 5393: }Line 5394: Line 5395: Line 5396: Line 5397: Line 5398: Line 5399: Line 5400: Line 5401: Line 5402: Line 5403: Line 5404: public class Cart {Line 5405: public Cart() {}Line 5406: Line 5407: public static int Qt(string path, string cartId, int codGrid) {Line 5408: int output = 0;Line 5409: Line 5410: SqlConnection conn = new SqlConnection(path);Line 5411: conn.Open();Line 5412: Line 5413: string query = "SELECT qt FROM sys_cart WITH (NOLOCK) WHERE (cid = @cid) AND (codGrid = @codGrid)";Line 5414: SqlCommand cmd = new SqlCommand(query, conn);Line 5415: cmd.Parameters.Add(new SqlParameter("@cid", SqlDbType.NVarChar));Line 5416: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 5417: cmd.Parameters["@cid"].Value = cartId;Line 5418: cmd.Parameters["@codGrid"].Value = codGrid;Line 5419: Line 5420: output = Convert.ToInt32(cmd.ExecuteScalar());Line 5421: Line 5422: conn.Close();Line 5423: Line 5424: return output;Line 5425: }Line 5426: Line 5427: public static int ItemsQt(string path, string cartId) {Line 5428: int output = 0;Line 5429: Line 5430: SqlConnection conn = new SqlConnection(path);Line 5431: conn.Open();Line 5432: Line 5433: string query = "SELECT count(cid) FROM sys_cart WITH (NOLOCK) WHERE cid = @cid";Line 5434: SqlCommand cmd = new SqlCommand(query, conn);Line 5435: cmd.Parameters.Add(new SqlParameter("@cid", SqlDbType.NVarChar));Line 5436: cmd.Parameters["@cid"].Value = cartId;Line 5437: Line 5438: output = Convert.ToInt32(cmd.ExecuteScalar());Line 5439: Line 5440: conn.Close();Line 5441: Line 5442: return output;Line 5443: }Line 5444: Line 5445: public static string Add(int shopId, string cartId, int codGrid, int qt, ShopSetup shop) {Line 5446: return Add(shopId, cartId, codGrid, qt, 0, shop, null);Line 5447: }Line 5448: Line 5449: public static string Add(int shopId, string cartId, int codGrid, int qt, int idBt, ShopSetup shop, Promotion P) {Line 5450: int r = 0;Line 5451: string output = "";Line 5452: Line 5453: SqlConnection conn = new SqlConnection(shop.Path);Line 5454: conn.Open();Line 5455: Line 5456: try {Line 5457: if ( shop.UseSC ) {Line 5458: r = Stock.Qt(shop.Path, codGrid);Line 5459: if (r<qt)return "Estoque insuficiente. Apenas " + r + " disponveis.";Line 5460: }Line 5461: Line 5462: r = Cart.Qt(shop.Path, cartId, codGrid);Line 5463: if (r > 0) {Line 5464: if( shop.Next.webluto != null && Convert.ToBoolean(shop.Next.webluto.active) ) {Line 5465: output = "True";Line 5466: } else {Line 5467: output = Cart.Update(shopId,cartId,codGrid,qt+r,true, shop, P);Line 5468: }Line 5469: Line 5470: } else {Line 5471: string query = "INSERT INTO sys_cart (cid, codGrid, qt, dspOrder, idBt) VALUES (@cartId, @codGrid, @qt, GETDATE(), @idBt)";Line 5472: SqlCommand cmd = new SqlCommand(query, conn);Line 5473: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 5474: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 5475: cmd.Parameters.Add(new SqlParameter("@qt", SqlDbType.Int));Line 5476: cmd.Parameters.Add(new SqlParameter("@idBt", SqlDbType.Int));Line 5477: cmd.Parameters["@cartId"].Value = cartId;Line 5478: cmd.Parameters["@codGrid"].Value = codGrid;Line 5479: cmd.Parameters["@qt"].Value = qt;Line 5480: cmd.Parameters["@idBt"].Value = idBt;Line 5481: r = cmd.ExecuteNonQuery();Line 5482: if ( r > 0 ) {Line 5483: output = "True";Line 5484: } else {Line 5485: output = "Erro na inclusão do produto. Favor tentar novamente.";Line 5486: }Line 5487: }Line 5488: } catch (Exception e) {Line 5489: output = "Item já adicionado. Por favor verifique o seu carrinho." + e;Line 5490: }Line 5491: Line 5492: conn.Close();Line 5493: Line 5494: return output;Line 5495: }Line 5496: Line 5497: public static bool Remove(int shopId, string cartId, int codGrid, ShopSetup shop) {Line 5498: SqlConnection conn = new SqlConnection(shop.Path);Line 5499: conn.Open();Line 5500: Line 5501: string query = "DELETE FROM sys_cart WHERE (cid = @cartId) AND (codGrid = @codGrid)";Line 5502: SqlCommand cmd = new SqlCommand(query, conn);Line 5503: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 5504: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 5505: cmd.Parameters["@cartId"].Value = cartId;Line 5506: cmd.Parameters["@codGrid"].Value = codGrid;Line 5507: int r = cmd.ExecuteNonQuery();Line 5508: Line 5509: conn.Close();Line 5510: Line 5511: if (r>0)return true;Line 5512: else return false;Line 5513: }Line 5514: Line 5515: public static string Update(int shopId, string cartId, int codGrid, int qt, bool changeDspOrder, ShopSetup shop, Promotion P) {Line 5516: string output = "";Line 5517: string iRef = "";Line 5518: string iProdDesc = "";Line 5519: int r = 0;Line 5520: Line 5521: if (shop.UseSC) {Line 5522: r = Stock.Qt(shop.Path, codGrid);Line 5523: if (r<qt)return "ATENÇÃO - TEMOS SOMENTE: " + r + " UN(s) EM ESTOQUE. POR FAVOR CONFIRA SEU CARRINHO E TENTE NOVAMENTE.";Line 5524: }Line 5525: Line 5526: SqlConnection conn = new SqlConnection(shop.Path);Line 5527: conn.Open();Line 5528: Line 5529: Line 5530: Line 5531: // promotion product max quantityLine 5532: string query = @"Line 5533: SELECTLine 5534: tbl_grid.codGrid,Line 5535: tbl_grid.ref,Line 5536: tbl_prod.codProd,Line 5537: tbl_prod.[desc] AS prodDesc,Line 5538: tbl_prod.codBrandLine 5539: FROM tbl_grid WITH (NOLOCK)Line 5540: INNER JOIN tbl_prod WITH (NOLOCK) ON tbl_grid.codProd = tbl_prod.codProdLine 5541: WHERE (tbl_grid.codGrid = @codGrid)Line 5542: ";Line 5543: Line 5544: SqlCommand cmd = new SqlCommand(query, conn);Line 5545: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.NVarChar));Line 5546: cmd.Parameters["@codGrid"].Value = codGrid;Line 5547: SqlDataReader rdr = cmd.ExecuteReader();Line 5548: Line 5549: if ( rdr.Read() ) {Line 5550: iRef = ( rdr["ref"] != DBNull.Value && Convert.ToString(rdr["ref"]) != "" ? Convert.ToString(rdr["ref"]) : "-" );Line 5551: iProdDesc = Convert.ToString(rdr["prodDesc"]);Line 5552: Line 5553: // check promotionsLine 5554: try {Line 5555: object oJson = JavaScriptDeserializer.DeserializeFromJson(Line 5556: P.getEffect(Line 5557: Convert.ToInt32(rdr["codBrand"]),Line 5558: Details.getProductMenus(shop.Path, Convert.ToInt32(rdr["codProd"])),Line 5559: codGrid,Line 5560: qt,Line 5561: ""Line 5562: ),Line 5563: typeof(NameValueCollection)Line 5564: );Line 5565: Line 5566: if ( Convert.ToInt32(((NameValueCollection)oJson)["id"]) > 0 ) {Line 5567: if ( ((NameValueCollection)oJson)["products"] != null ) {Line 5568: string[] products = Convert.ToString(((NameValueCollection)oJson)["products"]).Split(',');Line 5569: foreach( string product in products ) {Line 5570: string[] arr = product.Split('_');Line 5571: if ( codGrid == Convert.ToInt32(arr[0]) && Convert.ToInt32(arr[1]) > 0 && qt > Convert.ToInt32(arr[1]) ) {Line 5572: rdr.Close();Line 5573: conn.Close();Line 5574: return "ATENÇÃO: A QUANTIDADE DO ITEM [ " + iProdDesc + " REF.: " + iRef + " ] ESTÁ LIMITADA A [ " + Convert.ToInt32(arr[1]) + " ] POR PEDIDO.";Line 5575: }Line 5576: }Line 5577: }Line 5578: }Line 5579: } catch ( Exception e ) { /* DEBUG */ }Line 5580: Line 5581: }Line 5582: rdr.Close();Line 5583: Line 5584: Line 5585: Line 5586: query = "";Line 5587: if (changeDspOrder)query = "UPDATE sys_cart SET qt = @qt, dspOrder = GETDATE() WHERE (cid = @cartId) AND (codGrid = @codGrid)";Line 5588: else query = "UPDATE sys_cart SET qt = @qt WHERE (cid = @cartId) AND (codGrid = @codGrid)";Line 5589: Line 5590: cmd = new SqlCommand(query, conn);Line 5591: cmd.Parameters.Add(new SqlParameter("@qt", SqlDbType.Int));Line 5592: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 5593: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 5594: cmd.Parameters["@qt"].Value = qt;Line 5595: cmd.Parameters["@cartId"].Value = cartId;Line 5596: cmd.Parameters["@codGrid"].Value = codGrid;Line 5597: r = cmd.ExecuteNonQuery();Line 5598: if (r>0) {Line 5599: output = "True";Line 5600: } else {Line 5601: output = "Erro na atualizao do produto. Favor tentar novamente.";Line 5602: Line 5603: }Line 5604: conn.Close();Line 5605: Line 5606: return output;Line 5607: }Line 5608: Line 5609: public static bool Delete(int shopId, string cartId, ShopSetup shop) {Line 5610: SqlConnection conn = new SqlConnection(shop.Path);Line 5611: string query = "DELETE FROM sys_cart WHERE (cid = @cartId)";Line 5612: SqlCommand cmd = new SqlCommand(query, conn);Line 5613: Line 5614: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 5615: cmd.Parameters["@cartId"].Value = cartId;Line 5616: cmd.Connection.Open();Line 5617: int r = cmd.ExecuteNonQuery();Line 5618: conn.Close();Line 5619: Line 5620: if (shop.UseEG) {Line 5621: if (Gifts.Delete(shopId,cartId,shop)) {Line 5622: if (r>0) {Line 5623: return true;Line 5624: } else {Line 5625: return false;Line 5626: }Line 5627: } else {Line 5628: return false;Line 5629: }Line 5630: } else {Line 5631: if (r>0) {Line 5632: return true;Line 5633: } else {Line 5634: return false;Line 5635: }Line 5636: }Line 5637: }Line 5638: Line 5639: public static string Body(Line 5640: int shopId,Line 5641: string cartId,Line 5642: int userId,Line 5643: ShopSetup shop,Line 5644: Promotion P,Line 5645: string ufLine 5646: ) {Line 5647: decimal a = 0;Line 5648: int b = 0;Line 5649: int c = 0;Line 5650: XmlDocument D = new XmlDocument();Line 5651: return Cart.Body( shopId, cartId, userId, false, out a, out b, out c, shop, P, uf, out D );Line 5652: }Line 5653: Line 5654: public static string Body(Line 5655: int shopId,Line 5656: string cartId,Line 5657: int userId,Line 5658: bool isStatic,Line 5659: out decimal sub_total,Line 5660: ShopSetup shop,Line 5661: Promotion P,Line 5662: string ufLine 5663: ) {Line 5664: int b = 0;Line 5665: int c = 0;Line 5666: XmlDocument D = new XmlDocument();Line 5667: return Cart.Body( shopId, cartId, userId, isStatic, out sub_total, out b, out c, shop, P, uf, out D );Line 5668: }Line 5669: Line 5670: public static string Body(Line 5671: int shopId,Line 5672: string cartId,Line 5673: int userId,Line 5674: out decimal sub_total,Line 5675: out int weight,Line 5676: out int volume,Line 5677: ShopSetup shop,Line 5678: Promotion P,Line 5679: string ufLine 5680: ) {Line 5681: XmlDocument D = new XmlDocument();Line 5682: return Cart.Body( shopId, cartId, userId, false, out sub_total, out weight, out volume, shop, P, uf, out D );Line 5683: }Line 5684: Line 5685: public static string Body(Line 5686: int shopId,Line 5687: string cartId,Line 5688: int userId,Line 5689: bool isStatic,Line 5690: out decimal sub_total,Line 5691: out int weight,Line 5692: out int volume,Line 5693: ShopSetup shop,Line 5694: Promotion P,Line 5695: string uf,Line 5696: out XmlDocument PreOrderLine 5697: ) {Line 5698: return Cart.Body(shopId, cartId, userId, isStatic, out sub_total, out weight, out volume, shop, P, uf, out PreOrder, false);Line 5699: }Line 5700: Line 5701: public static string Body(Line 5702: int shopId,Line 5703: string cartId,Line 5704: int userId,Line 5705: bool isStatic,Line 5706: out decimal sub_total,Line 5707: out int weight,Line 5708: out int volume,Line 5709: ShopSetup shop,Line 5710: Promotion P,Line 5711: string uf,Line 5712: out XmlDocument PreOrder,Line 5713: bool freeShippingRefusedLine 5714: ) {Line 5715: string output = "";Line 5716: string ndd = "";Line 5717: string i_item_href = "";Line 5718: string i_img = "";Line 5719: string i_img_src = "";Line 5720: string i_img_alt = "";Line 5721: string i_ref = "";Line 5722: string i_name = "";Line 5723: string i_variant = "";Line 5724: string i_desc = "";Line 5725: string i_row = "";Line 5726: string i_row_frag = "";Line 5727: string taxes_header = "";Line 5728: string gift_info = "";Line 5729: string promotion = "";Line 5730: string promotion_info = "";Line 5731: Line 5732: int i = 0;Line 5733: string[] imgSizes = null;Line 5734: Line 5735: int e_weight = 0;Line 5736: int e_volume = 0;Line 5737: int qtStep = 1;Line 5738: Line 5739: decimal i_item_prc = 0;Line 5740: decimal i_item_disc_rate = 0;Line 5741: decimal i_item_prc_full = 0;Line 5742: decimal i_item_qty = 0;Line 5743: decimal i_item_total = 0;Line 5744: decimal prom_fixed_disc = 0;Line 5745: decimal sub_total_ac = 0;Line 5746: Line 5747: bool freeShipping = false;Line 5748: Line 5749: object taxes_total = JavaScriptDeserializer.DeserializeFromJson( "{}", typeof(NameValueCollection) );Line 5750: Line 5751: /* GOOGLE_TAG_MANAGER */Line 5752: JArray gtm_cart_products = new JArray();Line 5753: /* GOOGLE_TAG_MANAGER */Line 5754: Line 5755: StringBuilder Sb_rows = new StringBuilder();Line 5756: StringBuilder Sb_taxes = new StringBuilder();Line 5757: StringDictionary Sd_taxes_total = new StringDictionary();Line 5758: StringDictionary Sd_proms = new StringDictionary();Line 5759: XmlDocument Taxes = new XmlDocument();Line 5760: Line 5761: // pre_order load xmlLine 5762: XmlDocument Root = new XmlDocument();Line 5763: XmlElement XE_pre_order = (XmlElement)Root.AppendChild( Root.CreateElement("pre_order") );Line 5764: XmlElement XE_items = (XmlElement)XE_pre_order.AppendChild( Root.CreateElement("items") );Line 5765: XmlElement XE_taxes = (XmlElement)XE_pre_order.AppendChild( Root.CreateElement("taxes") );Line 5766: Line 5767: Line 5768: Line 5769: for( i = 0; i < shop.NDD; i++ ) {Line 5770: ndd += "0";Line 5771: }Line 5772: Line 5773: if ( shop.getConfig("Taxes") != "" ) {Line 5774: try {Line 5775: StringBuilder Sb = new StringBuilder();Line 5776: Line 5777: Taxes.LoadXml( shop.getConfig("Taxes") );Line 5778: foreach( XmlNode Node in Taxes.SelectNodes("/taxes/*") ) {Line 5779: Sb.Append( String.Format( "<th class='cart_body_col_tax'>{0}</th>", Node.SelectSingleNode("@presentation").InnerText ) );Line 5780: }Line 5781: Line 5782: taxes_header = Sb.ToString();Line 5783: } catch ( Exception ex ) {Line 5784: taxes_header = "<!-- Oops! load taxes config failed -->";Line 5785: }Line 5786: }Line 5787: Line 5788: SqlConnection conn = new SqlConnection(shop.Path);Line 5789: conn.Open();Line 5790: Line 5791: string query = String.Format(Line 5792: @"Line 5793: SELECTLine 5794: tbl_prod.codBrandLine 5795: , tbl_prod.[desc] AS DescProdLine 5796: , tbl_brands.name AS brandNameLine 5797: , tbl_grid.codGridLine 5798: , tbl_grid.refLine 5799: , tbl_grid.codProdLine 5800: , tbl_grid.codCompLine 5801: , sys_cart.qtLine 5802: , sys_cart.codGridLine 5803: , tbl_prices.discRateLine 5804: , tbl_prices.prcLine 5805: , tbl_grid.weightLine 5806: , tbl_grid.vXLine 5807: , tbl_grid.vYLine 5808: , tbl_grid.vZLine 5809: , tbl_acronyms.[desc] AS acroDescLine 5810: , tbl_acronyms.acronymLine 5811: , tbl_prices.objectLine 5812: FROM tbl_prices WITH (NOLOCK)Line 5813: INNER JOIN tbl_grid WITH (NOLOCK) ON tbl_prices.codGrid = tbl_grid.codGridLine 5814: INNER JOIN tbl_prod WITH (NOLOCK) ON tbl_grid.codProd = tbl_prod.codProdLine 5815: INNER JOIN tbl_brands WITH (NOLOCK) ON tbl_prod.codBrand = tbl_brands.codBrandLine 5816: INNER JOIN sys_cart WITH (NOLOCK) ON tbl_grid.codGrid = sys_cart.codGridLine 5817: INNER JOIN tbl_acronyms WITH (NOLOCK) ON tbl_prod.codUn = tbl_acronyms.codUnLine 5818: WHERE (tbl_grid.active = 1) AND (tbl_prices.codGroup = @userGroup) AND (sys_cart.cid = @cartId)Line 5819: ORDER BY sys_cart.dspOrder ASC, tbl_prod.[desc]Line 5820: "Line 5821: , shop.OwnerLine 5822: );Line 5823: Line 5824: SqlCommand cmd = new SqlCommand(query, conn);Line 5825: cmd.Parameters.Add(new SqlParameter("@userGroup", SqlDbType.Int));Line 5826: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 5827: cmd.Parameters["@userGroup"].Value = UserSetup.UserGroup(shop.Path, userId);Line 5828: cmd.Parameters["@cartId"].Value = cartId;Line 5829: SqlDataReader rdr = cmd.ExecuteReader();Line 5830: Line 5831: if (!rdr.Read()) {Line 5832: // assign outputLine 5833: output = String.Format(Line 5834: @"Line 5835: <h2>Seu carrinho está vazio!</h2>Line 5836: <p>Para inserir produtos em seu carrinho, navegue pelas categorias do site ou faça uma pesquisa para encontrar o produto desejado.</p>Line 5837: <a href='/'><span>Continuar navegando</span></a>Line 5838: "Line 5839: );Line 5840: Line 5841: // dispose unmanaged resourcesLine 5842: rdr.Close();Line 5843: conn.Close();Line 5844: Line 5845: // assign output paramsLine 5846: sub_total = 0;Line 5847: weight = 0;Line 5848: volume = 0;Line 5849: PreOrder = Root;Line 5850: Line 5851: return output;Line 5852: } else {Line 5853: do {Line 5854: i_ref = "";Line 5855: if (null!=rdr["ref"]&&!Convert.ToString(rdr["ref"]).Equals(""))Line 5856: i_ref=Convert.ToString(rdr["ref"]);Line 5857: Line 5858: i_desc = (string)rdr["DescProd"];Line 5859: i_name = i_desc;Line 5860: i_item_href = String.Format(Line 5861: "{0}/{1}.{2}.html",Line 5862: shop.Http.Replace("/octopus/", ""), ZenTools.urlize(i_desc), Convert.ToInt32(rdr["codGrid"])Line 5863: );Line 5864: Line 5865: if ( null != rdr["codComp"] && !Convert.ToString(rdr["codComp"]).Equals("") ) {Line 5866: i_variant = Generics.GridDescription( shop.Path, Convert.ToString(rdr["codComp"]) );Line 5867: i_desc += " " + i_variant;Line 5868: i_variant = Regex.Replace( i_variant, @"^\[|\]$", "" ).Trim();Line 5869: }Line 5870: Line 5871: i_item_prc = (decimal)rdr["prc"];Line 5872: i_item_disc_rate = (decimal)rdr["discRate"];Line 5873: Line 5874: //--( Using AjaxPro.dll to deserialize a json from tbl_prices )Line 5875: string sJson = "{}";Line 5876: if ( rdr["object"] != DBNull.Value && Convert.ToString(rdr["object"]) != "" ) {Line 5877: sJson = Convert.ToString(rdr["object"]);Line 5878: }Line 5879: Line 5880: // item imageLine 5881: imgSizes = shop.getImgSize("T");Line 5882: i_img_src = Details.getProductImgSrc(shopId, Convert.ToInt32(rdr["codGrid"]), shop, out i_img_alt);Line 5883: if ( i_img_alt == "" )Line 5884: i_img_alt = i_desc;Line 5885: i_img = string.Format(Line 5886: "<img src='{0}' alt='{1}' width='{2}' height='{3}' />",Line 5887: i_img_src.Replace("{size}", "t"), i_img_alt, imgSizes[0], imgSizes[1]Line 5888: );Line 5889: Line 5890: try {Line 5891: object oJson = JavaScriptDeserializer.DeserializeFromJson(sJson, typeof(NameValueCollection));Line 5892: if (Line 5893: Convert.ToBoolean(((NameValueCollection)oJson)["freeShipping"])Line 5894: && Convert.ToString(((NameValueCollection)oJson)["freeShippingType"]) != "RESTRICTED"Line 5895: ) {Line 5896: freeShipping = true;Line 5897: }Line 5898: Line 5899: if ( ((NameValueCollection)oJson)["qtIncrement"] != null && ((NameValueCollection)oJson)["qtIncrement"] != "" ) {Line 5900: qtStep = Convert.ToInt32(((NameValueCollection)oJson)["qtIncrement"]);Line 5901: }Line 5902: } catch (Exception e) {}Line 5903: Line 5904: Line 5905: Line 5906: // check promotionsLine 5907: promotion = "";Line 5908: try {Line 5909: object oJson = JavaScriptDeserializer.DeserializeFromJson(Line 5910: P.getEffect(Line 5911: Convert.ToInt32(rdr["codBrand"]),Line 5912: Details.getProductMenus(shop.Path, Convert.ToInt32(rdr["codProd"])),Line 5913: Convert.ToInt32(rdr["codGrid"]),Line 5914: Convert.ToInt32(rdr["qt"]),Line 5915: cartIdLine 5916: ),Line 5917: typeof(NameValueCollection)Line 5918: );Line 5919: Line 5920: //Sb.Append( ((NameValueCollection)oJson)["debug"] );Line 5921: Line 5922: if ( Convert.ToInt32(((NameValueCollection)oJson)["id"]) > 0 ) {Line 5923: switch( Convert.ToString(((NameValueCollection)oJson)["discountType"]) ) {Line 5924: case "percent":Line 5925: i_item_disc_rate += Convert.ToDecimal(((NameValueCollection)oJson)["discountValue"]);Line 5926: break;Line 5927: case "fixed":Line 5928: if ( Sd_proms[((NameValueCollection)oJson)["id"]] != "active" ) {Line 5929: prom_fixed_disc += Convert.ToDecimal(((NameValueCollection)oJson)["discountValue"]);Line 5930: Sd_proms.Add( ((NameValueCollection)oJson)["id"], "active" );Line 5931: }Line 5932: break;Line 5933: case "freeShipping":Line 5934: freeShipping = true;Line 5935: if ( freeShippingRefused ) {Line 5936: promotion = "";Line 5937: }Line 5938: break;Line 5939: }Line 5940: Line 5941: // display active promotionLine 5942: promotion += " [ " + Convert.ToString(((NameValueCollection)oJson)["name"]) + " ]";Line 5943: }Line 5944: Line 5945: } catch ( Exception e ) {Line 5946: //Sb.Append( e.Message + " : " + e.Source );Line 5947: i_item_prc = Convert.ToDecimal(rdr["prc"]);Line 5948: }Line 5949: Line 5950: Line 5951: Line 5952: //if (!freeShipping) {Line 5953: e_weight += ((int)rdr["weight"]*(int)rdr["qt"]);Line 5954: e_volume += ((int)rdr["vX"]*(int)rdr["vY"]*(int)rdr["vZ"]*(int)rdr["qt"]);Line 5955: //}Line 5956: Line 5957: i_item_prc_full = Math.Round( ( 1 - i_item_disc_rate / 100 ) * i_item_prc, shop.NDD );Line 5958: i_item_total = i_item_prc_full;Line 5959: i_item_qty = (int)rdr["qt"];Line 5960: Line 5961: if ( !isStatic ) {Line 5962: i_row_frag = String.Format(Line 5963: @"Line 5964: <td class='cart_body_col_qty'>Line 5965: <input {0} class='n cart_items' name='cg_{1}' size='3' maxlength='7' onchange={2} value='{3}' />Line 5966: </td>Line 5967: <td class='cart_body_col_remove'>Line 5968: <a href='#' onclick={4} >Line 5969: <img src='/octopus/design/images/{5}/cart_refresh.gif' alt='Recalcular pedido' title='Recalcular pedido' />Line 5970: <font>Recalcular</font>Line 5971: </a>Line 5972: <br />Line 5973: <a href='#' onclick={6}>Line 5974: <img src='/octopus/design/images/{5}/cart_remove.gif' alt='Remover item' title='Remover item' />Line 5975: <font>Remover</font>Line 5976: </a>Line 5977: </td>Line 5978: "Line 5979: , ( shop.isRetail ? "type='text'" : "type='number' step='" + qtStep + "' min='0'" )Line 5980: , (int)rdr["codGrid"]Line 5981: , String.Format(Line 5982: "\"setMustUpd(true);req_updCart({0}, '{1}', {2});filterNum(this);req_checkStock(this.name, '{3}', this.value);\""Line 5983: , shopId, cartId, userId, Convert.ToString(rdr["codGrid"])Line 5984: )Line 5985: , Convert.ToString(rdr["qt"])Line 5986: , String.Format( "\"req_updCart({0}, '{1}', {2});\"", shopId, cartId, userId )Line 5987: , shopIdLine 5988: , String.Format( "\"req_removeItem({0},'{1}', {2}, {3});\"", shopId, cartId, Convert.ToString(rdr["codGrid"]), userId )Line 5989: );Line 5990: } else {Line 5991: i_row_frag = String.Format( "<td class='cart_body_col_qty'>{0}</td>", i_item_qty );Line 5992: }Line 5993: Line 5994: i_row = String.Format(Line 5995: @"Line 5996: <tr class='{0}'>Line 5997: {1}Line 5998: <td class='cart_body_col_ref'>{3}</td>Line 5999: <td class='cart_body_col_desc'>{4}</td>Line 6000: {5}Line 6001: <td class='cart_body_col_unitPrc'>Line 6002: {6}Line 6003: <acronym title='{7}'> / {8}</acronym>Line 6004: </td>Line 6005: @TAXESLine 6006: <td class='cart_body_col_rowTot'>@SUB_TOTAL</td>Line 6007: </tr>Line 6008: "Line 6009: , ( 0 == i % 2 ? "tbl_row_0" : "tbl_row_1" )Line 6010: , ( !isStatic ? String.Format( "<td class='cart_body_col_img'>{2}</td>", i_item_href, i_desc, i_img ) : "" )Line 6011: , i_item_hrefLine 6012: , i_refLine 6013: , i_desc + ( !freeShippingRefused ? ( freeShipping ? " [ Frete Grátis ]" : "" ) + promotion : "" )Line 6014: , i_row_fragLine 6015: , shop.CurrType + string.Format( "{0:0."+ ndd +"}", i_item_prc_full )Line 6016: , (string)rdr["acroDesc"]Line 6017: , ( (string)rdr["acronym"] == "" ? (string)rdr["acroDesc"] : (string)rdr["acronym"] )Line 6018: );Line 6019: Line 6020: if ( Taxes.HasChildNodes ) {Line 6021: string xpath = "";Line 6022: decimal item_tax = 0;Line 6023: decimal item_taxes_total = 0;Line 6024: bool apply_in_prc = false;Line 6025: StringBuilder Sb = new StringBuilder();Line 6026: Line 6027: // get json taxes from tbl_prices.objectLine 6028: object o = JavaScriptDeserializer.DeserializeFromJson( sJson, typeof(NameValueCollection) );Line 6029: string s = "";Line 6030: sJson = ((NameValueCollection)o)["taxes"];Line 6031: Line 6032: XmlElement XE_item = (XmlElement)XE_items.AppendChild( Root.CreateElement("item") );Line 6033: XE_item.SetAttribute( "id", Convert.ToString(rdr["codGrid"]) );Line 6034: XmlElement XE_item_taxes = (XmlElement)XE_item.AppendChild( Root.CreateElement("taxes") );Line 6035: Line 6036: foreach( XmlNode Node in Taxes.SelectNodes("/taxes/*") ) {Line 6037: s = "";Line 6038: item_tax = 0;Line 6039: apply_in_prc = false;Line 6040: Line 6041: try {Line 6042: Line 6043: if ( uf != "" ) {Line 6044: o = JavaScriptDeserializer.DeserializeFromJson( sJson, typeof(NameValueCollection) );Line 6045: s = ((NameValueCollection)o)[Node.Name];Line 6046: Line 6047: o = JavaScriptDeserializer.DeserializeFromJson( s, typeof(NameValueCollection) );Line 6048: s = ((NameValueCollection)o)[uf];Line 6049: apply_in_prc = Convert.ToBoolean(((NameValueCollection)o)["apply_in_prc"]);Line 6050: Line 6051: o = JavaScriptDeserializer.DeserializeFromJson( s, typeof(NameValueCollection) );Line 6052: if ( Convert.ToDecimal(((NameValueCollection)o)["a"]) > 0 ) {Line 6053: item_tax = Math.Round( i_item_prc_full * Convert.ToDecimal( (((NameValueCollection)o)["a"]).Replace(".", ",") ), shop.NDD );Line 6054: }Line 6055: if ( Convert.ToDecimal(((NameValueCollection)o)["b"]) > 0 ) {Line 6056: item_tax = i_item_prc_full + Convert.ToDecimal( (((NameValueCollection)o)["b"]).Replace(".", ",") );Line 6057: }Line 6058: if ( item_tax > 0 && apply_in_prc ) {Line 6059: i_item_prc_full = Math.Round( item_tax, shop.NDD );Line 6060: i_item_total = i_item_prc_full;Line 6061: } else {Line 6062: i_item_total = i_item_total + item_tax;Line 6063: }Line 6064: }Line 6065: Line 6066: } catch (Exception e) {Line 6067: /* load taxes failed */Line 6068: }Line 6069: Line 6070: // pre_order load itemsLine 6071: XmlElement XE_item_tax = (XmlElement)XE_item_taxes.AppendChild( Root.CreateElement( Node.Name ) );Line 6072: XE_item_tax.SetAttribute( "presentation", Node.SelectSingleNode("@presentation").InnerText );Line 6073: XE_item_tax.SetAttribute( "value", string.Format( "{0:0." + ndd + "}", item_tax ) );Line 6074: XE_item_tax.SetAttribute( "apply_in_prc", Convert.ToString(apply_in_prc) );Line 6075: Line 6076: // pre_order load taxesLine 6077: if ( Convert.ToBoolean( Node.SelectSingleNode("@totalize").InnerText ) ) {Line 6078: if ( XE_taxes.SelectSingleNode( Node.Name ) != null ) {Line 6079: decimal v = Convert.ToDecimal( XE_taxes.SelectSingleNode( Node.Name ).Attributes[1].Value );Line 6080: XE_taxes.SelectSingleNode( Node.Name ).Attributes[1].Value = string.Format( "{0:0." + ndd + "}", v + (item_tax * i_item_qty) );Line 6081: } else {Line 6082: XmlElement XE_tax = (XmlElement)XE_taxes.AppendChild( Root.CreateElement( Node.Name ) );Line 6083: XE_tax.SetAttribute( "presentation", Node.SelectSingleNode("@presentation").InnerText );Line 6084: XE_tax.SetAttribute( "value", string.Format( "{0:0." + ndd + "}", (item_tax * i_item_qty) ) );Line 6085: }Line 6086: }Line 6087: Line 6088: Sb.Append(Line 6089: String.Format(Line 6090: "<td class='cart_body_col_tax tax_{0}'>{1}</td>"Line 6091: , Node.Name.ToLower()Line 6092: , shop.CurrType + string.Format( "{0:0." + ndd + "}", item_tax )Line 6093: )Line 6094: );Line 6095: }Line 6096: item_taxes_total = item_taxes_total * i_item_qty;Line 6097: i_row = i_row.Replace( "@TAXES", Sb.ToString() );Line 6098: } else {Line 6099: i_row = i_row.Replace( "@TAXES", "" );Line 6100: }Line 6101: Line 6102: i_item_total = i_item_total * i_item_qty;Line 6103: Line 6104: i_row = i_row.Replace( "@SUB_TOTAL", shop.CurrType + string.Format( "{0:0.00}", i_item_total ) );Line 6105: Sb_rows.Append( i_row );Line 6106: Line 6107: sub_total_ac = sub_total_ac + (i_item_prc_full * i_item_qty);Line 6108: Line 6109: /* GOOGLE_TAG_MANAGER */Line 6110: dynamic product = JsonConvert.DeserializeObject<JObject>("{}");Line 6111: product.idVariant = Convert.ToInt32(rdr["codGrid"]);Line 6112: product.name = i_name;Line 6113: product.id = i_ref;Line 6114: product.price = string.Format( "{0:0.00}", i_item_prc_full ).Replace(",", ".");Line 6115: product.brand = Convert.ToString(rdr["brandName"]);Line 6116: if ( i_variant != "" )Line 6117: product.variant = i_variant;Line 6118: product.quantity = Convert.ToInt32(i_item_qty);Line 6119: gtm_cart_products.Add( product );Line 6120: /* GOOGLE_TAG_MANAGER */Line 6121: Line 6122: i++;Line 6123: freeShipping = false;Line 6124: } while(rdr.Read());Line 6125: }Line 6126: rdr.Close();Line 6127: conn.Close();Line 6128: Line 6129: Line 6130: Line 6131: // apply promotion fixed discountLine 6132: if ( prom_fixed_disc > 0 && sub_total_ac > prom_fixed_disc ) {Line 6133: sub_total_ac = sub_total_ac - prom_fixed_disc;Line 6134: } else {Line 6135: prom_fixed_disc = 0;Line 6136: }Line 6137: Line 6138: Line 6139: Line 6140: if (shop.UseEG) {Line 6141: decimal g_total = 0;Line 6142: int g_weight = 0;Line 6143: int g_volume = 0;Line 6144: Line 6145: gift_info = Gifts.Body(shopId, cartId, userId, isStatic, out g_total, out g_weight, out g_volume, shop);Line 6146: Line 6147: sub_total_ac += g_total;Line 6148: e_weight += g_weight;Line 6149: e_volume += g_volume;Line 6150: }Line 6151: Line 6152: Line 6153: Line 6154: // show fixed discountsLine 6155: if ( prom_fixed_disc > 0 ) {Line 6156: promotion_info = String.Format(Line 6157: @"Line 6158: <div class='promotion-fixed-discount'>Line 6159: <table>Line 6160: <tr>Line 6161: <td width='50%' class='lft_half'><span></span></td>Line 6162: <td width='50%' class='rgt_half'>Line 6163: <table>Line 6164: <tr>Line 6165: <th>Desconto de promoções:</th>Line 6166: <td>{0}</td>Line 6167: </tr>Line 6168: </table>Line 6169: </td>Line 6170: </tr>Line 6171: </table>Line 6172: </div>Line 6173: "Line 6174: , shop.CurrType + string.Format("{0:0.00}", prom_fixed_disc )Line 6175: );Line 6176: }Line 6177: Line 6178: // load output paramsLine 6179: sub_total = Math.Round( sub_total_ac, 2 );Line 6180: weight = e_weight;Line 6181: volume = e_volume;Line 6182: PreOrder = Root;Line 6183: Line 6184: foreach( XmlNode Tax in Root.SelectNodes("/pre_order/taxes/*") ) {Line 6185: Sb_taxes.Append(Line 6186: String.Format(Line 6187: ", \"{0}\": {1}"Line 6188: , Tax.Name.ToLower(), Convert.ToString( Tax.SelectSingleNode("@value").InnerText ).Replace(",", ".")Line 6189: )Line 6190: );Line 6191: }Line 6192: Line 6193: output = String.Format(Line 6194: @"Line 6195: <table>Line 6196: <tr>Line 6197: {0}Line 6198: <th class='cart_body_col_ref'>Ref.</th>Line 6199: <th class='cart_body_col_desc'>Descrição</th>Line 6200: <th class='cart_body_col_qty' colspan='2'>Quantidade</th>Line 6201: {1}Line 6202: @TAXES_HEADERLine 6203: <th class='cart_body_col_rowTot'>Total</th>Line 6204: </tr>Line 6205: @ROWSLine 6206: </table>Line 6207: @GIFT_INFOLine 6208: @PROMOTION_INFOLine 6209: <div id='items_total' style='display:none;'>{2}</div>Line 6210: <div id='taxes_total' style='display:none;'>{3}</div>Line 6211: ",Line 6212: ( !isStatic ? "<th class='cart_body_col_img'><span></span></th>" : "" ),Line 6213: ( !isStatic ? "<th class='cart_body_col_unitPrc'>Preço</th>" : ""),Line 6214: string.Format("{0:0.00}", sub_total_ac ),Line 6215: "{\"taxes\": {" + ( Sb_taxes.ToString() != "" ? Sb_taxes.ToString().Substring(1) : "" ) + "}}"Line 6216: );Line 6217: Line 6218: output = output.Replace( "@TAXES_HEADER", taxes_header );Line 6219: output = output.Replace( "@ROWS", Sb_rows.ToString() );Line 6220: output = output.Replace( "@GIFT_INFO", gift_info);Line 6221: output = output.Replace( "@PROMOTION_INFO", promotion_info);Line 6222: Line 6223: /* GOOGLE_TAG_MANAGER */Line 6224: output += "<script id='gtm-cart-products' type='text/x-gtm-products'>";Line 6225: output += Environment.NewLine;Line 6226: output += gtm_cart_products.ToString();Line 6227: output += Environment.NewLine;Line 6228: output += "</" + "script>";Line 6229: /* GOOGLE_TAG_MANAGER */Line 6230: Line 6231: return output;Line 6232: }Line 6233: Line 6234: public static string ShippingCharge(int shopId, string cartId, int userId, string code, int transporterId, string shopHttp) {Line 6235: return ShippingCharge(shopId, cartId, userId, code, transporterId, shopHttp, "");Line 6236: }Line 6237: Line 6238: public static string ShippingCharge(Line 6239: int shopId,Line 6240: string cartId,Line 6241: int userId,Line 6242: string code,Line 6243: int transporterId,Line 6244: string shopHttp,Line 6245: string mainIncludeLine 6246: ) {Line 6247: string output = "";Line 6248: string url = String.Format(Line 6249: "{0}/sub/__{1}.aspx?sid={1}&cid={2}&uid={3}&c={4}&tid={5}&s=1{6}",Line 6250: ( shopHttp.IndexOf("octopus") > -1 ? shopHttp : shopHttp + "octopus" ),Line 6251: shopId,Line 6252: cartId,Line 6253: userId,Line 6254: code,Line 6255: transporterId,Line 6256: ( mainInclude != "" ? "&mi=" + mainInclude : "" )Line 6257: );Line 6258: Line 6259: try {Line 6260: HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);Line 6261: req.MaximumAutomaticRedirections = 4;Line 6262: req.MaximumResponseHeadersLength = 4;Line 6263: req.Credentials = CredentialCache.DefaultCredentials;Line 6264: HttpWebResponse res = (HttpWebResponse)req.GetResponse();Line 6265: Line 6266: Stream reStream = res.GetResponseStream();Line 6267: StreamReader readStream = new StreamReader(reStream, Encoding.UTF8);Line 6268: output = readStream.ReadToEnd();Line 6269: readStream.Close();Line 6270: res.Close();Line 6271: } catch (Exception e) {Line 6272: output = "url: " + url;Line 6273: }Line 6274: return output;Line 6275: }Line 6276: Line 6277: public static string FloatingCartBody(int shopId, string cartId, int userId, ShopSetup shop, Promotion P) {Line 6278: int i=0;Line 6279: string ndd = "";Line 6280: for( i = 0; i < shop.NDD; i++) ndd+="0";Line 6281: Line 6282: string thisConfig = "?sid=" + shopId;Line 6283: Line 6284: i = 0;Line 6285: string iRef = "";Line 6286: string iDesc = "";Line 6287: string i_img_src = "";Line 6288: string i_img_alt = "";Line 6289: string promotion = "";Line 6290: Line 6291: decimal iPrice = 0;Line 6292: decimal iDiscRate = 0;Line 6293: decimal promotionFixedDiscount = 0;Line 6294: decimal t_price = 0;Line 6295: int t_items = 0;Line 6296: Line 6297: StringBuilder Sb = new StringBuilder();Line 6298: StringDictionary SdActivePromotions = new StringDictionary();Line 6299: Line 6300: Sb.Append("\n");Line 6301: Sb.Append(" <h5><span>Últimos itens</span></h5>\n");Line 6302: Sb.Append(" <ul>\n");Line 6303: Line 6304: SqlConnection conn = new SqlConnection(shop.Path);Line 6305: conn.Open();Line 6306: Line 6307: string query = String.Format(Line 6308: @"Line 6309: SELECTLine 6310: tbl_grid.codGridLine 6311: , tbl_grid.refLine 6312: , tbl_grid.codProdLine 6313: , tbl_prod.codBrandLine 6314: , tbl_prod.[desc] AS ProdDescLine 6315: , tbl_grid.codCompLine 6316: , sys_cart.qtLine 6317: , sys_cart.codGridLine 6318: , tbl_prices.discRateLine 6319: , tbl_prices.prcLine 6320: , tbl_grid.weightLine 6321: , tbl_grid.vXLine 6322: , tbl_grid.vYLine 6323: , tbl_grid.vZLine 6324: , tbl_acronyms.[desc] AS acroDescLine 6325: , tbl_acronyms.acronymLine 6326: , tbl_prices.objectLine 6327: FROM tbl_prices WITH (NOLOCK)Line 6328: INNER JOIN tbl_grid WITH (NOLOCK) ON tbl_prices.codGrid = tbl_grid.codGridLine 6329: INNER JOIN tbl_prod WITH (NOLOCK) ON tbl_grid.codProd = tbl_prod.codProdLine 6330: INNER JOIN sys_cart WITH (NOLOCK) ON tbl_grid.codGrid = sys_cart.codGridLine 6331: INNER JOIN tbl_acronyms WITH (NOLOCK) ON tbl_prod.codUn = tbl_acronyms.codUnLine 6332: WHERE (tbl_grid.active = 1) AND (tbl_prices.codGroup = @codGroup) AND (sys_cart.cid = @cartId)Line 6333: ORDER BY sys_cart.dspOrder DESC, tbl_prod.[desc]Line 6334: "Line 6335: , shop.OwnerLine 6336: );Line 6337: Line 6338: SqlCommand cmd = new SqlCommand(query, conn);Line 6339: cmd.Parameters.Add(new SqlParameter("@codGroup", SqlDbType.Int));Line 6340: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 6341: cmd.Parameters["@codGroup"].Value = UserSetup.UserGroup(shop.Path, userId);Line 6342: cmd.Parameters["@cartId"].Value = cartId;Line 6343: SqlDataReader rdr = cmd.ExecuteReader();Line 6344: if (rdr.Read()) {Line 6345: Line 6346: do {Line 6347: iRef = "";Line 6348: if ( null != rdr["ref"] && !Convert.ToString(rdr["ref"]).Equals("") ) {Line 6349: iRef = Convert.ToString(rdr["ref"]);Line 6350: }Line 6351: Line 6352: iDesc = ZenTools.HtmlEncode((string)rdr["ProdDesc"]);Line 6353: if ( null != rdr["codComp"] && !Convert.ToString(rdr["codComp"]).Equals("") ) {Line 6354: iDesc += " " + Generics.GridDescription(shop.Path, Convert.ToString(rdr["codComp"]));Line 6355: }Line 6356: Line 6357: iPrice = (decimal)rdr["prc"];Line 6358: iDiscRate = (decimal)rdr["discRate"];Line 6359: Line 6360: Line 6361: Line 6362: // check promotionsLine 6363: promotion = "";Line 6364: try {Line 6365: object oJson = JavaScriptDeserializer.DeserializeFromJson(Line 6366: P.getEffect(Line 6367: Convert.ToInt32(rdr["codBrand"]),Line 6368: Details.getProductMenus(shop.Path, Convert.ToInt32(rdr["codProd"])),Line 6369: Convert.ToInt32(rdr["codGrid"]),Line 6370: Convert.ToInt32(rdr["qt"]),Line 6371: cartIdLine 6372: ),Line 6373: typeof(NameValueCollection)Line 6374: );Line 6375: Line 6376: //Sb.Append( ((NameValueCollection)oJson)["debug"] );Line 6377: Line 6378: if ( Convert.ToInt32(((NameValueCollection)oJson)["id"]) > 0 ) {Line 6379: switch( Convert.ToString(((NameValueCollection)oJson)["discountType"]) ) {Line 6380: case "percent":Line 6381: iDiscRate += Convert.ToDecimal(((NameValueCollection)oJson)["discountValue"]);Line 6382: break;Line 6383: case "fixed":Line 6384: if ( SdActivePromotions[((NameValueCollection)oJson)["id"]] != "active" ) {Line 6385: promotionFixedDiscount += Convert.ToDecimal(((NameValueCollection)oJson)["discountValue"]);Line 6386: SdActivePromotions.Add( ((NameValueCollection)oJson)["id"], "active" );Line 6387: }Line 6388: break;Line 6389: case "freeShipping": break;Line 6390: }Line 6391: Line 6392: // display active promotionLine 6393: promotion += " [ " + Convert.ToString(((NameValueCollection)oJson)["name"]) + " ]";Line 6394: }Line 6395: Line 6396: } catch ( Exception e ) {Line 6397: Sb.Append( e.Message + " : " + e.Source );Line 6398: iPrice = Convert.ToDecimal(rdr["prc"]);Line 6399: }Line 6400: Line 6401: Line 6402: Line 6403: if ( i < 3 ) {Line 6404: Sb.Append(" <li>\n");Line 6405: Line 6406: // item imageLine 6407: i_img_alt = "";Line 6408: i_img_src = Details.getProductImgSrc(shopId, Convert.ToInt32(rdr["codGrid"]), shop, out i_img_alt);Line 6409: if ( i_img_alt == "" )Line 6410: i_img_alt = iDesc;Line 6411: i_img_alt = HttpContext.Current.Server.HtmlEncode(i_img_alt);Line 6412: Sb.Append( string.Format("<img src='{0}' alt='{1}' />", i_img_src.Replace("{size}", "t"), i_img_alt) );Line 6413: Line 6414: Sb.Append(" <span class='ref'>" + iRef + "</span>\n");Line 6415: if ( promotion != "" )Line 6416: iDesc += " " + promotion;Line 6417: Sb.Append(" <span class='desc'>" + iDesc + "</span>\n");Line 6418: Line 6419: Sb.Append(" <span class='price'>" + shop.CurrType + string.Format("{0:0." + ndd + "}",( 1 - iDiscRate / 100 ) * iPrice ) + "</span><span class='items'> - <acronym title='" + (string)rdr["AcroDesc"] + "'>" + Convert.ToString(rdr["qt"]) + " " + (string)rdr["acronym"] + "</acronym></span>\n");Line 6420: Sb.Append(" <a class='remover' href='javascript:handle_remover_onClick(" + (int)rdr["codGrid"] + ");'><span>x</span></a>");Line 6421: Sb.Append(" </li>\n");Line 6422: }Line 6423: Line 6424: t_price += ( 1 - iDiscRate / 100 ) * iPrice * (int)rdr["qt"];Line 6425: t_items += (int)rdr["qt"];Line 6426: i++;Line 6427: } while(rdr.Read());Line 6428: Line 6429: Line 6430: Line 6431: // apply promotion fixed discountLine 6432: t_price = t_price - promotionFixedDiscount;Line 6433: Line 6434: Line 6435: Line 6436: } else {Line 6437: Sb.Append(" <li>\n");Line 6438: Sb.Append(" <span class='desc'>O carrinho está vazio</span>\n");Line 6439: Sb.Append(" </li>\n");Line 6440: }Line 6441: Line 6442: rdr.Close();Line 6443: conn.Close();Line 6444: Line 6445: Sb.Append(" </ul>\n");Line 6446: Sb.Append(" <div id='floating_cart_body_total_price'><span><label>Valor total:</label>"+ shop.CurrType + string.Format("{0:0.00}", t_price) +" </span></div>\n");Line 6447: Sb.Append(" <div id='floating_cart_body_total_items'><span><label>Qt.Itens:</label>"+ Convert.ToString(t_items) +"</span></div>\n");Line 6448: Line 6449: Sb.Append("<script>function handle_remover_onClick(cg){ new XHR({ method: 'get', onSuccess: function(txt,xml){ refreshFloatingCart(" + shopId + ",'" + cartId + "', Cookie.get('uid') || 0); } }).send('/octopus/__cart_remove.aspx', 'sid=" + shopId + "&cid=" + cartId + "&cg=' + cg); }<"+"/script>");Line 6450: Line 6451: return Sb.ToString();Line 6452: }Line 6453: Line 6454: Line 6455: private static bool stRules(string config_uf, string uf, string rule, string utp, string id2) {Line 6456: bool output = false;Line 6457: Line 6458: if ( config_uf == uf ) {Line 6459: switch( rule ) {Line 6460: case "F": // Somente para pessoa fsicaLine 6461: if ( utp == "F" ) {Line 6462: output = true;Line 6463: }Line 6464: break;Line 6465: Line 6466: case "J": // Somente para pessoa jurdicaLine 6467: if ( utp == "J" ) {Line 6468: output = true;Line 6469: }Line 6470: break;Line 6471: Line 6472: case "JI": // Somente pessoa juridica com isenção de I.ELine 6473: if ( utp == "J" && id2 == "" ) {Line 6474: output = true;Line 6475: }Line 6476: break;Line 6477: Line 6478: case "JIE": // Somente pessoa jurídica com I.ELine 6479: if ( utp == "J" && id2 != "" && id2.ToLower() != "isento" ) {Line 6480: output = true;Line 6481: }Line 6482: break;Line 6483: Line 6484: case "FJI": // Somente pessoa fsica ou juridica com isenção de I.ELine 6485: if ( utp == "F" || ( utp == "J" && ( id2 == "" || id2 == "isento" ) ) ) {Line 6486: output = true;Line 6487: }Line 6488: break;Line 6489: Line 6490: default: // Todos os casosLine 6491: output = true;Line 6492: break;Line 6493: }Line 6494: }Line 6495: Line 6496: return output;Line 6497: }Line 6498: Line 6499: public static decimal stCharge(int userId, string code, decimal subTotal, ShopSetup shop) {Line 6500: decimal output = 0;Line 6501: string uf = "";Line 6502: string utp = "";Line 6503: string id2 = "";Line 6504: string config = shop.getConfig("UseST");Line 6505: bool continueRunning = false;Line 6506: Line 6507: string[] arr1;Line 6508: string[] arr2;Line 6509: Line 6510: SqlConnection conn;Line 6511: SqlCommand cmd;Line 6512: SqlDataReader rdr;Line 6513: string query = "";Line 6514: Line 6515: conn = new SqlConnection( ConfigurationSettings.AppSettings["correioConn"] );Line 6516: conn.Open();Line 6517: try {Line 6518: query = "SELECT uf FROM tbl_uf WITH (NOLOCK) WHERE (a <= @code) AND (@code <= b) ";Line 6519: cmd = new SqlCommand(query, conn);Line 6520: cmd.Parameters.Add(new SqlParameter("@code", SqlDbType.NVarChar));Line 6521: cmd.Parameters["@code"].Value = code;Line 6522: uf = Convert.ToString( cmd.ExecuteScalar() ).ToUpper();Line 6523: } catch (Exception e) {}Line 6524: conn.Close();Line 6525: Line 6526: if ( uf.Length > 0 ) {Line 6527: conn = new SqlConnection(shop.Path);Line 6528: conn.Open();Line 6529: Line 6530: if ( userId > 0 ) {Line 6531: query = "SELECT userType, id2 FROM sys_users WITH (NOLOCK) WHERE codUser = @codUser";Line 6532: cmd = new SqlCommand(query, conn);Line 6533: cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));Line 6534: cmd.Parameters["@codUser"].Value = userId;Line 6535: rdr = cmd.ExecuteReader();Line 6536: if ( rdr.Read() ) {Line 6537: utp = Convert.ToString( rdr["userType"] );Line 6538: id2 = Convert.ToString( rdr["id2"] );Line 6539: }Line 6540: rdr.Close();Line 6541: }Line 6542: Line 6543: arr1 = config.Split('|');Line 6544: for(int i = 0; i < arr1.Length; i++) {Line 6545: arr2 = arr1[i].Split(';');Line 6546: if ( arr2.Length == 2 ) {Line 6547: if ( stRules( arr2[0], uf, arr2[1], utp, id2 ) ) {Line 6548: continueRunning = true;Line 6549: break;Line 6550: }Line 6551: } else {Line 6552: if ( stRules( uf, uf, arr1[0], utp, id2 ) ) {Line 6553: continueRunning = true;Line 6554: break;Line 6555: }Line 6556: }Line 6557: }Line 6558: Line 6559: if ( continueRunning ) {Line 6560: int i = 0;Line 6561: string ndd = "";Line 6562: decimal st = 0;Line 6563: decimal stFixed = 0;Line 6564: Line 6565: for(i=0; i<shop.NDD; i++)ndd+="0";Line 6566: Line 6567: query = "SELECT percentage, fixed FROM sys_subsTributaria WITH (NOLOCK) WHERE uf = @uf";Line 6568: Line 6569: cmd = new SqlCommand(query, conn);Line 6570: cmd.Parameters.Add(new SqlParameter("@uf", SqlDbType.NVarChar));Line 6571: cmd.Parameters["@uf"].Value = uf;Line 6572: rdr = cmd.ExecuteReader();Line 6573: Line 6574: while(rdr.Read()) {Line 6575: st = Convert.ToDecimal(rdr[0]) / (decimal)100;Line 6576: stFixed = Convert.ToDecimal(rdr[1]);Line 6577: }Line 6578: rdr.Close();Line 6579: Line 6580: if ( st > 0 ) {Line 6581: output += subTotal * st;Line 6582: }Line 6583: Line 6584: if ( stFixed > 0 ) {Line 6585: output += stFixed;Line 6586: }Line 6587: }Line 6588: Line 6589: conn.Close();Line 6590: }Line 6591: Line 6592: return Math.Round(output, 2);Line 6593: }Line 6594: Line 6595: /* GOOGLE_DEPRECATED */Line 6596: public static string remarketingGoogle(ShopSetup shop, string cartId, int codGroup) {Line 6597: string codGrids = "";Line 6598: string prodValue = "";Line 6599: string prodTotal = "";Line 6600: string query = "";Line 6601: string ndd = "";Line 6602: for( int i = 0; i < shop.NDD; i++ ) ndd += "0";Line 6603: decimal s_total = 0;Line 6604: StringBuilder Sb = new StringBuilder();Line 6605: Line 6606: SqlConnection conn = new SqlConnection(shop.Path);Line 6607: conn.Open();Line 6608: Line 6609: query = @"Line 6610: SELECTLine 6611: sys_cart.codGrid,Line 6612: sys_cart.qt,Line 6613: ( tbl_prices.prc * ( 1 - tbl_prices.discRate / 100 ) ) AS discPrcLine 6614: FROM sys_cart WITH (NOLOCK)Line 6615: LEFT OUTER JOIN tbl_prices WITH (NOLOCK) ON sys_cart.codGrid = tbl_prices.codGridLine 6616: WHERE (sys_cart.cid = @cartId) AND (tbl_prices.codGroup = @codGroup)Line 6617: ";Line 6618: Line 6619: SqlCommand cmd = new SqlCommand(query, conn);Line 6620: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 6621: cmd.Parameters.Add(new SqlParameter("@codGroup", SqlDbType.NVarChar));Line 6622: cmd.Parameters["@cartId"].Value = cartId;Line 6623: cmd.Parameters["@codGroup"].Value = codGroup;Line 6624: SqlDataReader rdr = cmd.ExecuteReader();Line 6625: Line 6626: while( rdr.Read() ) {Line 6627: codGrids += ",'" + Convert.ToString(rdr["codGrid"]) + "'";Line 6628: prodValue += ",'" + string.Format("{0:0." + ndd + "}", Convert.ToDecimal(rdr["discPrc"])).Replace(",", ".") + "'";Line 6629: s_total += Convert.ToDecimal(rdr["discPrc"]) * Convert.ToInt32(rdr["qt"]);Line 6630: }Line 6631: Line 6632: rdr.Close();Line 6633: conn.Close();Line 6634: Line 6635: Sb.Append( "{" );Line 6636: Sb.Append(Line 6637: String.Format(Line 6638: "'ecomm_prodid': [{0}], 'ecomm_pagetype': 'cart', 'ecomm_totalvalue': {1}"Line 6639: , ( codGrids != "" ? codGrids.Substring(1) : "" ), string.Format( "{0:0.00}", s_total ).Replace(",", ".")Line 6640: )Line 6641: );Line 6642: Sb.Append( "}" );Line 6643: Line 6644: return Sb.ToString();Line 6645: }Line 6646: /* GOOGLE_DEPRECATED */Line 6647: Line 6648: public static string isMultiple(string path, int codGrid, int qt, int codGroup) {Line 6649: string output = "True";Line 6650: SqlConnection conn = new SqlConnection(path);Line 6651: conn.Open();Line 6652: try {Line 6653: string query = "SELECT object FROM tbl_prices WITH (NOLOCK) WHERE (codGrid = @codGrid) AND (codGroup = @codGroup)";Line 6654: SqlCommand cmd = new SqlCommand(query, conn);Line 6655: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 6656: cmd.Parameters.Add(new SqlParameter("@codGroup", SqlDbType.Int));Line 6657: cmd.Parameters["@codGrid"].Value = codGrid;Line 6658: cmd.Parameters["@codGroup"].Value = codGroup;Line 6659: object o = JavaScriptDeserializer.DeserializeFromJson(Convert.ToString(cmd.ExecuteScalar()), typeof(NameValueCollection));Line 6660: int qts = Convert.ToInt32(((NameValueCollection)o)["qtIncrement"]);Line 6661: if ( qts > 0 && (qt % qts) != 0 ) {Line 6662: output = String.Format("Valor do campo [quantidade] deve ser múltiplo de {0}.", qts);Line 6663: }Line 6664: } catch (Exception ex) {}Line 6665: conn.Close();Line 6666: return output;Line 6667: }Line 6668: Line 6669: public static bool existsCrossDeviceCart(string path, string id) {Line 6670: int c = 0;Line 6671: SqlConnection conn = new SqlConnection(path);Line 6672: conn.Open();Line 6673: SqlCommand cmd = new SqlCommand("SELECT COUNT(cid) FROM sys_cart WITH (NOLOCK) WHERE (cid = @cid)", conn);Line 6674: cmd.Parameters.Add(new SqlParameter("@cid", SqlDbType.NVarChar));Line 6675: cmd.Parameters["@cid"].Value = id;Line 6676: c = Convert.ToInt32( cmd.ExecuteScalar() );Line 6677: conn.Close();Line 6678: Line 6679: return (c > 0);Line 6680: Line 6681: }Line 6682: Line 6683: public static string createCrossDeviceCart(string path, string id, string cartId) {Line 6684: int ra = 0;Line 6685: SqlConnection conn = new SqlConnection(path);Line 6686: conn.Open();Line 6687: SqlCommand cmd = new SqlCommand("UPDATE sys_cart SET cid = (@id) WHERE (cid = @cid)", conn);Line 6688: cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.NVarChar));Line 6689: cmd.Parameters.Add(new SqlParameter("@cid", SqlDbType.NVarChar));Line 6690: cmd.Parameters["@id"].Value = id;Line 6691: cmd.Parameters["@cid"].Value = cartId;Line 6692: ra = Convert.ToInt32( cmd.ExecuteNonQuery() );Line 6693: conn.Close();Line 6694: Line 6695: return (ra > 0 ? "SUCCESS" : "FAILURE");Line 6696: Line 6697: }Line 6698: Line 6699: }Line 6700: Line 6701: Line 6702: Line 6703: Line 6704: Line 6705: Line 6706: Line 6707: Line 6708: Line 6709: Line 6710: Line 6711: public class Gifts {Line 6712: public Gifts() {}Line 6713: Line 6714: public static int Qt(string path, string cartId, int codGift) {Line 6715: int output = 0;Line 6716: Line 6717: SqlConnection conn = new SqlConnection(path);Line 6718: conn.Open();Line 6719: string query = "SELECT qt FROM rel_cartWeg WITH (NOLOCK) WHERE (cid = @cid) AND (codGift = @codGift);";Line 6720: SqlCommand cmd = new SqlCommand(query, conn);Line 6721: cmd.Parameters.Add(new SqlParameter("@cid", SqlDbType.NVarChar));Line 6722: cmd.Parameters.Add(new SqlParameter("@codGift", SqlDbType.Int));Line 6723: cmd.Parameters["@cid"].Value = cartId;Line 6724: cmd.Parameters["@codGift"].Value = codGift;Line 6725: output = Convert.ToInt32(cmd.ExecuteScalar());Line 6726: conn.Close();Line 6727: Line 6728: return output;Line 6729: }Line 6730: Line 6731: public static bool Add(int shopId, string cartId, int codGift, ShopSetup shop) {Line 6732: int r = Gifts.Qt(shop.Path, cartId, codGift);Line 6733: if (r>0) {Line 6734: bool f = Gifts.Update(shopId,cartId,codGift,1+r,true,shop);Line 6735: if (f)r=1;Line 6736: else r=0;Line 6737: } else {Line 6738: SqlConnection conn = new SqlConnection(shop.Path);Line 6739: conn.Open();Line 6740: Line 6741: string query = "INSERT INTO rel_cartWeg (cid, codGift, qt, dspOrder) VALUES (@cartId, @codGift, 1, GETDATE())";Line 6742: SqlCommand cmd = new SqlCommand(query, conn);Line 6743: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 6744: Line 6745: cmd.Parameters.Add(new SqlParameter("@codGift", SqlDbType.Int));Line 6746: cmd.Parameters["@cartId"].Value = cartId;Line 6747: cmd.Parameters["@codGift"].Value = codGift;Line 6748: r = cmd.ExecuteNonQuery();Line 6749: Line 6750: conn.Close();Line 6751: }Line 6752: Line 6753: if (r>0) {Line 6754: return true;Line 6755: } else {Line 6756: return false;Line 6757: }Line 6758: }Line 6759: Line 6760: public static bool Remove(int shopId, string cartId, int codGift, ShopSetup shop) {Line 6761: SqlConnection conn = new SqlConnection(shop.Path);Line 6762: conn.Open();Line 6763: Line 6764: string query = "DELETE FROM rel_cartWeg WHERE (cid = @cartId) AND (codGift = @codGift)";Line 6765: SqlCommand cmd = new SqlCommand(query, conn);Line 6766: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 6767: cmd.Parameters.Add(new SqlParameter("@codGift", SqlDbType.Int));Line 6768: cmd.Parameters["@cartId"].Value = cartId;Line 6769: cmd.Parameters["@codGift"].Value = codGift;Line 6770: int r = cmd.ExecuteNonQuery();Line 6771: Line 6772: conn.Close();Line 6773: Line 6774: if (r>0) {Line 6775: return true;Line 6776: } else {Line 6777: return false;Line 6778: }Line 6779: }Line 6780: Line 6781: public static bool Update(int shopId, string cartId, int codGift, int qt, bool changeDspOrder, ShopSetup shop) {Line 6782: SqlConnection conn = new SqlConnection(shop.Path);Line 6783: conn.Open();Line 6784: Line 6785: string query = "";Line 6786: if (changeDspOrder)query = "UPDATE rel_cartWeg SET qt = @qt, dspOrder = GETDATE() WHERE (cid = @cartId) AND (codGift = @codGift)";Line 6787: else query = "UPDATE rel_cartWeg SET qt = @qt WHERE (cid = @cartId) AND (codGift = @codGift)";Line 6788: Line 6789: SqlCommand cmd = new SqlCommand(query, conn);Line 6790: cmd.Parameters.Add(new SqlParameter("@qt", SqlDbType.Int));Line 6791: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 6792: cmd.Parameters.Add(new SqlParameter("@codGift", SqlDbType.Int));Line 6793: cmd.Parameters["@qt"].Value = qt;Line 6794: cmd.Parameters["@cartId"].Value = cartId;Line 6795: cmd.Parameters["@codGift"].Value = codGift;Line 6796: int r = cmd.ExecuteNonQuery();Line 6797: Line 6798: conn.Close();Line 6799: Line 6800: if (r>0) {Line 6801: return true;Line 6802: } else {Line 6803: return false;Line 6804: }Line 6805: }Line 6806: Line 6807: public static bool Delete(int shopId, string cartId, ShopSetup shop) {Line 6808: SqlConnection conn = new SqlConnection(shop.Path);Line 6809: string query = "DELETE FROM rel_cartWeg WHERE (cid = @cartId)";Line 6810: SqlCommand cmd = new SqlCommand(query, conn);Line 6811: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 6812: cmd.Parameters["@cartId"].Value = cartId;Line 6813: cmd.Connection.Open();Line 6814: int r = cmd.ExecuteNonQuery();Line 6815: conn.Close();Line 6816: Line 6817: if (r>0) {Line 6818: return true;Line 6819: } else {Line 6820: return false;Line 6821: }Line 6822: }Line 6823: Line 6824: public static string Body(int shopId, string cartId, int userId, bool isStatic, out decimal sub_total, out int estimated_weight, out int estimated_volume, ShopSetup shop) {Line 6825: int i=0;string ndd="";for(i=0; i<shop.NDD; i++)ndd+="0";Line 6826: Line 6827: string thisConfig = "?sid=" + shopId;Line 6828: if (userId>0)thisConfig += "&uid=" + userId;Line 6829: Line 6830: string iClass = "";Line 6831: string iImg = "";Line 6832: Line 6833: string iRef = "";Line 6834: string iDesc = "";Line 6835: decimal iPrice = 0;Line 6836: Line 6837: decimal s_total = 0;Line 6838: int e_weight = 0;Line 6839: int e_volume = 0;Line 6840: Line 6841: i = 0;Line 6842: StringBuilder Sb = new StringBuilder();Line 6843: Line 6844: SqlConnection conn = new SqlConnection(shop.Path);Line 6845: conn.Open();Line 6846: Line 6847: string query = @"Line 6848: SELECTLine 6849: tbl_eg_prod.imgSrc,Line 6850: tbl_eg_prod.ref,Line 6851: tbl_eg_prod.name,Line 6852: rel_cartWeg.qt,Line 6853: rel_cartWeg.codGift,Line 6854: tbl_eg_prod.prc,Line 6855: tbl_eg_prod.weight,Line 6856: tbl_eg_prod.vX,Line 6857: tbl_eg_prod.vY,Line 6858: tbl_eg_prod.vZLine 6859: FROM rel_cartWeg WITH (NOLOCK)Line 6860: INNER JOIN tbl_eg_prod WITH (NOLOCK) ON rel_cartWeg.codGift = tbl_eg_prod.codGiftLine 6861: WHERE (rel_cartWeg.cid = @cartId) AND (tbl_eg_prod.active = 1)Line 6862: ORDER BY rel_cartWeg.dspOrder, tbl_eg_prod.nameLine 6863: ";Line 6864: SqlCommand cmd = new SqlCommand(query, conn);Line 6865: cmd.Parameters.Add(new SqlParameter("@cartId",SqlDbType.NVarChar));Line 6866: cmd.Parameters["@cartId"].Value = cartId;Line 6867: SqlDataReader rdr = cmd.ExecuteReader();Line 6868: if (rdr.Read()) {Line 6869: Sb.Append(" </table>\n");Line 6870: Sb.Append(" <div class='hr'><hr /></div>\n");Line 6871: Sb.Append(" <table> \n");Line 6872: Line 6873: do {Line 6874: if (0==i%2) {Line 6875: iClass = "tbl_row_0";Line 6876: } else {Line 6877: iClass = "tbl_row_1";Line 6878: }Line 6879: Line 6880: iImg = "<span></span>";Line 6881: if ( null != rdr["imgSrc"] && !Convert.ToString(rdr["imgSrc"]).Equals("")) {Line 6882: if ( shop.useLazyLoad )Line 6883: iImg="<img class='lazyload' src='/octopus/design/images/blank.gif' data-src='/octopus/design/images/" + shopId + "/gifts/t/" + Convert.ToString(rdr["imgSrc"]) + ".jpg' alt='' />";Line 6884: elseLine 6885: iImg="<img src='/octopus/design/images/" + shopId + "/gifts/t/" + Convert.ToString(rdr["imgSrc"]) + ".jpg' alt='' />";Line 6886: }Line 6887: Line 6888: iRef = "";Line 6889: Line 6890: if (null!=rdr["ref"]&&!Convert.ToString(rdr["ref"]).Equals(""))iRef=Convert.ToString(rdr["ref"]);Line 6891: Line 6892: iDesc = (string)rdr["name"];Line 6893: iPrice = (decimal)rdr["prc"];Line 6894: s_total+=iPrice*(int)rdr["qt"];Line 6895: e_weight+=(int)rdr["weight"];Line 6896: e_volume+=((int)rdr["vX"]*(int)rdr["vY"]*(int)rdr["vZ"]*Convert.ToInt32(rdr["qt"]));Line 6897: Line 6898: Sb.Append(" <tr class='" +iClass+ "'>\n");Line 6899: if (!isStatic)Line 6900: Sb.Append(" <td class='cart_body_col_img'>" + iImg + "</td>\n");Line 6901: Sb.Append(" <td class='cart_body_col_ref'>" + iRef + "</td>\n");Line 6902: Sb.Append(" <td class='cart_body_col_desc'>" + iDesc + "</td>\n");Line 6903: if (!isStatic) {Line 6904: Sb.Append(" <td class='cart_body_col_qty'><input type='text' class='n' name='gf" + i + "' size='3' onChange='javascript:setMustUpd(true);' value='" + Convert.ToString(rdr["qt"]) + "' /></td>\n");Line 6905: Sb.Append(" <td class='cart_body_col_remove'><a href=\"javascript:removeGift(" + shopId + ",'" + cartId + "'," + Convert.ToString(rdr["codGift"]) + "," + userId + ")\"><img src='/octopus/design/images/" +shopId+ "/cart_remove.gif' alt='' /></a></td>\n");Line 6906: } else {Line 6907: Sb.Append(" <td class='cart_body_col_qty'>" + Convert.ToString(rdr["qt"]) + "</td>\n");Line 6908: }Line 6909: Sb.Append(" <td class='cart_body_col_unitPrc'>" + shop.CurrType + string.Format("{0:0." + ndd + "}",iPrice) + "</td>\n");Line 6910: Sb.Append(" <td class='cart_body_col_rowTot'>" + shop.CurrType + string.Format("{0:0.00}", iPrice*(int)rdr["qt"]) + "</td>\n");Line 6911: Sb.Append(" </tr>\n");Line 6912: i++;Line 6913: } while(rdr.Read());Line 6914: }Line 6915: Line 6916: rdr.Close();Line 6917: conn.Close();Line 6918: Line 6919: sub_total = s_total;Line 6920: estimated_weight = e_weight;Line 6921: estimated_volume = e_volume;Line 6922: Line 6923: return Sb.ToString();Line 6924: }Line 6925: }Line 6926: Line 6927: Line 6928: Line 6929: Line 6930: Line 6931: Line 6932: Line 6933: Line 6934: Line 6935: Line 6936: public class Coupon {Line 6937: public Coupon() {}Line 6938: Line 6939: public static string Add() {Line 6940: // TODOLine 6941: return "";Line 6942: }Line 6943: Line 6944: public static string Get(int shopId, string couponId, decimal total, ShopSetup shop) {Line 6945: int i=0;string ndd="";for(i=0; i<shop.NDD; i++)ndd+="0";Line 6946: Line 6947: string output = "";Line 6948: //try {couponId=Convert.ToString(XmlConvert.ToGuid(couponId));}Line 6949: try {Line 6950: couponId = Convert.ToString(couponId);Line 6951: } catch (Exception e) {Line 6952: couponId = "";Line 6953: }Line 6954: Line 6955: if (couponId.Equals("")) {Line 6956: output = "(1;0)";Line 6957: } else {Line 6958: bool isEOF = true;Line 6959: string coupon_name = "";Line 6960: decimal coupon_startAt = 0;Line 6961: DateTime coupon_dateA = DateTime.MinValue;Line 6962: DateTime coupon_dateB = DateTime.MaxValue;Line 6963: int coupon_type = 0;Line 6964: decimal coupon_value = 0;Line 6965: Line 6966: SqlConnection conn = new SqlConnection(shop.Path);Line 6967: conn.Open();Line 6968: Line 6969: string query = "SELECT * FROM sys_dc_n_gc_list WITH (NOLOCK) WHERE (type < 2) AND (codCoupon = @codCoupon)";Line 6970: SqlCommand cmd = new SqlCommand(query, conn);Line 6971: cmd.Parameters.Add(new SqlParameter("@codCoupon", SqlDbType.NVarChar));Line 6972: cmd.Parameters["@codCoupon"].Value = couponId;Line 6973: SqlDataReader rdr = cmd.ExecuteReader();Line 6974: if (rdr.Read()) {Line 6975: isEOF = false;Line 6976: if (DBNull.Value!=rdr["name"])coupon_name=(string)rdr["name"];Line 6977: if (DBNull.Value!=rdr["startAt"])coupon_startAt=(decimal)rdr["startAt"];Line 6978: Line 6979: if (DBNull.Value!=rdr["dateA"])Line 6980: coupon_dateA = Convert.ToDateTime(rdr["dateA"]);Line 6981: if (DBNull.Value!=rdr["dateB"])Line 6982: coupon_dateB = Convert.ToDateTime(Convert.ToString(rdr["dateB"]).Split(' ')[0] + " 23:59:59");Line 6983: Line 6984: if (DBNull.Value!=rdr["type"])coupon_type=Convert.ToInt32(rdr["type"]);Line 6985: if (DBNull.Value!=rdr["value"])coupon_value=(decimal)rdr["value"];Line 6986: }Line 6987: rdr.Close();Line 6988: Line 6989: if (isEOF) {Line 6990: output = "(1;0)";Line 6991: } else {Line 6992: switch(coupon_type) {Line 6993: case -1:Line 6994: if ( coupon_dateA <= DateTime.Now && DateTime.Now <= coupon_dateB ) {Line 6995: if (coupon_startAt <= total ) {Line 6996: output = string.Format("{0:0.00}", coupon_value);Line 6997: } else {Line 6998: output = "(1;1)";Line 6999: }Line 7000: } else {Line 7001: if ( DateTime.Now < coupon_dateA ) {Line 7002: output = "(1;2A)";Line 7003: } else {Line 7004: output = "(1;2B)";Line 7005: }Line 7006: }Line 7007: break;Line 7008: Line 7009: case 0:Line 7010: if ( coupon_dateA <= DateTime.Now && DateTime.Now <= coupon_dateB ) {Line 7011: if (coupon_startAt <= total && total > coupon_value ) {Line 7012: Line 7013: if ( coupon_name == "__AUTO_GENERATED_BY_PROMOTION__" ) {Line 7014: if ( UserSetup.getOrderStatus( shop.Path, Convert.ToInt32( couponId.Substring(15) ) ) > 2 ) {Line 7015: output = string.Format("{0:0.00}", coupon_value);Line 7016: } else {Line 7017: output = "(1;0)";Line 7018: }Line 7019: } else {Line 7020: output = string.Format("{0:0.00}", coupon_value );Line 7021: }Line 7022: Line 7023: } else {Line 7024: output = "(1;1)";Line 7025: }Line 7026: } else {Line 7027: if ( DateTime.Now < coupon_dateA ) {Line 7028: output = "(1;2A)";Line 7029: } else {Line 7030: output = "(1;2B)";Line 7031: }Line 7032: }Line 7033: break;Line 7034: Line 7035: case 1:Line 7036: if ( coupon_dateA <= DateTime.Now && DateTime.Now <= coupon_dateB) {Line 7037: if ( coupon_startAt <= total ) {Line 7038: output = string.Format("{0:0.00}", total * (coupon_value / 100) );Line 7039: } else {Line 7040: output = "(1;1)";Line 7041: }Line 7042: } else {Line 7043: if ( DateTime.Now < coupon_dateA ) {Line 7044: output = "(1;2A)";Line 7045: } else {Line 7046: output = "(1;2B)";Line 7047: }Line 7048: }Line 7049: break;Line 7050: Line 7051: case 2:Line 7052: output = "(1;3)";Line 7053: break;Line 7054: }Line 7055: }Line 7056: Line 7057: conn.Close();Line 7058: }Line 7059: return output;Line 7060: }Line 7061: Line 7062: public static decimal Get(string path, string couponId, decimal subTotal) {Line 7063: decimal output = 0;Line 7064: Line 7065: SqlConnection conn = new SqlConnection(path);Line 7066: conn.Open();Line 7067: Line 7068: string query = "SELECT codCoupon, name, type, value FROM sys_dc_n_gc_list WITH (NOLOCK) WHERE (codCoupon = @codCoupon)";Line 7069: SqlCommand cmd = new SqlCommand(query, conn);Line 7070: cmd.Parameters.Add(new SqlParameter("@codCoupon", SqlDbType.NVarChar));Line 7071: cmd.Parameters["@codCoupon"].Value = couponId;Line 7072: SqlDataReader rdr = cmd.ExecuteReader();Line 7073: Line 7074: try {Line 7075: if ( rdr.Read() ) {Line 7076: int type = Convert.ToInt32(rdr["type"]);Line 7077: if ( type >= 0 ) {Line 7078: if ( type == 1 ) {Line 7079: output = subTotal * ( Convert.ToDecimal(rdr["value"]) / 100 );Line 7080: } else {Line 7081: Line 7082: // promotionLine 7083: if ( Convert.ToString(rdr["name"]) == "__AUTO_GENERATED_BY_PROMOTION__" ) {Line 7084: if ( UserSetup.getOrderStatus( path, Convert.ToInt32( Convert.ToString(rdr["codCoupon"]).Substring(15) ) ) > 2 ) {Line 7085: output = Convert.ToDecimal(rdr[1]);Line 7086: }Line 7087: } else {Line 7088: output = Convert.ToDecimal(rdr[1]);Line 7089: }Line 7090: Line 7091: }Line 7092: }Line 7093: }Line 7094: } catch (Exception e) {};Line 7095: Line 7096: rdr.Close();Line 7097: conn.Close();Line 7098: Line 7099: return output;Line 7100: }Line 7101: Line 7102: public static string Body(int shopId, string couponId, string currType, decimal total, string ndd, bool isStatic, ShopSetup shop) {Line 7103: decimal trash;Line 7104: return Coupon.Body(shopId,couponId,currType,total,ndd,isStatic, out trash, shop);Line 7105: }Line 7106: Line 7107: public static string Body(int shopId, string couponId, string currType, decimal total, string ndd, bool isStatic, out decimal couponValue, ShopSetup shop) {Line 7108: string dc_label = "";Line 7109: string dc_value = string.Format("{0:0.00}",0);Line 7110: string disabled = "";Line 7111: if (!couponId.Equals("")) {Line 7112: // disabled = " disabled='disabled'";Line 7113: disabled = "";Line 7114: dc_value = Coupon.Get(shopId, couponId, total, shop);Line 7115: if (!ZenTools.Left(dc_value,1).Equals("(")) {Line 7116: dc_value = string.Format("{0:0.00}", dc_value);Line 7117: } else {Line 7118: dc_value = string.Format("{0:0.00}",0);Line 7119: }Line 7120: }Line 7121: Line 7122: couponValue = Convert.ToDecimal(dc_value);Line 7123: Line 7124: SqlConnection conn = new SqlConnection(shop.Path);Line 7125: conn.Open();Line 7126: Line 7127: string query = "SELECT * FROM sys_dc_n_gc_setup WITH (NOLOCK)";Line 7128: SqlCommand cmd = new SqlCommand(query,conn);Line 7129: SqlDataReader rdr = cmd.ExecuteReader();Line 7130: if (rdr.Read())dc_label = (string)rdr["dc_label"];Line 7131: Line 7132: rdr.Close();Line 7133: conn.Close();Line 7134: Line 7135: StringBuilder Sb = new StringBuilder();Line 7136: Sb.Append(" <div id='cart_dc'>\n");Line 7137: Sb.Append(" <table>\n");Line 7138: Line 7139: Sb.Append(" <tr>\n");Line 7140: Sb.Append(" <td width='50%' class='lft_half'>\n");Line 7141: Sb.Append(" <ul>\n");Line 7142: Sb.Append(" <li class='label'><span>" + dc_label + "</span></li>\n");Line 7143: if (!isStatic)Line 7144: Sb.Append(" <li class='field'><input id='coupon-id' type='text' class='a' name='couponId' maxlength='50' value='" + couponId + "' onchange='javascript:setMustRecharge(true);'" + disabled + " autocomplete='off' /></li>\n");Line 7145: elseLine 7146: Sb.Append(" <li class='field'><span>" + couponId + "</span></li>\n");Line 7147: if (!isStatic)Line 7148: Sb.Append(" <li class='submit'><a href='javascript:req_setCouponValue();'><img src='/octopus/design/images/" + shopId + "/cart_ok.gif' alt='' /></a></li>\n");Line 7149: Sb.Append(" </ul>\n");Line 7150: Sb.Append(" </td>\n");Line 7151: Sb.Append(" <td width='50%' class='rgt_half'>\n");Line 7152: Sb.Append(" <table><tr><th>" + dc_label + "</th><td><span id='coupon_value_parent'>" + currType + "<span id='coupon_value'>" + dc_value + "</span></span></td></tr></table>\n");Line 7153: Sb.Append(" </td>\n");Line 7154: Sb.Append(" </tr>\n");Line 7155: Sb.Append(" </table>\n");Line 7156: Sb.Append(" </div>\n");Line 7157: Line 7158: return Sb.ToString();Line 7159: }Line 7160: Line 7161: public static int getTimes(string path, string couponId) {Line 7162: int output = 0;Line 7163: Line 7164: SqlConnection conn = new SqlConnection(path);Line 7165: conn.Open();Line 7166: Line 7167: try {Line 7168: string query = "SELECT times FROM sys_dc_n_gc_list WITH (NOLOCK) WHERE (codCoupon = @codCoupon)";Line 7169: SqlCommand cmd = new SqlCommand(query, conn);Line 7170: cmd.Parameters.Add(new SqlParameter("@codCoupon", SqlDbType.NVarChar));Line 7171: cmd.Parameters["@codCoupon"].Value = couponId;Line 7172: output = Convert.ToInt32(cmd.ExecuteScalar());Line 7173: } catch (Exception e) {};Line 7174: Line 7175: conn.Close();Line 7176: Line 7177: return output;Line 7178: }Line 7179: Line 7180: public static bool used(string path, string couponId, string name, int userId) {Line 7181: bool output = false;Line 7182: Line 7183: SqlConnection conn = new SqlConnection(path);Line 7184: conn.Open();Line 7185: Line 7186: string query = @"Line 7187: SELECT COUNT(O.codOrder)Line 7188: FROM sys_orders O WITH (NOLOCK)Line 7189: INNER JOIN rel_ordersWdc_n_gc R WITH (NOLOCK) ON R.codOrder = O.codOrderLine 7190: INNER JOIN sys_dc_n_gc_list D WITH (NOLOCK) ON R.code = D.codCouponLine 7191: WHERE (O.codUser = @userId)Line 7192: AND (D.codCoupon = @couponId)Line 7193: AND ( (D.dateA <= O.date) AND (O.date <= D.dateB) OR (D.dateA <= O.date) AND (D.dateB IS NULL) )Line 7194: AND (D.name LIKE @name)Line 7195: ";Line 7196: Line 7197: SqlCommand cmd = new SqlCommand(query, conn);Line 7198: cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int));Line 7199: cmd.Parameters.Add(new SqlParameter("@couponId", SqlDbType.NVarChar));Line 7200: cmd.Parameters.Add(new SqlParameter("@name", SqlDbType.NVarChar));Line 7201: cmd.Parameters["@userId"].Value = userId;Line 7202: cmd.Parameters["@couponId"].Value = couponId;Line 7203: cmd.Parameters["@name"].Value = name + "%";Line 7204: Line 7205: if ( Convert.ToInt32(cmd.ExecuteScalar()) > 0 ) {Line 7206: output = true;Line 7207: }Line 7208: Line 7209: conn.Close();Line 7210: Line 7211: return output;Line 7212: }Line 7213: Line 7214: }Line 7215: Line 7216: Line 7217: Line 7218: Line 7219: Line 7220: Line 7221: Line 7222: Line 7223: Line 7224: Line 7225: public class Stock {Line 7226: public Stock() {}Line 7227: Line 7228: public static int Qt(string path, int codGrid) {Line 7229: int output = 0;Line 7230: Line 7231: SqlConnection conn = new SqlConnection(path);Line 7232: conn.Open();Line 7233: Line 7234: string query = "SELECT qt FROM sys_stock WITH (NOLOCK) WHERE (codGrid = @codGrid);";Line 7235: SqlCommand cmd = new SqlCommand(query, conn);Line 7236: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 7237: cmd.Parameters["@codGrid"].Value = codGrid;Line 7238: output = Convert.ToInt32(cmd.ExecuteScalar());Line 7239: Line 7240: conn.Close();Line 7241: Line 7242: return output;Line 7243: }Line 7244: Line 7245: public static int gridQt(string path, int codProd) {Line 7246: int output = 0;Line 7247: Line 7248: SqlConnection conn = new SqlConnection(path);Line 7249: conn.Open();Line 7250: Line 7251: string query = @"Line 7252: SELECT SUM(qt)Line 7253: FROM sys_stock WITH (NOLOCK)Line 7254: WHERE ( codGrid IN ( SELECT tbl_grid.codGrid FROM tbl_grid WITH (NOLOCK) WHERE (codProd = @codProd) AND (active = 1) ) )Line 7255: ";Line 7256: SqlCommand cmd = new SqlCommand(query, conn);Line 7257: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 7258: cmd.Parameters["@codProd"].Value = codProd;Line 7259: output = Convert.ToInt32(cmd.ExecuteScalar());Line 7260: Line 7261: conn.Close();Line 7262: Line 7263: return output;Line 7264: }Line 7265: Line 7266: public static string InsertInStockNotification(int shopId, int codGrid, string name, string email, string phone, ShopSetup shop) {Line 7267: string output = "";Line 7268: Line 7269: SqlConnection conn = new SqlConnection(shop.Path);Line 7270: conn.Open();Line 7271: Line 7272: string query = "INSERT INTO sys_isn_list(codGrid,name,email,jsonExt) VALUES(@codGrid, @name, @email, @json)";Line 7273: SqlCommand cmd = new SqlCommand(query, conn);Line 7274: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 7275: cmd.Parameters.Add(new SqlParameter("@name", SqlDbType.NVarChar));Line 7276: cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar));Line 7277: cmd.Parameters.Add(new SqlParameter("@json", SqlDbType.NText));Line 7278: cmd.Parameters["@codGrid"].Value = codGrid;Line 7279: cmd.Parameters["@name"].Value = name;Line 7280: cmd.Parameters["@email"].Value = email;Line 7281: cmd.Parameters["@json"].Value = ( phone != "" ? "{ \"phone\": \"" + phone + "\" }" : "{}" );Line 7282: int r = cmd.ExecuteNonQuery();Line 7283: Line 7284: if (r>0) {Line 7285: output += "<table><tr><th>Avise-me ao chegar</th></tr><tr><td>Seu cadastro foi realizado e logo que este produto estiver disponível, você será notificado.</td></tr></table>";Line 7286: Line 7287: /* --( Automatic email )----------------------------------------------------- */Line 7288: string isn_subj = "";Line 7289: string isn_body = "";Line 7290: string isn_prod = "";Line 7291: Line 7292: query = "SELECT subject, body FROM sys_emails WITH (NOLOCK) WHERE codEmail = 2";Line 7293: cmd = new SqlCommand(query, conn);Line 7294: SqlDataReader rdr = cmd.ExecuteReader();Line 7295: if (rdr.Read()) {Line 7296: isn_subj = (string)rdr["subject"];Line 7297: isn_body = (string)rdr["body"];Line 7298: isn_body = isn_body.Replace("[? user_name ?]",name);Line 7299: }Line 7300: rdr.Close();Line 7301: Line 7302: query = @"Line 7303: SELECTLine 7304: tbl_grid.ref,Line 7305: tbl_prod.[desc] AS ProdDesc,Line 7306: tbl_grid.codCompLine 7307: FROM tbl_prod WITH (NOLOCK)Line 7308: INNER JOIN tbl_grid WITH (NOLOCK) ON tbl_prod.codProd = tbl_grid.codProdLine 7309: WHERE (tbl_grid.codGrid = @cg)Line 7310: ";Line 7311: cmd = new SqlCommand(query,conn);Line 7312: cmd.Parameters.Add(new SqlParameter("@cg", SqlDbType.Int));Line 7313: cmd.Parameters["@cg"].Value = codGrid;Line 7314: rdr = cmd.ExecuteReader();Line 7315: if (rdr.Read()) {Line 7316: if (null!=rdr["ref"]) {Line 7317: isn_prod += Convert.ToString(rdr["ref"]);Line 7318: isn_prod += " - ";Line 7319: }Line 7320: isn_prod += (string)rdr["ProdDesc"];Line 7321: if (null!=rdr["codComp"]&&!Convert.ToString(rdr["codComp"]).Equals(""))isn_prod += " " + Generics.GridDescription(shop.Path, Convert.ToString(rdr["codComp"]));Line 7322: Line 7323: isn_subj = isn_subj.Replace("[? prod_name ?]",isn_prod);Line 7324: isn_body = isn_body.Replace("[? prod_name ?]",isn_prod);Line 7325: }Line 7326: rdr.Close();Line 7327: Line 7328: isn_body = shop.ShopTags(isn_body);Line 7329: Line 7330: //bool isn_mailer = ZenTools.Mail(shop.Email, email, isn_subj, isn_body);Line 7331: Line 7332: string res = ZenTools.SyncWebRequest(Line 7333: string.Format( "{0}shared/mail_auth.asp", shop.Http ),Line 7334: string.Format( "sid={0}&to={1}&subject={2}&body={3}", shopId, email, HttpUtility.UrlEncode( isn_subj ), HttpUtility.UrlEncode( isn_body ) )Line 7335: );Line 7336: Line 7337: } else {Line 7338: output += "<table><tr><th>Avise-me ao chegar</th></tr><tr><td>Não foi possível realizar o cadastro.</td></tr></table>";Line 7339: }Line 7340: Line 7341: conn.Close();Line 7342: Line 7343: return output;Line 7344: }Line 7345: Line 7346: // DEPRECATED 2014-06-18Line 7347: public static int AvailabilityUpdate(SqlConnection conn, SqlTransaction trans, int codGrid, int status) {Line 7348: int output = 0;Line 7349: Line 7350: string query = "UPDATE tbl_prices SET codAvailability = @availability WHERE (codGrid = @codGrid) AND (codAvailability < 3)";Line 7351: Line 7352: SqlCommand cmd = new SqlCommand(query, conn);Line 7353: cmd.Transaction = trans;Line 7354: cmd.Parameters.Add(new SqlParameter("@availability", SqlDbType.Int));Line 7355: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 7356: cmd.Parameters["@availability"].Value = status;Line 7357: cmd.Parameters["@codGrid"].Value = codGrid;Line 7358: output = Convert.ToInt32(cmd.ExecuteNonQuery());Line 7359: return output;Line 7360: }Line 7361: Line 7362: public static void IllustrativeCheck(SqlConnection conn, SqlTransaction trans, int codGrid) {Line 7363: bool gridSoldOut = false;Line 7364: string query = "";Line 7365: Line 7366: // check if grid is sold outLine 7367: query = @"Line 7368: SELECT COUNT(tbl_grid.codGrid)Line 7369: FROM tbl_grid WITH (NOLOCK)Line 7370: INNER JOIN tbl_prices WITH (NOLOCK) ON tbl_grid.codGrid = tbl_prices.codGridLine 7371: WHERE ( tbl_grid.codProd = ( SELECT TOP 1 codProd FROM tbl_grid WHERE tbl_grid.codGrid = @codGrid ) )Line 7372: AND (tbl_prices.codStatus <> 4 ) AND (tbl_prices.codAvailability = 1)Line 7373: ";Line 7374: Line 7375: SqlCommand cmd = new SqlCommand(query, conn);Line 7376: cmd.Transaction = trans;Line 7377: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 7378: cmd.Parameters["@codGrid"].Value = codGrid;Line 7379: if ( Convert.ToInt32(cmd.ExecuteScalar()) == 0 ) {Line 7380: gridSoldOut = true;Line 7381: }Line 7382: Line 7383: if ( gridSoldOut ) {Line 7384: // get illustrative codGridLine 7385: query = @"Line 7386: SELECT TOP 1 tbl_grid.codGridLine 7387: FROM tbl_grid WITH (NOLOCK)Line 7388: INNER JOIN tbl_prices WITH (NOLOCK) ON tbl_grid.codGrid = tbl_prices.codGridLine 7389: WHERE ( tbl_grid.codProd = ( SELECT TOP 1 codProd FROM tbl_grid WITH (NOLOCK) WHERE tbl_grid.codGrid = @codGrid ) )Line 7390: AND (tbl_prices.codStatus = 4 )Line 7391: ";Line 7392: Line 7393: cmd = new SqlCommand(query, conn);Line 7394: cmd.Transaction = trans;Line 7395: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 7396: cmd.Parameters["@codGrid"].Value = codGrid;Line 7397: int codGridIll = Convert.ToInt32(cmd.ExecuteScalar());Line 7398: Line 7399: if ( codGridIll > 0 ) {Line 7400: // update availability from illustrative productLine 7401: query = "UPDATE tbl_prices SET codAvailability = 2 WHERE (codGrid = @codGrid)";Line 7402: cmd = new SqlCommand(query, conn);Line 7403: cmd.Transaction = trans;Line 7404: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 7405: cmd.Parameters["@codGrid"].Value = codGridIll;Line 7406: cmd.ExecuteNonQuery();Line 7407: }Line 7408: }Line 7409: }Line 7410: Line 7411: }Line 7412: Line 7413: Line 7414: Line 7415: Line 7416: Line 7417: Line 7418: Line 7419: Line 7420: Line 7421: Line 7422: public class Transporters {Line 7423: public Transporters() {}Line 7424: Line 7425: public static int Add(int shopId, string transpName, string transpPhone, ShopSetup shop) {Line 7426: int output = 0;Line 7427: Line 7428: SqlConnection conn = new SqlConnection(shop.Path);Line 7429: conn.Open();Line 7430: Line 7431: SqlTransaction tran = conn.BeginTransaction();Line 7432: SqlCommand cmd = conn.CreateCommand();Line 7433: cmd.Connection = conn;Line 7434: cmd.Transaction = tran;Line 7435: try {Line 7436: cmd.CommandText = "INSERT INTO sys_transp (name, phone, active) VALUES (@ins_name, @ins_phone, 1)";Line 7437: cmd.Parameters.Add(new SqlParameter("@ins_name", SqlDbType.NVarChar));Line 7438: cmd.Parameters.Add(new SqlParameter("@ins_phone", SqlDbType.NVarChar));Line 7439: cmd.Parameters["@ins_name"].Value = transpName;Line 7440: cmd.Parameters["@ins_phone"].Value = transpPhone;Line 7441: output = cmd.ExecuteNonQuery();Line 7442: Line 7443: cmd.CommandText = "SELECT codTransp FROM sys_transp WITH (NOLOCK) WHERE name = @view_name";Line 7444: cmd.Parameters.Add(new SqlParameter("@view_name", SqlDbType.NVarChar));Line 7445: cmd.Parameters["@view_name"].Value = transpName;Line 7446: output = Convert.ToInt32(cmd.ExecuteScalar());Line 7447: Line 7448: tran.Commit();Line 7449: } catch (Exception e) {Line 7450: try {Line 7451: tran.Rollback();Line 7452: output = -1;Line 7453: } catch (SqlException sqlE) {Line 7454: output = -2;Line 7455: }Line 7456: }Line 7457: Line 7458: conn.Close();Line 7459: Line 7460: return output;Line 7461: }Line 7462: Line 7463: public static string List(int shopId, int transpId, ShopSetup shop) {Line 7464: string output = "";Line 7465: output += "<select class='a required' name='transp' style='width:140px'>";Line 7466: Line 7467: SqlConnection conn = new SqlConnection(shop.Path);Line 7468: conn.Open();Line 7469: Line 7470: string query = "SELECT codTransp, name FROM sys_transp WITH (NOLOCK) WHERE (active = 1) ORDER BY name";Line 7471: SqlCommand cmd = new SqlCommand(query, conn);Line 7472: SqlDataReader rdr = cmd.ExecuteReader();Line 7473: while(rdr.Read()) {Line 7474: output += "<option value='" + (int)rdr["codTransp"] + "'";Line 7475: if (transpId==(int)rdr["codTransp"])output+=" selected='selected'";Line 7476: output += ">" + (string)rdr["name"] + "</option>";Line 7477: }Line 7478: Line 7479: rdr.Close();Line 7480: conn.Close();Line 7481: Line 7482: output += "</select>";Line 7483: return output;Line 7484: }Line 7485: Line 7486: public static string Select(int shopId, int transpId, ShopSetup shop) {Line 7487: string output = "";Line 7488: Line 7489: SqlConnection conn = new SqlConnection(shop.Path);Line 7490: conn.Open();Line 7491: Line 7492: string query = "SELECT name, phone FROM sys_transp WITH (NOLOCK) WHERE (active = 1) AND (codTransp = @codTransp)";Line 7493: SqlCommand cmd = new SqlCommand(query, conn);Line 7494: cmd.Parameters.Add(new SqlParameter("@codTransp", SqlDbType.Int));Line 7495: cmd.Parameters["@codTransp"].Value = transpId;Line 7496: SqlDataReader rdr = cmd.ExecuteReader();Line 7497: Line 7498: if (rdr.Read()) {Line 7499: output += (string)rdr["name"] + " - Tel.: " + (string)rdr["phone"];Line 7500: }Line 7501: Line 7502: rdr.Close();Line 7503: conn.Close();Line 7504: Line 7505: return output;Line 7506: }Line 7507: Line 7508: }Line 7509: Line 7510: Line 7511: Line 7512: Line 7513: Line 7514: Line 7515: Line 7516: Line 7517: Line 7518: Line 7519: Line 7520: Line 7521: Line 7522: Line 7523: Line 7524: Line 7525: Line 7526: Line 7527: Line 7528: Line 7529: public class Quotation {Line 7530: public Quotation() {}Line 7531: Line 7532: public static void Add(string path, string email, string code, string cartId) {Line 7533: Add(path, email, code, cartId, "");Line 7534: }Line 7535: Line 7536: public static void Add(string path, string email, string code, string cartId, string idQtn ) {Line 7537: bool isRunning = true;Line 7538: string item_json = "";Line 7539: Line 7540: Delete(path, cartId);Line 7541: if ( idQtn != "" ) {Line 7542: Delete(path, idQtn);Line 7543: }Line 7544: Line 7545: StringDictionary Sd = new StringDictionary();Line 7546: Line 7547: SqlConnection conn = new SqlConnection(path);Line 7548: conn.Open();Line 7549: Line 7550: //--( Check if cart is empty )------------------------------------------Line 7551: string query = "SELECT count(codGrid) FROM sys_cart WITH (NOLOCK) WHERE (cid = @cartId)";Line 7552: SqlCommand cmd = new SqlCommand(query, conn);Line 7553: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 7554: cmd.Parameters["@cartId"].Value = cartId;Line 7555: if ( Convert.ToInt32( cmd.ExecuteScalar() ) <= 0 ) {Line 7556: conn.Close();Line 7557: return;Line 7558: }Line 7559: Line 7560: query = "INSERT INTO sys_quotations (id, email, code) VALUES (@id, @email, @code)";Line 7561: cmd = new SqlCommand(query, conn);Line 7562: cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.NVarChar));Line 7563: cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar));Line 7564: cmd.Parameters.Add(new SqlParameter("@code", SqlDbType.NVarChar));Line 7565: cmd.Parameters["@id"].Value = (idQtn != "" ? idQtn : cartId);Line 7566: cmd.Parameters["@email"].Value = email;Line 7567: cmd.Parameters["@code"].Value = code;Line 7568: Line 7569: if ( Convert.ToInt32( cmd.ExecuteNonQuery() ) == 0 )Line 7570: isRunning = false;Line 7571: Line 7572: if ( isRunning ) {Line 7573: query = "SELECT codGrid, qt FROM sys_cart WITH (NOLOCK) WHERE cid = @cartId";Line 7574: Line 7575: cmd = new SqlCommand(query, conn);Line 7576: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 7577: cmd.Parameters["@cartId"].Value = cartId;Line 7578: SqlDataReader rdr = cmd.ExecuteReader();Line 7579: Line 7580: while( rdr.Read() ) {Line 7581: if ( Sd.ContainsKey( Convert.ToString(rdr[0]) ) ) {Line 7582: Sd[Convert.ToString(rdr[0])] = Convert.ToString( Convert.ToInt32(Sd[Convert.ToString(rdr[0])]) + Convert.ToInt32(rdr[1]) );Line 7583: } else {Line 7584: Sd.Add( Convert.ToString(rdr[0]), Convert.ToString(rdr[1]) );Line 7585: }Line 7586: }Line 7587: Line 7588: rdr.Close();Line 7589: Line 7590: Line 7591: Line 7592: foreach( DictionaryEntry Item in Sd ) {Line 7593: item_json = "{}";Line 7594: cmd = new SqlCommand(Line 7595: @"Line 7596: SELECT codGroup, ( (1 - discRate / 100) * prc ) AS prc_fullLine 7597: FROM tbl_prices WITH (NOLOCK)Line 7598: WHERE (codGrid = @codGrid)"Line 7599: , connLine 7600: );Line 7601: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 7602: cmd.Parameters["@codGrid"].Value = Convert.ToInt32(Item.Key);Line 7603: rdr = cmd.ExecuteReader();Line 7604: Line 7605: try {Line 7606: // get item priceLine 7607: object o = JavaScriptDeserializer.DeserializeFromJson("{}", typeof(NameValueCollection));Line 7608: while( rdr.Read() ) {Line 7609: ((NameValueCollection)o)["unit_prc_" + Convert.ToString(rdr["codGroup"])] = Convert.ToString(rdr["prc_full"]);Line 7610: }Line 7611: item_json = JavaScriptSerializer.Serialize(o);Line 7612: } catch (Exception ex) {}Line 7613: Line 7614: rdr.Close();Line 7615: Line 7616: query = "INSERT INTO sys_quotationsBodies (idQuotation, codGrid, qt, json) VALUES (@idQuotation, @codGrid, @qt, @json)";Line 7617: cmd = new SqlCommand(query, conn);Line 7618: cmd.Parameters.Add(new SqlParameter("@idQuotation", SqlDbType.NVarChar));Line 7619: cmd.Parameters.Add(new SqlParameter("@codGrid", SqlDbType.Int));Line 7620: cmd.Parameters.Add(new SqlParameter("@qt", SqlDbType.Int));Line 7621: cmd.Parameters.Add(new SqlParameter("@json", SqlDbType.NText));Line 7622: cmd.Parameters["@idQuotation"].Value = (idQtn != "" ? idQtn : cartId);Line 7623: cmd.Parameters["@codGrid"].Value = Convert.ToInt32(Item.Key);Line 7624: cmd.Parameters["@qt"].Value = Convert.ToInt32(Item.Value);Line 7625: cmd.Parameters["@json"].Value = item_json;Line 7626: cmd.ExecuteNonQuery();Line 7627: }Line 7628: }Line 7629: Line 7630: conn.Close();Line 7631: }Line 7632: Line 7633: Line 7634: public static void Delete(string path, string cartId) {Line 7635: SqlConnection conn = new SqlConnection(path);Line 7636: conn.Open();Line 7637: Line 7638: string query = "DELETE FROM sys_quotations WHERE id = @id";Line 7639: Line 7640: SqlCommand cmd = new SqlCommand(query, conn);Line 7641: cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.NVarChar));Line 7642: cmd.Parameters["@id"].Value = cartId;Line 7643: cmd.ExecuteNonQuery();Line 7644: Line 7645: Line 7646: conn.Close();Line 7647: }Line 7648: Line 7649: public static void Add2cart(int shopId, string idQtn, int codGroup, ShopSetup shop) {Line 7650: Add2cart(shopId, idQtn, "", codGroup, shop);Line 7651: }Line 7652: Line 7653: public static void Add2cart(int shopId, string idQtn, string cartId, int codGroup, ShopSetup shop) {Line 7654: StringDictionary Qtn = new StringDictionary();Line 7655: Line 7656: SqlConnection conn = new SqlConnection(shop.Path);Line 7657: conn.Open();Line 7658: Line 7659: string query = @"Line 7660: SELECT sys_quotationsBodies.codGrid, sys_quotationsBodies.qtLine 7661: FROM sys_quotationsBodies WITH (NOLOCK)Line 7662: INNER JOIN tbl_grid WITH (NOLOCK) ON sys_quotationsBodies.codGrid = tbl_grid.codGridLine 7663: INNER JOIN tbl_prices WITH (NOLOCK) ON tbl_grid.codGrid = tbl_prices.codGridLine 7664: WHERE (idQuotation = @idQuotation)Line 7665: AND (tbl_grid.active = 1)Line 7666: AND (tbl_prices.codAvailability = 1)Line 7667: AND (tbl_prices.codGroup = @codGroup)Line 7668: ";Line 7669: Line 7670: SqlCommand cmd = new SqlCommand(query, conn);Line 7671: cmd.Parameters.Add(new SqlParameter("@idQuotation", SqlDbType.NVarChar));Line 7672: cmd.Parameters.Add(new SqlParameter("@codGroup", SqlDbType.Int));Line 7673: cmd.Parameters["@idQuotation"].Value = idQtn;Line 7674: cmd.Parameters["@codGroup"].Value = codGroup;Line 7675: SqlDataReader rdr = cmd.ExecuteReader();Line 7676: while( rdr.Read() ) {Line 7677: Qtn.Add( Convert.ToString(rdr[0]), Convert.ToString(rdr[1]) );Line 7678: }Line 7679: rdr.Close();Line 7680: Line 7681: //--( Remove from cart )------------------------------------------------Line 7682: Cart.Delete(shopId, idQtn, shop);Line 7683: if ( cartId != "" ) {Line 7684: Cart.Delete(shopId, cartId, shop);Line 7685: }Line 7686: Line 7687: //--( Add to cart )-----------------------------------------------------Line 7688: foreach( DictionaryEntry Item in Qtn ) {Line 7689: Cart.Add( shopId, (cartId != "" ? cartId : idQtn), Convert.ToInt32(Item.Key), Convert.ToInt32(Item.Value), shop);Line 7690: }Line 7691: Line 7692: conn.Close();Line 7693: }Line 7694: Line 7695: }Line 7696: Line 7697: Line 7698: Line 7699: Line 7700: Line 7701: Line 7702: Line 7703: Line 7704: Line 7705: Line 7706: public class BuyTogether {Line 7707: Line 7708: private int shopId;Line 7709: Line 7710: private int userId;Line 7711: Line 7712: private string cartId;Line 7713: Line 7714: private string config;Line 7715: Line 7716: private ShopSetup shop;Line 7717: Line 7718: public BuyTogether(int sid, string thisConfig, int uid, string cid, ShopSetup Shop) {Line 7719: shopId = sid;Line 7720: config = thisConfig;Line 7721: userId = uid;Line 7722: cartId = cid;Line 7723: shop = Shop;Line 7724: }Line 7725: Line 7726: public string display(int codProd) {Line 7727: string query = "";Line 7728: string prodCollection = "";Line 7729: Line 7730: string[] priceLabels = new string[4];Line 7731: priceLabels[0] = "de: ";Line 7732: priceLabels[1] = "por: ";Line 7733: priceLabels[2] = "economize: ";Line 7734: priceLabels[3] = "comprando junto: ";Line 7735: Line 7736: string[] imgSizes = shop.getImgSize("T");Line 7737: Line 7738: decimal[] Prices = null;Line 7739: Line 7740: int i = 0;Line 7741: int plusIndex = 0;Line 7742: Line 7743: string ndd=""; for( i = 0; i < shop.NDD; i++) ndd += "0";Line 7744: Line 7745: decimal comboTotal = 0;Line 7746: decimal comboSave = 0;Line 7747: Line 7748: StringDictionary Descriptions = new StringDictionary();Line 7749: Line 7750: SqlConnection conn = new SqlConnection(shop.Path);Line 7751: conn.Open();Line 7752: Line 7753: //--( get combo id )--------------------------------------------Line 7754: query = @"Line 7755: SELECT [id]Line 7756: FROM tbl_buyTogether WITH (NOLOCK)Line 7757: WHERE ([id] = @codProd)Line 7758: GROUP BY id HAVING COUNT(id) > 1Line 7759: ";Line 7760: SqlCommand cmd = new SqlCommand(query, conn);Line 7761: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 7762: cmd.Parameters["@codProd"].Value = codProd;Line 7763: int comboId = Convert.ToInt32( cmd.ExecuteScalar() );Line 7764: Line 7765: StringBuilder Sb = new StringBuilder();Line 7766: StringBuilder Ct = new StringBuilder(); // Combo TotalsLine 7767: Line 7768: if ( comboId > 0 ) {Line 7769: Sb.Append(" <div id='buy-together'>"); Sb.Append(System.Environment.NewLine);Line 7770: Sb.Append(" <a name='buy-together'><font class='subtitle'>Compre junto</font></a>"); Sb.Append(System.Environment.NewLine);Line 7771: Sb.Append(" <div id='buy-together-combo'>"); Sb.Append(System.Environment.NewLine);Line 7772: Sb.Append(" <div id='combo_imgs'>"); Sb.Append(System.Environment.NewLine);Line 7773: Sb.Append(" <ul>"); Sb.Append(System.Environment.NewLine);Line 7774: Sb.Append(" <li id='item" + codProd + "'>"); Sb.Append(System.Environment.NewLine);Line 7775: Sb.Append(" <div class='item_box'>"); Sb.Append(System.Environment.NewLine);Line 7776: Sb.Append(" <div class='item_img'>"); Sb.Append(System.Environment.NewLine);Line 7777: Line 7778: if ( shop.useLazyLoad )Line 7779: Sb.Append("<img class='lazyload' src='/octopus/design/images/blank.gif' data-src='" + getImgSrc(codProd) + "' />");Line 7780: elseLine 7781: Sb.Append("<img loading='lazy' src='" + getImgSrc(codProd) + "' alt='" + getProdDesc( codProd ) + "' title='" + getProdDesc( codProd ) + "' width='" + imgSizes[0] + "' height='" + imgSizes[1] + "' />");Line 7782: Line 7783: Sb.Append(System.Environment.NewLine);Line 7784: Sb.Append(" </div>"); Sb.Append(System.Environment.NewLine);Line 7785: Sb.Append(" </div>"); Sb.Append(System.Environment.NewLine);Line 7786: Sb.Append(" </li>"); Sb.Append(System.Environment.NewLine);Line 7787: Line 7788: prodCollection = ";" + codProd;Line 7789: Line 7790: query = @"Line 7791: SELECTLine 7792: B.[codProd],Line 7793: P.[desc]Line 7794: FROM tbl_buyTogether B WITH (NOLOCK)Line 7795: INNER JOIN tbl_prod P WITH (NOLOCK) ON B.[codProd] = P.[codProd]Line 7796: INNER JOIN tbl_grid G WITH (NOLOCK) ON P.[codProd] = G.[codProd]Line 7797: WHERE (B.[id] = @id) AND (B.[codProd] <> @codProd) AND (G.[active] = 1)Line 7798: ";Line 7799: cmd = new SqlCommand(query, conn);Line 7800: cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.Int));Line 7801: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 7802: cmd.Parameters["@id"].Value = comboId;Line 7803: cmd.Parameters["@codProd"].Value = codProd;Line 7804: Line 7805: SqlDataReader rdr = cmd.ExecuteReader();Line 7806: Line 7807: int iCodProd = 0;Line 7808: i = 1;Line 7809: Line 7810: if ( !rdr.HasRows ) {Line 7811: // EOF: realease unmanaged resources and exit functionLine 7812: string jnk = Sb.ToString();Line 7813: rdr.Close();Line 7814: conn.Close();Line 7815: return "";Line 7816: }Line 7817: Line 7818: while( rdr.Read() ) {Line 7819: iCodProd = Convert.ToInt32(rdr[0]);Line 7820: Prices = getPrices(iCodProd, comboId);Line 7821: Line 7822: if ( i > 1 )Line 7823: plusIndex++;Line 7824: Line 7825: Line 7826: if (Prices[3] != 2) {Line 7827: Sb.Append(" <li id='plus" + plusIndex + "' class='plus'><font style='font-size:20px;'>+</font></li>"); Sb.Append(System.Environment.NewLine);Line 7828: Line 7829: Sb.Append(" <li id='item" + iCodProd + "'>"); Sb.Append(System.Environment.NewLine);Line 7830: Sb.Append(" <div class='item_box'>"); Sb.Append(System.Environment.NewLine);Line 7831: Sb.Append(" <div class='item_img'>"); Sb.Append(System.Environment.NewLine);Line 7832: Sb.Append(" <a href='" + getAnchorHref(iCodProd) + "'>");Line 7833: Line 7834: if ( shop.useLazyLoad )Line 7835: Sb.Append(" <img class='lazyload' src='/octopus/design/images/blank.gif' data-src='" + getImgSrc(Convert.ToInt32(iCodProd)) + "' alt='' title='' />");Line 7836: elseLine 7837: Sb.Append(" <img loading='lazy' src='" + getImgSrc(Convert.ToInt32(iCodProd)) + "' alt='" + getProdDesc( iCodProd ) + "' title='" + getProdDesc( iCodProd ) + "' width='" + imgSizes[0] + "' height='" + imgSizes[1] + "' />");Line 7838: Line 7839: Sb.Append(" </a>"); Sb.Append(System.Environment.NewLine);Line 7840: Sb.Append(" </div>"); Sb.Append(System.Environment.NewLine);Line 7841: Sb.Append(" </div>"); Sb.Append(System.Environment.NewLine);Line 7842: Sb.Append(" </li>"); Sb.Append(System.Environment.NewLine);Line 7843: }Line 7844: Line 7845: prodCollection += ";" + iCodProd;Line 7846: i++;Line 7847: }Line 7848: Line 7849: rdr.Close();Line 7850: Line 7851: //--( Product codes collection )------------------------------------Line 7852: prodCollection = prodCollection.Substring(1);Line 7853: Line 7854: Sb.Append(" </ul>"); Sb.Append(System.Environment.NewLine);Line 7855: Sb.Append(" </div>"); Sb.Append(System.Environment.NewLine);Line 7856: Sb.Append(" {COMBO_TOTALS}"); Sb.Append(System.Environment.NewLine);Line 7857: Sb.Append(" <div id='combo_txts' class='combo_on'>"); Sb.Append(System.Environment.NewLine);Line 7858: Sb.Append(" <ul>"); Sb.Append(System.Environment.NewLine);Line 7859: Line 7860: i = 0;Line 7861: plusIndex = 0;Line 7862: Line 7863: int tp = prodCollection.Split(';').Length;Line 7864: Line 7865: foreach( string prod in prodCollection.Split(';') ) {Line 7866: iCodProd = Convert.ToInt32(prod);Line 7867: Line 7868: Prices = getPrices(iCodProd, comboId);Line 7869: Line 7870: if ( i > 1 )Line 7871: plusIndex++;Line 7872: Line 7873: Sb.Append(" <li id='item" + iCodProd + "_txt' class='" + ( ( Prices[3] == 2 ) ? "item_off" : "item_on" ) + "'>"); Sb.Append(System.Environment.NewLine);Line 7874: Sb.Append(" <input type='checkbox' id='c_" + iCodProd + "' name='itemCheck' class='item_chk' value='" + getCodGrid(iCodProd) + "' " + ( ( Prices[3] == 2 ) ? "" : "checked='checked'" ) + " onclick='toggleIt(this.id, " + iCodProd + ", " + Convert.ToString(Prices[1]).Replace(',', '.') + ", " + Convert.ToString(Prices[2]).Replace(',', '.') + ", " + plusIndex + ")' " + ( ( i==0 || Prices[3] == 2 ) ? " disabled='disabled' " : "" ) + "/>"); Sb.Append(System.Environment.NewLine);Line 7875: Sb.Append(" <a href='" + getAnchorHref( iCodProd ) + "'><font class='item_desc'>" + getProdDesc( iCodProd ) + ( ( Prices[3] == 2 ) ? " (ESGOTADO)" : "" ) + "</font></a>"); Sb.Append(System.Environment.NewLine);Line 7876: Sb.Append(" <div class='item_prices'>"); Sb.Append(System.Environment.NewLine);Line 7877: Line 7878: //--( Prices )--------------------------------------------------Line 7879: if (Prices[1] < Prices[0]) {Line 7880: Sb.Append(" <font class='item_listPrice'><label>" + priceLabels[0] + "</label> " + shop.CurrType + string.Format("{0:0." + ndd + "}",Prices[0]) + "</font>"); Sb.Append(System.Environment.NewLine);Line 7881: Sb.Append(" <font class='item_ourPrice'><label>" + priceLabels[1] + "</label> " + shop.CurrType + string.Format("{0:0." + ndd + "}", Prices[1]) + "</font>"); Sb.Append(System.Environment.NewLine);Line 7882: Sb.Append(" <font class='item_save'><label>" + priceLabels[2] + "</label> " + shop.CurrType + string.Format("{0:0.00}",Prices[2]) + "</font>"); Sb.Append(System.Environment.NewLine);Line 7883: comboTotal += Prices[1];Line 7884: comboSave += Prices[2];Line 7885: } else {Line 7886: Sb.Append(" <font class='item_ourPrice'><label>" + priceLabels[1] + "</label> " + shop.CurrType + string.Format("{0:0." + ndd + "}",Prices[0]) + "</font>"); Sb.Append(System.Environment.NewLine);Line 7887: comboTotal += Prices[0];Line 7888: }Line 7889: Line 7890: Sb.Append(" </div>"); Sb.Append(System.Environment.NewLine);Line 7891: Sb.Append(" </li>"); Sb.Append(System.Environment.NewLine);Line 7892: Line 7893: i++;Line 7894: }Line 7895: Line 7896: Sb.Append(" </ul>"); Sb.Append(System.Environment.NewLine);Line 7897: Sb.Append(" </div>"); Sb.Append(System.Environment.NewLine);Line 7898: Sb.Append(" </div>"); Sb.Append(System.Environment.NewLine);Line 7899: Sb.Append(" </div>"); Sb.Append(System.Environment.NewLine);Line 7900: Line 7901: /* Para melhor vizualio do "Compre Junto" o fragmento abaixo serLine 7902: inserido entre as imagens e os textos. */Line 7903: Line 7904: Ct.Append(" <div id='details-buy-together-combo-total' class='combo_total'>"); Ct.Append(System.Environment.NewLine);Line 7905: Ct.Append(" <font class='combo_ourPrice'><label>" + priceLabels[3] + "</label> " + shop.CurrType + "<label id='bt-our-price'>" + string.Format("{0:0.00}", comboTotal ) + "</label></font>"); Ct.Append(System.Environment.NewLine);Line 7906: Line 7907: if ( comboSave > 0 )Line 7908: Line 7909: Ct.Append(" <font class='combo_save'><label>" + priceLabels[2] + "</label>" + shop.CurrType + "<label id='bt-save-price'>" + string.Format( "{0:0.00}", comboSave ) + "</label></font>"); Ct.Append(System.Environment.NewLine);Line 7910: Line 7911: Ct.Append(" </div>"); Sb.Append(System.Environment.NewLine);Line 7912: Ct.Append(" <div id='details-buy-together-buy'>"); Ct.Append(System.Environment.NewLine);Line 7913: Ct.Append(" <font class='item_btn_buy_bottom'>"); Ct.Append(System.Environment.NewLine);Line 7914: Ct.Append(" <a href=\"javascript:req_btAddItems('" + shop.Http + config + "'," + shopId + ",'" + cartId + "'," + Convert.ToString(shop.UseEG).ToLower() + "," + shop.UseFC + "," + userId + ",0);\">"); Sb.Append(System.Environment.NewLine);Line 7915: Ct.Append(" <img src='/octopus/design/images/" + shopId + "/cart_buy_together.gif' alt='' />"); Ct.Append(System.Environment.NewLine);Line 7916: Ct.Append(" </a>"); Ct.Append(System.Environment.NewLine);Line 7917: Ct.Append(" </font>"); Ct.Append(System.Environment.NewLine);Line 7918: Ct.Append(" </div>"); Ct.Append(System.Environment.NewLine);Line 7919: }Line 7920: Line 7921: conn.Close();Line 7922: Line 7923: return Sb.ToString().Replace("{COMBO_TOTALS}", Ct.ToString());Line 7924: }Line 7925: Line 7926: public string getDiscountByCart(string cartId, out decimal discountBt, ShopSetup shop) {Line 7927: string output = "";Line 7928: decimal[] Prices = null;Line 7929: int i = 0;Line 7930: string ndd="";Line 7931: for(i=0;i<shop.NDD;i++)ndd+="0";Line 7932: Line 7933: discountBt = 0;Line 7934: Line 7935: StringDictionary Combos = new StringDictionary();Line 7936: Line 7937: SqlConnection conn = new SqlConnection(shop.Path);Line 7938: conn.Open();Line 7939: Line 7940: string query = @"Line 7941: SELECTLine 7942: COUNT(codGrid) AS items,Line 7943: idBt,Line 7944: (Line 7945: SELECT TOP 1 qtLine 7946: FROM sys_cart WITH (NOLOCK)Line 7947: WHERE (cid = @cartId) AND (idBt = C.idBt) ORDER BY qt ASCLine 7948: ) AS qtyLine 7949: FROM sys_cart C WITH (NOLOCK)Line 7950: WHERE (C.cid = @cartId) AND (C.idBt > 0)Line 7951: GROUP BY idBTLine 7952: ";Line 7953: SqlCommand cmd = new SqlCommand(query, conn);Line 7954: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 7955: cmd.Parameters["@cartId"].Value = cartId;Line 7956: SqlDataReader rdr = cmd.ExecuteReader();Line 7957: while(rdr.Read()) {Line 7958: if ( Convert.ToInt32(rdr["items"]) > 1 ) {Line 7959: Combos.Add(Convert.ToString(rdr["idBt"]), Convert.ToString(rdr["qty"]));Line 7960: }Line 7961: }Line 7962: rdr.Close();Line 7963: Line 7964: foreach(DictionaryEntry Combo in Combos) {Line 7965: query = @"Line 7966: SELECT B.codProdLine 7967: FROM tbl_buyTogether B WITH (NOLOCK)Line 7968: INNER JOIN tbl_grid G WITH (NOLOCK) ON B.codProd = G.codProdLine 7969: INNER JOIN sys_cart C WITH (NOLOCK) ON G.codGrid = C.codGridLine 7970: WHERE (B.id = @id) AND (C.cid = @cartId)Line 7971: ";Line 7972: cmd = new SqlCommand(query, conn);Line 7973: cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.Int));Line 7974: cmd.Parameters.Add(new SqlParameter("@cartId", SqlDbType.NVarChar));Line 7975: cmd.Parameters["@id"].Value = Convert.ToInt32(Combo.Key);Line 7976: cmd.Parameters["@cartId"].Value = cartId;Line 7977: rdr = cmd.ExecuteReader();Line 7978: while(rdr.Read()) {Line 7979: Prices = getPrices(Convert.ToInt32(rdr[0]), Convert.ToInt32(Combo.Key));Line 7980: discountBt += Convert.ToInt32(Combo.Value) * Prices[2];Line 7981: }Line 7982: rdr.Close();Line 7983: }Line 7984: conn.Close();Line 7985: Line 7986: output = "<table width='100%'>\n"Line 7987: + " <thead></thead>\n"Line 7988: + " <tfoot></tfoot>\n"Line 7989: + " <tbody>\n"Line 7990: + " <tr>\n"Line 7991: + " <td width='50%' class='lft_half'>\n"Line 7992: + " </td>\n"Line 7993: + " <td width='50%' class='rgt_half'>\n"Line 7994: + " <table width='100%'>\n"Line 7995: + " <thead></thead>\n"Line 7996: + " <tfoot></tfoot>\n"Line 7997: + " <tbody>\n"Line 7998: + " <th>Desconto comprando junto:</th>\n"Line 7999: + " <td>" + shop.CurrType + "<font id='buy_together_discount'>" + string.Format("{0:0.00}", discountBt) + "</font></td>\n"Line 8000: + " </tbody>\n"Line 8001: + " </table>\n"Line 8002: + " </td>\n"Line 8003: + " </tr>\n"Line 8004: + " </tbody>\n"Line 8005: + "</table>\n";Line 8006: Line 8007: return output;Line 8008: }Line 8009: Line 8010: private string getProdDesc(int codProd) {Line 8011: string output = "";Line 8012: Line 8013: SqlConnection conn = new SqlConnection(shop.Path);Line 8014: conn.Open();Line 8015: Line 8016: string query = "SELECT [desc] FROM tbl_prod WITH (NOLOCK) WHERE codProd = @codProd";Line 8017: Line 8018: SqlCommand cmd = new SqlCommand(query, conn);Line 8019: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 8020: cmd.Parameters["@codProd"].Value = codProd;Line 8021: Line 8022: output = Convert.ToString(cmd.ExecuteScalar());Line 8023: Line 8024: conn.Close();Line 8025: Line 8026: return output;Line 8027: }Line 8028: Line 8029: private string getImgSrc(int codProd) {Line 8030: string output = "";Line 8031: int codGrid = 0;Line 8032: Line 8033: SqlConnection conn = new SqlConnection(shop.Path);Line 8034: conn.Open();Line 8035: Line 8036: string query = @"Line 8037: SELECT TOP 1 G.[codGrid]Line 8038: FROM tbl_prod P WITH (NOLOCK)Line 8039: INNER JOIN tbl_grid G WITH (NOLOCK) ON P.[codProd] = G.[codProd]Line 8040: WHERE (P.[codProd] = @codProd) AND (G.[link] = 1)Line 8041: ";Line 8042: SqlCommand cmd = new SqlCommand(query, conn);Line 8043: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 8044: cmd.Parameters["@codProd"].Value = codProd;Line 8045: codGrid = Convert.ToInt32(cmd.ExecuteScalar());Line 8046: if ( codGrid > 0 )Line 8047: output = Details.getProductImgSrc(shopId, codGrid, shop).Replace("{size}", "t");Line 8048: conn.Close();Line 8049: Line 8050: return output;Line 8051: }Line 8052: Line 8053: Line 8054: private string getAnchorHref(int codProd) {Line 8055: string output = "";Line 8056: Line 8057: SqlConnection conn = new SqlConnection(shop.Path);Line 8058: conn.Open();Line 8059: Line 8060: string query = @"Line 8061: SELECTLine 8062: tbl_prod.[desc] AS ProdDesc,Line 8063: tbl_grid.ref,Line 8064: tbl_grid.codGridLine 8065: FROM tbl_prod WITH (NOLOCK)Line 8066: INNER JOIN tbl_grid WITH (NOLOCK) ON tbl_prod.codProd = tbl_grid.codProdLine 8067: WHERE tbl_prod.codProd = @codProdLine 8068: ";Line 8069: SqlCommand cmd = new SqlCommand(query, conn);Line 8070: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 8071: cmd.Parameters["@codProd"].Value = codProd;Line 8072: SqlDataReader rdr = cmd.ExecuteReader();Line 8073: Line 8074: if ( rdr.Read() ) {Line 8075: output = String.Format(Line 8076: "{0}/{1}.{2}.html",Line 8077: shop.Http.Replace("/octopus/", ""), ZenTools.urlize((string)rdr["ProdDesc"]), Convert.ToInt32(rdr["codGrid"])Line 8078: );Line 8079: }Line 8080: Line 8081: rdr.Close();Line 8082: conn.Close();Line 8083: Line 8084: return output;Line 8085: }Line 8086: Line 8087: private decimal[] getPrices(int codProd, int comboId) {Line 8088: decimal[] output = new decimal[4];Line 8089: Line 8090: SqlConnection conn = new SqlConnection(shop.Path);Line 8091: conn.Open();Line 8092: Line 8093: string query = String.Format(@"Line 8094: SELECTLine 8095: tbl_prices.prc,Line 8096: tbl_prices.discRate,Line 8097: tbl_prices.codAvailability AS prodAvail,Line 8098: ISNULL( ( SELECT TOP 1 discRate FROM tbl_buyTogether WITH (NOLOCK) WHERE ( id = {0} ) AND ( codProd = {1} ) ), 0) AS discRateBtLine 8099: FROM tbl_prices WITH (NOLOCK)Line 8100: INNER JOIN tbl_grid WITH (NOLOCK) ON tbl_prices.codGrid = tbl_grid.codGridLine 8101: WHERE ( tbl_grid.codProd = @codProd ) AND ( tbl_prices.codGroup = @codGroup )Line 8102: ", comboId, codProd);Line 8103: Line 8104: SqlCommand cmd = new SqlCommand(query, conn);Line 8105: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 8106: cmd.Parameters.Add(new SqlParameter("@codGroup", SqlDbType.Int));Line 8107: cmd.Parameters["@codProd"].Value = codProd;Line 8108: cmd.Parameters["@codGroup"].Value = UserSetup.UserGroup(shop.Path, userId);Line 8109: Line 8110: SqlDataReader rdr = cmd.ExecuteReader();Line 8111: Line 8112: if (rdr.Read()) {Line 8113: decimal thisPrice = 0;Line 8114: decimal thisPriceBt = 0;Line 8115: Line 8116: if ( Convert.ToInt32(rdr["prodAvail"]) != 2 ) {Line 8117: thisPrice = ( 1 - Convert.ToDecimal(rdr["discRate"]) / 100 ) * Convert.ToDecimal(rdr["prc"]);Line 8118: thisPriceBt = (1 - Convert.ToDecimal(rdr["discRateBt"]) / 100) * thisPrice;Line 8119: }Line 8120: Line 8121: output[0] = Math.Round(thisPrice, 2);Line 8122: output[1] = Math.Round(thisPriceBt, 2);Line 8123: output[2] = Math.Round(thisPrice - thisPriceBt, 2);Line 8124: output[3] = Convert.ToInt32(rdr["prodAvail"]);Line 8125: }Line 8126: Line 8127: rdr.Close();Line 8128: conn.Close();Line 8129: Line 8130: Line 8131: return output;Line 8132: }Line 8133: Line 8134: private int getCodGrid(int codProd) {Line 8135: Line 8136: int output = 0;Line 8137: Line 8138: SqlConnection conn = new SqlConnection(shop.Path);Line 8139: conn.Open();Line 8140: Line 8141: string query = "SELECT codGrid FROM tbl_grid WITH (NOLOCK) WHERE codProd = @codProd";Line 8142: Line 8143: SqlCommand cmd = new SqlCommand(query, conn);Line 8144: cmd.Parameters.Add(new SqlParameter("@codProd", SqlDbType.Int));Line 8145: cmd.Parameters["@codProd"].Value = codProd;Line 8146: output = Convert.ToInt32(cmd.ExecuteScalar());Line 8147: Line 8148: Line 8149: conn.Close();Line 8150: Line 8151: return output;Line 8152: }Line 8153: }Line 8154: Line 8155: Line 8156: Line 8157: Line 8158: Line 8159: Line 8160: Line 8161: Line 8162: Line 8163: Line 8164: public class Billing {Line 8165: public Billing(){}Line 8166: Line 8167: public string getCreditCardOptions(string currType, string sNdd, string path, int shopId, int codCC, decimal orderTotal, int priceGroup, int parcelTimeSelected) {Line 8168: string query = "";Line 8169: string flag = "";Line 8170: Line 8171: StringBuilder Sb = new StringBuilder();Line 8172: Sb.Append( "<ul id='credit-card-options'>\n" );Line 8173: Line 8174: SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["coreConn"]);Line 8175: conn.Open();Line 8176: Line 8177: query = @"Line 8178: SELECTLine 8179: tbl_cc.src,Line 8180: tbl_cc.codCC,Line 8181: tbl_cc.nameLine 8182: FROM tbl_cc WITH (NOLOCK)Line 8183: INNER JOIN rel_coreCC WITH (NOLOCK) ON tbl_cc.codCC = rel_coreCC.codCCLine 8184: WHERE (rel_coreCC.sid = @shopId) ORDER BY tbl_cc.codCCLine 8185: ";Line 8186: Line 8187: SqlCommand cmd = new SqlCommand(query, conn);Line 8188: cmd.Parameters.Add(new SqlParameter("@shopId", SqlDbType.Int));Line 8189: cmd.Parameters["@shopId"].Value = shopId;Line 8190: SqlDataReader rdr = cmd.ExecuteReader();Line 8191: Line 8192: while(rdr.Read()) {Line 8193: flag = Convert.ToString(rdr["name"]);Line 8194: Line 8195: Sb.Append( " <li>\n" );Line 8196: Sb.Append( " <label for='billing-select-flag-" + flag + "'>\n" );Line 8197: Sb.Append( " <img src='/octopus/design/images/" + (string)rdr["src"] + "' />\n" );Line 8198: Sb.Append( " <font class='credit_card_flag'>" + flag + "</font>\n" );Line 8199: Sb.Append( " </label>\n" );Line 8200: Sb.Append( " <input id='billing-select-flag-" + flag + "' type='radio' name='cc' value='"+ rdr["codCC"] + "' class='creditCardRadioFlag' data-flag='" + flag + "' " + ( codCC == (int)rdr["codCC"] ? "checked='checked'" : "" ) + " />\n" );Line 8201: Sb.Append( " <label id='billing-select-flag-" + flag + "-parcels'>Parcelamento:</label>\n" );Line 8202: Line 8203: Sb.Append( getCreditCardParcels(currType, sNdd, path, flag, orderTotal, priceGroup, parcelTimeSelected) );Line 8204: Line 8205: Sb.Append( " </li>\n" );Line 8206: }Line 8207: Line 8208: rdr.Close();Line 8209: conn.Close();Line 8210: Line 8211: Sb.Append( "</ul>\n" );Line 8212: Line 8213: return Sb.ToString();Line 8214: }Line 8215: Line 8216: public string getDebitCardOptions(string currType, string sNdd, string path, int shopId) {Line 8217: string query = "";Line 8218: string flag = "";Line 8219: Line 8220: StringBuilder Sb = new StringBuilder();Line 8221: Sb.Append( "<ul id='debit-card-options'>\n" );Line 8222: Line 8223: SqlConnection conn = new SqlConnection(path);Line 8224: conn.Open();Line 8225: Line 8226: query = "SELECT * FROM sys_debitCard WITH (NOLOCK) ORDER BY codDC";Line 8227: Line 8228: SqlCommand cmd = new SqlCommand(query, conn);Line 8229: cmd.Parameters.Add(new SqlParameter("@shopId", SqlDbType.Int));Line 8230: cmd.Parameters["@shopId"].Value = shopId;Line 8231: SqlDataReader rdr = cmd.ExecuteReader();Line 8232: Line 8233: while(rdr.Read()) {Line 8234: flag = Convert.ToString(rdr["name"]);Line 8235: Sb.Append( "<li>\n" );Line 8236: Sb.Append( "<label for='billing-select-debit-flag-" + flag + "'>\n" );Line 8237: Sb.Append( "<img src='/octopus/design/images/" + (string)rdr["imgSrc"] + "' />\n" );Line 8238: Sb.Append( "<font class='debit_card_flag'>" + flag + "</font>\n" );Line 8239: Sb.Append( "</label>\n" );Line 8240: Sb.Append( "<input id='billing-select-debit-flag-" + flag + "' type='radio' name='dc' value='"+ rdr["codDC"] + "' class='debitCardRadioFlag' data-flag='" + flag + "'/>\n" );Line 8241: Sb.Append( "</li>\n" );Line 8242: }Line 8243: Line 8244: rdr.Close();Line 8245: conn.Close();Line 8246: Line 8247: Sb.Append( "</ul>\n" );Line 8248: Line 8249: return Sb.ToString();Line 8250: }Line 8251: Line 8252: public string getCreditCardParcels(string currType, string sNdd, string path, string flag, decimal orderTotal, int priceGroup, int parcelTimeSelected) {Line 8253: string output = "";Line 8254: string iValue = "";Line 8255: string dynamicFlag = "Default";Line 8256: int i = 0;Line 8257: Line 8258: StringBuilder Sb = new StringBuilder();Line 8259: Line 8260: SqlConnection conn = new SqlConnection(path);Line 8261: conn.Open();Line 8262: Line 8263: string query = "SELECT COUNT(*) FROM sys_parcels WITH (NOLOCK) WHERE ( ccFlag = @ccFlag ) AND ( sys_parcels.priceGroup = @priceGroup )";Line 8264: Line 8265: SqlCommand cmd = new SqlCommand(query, conn);Line 8266: cmd.Parameters.Add(new SqlParameter("@total", SqlDbType.Money));Line 8267: cmd.Parameters.Add(new SqlParameter("@priceGroup", SqlDbType.Int));Line 8268: cmd.Parameters.Add(new SqlParameter("@ccFlag", SqlDbType.NVarChar));Line 8269: cmd.Parameters["@total"].Value = orderTotal;Line 8270: cmd.Parameters["@priceGroup"].Value = priceGroup;Line 8271: cmd.Parameters["@ccFlag"].Value = flag;Line 8272: if ( Convert.ToInt32( cmd.ExecuteScalar() ) > 0 ) {Line 8273: dynamicFlag = flag;Line 8274: }Line 8275: Line 8276: query = @"Line 8277: SELECTLine 8278: value,Line 8279: times,Line 8280: interest,Line 8281: vtranslLine 8282: FROM sys_parcels WITH (NOLOCK)Line 8283: WHERE ( ( (sys_parcels.value) <= @total ) ) AND ( sys_parcels.priceGroup = @priceGroup ) AND ( ccFlag = @ccFlag )Line 8284: ORDER BY sys_parcels.value, sys_parcels.timesLine 8285: ";Line 8286: Line 8287: cmd = new SqlCommand(query, conn);Line 8288: cmd.Parameters.Add(new SqlParameter("@total", SqlDbType.Money));Line 8289: cmd.Parameters.Add(new SqlParameter("@priceGroup", SqlDbType.Int));Line 8290: cmd.Parameters.Add(new SqlParameter("@ccFlag", SqlDbType.NVarChar));Line 8291: Line 8292: cmd.Parameters["@total"].Value = orderTotal;Line 8293: cmd.Parameters["@priceGroup"].Value = priceGroup;Line 8294: cmd.Parameters["@ccFlag"].Value = dynamicFlag;Line 8295: Line 8296: SqlDataReader rdr = cmd.ExecuteReader();Line 8297: Line 8298: if ( rdr.Read() ) {Line 8299: iValue = currType + string.Format( "{0:0.00} vista", orderTotal + Convert.ToDecimal(rdr["vtransl"]) );Line 8300: Line 8301: Sb.Append( "<select name='ccPt_" + flag.ToLower().Replace(" ", "") + "' class='credit_card_parcels'>\n" );Line 8302: Line 8303: Sb.Append( " <option value='0'>SELECIONE...</option>\n" );Line 8304: Sb.Append( " <option value='" + Convert.ToString(rdr["times"]) + "'>" + iValue + "</option>\n" );Line 8305: Line 8306: if (rdr.Read()) {Line 8307: do {Line 8308: if ((decimal)rdr["interest"] > 0) {Line 8309: iValue = (int)rdr["times"] +"x de "+ currType + string.Format(Line 8310: "{0:0.00}"Line 8311: , Details.Juros_Composto( orderTotal, (decimal)rdr["interest"] / 100, (int)rdr["times"] ) + (decimal)rdr["vtransl"]Line 8312: ) + " (taxa de "+ string.Format( "{0:0.00}", (decimal)rdr["interest"] ) +"% a.m.)";Line 8313: } else {Line 8314: iValue = (int)rdr["times"] +"x de "+ currType + string.Format(Line 8315: "{0:0.00}"Line 8316: , (orderTotal / (int)rdr["times"]) + (decimal)rdr["vtransl"]Line 8317: );Line 8318: }Line 8319: Line 8320: Sb.Append( " <option value='" + Convert.ToString(rdr["times"]) + "'>" + iValue + "</option>\n" );Line 8321: } while(rdr.Read());Line 8322: }Line 8323: Line 8324: rdr.Close();Line 8325: Line 8326: Sb.Append( "</select>\n" );Line 8327: Line 8328: output = Sb.ToString();Line 8329: }Line 8330: Line 8331: conn.Close();Line 8332: Line 8333: return output;Line 8334: }Line 8335: Line 8336: public decimal[] getParcelData(string path, int parcelTimes, string flag, int priceGroup) {Line 8337: decimal[] output = new decimal[2];Line 8338: Line 8339: string dynamicFlag = "Default";Line 8340: Line 8341: SqlConnection conn = new SqlConnection(path);Line 8342: conn.Open();Line 8343: Line 8344: string query = "SELECT COUNT(*) FROM sys_parcels WITH (NOLOCK) WHERE (times = @times) AND (ccFlag = @flag) AND (priceGroup = @priceGroup)";Line 8345: SqlCommand cmd = new SqlCommand(query, conn);Line 8346: cmd.Parameters.Add(new SqlParameter("@times", SqlDbType.Int));Line 8347: cmd.Parameters.Add(new SqlParameter("@flag", SqlDbType.NVarChar));Line 8348: cmd.Parameters.Add(new SqlParameter("@priceGroup", SqlDbType.Int));Line 8349: cmd.Parameters["@times"].Value = parcelTimes;Line 8350: cmd.Parameters["@flag"].Value = flag;Line 8351: cmd.Parameters["@priceGroup"].Value = priceGroup;Line 8352: if ( Convert.ToInt32(cmd.ExecuteScalar()) > 0 ) {Line 8353: dynamicFlag = flag;Line 8354: }Line 8355: Line 8356: query = "SELECT interest, vtransl FROM sys_parcels WITH (NOLOCK) WHERE (times = @times) AND (ccFlag = @flag) AND (priceGroup = @priceGroup)";Line 8357: cmd = new SqlCommand(query, conn);Line 8358: cmd.Parameters.Add(new SqlParameter("@times", SqlDbType.Int));Line 8359: cmd.Parameters.Add(new SqlParameter("@flag", SqlDbType.NVarChar));Line 8360: cmd.Parameters.Add(new SqlParameter("@priceGroup", SqlDbType.Int));Line 8361: cmd.Parameters["@times"].Value = parcelTimes;Line 8362: cmd.Parameters["@flag"].Value = dynamicFlag;Line 8363: cmd.Parameters["@priceGroup"].Value = priceGroup;Line 8364: SqlDataReader rdr = cmd.ExecuteReader();Line 8365: Line 8366: if ( rdr.Read() ) {Line 8367: output[0] = Convert.ToDecimal(rdr[0]);Line 8368: output[1] = Convert.ToDecimal(rdr[1]);Line 8369: }Line 8370: Line 8371: rdr.Close();Line 8372: conn.Close();Line 8373: Line 8374: return output;Line 8375: }Line 8376: Line 8377: public string getCreditCardFormTable(string ccName, string ccNum, string ccMonth, string ccYear, string ccCode, string index) {Line 8378: StringBuilder Sb = new StringBuilder();Line 8379: Line 8380: int i = 0;Line 8381: Line 8382: Sb.Append( " <table id='credit-card-table-" + index + "'>\n" );Line 8383: Sb.Append( " <tr>\n" );Line 8384: Sb.Append( " <th><label for='credit-card-name'>Nome impresso no cartão:</label></th>\n" );Line 8385: Sb.Append( " <td><input id='credit-card-name' name='ccName' type='text' value='" + ccName + "' class='a' maxlength='26' size='24' autocomplete='off' /></td>\n" );Line 8386: Sb.Append( " </tr>\n" );Line 8387: Sb.Append( " <tr>\n" );Line 8388: Sb.Append( " <th><label for='credit-card-number'>Número do cartão:</label></th>\n" );Line 8389: Sb.Append( " <td><input id='credit-card-number' name='ccNumber' type='text' value='" + ccNum + "' class='a only_numbers' maxlength='24' size='24' autocomplete='off'/><br /><em>(apenas os números)</em></td>\n" );Line 8390: Sb.Append( " </tr>\n" );Line 8391: Sb.Append( " <tr>\n" );Line 8392: Sb.Append( " <th><label for='credit-card-date'>Data de validade:</label></th>\n" );Line 8393: Sb.Append( " <td>\n" );Line 8394: Line 8395: Sb.Append( " <select id='credit-card-date-month' name='ccMonth' class='a'>\n" );Line 8396: Line 8397: Line 8398: for(i = 1; i <= 12; i++) {Line 8399: Sb.Append( " <option value=" + ZenTools.Right("00" + i, 2) + ">" + ZenTools.Right("00" + i, 2) + "</option>\n" );Line 8400: }Line 8401: Line 8402: Sb.Append( " </select> /20\n" );Line 8403: Line 8404: Sb.Append( " <select id='credit-card-date-year' name='ccYear' class='a' >\n" );Line 8405: Line 8406: int year = Convert.ToInt32(Convert.ToString(DateTime.Now.Year).Substring(2));Line 8407: for( i = year; i < year + 15; i++ ) {Line 8408: Sb.Append( " <option value=" + ZenTools.Right("00" + i, 2) + ">" + ZenTools.Right("00" + i, 2) + "</option>\n" );Line 8409: }Line 8410: Line 8411: Sb.Append( " </select> Ex. (mm/aa)\n" );Line 8412: Line 8413: Sb.Append( " </td>\n" );Line 8414: Sb.Append( " </tr>\n" );Line 8415: Sb.Append( " <tr>\n" );Line 8416: Sb.Append( " <th><label for='credit-card-security-code'>Código de segurança:</label></th>\n" );Line 8417: Sb.Append( " <td><input id='credit-card-security-code' name='csc' type='text' value='" + ccCode + "' class='a only_numbers' maxlength='4' size='4' autocomplete='off' /></td>\n" );Line 8418: Line 8419: Sb.Append( " </tr>\n" );Line 8420: Sb.Append( " </table>\n" );Line 8421: Line 8422: return Sb.ToString();Line 8423: }Line 8424: Line 8425: public string paymentAcronymTranslate(string acronym) {Line 8426: switch( acronym ) { // PT -> ENLine 8427: case "TE": return "ET"; break;Line 8428: case "FE": return "EF"; break;Line 8429: case "DB": return "BD"; break;Line 8430: case "FT": return "IO"; break;Line 8431: case "CD": return "DC"; break;Line 8432: default: return acronym; break;Line 8433: }Line 8434: }Line 8435: Line 8436: }Line 8437: Line 8438: Line 8439: Line 8440: Line 8441: Line 8442: Line 8443: Line 8444: Line 8445: Line 8446: Line 8447: public class CaesarRef {Line 8448: public CaesarRef() {}Line 8449: Line 8450: Line 8451: public static string encode(string v) {Line 8452: return v;Line 8453: Line 8454: /*Line 8455: char[] ca = v.ToCharArray();Line 8456: for( int i = 0; i < v.Length; i++ ) {Line 8457: ca[i] = _map(v[i]);Line 8458: }Line 8459: return new string(ca);Line 8460: */Line 8461: }Line 8462: Line 8463: public static string decode(string v) {Line 8464: return v;Line 8465: Line 8466: /*Line 8467: char[] ca = v.ToCharArray();Line 8468: for( int i = 0; i < v.Length; i++ ) {Line 8469: ca[i] = _unmap(v[i]);Line 8470: }Line 8471: return new string(ca);Line 8472: */Line 8473: }Line 8474: Line 8475: private static char _map(char c) {Line 8476: Hashtable h = new Hashtable();Line 8477: h.Add('1', '4');Line 8478: h.Add('2', '6');Line 8479: h.Add('3', '7');Line 8480: h.Add('4', '9');Line 8481: h.Add('5', '8');Line 8482: h.Add('6', '2');Line 8483: h.Add('7', '5');Line 8484: h.Add('8', '1');Line 8485: h.Add('9', '0');Line 8486: h.Add('0', '3');Line 8487: Line 8488: return (char)h[c];Line 8489: }Line 8490: Line 8491: private static char _unmap(char c) {Line 8492: Hashtable h = new Hashtable();Line 8493: h.Add('4', '1');Line 8494: h.Add('6', '2');Line 8495: h.Add('7', '3');Line 8496: h.Add('9', '4');Line 8497: h.Add('8', '5');Line 8498: h.Add('2', '6');Line 8499: h.Add('5', '7');Line 8500: h.Add('1', '8');Line 8501: h.Add('0', '9');Line 8502: h.Add('3', '0');Line 8503: Line 8504: return (char)h[c];Line 8505: }Line 8506: Line 8507: }Line 8508: Line 8509: Line 8510: Line 8511: Line 8512: Line 8513: Line 8514: Line 8515: Line 8516: Line 8517: Line 8518: public class Solr {Line 8519: public Solr(){}Line 8520: Line 8521: public static bool hasRecords(XmlNode Nodes) {Line 8522: foreach( XmlNode Node in Nodes ) {Line 8523: if ( Convert.ToInt32(Node.InnerText) > 0 ) {Line 8524: return true;Line 8525: break;Line 8526: }Line 8527: }Line 8528: return false;Line 8529: }Line 8530: }Line 8531: Line 8532: Line 8533: Line 8534: Line 8535: Line 8536: Line 8537: Line 8538: Line 8539: Line 8540: Line 8541: public class Promotion {Line 8542: private ShopSetup shop;Line 8543: private int shopId;Line 8544: private int userId;Line 8545: private int zipCode;Line 8546: private decimal ordersTotalAcumulated;Line 8547: private string source;Line 8548: private string medium;Line 8549: private string campaign;Line 8550: Line 8551: public Promotion(ShopSetup s, int sid, int uid, int c, decimal ota, string _source, string _medium, string _campaign) {Line 8552: shop = s;Line 8553: shopId = sid;Line 8554: userId = uid;Line 8555: zipCode = c;Line 8556: ordersTotalAcumulated = ota;Line 8557: source = _source;Line 8558: medium = _medium;Line 8559: campaign = _campaign;Line 8560: }Line 8561: Line 8562: public string getEffect(int idBrand, string categories, int idGrid, int quantity, string cartId) {Line 8563: object Output = JavaScriptDeserializer.DeserializeFromJson("{}", typeof(NameValueCollection));Line 8564: string query = "";Line 8565: string sJson = "";Line 8566: int idPromotion = 0;Line 8567: decimal cartTotal = 0;Line 8568: bool isRunning = false;Line 8569: Line 8570: if ( cartId != "" ) {Line 8571: cartTotal = getCartTotal(cartId);Line 8572: }Line 8573: Line 8574: SqlConnection conn;Line 8575: SqlCommand cmd;Line 8576: SqlDataReader rdr;Line 8577: Line 8578: conn = new SqlConnection(shop.Path);Line 8579: conn.Open();Line 8580: Line 8581: query = @"Line 8582: SELECT id, name, description, dta, dtb, times, blobLine 8583: FROM sys_promotions WITH (NOLOCK)Line 8584: WHERE (active = 1) AND ( (dta IS NULL) OR (dtb IS NULL) OR ( dta <= GETDATE() AND GETDATE() <= dtb ) )Line 8585: ORDER BY priority ASC, dtIns ASCLine 8586: ";Line 8587: Line 8588: cmd = new SqlCommand(query, conn);Line 8589: rdr = cmd.ExecuteReader();Line 8590: Line 8591: while( rdr.Read() && !isRunning ) {Line 8592: isRunning = true;Line 8593: Output = JavaScriptDeserializer.DeserializeFromJson("{}", typeof(NameValueCollection));Line 8594: Line 8595: idPromotion = Convert.ToInt32(rdr["id"]);Line 8596: sJson = Convert.ToString(rdr["blob"]);Line 8597: Line 8598: //((NameValueCollection)Output)["debug"] = Convert.ToString(rdr["id"]) + " : " + isRunning;Line 8599: Line 8600: if ( sJson != "" ) {Line 8601: try {Line 8602: object oJson = JavaScriptDeserializer.DeserializeFromJson(sJson, typeof(NameValueCollection));Line 8603: Line 8604: // check price groupLine 8605: string priceGroupId = "";Line 8606: if ( ((NameValueCollection)oJson)["priceGroupId"] != null )Line 8607: priceGroupId = ((NameValueCollection)oJson)["priceGroupId"];Line 8608: if ( priceGroupId != "" && Convert.ToInt32(priceGroupId) != UserSetup.UserGroup(shop.Path, userId) )Line 8609: isRunning = false;Line 8610: Line 8611: // check timesLine 8612: if ( Convert.ToInt32(rdr["times"]) == -1 )Line 8613: isRunning = false;Line 8614: Line 8615: if ( isRunning ) {Line 8616: // check times by userLine 8617: if ( Convert.ToInt32(((NameValueCollection)oJson)["timesByUser"]) > 0 ) {Line 8618: if ( userId > 0 ) {Line 8619: isRunning = !( getUserWpromotion( idPromotion ) >= Convert.ToInt32(((NameValueCollection)oJson)["timesByUser"]) );Line 8620: } else {Line 8621: isRunning = false;Line 8622: }Line 8623: }Line 8624: Line 8625: if ( isRunning ) {Line 8626: // datetimeLine 8627: if ( rdr["dta"] != DBNull.Value && rdr["dtb"] != DBNull.Value ) {Line 8628: DateTime dtA = Convert.ToDateTime(rdr["dta"]);Line 8629: DateTime dtB = Convert.ToDateTime(rdr["dtb"]);Line 8630: DateTime dtN = DateTime.Now;Line 8631: Line 8632: if ( !( dtA <= dtN && dtN <= dtB ) ) {Line 8633: isRunning = false;Line 8634: }Line 8635: }Line 8636: Line 8637: if ( isRunning ) {Line 8638: // zicode rangesLine 8639: if ( ((NameValueCollection)oJson)["zipCodeRanges"] != "" ) {Line 8640: string[] ranges = Convert.ToString( ((NameValueCollection)oJson)["zipCodeRanges"] ).Split(',');Line 8641: string[] arr = null;Line 8642: isRunning = false;Line 8643: Line 8644: foreach( string range in ranges ) {Line 8645: arr = range.Split('|');Line 8646: if ( ( Convert.ToInt32(arr[1]) <= zipCode && zipCode <= Convert.ToInt32(arr[2]) ) ) {Line 8647: isRunning = true;Line 8648: }Line 8649: }Line 8650: }Line 8651: Line 8652: if ( isRunning ) {Line 8653: // greater than valueLine 8654: if ( ((NameValueCollection)oJson)["greaterThanValue"] != "" ) {Line 8655: if ( cartTotal < Convert.ToDecimal( (((NameValueCollection)oJson)["greaterThanValue"]).Replace(",", "").Replace(".", ",") ) ) {Line 8656: isRunning = false;Line 8657: }Line 8658: }Line 8659: Line 8660: if ( isRunning ) {Line 8661: // acumulated order valueLine 8662: if ( ((NameValueCollection)oJson)["acumulatedValue"] != "" ) {Line 8663: if ( ordersTotalAcumulated < Convert.ToDecimal( (((NameValueCollection)oJson)["acumulatedValue"]).Replace(",", "").Replace(".", ",") ) ) {Line 8664: isRunning = false;Line 8665: }Line 8666: }Line 8667: Line 8668: if ( isRunning ) {Line 8669: // brandsLine 8670: if ( ((NameValueCollection)oJson)["brands"] != "" ) {Line 8671: isRunning = checkBrand( idBrand, ((NameValueCollection)oJson)["brands"] );Line 8672: }Line 8673: Line 8674: if ( isRunning ) {Line 8675: // categoriesLine 8676: if ( ((NameValueCollection)oJson)["categories"] != "" ) {Line 8677: //((NameValueCollection)Output)["debug"] = idCategory + " = " + ((NameValueCollection)oJson)["categories"];Line 8678: isRunning = checkCategories( categories, ((NameValueCollection)oJson)["categories"] );Line 8679: }Line 8680: Line 8681: Line 8682: if ( isRunning ) {Line 8683: // productsLine 8684: if ( ((NameValueCollection)oJson)["products"] != "" ) {Line 8685: isRunning = checkProducts(idGrid, quantity, ((NameValueCollection)oJson)["products"]);Line 8686: }Line 8687: Line 8688: if ( isRunning ) {Line 8689: // utm_sourceLine 8690: if ( ((NameValueCollection)oJson)["utm_source"] != "" ) {Line 8691: if ( source != ((NameValueCollection)oJson)["utm_source"] ) {Line 8692: isRunning = false;Line 8693: }Line 8694: }Line 8695: Line 8696: if ( isRunning ) {Line 8697: // utm_mediumLine 8698: if ( ((NameValueCollection)oJson)["utm_medium"] != "" ) {Line 8699: if ( medium != ((NameValueCollection)oJson)["utm_medium"] ) {Line 8700: isRunning = false;Line 8701: }Line 8702: }Line 8703: Line 8704: if ( isRunning ) {Line 8705: // utm_campaignLine 8706: if ( ((NameValueCollection)oJson)["utm_campaign"] != "" ) {Line 8707: if ( campaign != ((NameValueCollection)oJson)["utm_campaign"] ) {Line 8708: isRunning = false;Line 8709: }Line 8710: }Line 8711: Line 8712: if ( isRunning ) {Line 8713: // get effectLine 8714: if ( isRunning ) {Line 8715: ((NameValueCollection)Output)["id"] = Convert.ToString(rdr["id"]);Line 8716: ((NameValueCollection)Output)["name"] = Convert.ToString(rdr["name"]);Line 8717: ((NameValueCollection)Output)["description"] = ( Convert.ToString(rdr["description"]) != "" ? Convert.ToString(rdr["description"]) : "-" );Line 8718: ((NameValueCollection)Output)["thumbnail"] = ((NameValueCollection)oJson)["thumbnail"];Line 8719: Line 8720: if ( ((NameValueCollection)oJson)["products"] != "" ) {Line 8721: ((NameValueCollection)Output)["products"] = ((NameValueCollection)oJson)["products"];Line 8722: }Line 8723: Line 8724: ((NameValueCollection)Output)["discountType"] = ((NameValueCollection)oJson)["discountType"];Line 8725: Line 8726: if (Line 8727: ((NameValueCollection)oJson)["discountType"] == "ticket" &&Line 8728: ((NameValueCollection)oJson)["ticketDatetime_a"] != "" &&Line 8729: ((NameValueCollection)oJson)["ticketDatetime_a"] != ""Line 8730: ) {Line 8731: ((NameValueCollection)Output)["ticketDatetime_a"] = ((NameValueCollection)oJson)["ticketDatetime_a"];Line 8732: ((NameValueCollection)Output)["ticketDatetime_b"] = ((NameValueCollection)oJson)["ticketDatetime_b"];Line 8733: }Line 8734: Line 8735: ((NameValueCollection)Output)["discountValue"] = (((NameValueCollection)oJson)["discountValue"]).Replace(",", "").Replace(".", ",");Line 8736: }Line 8737: }Line 8738: }Line 8739: }Line 8740: }Line 8741: Line 8742: }Line 8743: }Line 8744: }Line 8745: }Line 8746: }Line 8747: }Line 8748: }Line 8749: }Line 8750: } catch ( Exception e ) {}Line 8751: }Line 8752: }Line 8753: rdr.Close();Line 8754: conn.Close();Line 8755: Line 8756: return JavaScriptSerializer.Serialize(Output);Line 8757: }Line 8758: Line 8759: private decimal getCartTotal(string cartId) {Line 8760: Line 8761: decimal output = 0;Line 8762: SqlConnection conn = new SqlConnection(shop.Path);Line 8763: conn.Open();Line 8764: Line 8765: string query = String.Format( @"Line 8766: SELECT SUM( sys_cart.qt * ( tbl_prices.prc * ( 1 - ( tbl_prices.discRate / 100 ) ) ) ) AS cartTotalLine 8767: FROM sys_cart WITH (NOLOCK)Line 8768: INNER JOIN tbl_prices WITH (NOLOCK) ON sys_cart.codGrid = tbl_prices.codGridLine 8769: WHERE ( sys_cart.cid = '{0}' ) AND (tbl_prices.codGroup = {1})", cartId, UserSetup.UserGroup(shop.Path, userId) );Line 8770: SqlCommand cmd = new SqlCommand(query, conn);Line 8771: output = Convert.ToDecimal( cmd.ExecuteScalar() );Line 8772: conn.Close();Line 8773: Line 8774: return output;Line 8775: }Line 8776: Line 8777: private bool checkBrand(int idBrand, string brands) {Line 8778: bool output = false;Line 8779: foreach( string brand in brands.Split(',') ) {Line 8780: if ( idBrand == Convert.ToInt32(brand) ) {Line 8781: output = true;Line 8782: break;Line 8783: }Line 8784: }Line 8785: return output;Line 8786: }Line 8787: Line 8788: private bool checkCategories(string categories, string p_categories) {Line 8789: bool output = false;Line 8790: foreach( string p_category in p_categories.Split(',') ) {Line 8791: foreach( string category in categories.Split(',') ) {Line 8792: if ( category == p_category ) {Line 8793: output = true;Line 8794: break;Line 8795: }Line 8796: }Line 8797: }Line 8798: return output;Line 8799: }Line 8800: Line 8801: private bool checkProducts(int idGrid, int qt, string products) {Line 8802: bool output = false;Line 8803: foreach( string product in products.Split(',') ) {Line 8804: string[] arr = product.Split('_');Line 8805: if ( idGrid == Convert.ToInt32(arr[0]) ) {Line 8806: output = true;Line 8807: break;Line 8808: }Line 8809: }Line 8810: return output;Line 8811: }Line 8812: Line 8813: private int getUserWpromotion(int idPromotion) {Line 8814: int output = 0;Line 8815: Line 8816: SqlConnection conn = new SqlConnection(shop.Path);Line 8817: conn.Open();Line 8818: Line 8819: string query = "SELECT COUNT(id) FROM rel_usersWpromotions WITH (NOLOCK) WHERE (codUser = " + userId + ") AND (idPromotion = " + idPromotion + ")";Line 8820: SqlCommand cmd = new SqlCommand(query, conn);Line 8821: output = Convert.ToInt32( cmd.ExecuteScalar() );Line 8822: Line 8823: conn.Close();Line 8824: return output;Line 8825: }Line 8826: Line 8827: }Line 8828: Line 8829:
Line 8830: #line default
Line 8831: #line hidden
Line 8832:
Line 8833:
Line 8834: #line 923 "C:\octopus\http\current\shared\_Order.Body.aspx"
Line 8835: Line 8836: Line 8837: // helpersLine 8838: public string getValueFromProductDetails(string path, string _enum, string _ref) {Line 8839: SqlConnection conn = new SqlConnection(path);Line 8840: conn.Open();Line 8841: SqlCommand cmd = new SqlCommand(Line 8842: @"Line 8843: SELECT D.[desc] AS valueLine 8844: FROM [tbl_detailTitles] DTLine 8845: JOIN [tbl_details] D ON D.codTitle = DT.codTitleLine 8846: JOIN [tbl_prod] P ON P.codProd = D.codProdLine 8847: JOIN [tbl_grid] G ON G.codProd = P.codProdLine 8848: WHERE DT.[value] = @title AND G.[ref] = @refLine 8849: ",Line 8850: connLine 8851: );Line 8852: cmd.Parameters.Add(new SqlParameter("@title", SqlDbType.NVarChar));Line 8853: cmd.Parameters.Add(new SqlParameter("@ref", SqlDbType.NVarChar));Line 8854: cmd.Parameters["@title"].Value = _enum;Line 8855: cmd.Parameters["@ref"].Value = _ref;Line 8856: return Convert.ToString(cmd.ExecuteScalar());Line 8857: conn.Close();Line 8858: }Line 8859: Line 8860: public void load_by_sku(string path, dynamic product) {Line 8861: SqlConnection conn = new SqlConnection(path);Line 8862: conn.Open();Line 8863: SqlCommand cmd = new SqlCommand(Line 8864: @"Line 8865: SELECT TOP 1Line 8866: P.[codProd],Line 8867: P.[desc] AS prodName,Line 8868: B.[name] AS brandName,Line 8869: G.[codComp]Line 8870: FROM tbl_grid GLine 8871: LEFT OUTER JOIN tbl_prod P ON G.[codProd] = P.[codProd]Line 8872: LEFT OUTER JOIN tbl_brands B ON P.[codBrand] = B.[codBrand]Line 8873: WHERE G.[ref] = @skuLine 8874: ",Line 8875: connLine 8876: );Line 8877: cmd.Parameters.Add(new SqlParameter("@sku", SqlDbType.NVarChar));Line 8878: cmd.Parameters["@sku"].Value = Convert.ToString(product.id);Line 8879: SqlDataReader rdr = cmd.ExecuteReader();Line 8880: if( rdr.Read() ) {Line 8881: product.name = Convert.ToString(rdr["prodName"]);Line 8882: if( rdr["brandName"] != DBNull.Value )Line 8883: product.brand = Convert.ToString(rdr["brandName"]);Line 8884: if( rdr["codComp"] != DBNull.Value ) {Line 8885: product.variant = Generics.GridDescription(path, Convert.ToString(rdr["codComp"]));;Line 8886: product.variant = Regex.Replace( Convert.ToString( product.variant ), @"^\[|\]$", "" ).Trim();Line 8887: }Line 8888: product.category = Details.getProductMenu( path, Convert.ToInt32( rdr["codProd"] ) );Line 8889: }Line 8890: rdr.Close();Line 8891: conn.Close();Line 8892: }Line 8893: Line 8894:
Line 8895: #line default
Line 8896: #line hidden
Line 8897:
Line 8898:
Line 8899: [System.Diagnostics.DebuggerNonUserCodeAttribute()]
Line 8900: public dsp_system_aspx() {
Line 8901: string[] dependencies;
Line 8902: ((global::System.Web.UI.Page)(this)).AppRelativeVirtualPath = "~/dsp_system.aspx";
Line 8903: if ((global::ASP.dsp_system_aspx.@__initialized == false)) {
Line 8904: global::ASP.dsp_system_aspx.@__stringResource = this.ReadStringResource();
Line 8905: dependencies = new string[35];
Line 8906: dependencies[0] = "~/shared/_logged.aspx";
Line 8907: dependencies[1] = "~/_signinForgot.aspx";
Line 8908: dependencies[2] = "~/_billing_step_1.aspx";
Line 8909: dependencies[3] = "~/shared/__user_shared.aspx";
Line 8910: dependencies[4] = "~/_ASQ-frmQuestion.aspx";
Line 8911: dependencies[5] = "~/shared/_alert.aspx";
Line 8912: dependencies[6] = "~/_billing_step_2.aspx";
Line 8913: dependencies[7] = "~/shared/_library.aspx";
Line 8914: dependencies[8] = "~/zen_header.inc";
Line 8915: dependencies[9] = "~/_wishlistRegistry.aspx";
Line 8916: dependencies[10] = "~/shared/_menuU.aspx";
Line 8917: dependencies[11] = "~/_register.aspx";
Line 8918: dependencies[12] = "~/shared/__mapping.aspx";
Line 8919: dependencies[13] = "~/_weddingRegistry.aspx";
Line 8920: dependencies[14] = "~/__userCheck.aspx";
Line 8921: dependencies[15] = "~/shared/_title.aspx";
Line 8922: dependencies[16] = "~/shared/_menu0.aspx";
Line 8923: dependencies[17] = "~/shared/zen_message.inc";
Line 8924: dependencies[18] = "~/_payment.aspx";
Line 8925: dependencies[19] = "~/shared/_date.aspx";
Line 8926: dependencies[20] = "~/shared/_extrasFull.aspx";
Line 8927: dependencies[21] = "~/shared/zen_library.aspx";
Line 8928: dependencies[22] = "~/shared/_GR-subShared.aspx";
Line 8929: dependencies[23] = "~/shared/zen_footer.inc";
Line 8930: dependencies[24] = "~/dsp_system.aspx";
Line 8931: dependencies[25] = "~/_babylistRegistry.aspx";
Line 8932: dependencies[26] = "~/_orders.aspx";
Line 8933: dependencies[27] = "~/_summary.aspx";
Line 8934: dependencies[28] = "~/_testimonials.aspx";
Line 8935: dependencies[29] = "~/shared/_Order.Body.aspx";
Line 8936: dependencies[30] = "~/shared/_ASQ-subShared.aspx";
Line 8937: dependencies[31] = "~/_GR-frmReview.aspx";
Line 8938: dependencies[32] = "~/_signin.aspx";
Line 8939: dependencies[33] = "~/shared/_logo.aspx";
Line 8940: dependencies[34] = "~/shared/_banners.aspx";
Line 8941: global::ASP.dsp_system_aspx.@__fileDependencies = this.GetWrappedFileDependencies(dependencies);
Line 8942: global::ASP.dsp_system_aspx.@__initialized = true;
Line 8943: }
Line 8944: this.Server.ScriptTimeout = 30000000;
Line 8945: }
Line 8946:
Line 8947: protected System.Web.Profile.DefaultProfile Profile {
Line 8948: get {
Line 8949: return ((System.Web.Profile.DefaultProfile)(this.Context.Profile));
Line 8950: }
Line 8951: }
Line 8952:
Line 8953: protected System.Web.HttpApplication ApplicationInstance {
Line 8954: get {
Line 8955: return ((System.Web.HttpApplication)(this.Context.ApplicationInstance));
Line 8956: }
Line 8957: }
Line 8958:
Line 8959: [System.Diagnostics.DebuggerNonUserCodeAttribute()]
Line 8960: private void @__BuildControlTree(dsp_system_aspx @__ctrl) {
Line 8961:
Line 8962: #line 1 "C:\octopus\https\current\dsp_system.aspx"
Line 8963: this.InitializeCulture();
Line 8964:
Line 8965: #line default
Line 8966: #line hidden
Line 8967: @__ctrl.SetRenderMethodDelegate(new System.Web.UI.RenderMethod(this.@__Render__control1));
Line 8968: }
Line 8969:
Line 8970: private void @__Render__control1(System.Web.UI.HtmlTextWriter @__w, System.Web.UI.Control parameterContainer) {
Line 8971:
Line 8972: #line 4 "C:\octopus\https\current\dsp_system.aspx"
Line 8973:
Line 8974:
Line 8975: bool isMobile = false;
Line 8976: if( Request.QueryString["isMobile"] != "" && Request.QueryString["isMobile"] == "true") { // DEBUG ONLY ?
Line 8977: isMobile = true;
Line 8978: }
Line 8979:
Line 8980: bool is_https = true;
Line 8981:
Line 8982: SqlConnection conn = null;
Line 8983: SqlTransaction tran = null;
Line 8984: SqlCommand cmd = null;
Line 8985: SqlDataReader rdr = null;
Line 8986: string query = "";
Line 8987:
Line 8988: int i = 0;
Line 8989: int t = 0;
Line 8990: int shopId = 0;
Line 8991:
Line 8992: StringDictionary strdGlobal = new StringDictionary();
Line 8993: StringDictionary strdModule = new StringDictionary();
Line 8994:
Line 8995:
Line 8996:
Line 8997: #line default
Line 8998: #line hidden
Line 8999:
Line 9000: #line 1 "C:\octopus\http\current\shared\__mapping.aspx"
Line 9001: Line 9002: Line 9003: switch( Request.ServerVariables["HTTP_HOST"] ) {Line 9004: Line 9005: case "www.armarinhosantacecilia.com.br":Line 9006: case "armarinhosantacecilia.com.br":Line 9007: shopId = 64;Line 9008: break;Line 9009: Line 9010: case "www.sunny.com.br":Line 9011: case "sunny.com.br":Line 9012: shopId = 82;Line 9013: break;Line 9014: Line 9015: case "www.pictoys.com.br":Line 9016: case "pictoys.com.br":Line 9017: shopId = 183;Line 9018: break;Line 9019: Line 9020: case "suellenarmarinhos.com.br":Line 9021: case "www.suellenarmarinhos.com.br":Line 9022: shopId = 221;Line 9023: break;Line 9024: Line 9025: case "loja.pluraliza.com.br":Line 9026: shopId = 225;Line 9027: break;Line 9028: Line 9029: case "www.outletpersianas.com.br":Line 9030: Response.Redirect("/index.html");Line 9031: break;Line 9032: Line 9033: case "outletpersianas.lojcommex.com.br":Line 9034: shopId = 235;Line 9035: break;Line 9036: Line 9037: default:Line 9038: Response.StatusCode = 400;Line 9039: Response.Write("Oops! Invalid octopus shop id. Evaluated: ");Line 9040: Response.Write( Request.ServerVariables["HTTP_HOST"] );Line 9041: Response.Write(" at mapping");Line 9042: Response.End();Line 9043: break;Line 9044: }Line 9045: Line 9046:
Line 9047:
Line 9048: #line default
Line 9049: #line hidden
Line 9050:
Line 9051: #line 26 "C:\octopus\https\current\dsp_system.aspx"
Line 9052:
Line 9053:
Line 9054: string cartId = CID();
Line 9055: int wrId = WRID();
Line 9056:
Line 9057: string listType = LTYPE();
Line 9058:
Line 9059: if(shopId == 0) Response.Redirect("/octopus/shared/zen_message.aspx?m=Invalid shop ID");
Line 9060:
Line 9061: string thisConfig = "?sid=" + shopId;
Line 9062: string crossConfig = "&cid=" + cartId;
Line 9063: if( wrId > 0 ) {
Line 9064: crossConfig += "&wrid=" + wrId;
Line 9065: } else {
Line 9066: crossConfig += "&wrid=none";
Line 9067: }
Line 9068:
Line 9069: string asyncPassport = ZenTools.CriticalAJAXEncryption("idS="+ shopId +"&idC="+ cartId);
Line 9070:
Line 9071: int idGrid = 0;
Line 9072: if((null != Request["idG"]) && (!Convert.ToString(Request["idG"]).Equals("")))
Line 9073: idGrid = Convert.ToInt32(Request["idG"]);
Line 9074:
Line 9075: //int userId = UID();
Line 9076: //if( userId > 0 ) {
Line 9077: // thisConfig += "&uid=" + userId;
Line 9078: //}
Line 9079:
Line 9080: int bllStep = 1;
Line 9081: if((null != Request["bllstp"]) && (!Convert.ToString(Request["bllstp"]).Equals(""))) {
Line 9082: bllStep = Convert.ToInt32(Request["bllstp"]);
Line 9083: }
Line 9084:
Line 9085: string couponId = "";
Line 9086: if(( null != Request.QueryString["dc"] ) && !Request.QueryString["dc"].Equals("")) {
Line 9087: try {
Line 9088: couponId = Convert.ToString(Request.QueryString["dc"]);
Line 9089: thisConfig += "&dc=" + couponId;
Line 9090: } catch(Exception e) {}
Line 9091: }
Line 9092:
Line 9093: bool fromQtn = false;
Line 9094: if(( null != Request.QueryString["fqtn"] ) && !Request.QueryString["fqtn"].Equals("")) {
Line 9095: try {
Line 9096: fromQtn = true;
Line 9097: thisConfig += "&fqtn=" + Convert.ToString( Request.QueryString["fqtn"] );
Line 9098: } catch(Exception e) {}
Line 9099: }
Line 9100:
Line 9101: string cardId = "";
Line 9102: if(null != Request["gc"] && !Request["gc"].Equals("")) {
Line 9103: try {
Line 9104: cardId = Convert.ToString(Request["gc"]);
Line 9105: thisConfig += "&gc="+ cardId;
Line 9106: } catch(Exception e) {}
Line 9107: }
Line 9108:
Line 9109: string code = "";
Line 9110: if(null != Request["c"] && !Request["c"].Equals("")) {
Line 9111: code = Convert.ToString(Request["c"]);
Line 9112: thisConfig += "&c="+ code;
Line 9113: }
Line 9114:
Line 9115: int transporterId = 0;
Line 9116: if(null != Request["tid"] && !Request["tid"].Equals("")) {
Line 9117: transporterId = Convert.ToInt32(Request["tid"]);
Line 9118: thisConfig += "&tid="+ transporterId;
Line 9119: }
Line 9120:
Line 9121: bool framed = false;
Line 9122:
Line 9123: string mainInclude = "BLL";
Line 9124: if(null != Request["mi"] && !Request["mi"].Equals(""))
Line 9125: mainInclude = Request["mi"];
Line 9126:
Line 9127: string redirectMainInclude = "BLL";
Line 9128: if(null != Request["rmi"] && !Request["rmi"].Equals(""))
Line 9129: redirectMainInclude = Request["rmi"];
Line 9130:
Line 9131: string redirectMainIncludeNext = "BLL";
Line 9132: if(null != Request["rmin"] && !Request["rmin"].Equals(""))
Line 9133: redirectMainIncludeNext = Request["rmin"];
Line 9134:
Line 9135: int codMenu1st = 0; if(null != Request.QueryString["cm1"] && !Request.QueryString["cm1"].Equals(""))codMenu1st=Convert.ToInt32(Request.QueryString["cm1"]);
Line 9136: int codMenu2nd = 0; if(null != Request.QueryString["cm2"] && !Request.QueryString["cm2"].Equals(""))codMenu2nd=Convert.ToInt32(Request.QueryString["cm2"]);
Line 9137: int codMenu3rd = 0; if(null != Request.QueryString["cm3"] && !Request.QueryString["cm3"].Equals(""))codMenu3rd=Convert.ToInt32(Request.QueryString["cm3"]);
Line 9138:
Line 9139: string msgType = "";
Line 9140: if((null != Request["msgtype"]) && (!Convert.ToString(Request["msgtype"]).Equals("")))
Line 9141: msgType = Convert.ToString(Request["msgType"]);
Line 9142:
Line 9143: string msg = "";
Line 9144: if((null != Request["msg"]) && (!Convert.ToString(Request["msg"]).Equals("")))
Line 9145: msg = Convert.ToString(Request["msg"]).Replace("[br]", "<br />");
Line 9146:
Line 9147: string iClass = "";
Line 9148: string iTarget = "";
Line 9149: string iValue = "";
Line 9150:
Line 9151:
Line 9152:
Line 9153:
Line 9154:
Line 9155: ShopSetup shop = new ShopSetup(shopId);
Line 9156: shop.FillVars();
Line 9157:
Line 9158:
Line 9159:
Line 9160:
Line 9161:
Line 9162: dynamic social = JsonConvert.DeserializeObject<JObject>( shop.getConfig("SocialNetworks") );
Line 9163: if( social == null )
Line 9164: social = JsonConvert.DeserializeObject<JObject>("{}");
Line 9165:
Line 9166: /* GOOGLE_DEPRECATED */
Line 9167: string google_merchant_id = shop.getConfig("GoogleMerchantId");
Line 9168: /* GOOGLE_DEPRECATED */
Line 9169:
Line 9170: StringDictionary Sd_facebook = new StringDictionary();
Line 9171: string fb_content_ids = "";
Line 9172: string fb_value = "";
Line 9173: if( shop.getConfig("UseFacebookPixel") != "" ) {
Line 9174: try {
Line 9175: object o = JavaScriptDeserializer.DeserializeFromJson(shop.getConfig("UseFacebookPixel"), typeof(NameValueCollection));
Line 9176: Sd_facebook.Add("status", ((NameValueCollection)o)["status"]);
Line 9177: Sd_facebook.Add("pixel_id", ((NameValueCollection)o)["pixel_id"]);
Line 9178: } catch(Exception ex) {
Line 9179: Response.Write( "Error @dsp_system.aspx - Please provide a valid 'UseFacebookPixel' config." );
Line 9180: }
Line 9181: }
Line 9182:
Line 9183: if( ZenTools.isMobile( Request.ServerVariables["HTTP_USER_AGENT"] ) && shop.getConfig("UseMobile").ToLower() == "true" ) isMobile = true;
Line 9184:
Line 9185: string ndd="";for(i=0;i<shop.NDD;i++)ndd+="0";
Line 9186:
Line 9187: bool useKonduto = false;
Line 9188: if( shop.getConfig("Konduto") != "" )
Line 9189: useKonduto = true;
Line 9190:
Line 9191:
Line 9192:
Line 9193:
Line 9194:
Line 9195: /*--[ LOGIN VERIFICATION: BEGIN ] --------------------------------------------*/
Line 9196:
Line 9197: int userId = UID();
Line 9198: if( userId > 0 ) {
Line 9199: // cookie check
Line 9200: if( LOGGED(shopId, userId) ) {
Line 9201: thisConfig += "&uid=" + userId;
Line 9202: } else {
Line 9203: // remove old data
Line 9204: Response.Cookies["uid"].Expires = DateTime.Now;
Line 9205: Response.Cookies["lgd" + shopId + userId].Expires = DateTime.Now;
Line 9206: userId = 0;
Line 9207:
Line 9208: // use querystring
Line 9209: userId = UID();
Line 9210:
Line 9211: if( userId > 0 && UserSetup.isLogged(shop.Path, userId) ) {
Line 9212: Response.Cookies["lgd" + shopId + userId].Value = "true";
Line 9213: Response.Cookies["lgd" + shopId + userId].Expires = DateTime.Now.AddYears(99);
Line 9214: UserSetup.setLogin(shop.Path, userId, false);
Line 9215: thisConfig += "&uid=" + userId;
Line 9216: }
Line 9217: }
Line 9218: }
Line 9219:
Line 9220: /*--[ LOGIN VERIFICATION: END ] ----------------------------------------------*/
Line 9221:
Line 9222:
Line 9223:
Line 9224:
Line 9225:
Line 9226: //--( Promotion )---------------------------------------------------------------
Line 9227: string source = "";
Line 9228: string medium = "";
Line 9229: string campaign = "";
Line 9230: decimal ordersTotalAcumulated = 0;
Line 9231:
Line 9232: if( userId > 0 ) {
Line 9233: if( Request.Cookies["uid-ota"] != null && Request.Cookies["uid-ota"].Value != "" ) {
Line 9234: ordersTotalAcumulated = Convert.ToDecimal(ZenTools.Decrypt(Request.Cookies["uid-ota"].Value, shop.EncryptPass));
Line 9235: } else {
Line 9236: ordersTotalAcumulated = UserSetup.getOrdersTotalAcumulated(shop.Path, userId);
Line 9237: Response.Cookies["uid-ota"].Value = ZenTools.Encrypt(Convert.ToString(ordersTotalAcumulated), shop.EncryptPass);
Line 9238: Response.Cookies["uid-ota"].Expires = DateTime.Today.AddDays(1d);
Line 9239: }
Line 9240: }
Line 9241:
Line 9242: // utm_source
Line 9243: if( Request.QueryString["utm_source"] != null && Request.QueryString["utm_source"] != "" ) {
Line 9244: Response.Cookies["p_source"].Value = Convert.ToString(Request.QueryString["utm_source"]);
Line 9245: }
Line 9246:
Line 9247: if( Request.Cookies["p_source"] != null && Request.Cookies["p_source"].Value != "" ) {
Line 9248: source = Request.Cookies["p_source"].Value;
Line 9249: //thisConfig += "&utm_source=" + source;
Line 9250: }
Line 9251:
Line 9252: // utm_medium
Line 9253: if( Request.QueryString["utm_medium"] != null && Request.QueryString["utm_medium"] != "" ) {
Line 9254: Response.Cookies["p_medium"].Value = Convert.ToString(Request.QueryString["utm_medium"]);
Line 9255: }
Line 9256:
Line 9257: if( Request.Cookies["p_medium"] != null && Request.Cookies["p_medium"].Value != "" ) {
Line 9258: medium = Request.Cookies["p_medium"].Value;
Line 9259: //thisConfig += "&utm_medium=" + medium;
Line 9260: }
Line 9261:
Line 9262: // utm_campaign
Line 9263: if( Request.QueryString["utm_campaign"] != null && Request.QueryString["utm_campaign"] != "" ) {
Line 9264: Response.Cookies["p_campaign"].Value = Convert.ToString(Request.QueryString["utm_campaign"]);
Line 9265: }
Line 9266:
Line 9267: if( Request.Cookies["p_campaign"] != null && Request.Cookies["p_campaign"].Value != "" ) {
Line 9268: campaign = Request.Cookies["p_campaign"].Value;
Line 9269: //thisConfig += "&utm_campaign=" + campaign;
Line 9270: }
Line 9271:
Line 9272: Promotion Prom = new Promotion(
Line 9273: shop,
Line 9274: shopId,
Line 9275: userId,
Line 9276: (code != "" ? Convert.ToInt32(code) : 0),
Line 9277: ordersTotalAcumulated,
Line 9278: source,
Line 9279: medium,
Line 9280: campaign
Line 9281: );
Line 9282:
Line 9283:
Line 9284:
Line 9285:
Line 9286:
Line 9287: if(shop.isLocked)Server.Transfer("_updating.aspx");
Line 9288:
Line 9289: if(mainInclude.Equals("PRD"))Response.Redirect(shop.Http + thisConfig);
Line 9290:
Line 9291: switch(mainInclude) {
Line 9292: case "GR":
Line 9293: case "ASQ":
Line 9294: case "BLL":
Line 9295: case "MDT":
Line 9296: case "MRD":
Line 9297: case "WR":
Line 9298: case "WL":
Line 9299: case "BL":
Line 9300: case "TMS":
Line 9301: case "DTL":
Line 9302: case "PAY":
Line 9303: case "PRDA":
Line 9304:
Line 9305:
Line 9306: #line default
Line 9307: #line hidden
Line 9308:
Line 9309: #line 1 "C:\octopus\https\current\__userCheck.aspx"
Line 9310:
Line 9311:
Line 9312: bool userCheck_isAuth = false;
Line 9313:
Line 9314:
Line 9315:
Line 9316:
Line 9317:
Line 9318: if( mainInclude == "PRDA" ) { // remove old autentication
Line 9319: Response.Cookies["uid"].Expires = DateTime.Now;
Line 9320: Response.Cookies["lgd" + shopId + userId].Expires = DateTime.Now;
Line 9321: Response.Cookies["pass"].Expires = DateTime.Now;
Line 9322:
Line 9323: userId = 0;
Line 9324: if( Request.QueryString["uid"] != null && Request.QueryString["uid"] != "" ) {
Line 9325: userId = Convert.ToInt32(Request.QueryString["uid"]);
Line 9326: }
Line 9327: }
Line 9328:
Line 9329: conn = new SqlConnection(shop.Path);
Line 9330: conn.Open();
Line 9331:
Line 9332: query = "SELECT pass FROM sys_users WHERE (codUser = @codUser) AND (active = 1)";
Line 9333:
Line 9334: cmd = new SqlCommand(query, conn);
Line 9335: cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));
Line 9336: cmd.Parameters["@codUser"].Value = userId;
Line 9337: rdr = cmd.ExecuteReader();
Line 9338:
Line 9339: if( rdr.Read() ) {
Line 9340: if( mainInclude == "PRDA" ) { // try new authentication
Line 9341: string prdaTkn = ZenTools.md5(Convert.ToString(shopId) + Convert.ToString(userId) + Convert.ToString(rdr["pass"]));
Line 9342: if(
Line 9343: userId > 0
Line 9344: && Request.Form["token"] != null
Line 9345: && Request.Form["token"] != ""
Line 9346: && prdaTkn == Convert.ToString(Request.Form["token"])
Line 9347: ) {
Line 9348: Response.Cookies["pass"].Value = ZenTools.md5( Convert.ToString(rdr["pass"]) );
Line 9349: Response.Cookies["uid"].Value = Convert.ToString(userId);
Line 9350: Response.Cookies["uid"].Expires = DateTime.Now.AddYears(99);
Line 9351: Response.Cookies["lgd" + shopId + userId].Value = "true";
Line 9352: Response.Cookies["lgd" + shopId + userId].Expires = DateTime.Now.AddYears(99);
Line 9353: UserSetup.setLogin(shop.Path, userId, true);
Line 9354: userCheck_isAuth = true;
Line 9355: }
Line 9356: } else {
Line 9357: if( null == Request.Cookies["pass"] || !Convert.ToString(Request.Cookies["pass"].Value).Equals( ZenTools.md5( Convert.ToString( rdr["pass"] ) ) ) ) {
Line 9358:
Line 9359: switch( mainInclude ) {
Line 9360: case "GR":
Line 9361: string grTkn = ZenTools.md5(Convert.ToString(shopId) + Convert.ToString(userId) + Convert.ToString(idGrid));
Line 9362:
Line 9363: if(
Line 9364: userId > 0
Line 9365: && Request.QueryString["token"] != null
Line 9366: && Request.QueryString["token"] != ""
Line 9367: && grTkn == Convert.ToString(Request.QueryString["token"])
Line 9368: ) {
Line 9369: Response.Cookies["pass"].Value = ZenTools.md5( Convert.ToString(rdr["pass"]) );
Line 9370: Response.Cookies["uid"].Value = Convert.ToString(userId);
Line 9371: Response.Cookies["uid"].Expires = DateTime.Now.AddYears(99);
Line 9372: Response.Cookies["lgd" + shopId + userId].Value = "true";
Line 9373: Response.Cookies["lgd" + shopId + userId].Expires = DateTime.Now.AddYears(99);
Line 9374: UserSetup.setLogin(shop.Path, userId, true);
Line 9375: userCheck_isAuth = true;
Line 9376: }
Line 9377: break;
Line 9378: }
Line 9379:
Line 9380: } else {
Line 9381: Response.Cookies["pass"].Value = Convert.ToString(Request.Cookies["pass"].Value);
Line 9382: userCheck_isAuth = true;
Line 9383: }
Line 9384: }
Line 9385: }
Line 9386:
Line 9387: rdr.Close();
Line 9388: conn.Close();
Line 9389:
Line 9390:
Line 9391:
Line 9392:
Line 9393:
Line 9394: if( !userCheck_isAuth ) {
Line 9395: mainInclude = "SGN";
Line 9396: } else {
Line 9397: // handle cross-device cart
Line 9398: if( cartId != Convert.ToString(userId) ) {
Line 9399: Quotation.Delete(shop.Path, cartId);
Line 9400: if( Cart.ItemsQt(shop.Path, cartId) > 0 )
Line 9401: Cart.Delete(shopId, Convert.ToString(userId), shop);
Line 9402: if( Cart.createCrossDeviceCart(shop.Path, Convert.ToString(userId), cartId) == "SUCCESS" ) {
Line 9403: cartId = Convert.ToString(userId);
Line 9404: Response.Cookies["cid"].Value = cartId;
Line 9405: Response.Cookies["cid"].Expires = DateTime.Today.AddDays(1d);
Line 9406: }
Line 9407: }
Line 9408: }
Line 9409:
Line 9410:
Line 9411:
Line 9412: #line default
Line 9413: #line hidden
Line 9414:
Line 9415: #line 278 "C:\octopus\https\current\dsp_system.aspx"
Line 9416:
Line 9417: break;
Line 9418: }
Line 9419:
Line 9420:
Line 9421:
Line 9422: #line default
Line 9423: #line hidden
Line 9424: this.WriteUTF8ResourceString(@__w, 46717, 490, true);
Line 9425: @__w.Write("\r\n\r\n\t<title>");
Line 9426:
Line 9427: #line 285 "C:\octopus\https\current\dsp_system.aspx"
Line 9428:
Line 9429:
Line 9430: switch(mainInclude) {
Line 9431: case "MDT":
Line 9432: Response.Write("MEU CADASTRO");
Line 9433: break;
Line 9434:
Line 9435: case "MRD":
Line 9436: Response.Write("MEUS PEDIDOS");
Line 9437: break;
Line 9438:
Line 9439: case "SGN":
Line 9440: mainInclude = "SGN";
Line 9441: Response.Write("TELA DE IDENTIFICACAO");
Line 9442: break;
Line 9443:
Line 9444: case "RGS":
Line 9445: Response.Write("CADASTRO");
Line 9446: break;
Line 9447:
Line 9448: case "BLL":
Line 9449: Response.Write("FORMA DE PAGAMENTO");
Line 9450: break;
Line 9451:
Line 9452: case "SMR":
Line 9453: Response.Write("PEDIDO CONCLUIDO");
Line 9454: break;
Line 9455:
Line 9456: case "DTL":
Line 9457: Response.Redirect( shop.Http + thisConfig + "&mi=DTL&cg=" + idGrid );
Line 9458: break;
Line 9459:
Line 9460: case "PAY":
Line 9461: Response.Write("FORMA DE PAGAMENTO");
Line 9462: break;
Line 9463:
Line 9464: case "PRDA":
Line 9465: string prda_url = shop.Http + Regex.Replace(thisConfig, @"\&uid=\d+", "") + "&uid=" + userId + "&m=B";
Line 9466:
Line 9467: if( Request.QueryString["cm1"] != null && Request.QueryString["cm1"] != "" ) {
Line 9468: prda_url += "&cm1=" + Convert.ToString(Request.QueryString["cm1"]);
Line 9469: }
Line 9470:
Line 9471: if( Request.QueryString["cm2"] != null && Request.QueryString["cm2"] != "" ) {
Line 9472: prda_url += "&cm2=" + Convert.ToString(Request.QueryString["cm2"]);
Line 9473: }
Line 9474:
Line 9475: if( Request.QueryString["cm3"] != null && Request.QueryString["cm3"] != "" ) {
Line 9476: prda_url += "&cm3=" + Convert.ToString(Request.QueryString["cm3"]);
Line 9477: }
Line 9478:
Line 9479: Response.Redirect( prda_url );
Line 9480: break;
Line 9481:
Line 9482: default:
Line 9483: Response.Write(shop.Title);
Line 9484: break;
Line 9485: }
Line 9486:
Line 9487:
Line 9488:
Line 9489: #line default
Line 9490: #line hidden
Line 9491: this.WriteUTF8ResourceString(@__w, 47207, 346, true);
Line 9492:
Line 9493: #line 352 "C:\octopus\https\current\dsp_system.aspx"
Line 9494:
Line 9495:
Line 9496: if( useKonduto ) {
Line 9497: switch(mainInclude) {
Line 9498: case "BLL":
Line 9499: if( bllStep == 2 )
Line 9500: Response.Write("<meta name='kdt:page' content='checkout' />\r\n");
Line 9501: break;
Line 9502:
Line 9503: case "FGT":
Line 9504: Response.Write("<meta name='kdt:page' content='password_reset' />\r\n");
Line 9505: break;
Line 9506:
Line 9507: case "MDT":
Line 9508: Response.Write("<meta name='kdt:page' content='account' />\r\n");
Line 9509: break;
Line 9510:
Line 9511: case "RGS":
Line 9512: Response.Write("<meta name='kdt:page' content='account_creation' />\r\n");
Line 9513: break;
Line 9514:
Line 9515: default:
Line 9516: break;
Line 9517: }
Line 9518: }
Line 9519:
Line 9520:
Line 9521:
Line 9522:
Line 9523: #line default
Line 9524: #line hidden
Line 9525: @__w.Write("\r\n\t<link href=\"/octopus/design/css/zen_basic.css\" rel=\"stylesheet\" type=\"text/css" +
Line 9526: "\" />\r\n\t<link href=\"/octopus/design/css/AutoComplete.css\" rel=\"stylesheet\" type=\"" +
Line 9527: "text/css\" />\r\n");
Line 9528:
Line 9529: #line 382 "C:\octopus\https\current\dsp_system.aspx"
Line 9530:
Line 9531:
Line 9532: string cssVersion = "";
Line 9533: if( shop.getConfig("CSS") != null && shop.getConfig("CSS") != "" ) {
Line 9534: try {
Line 9535: object oJson = JavaScriptDeserializer.DeserializeFromJson(shop.getConfig("CSS"), typeof(NameValueCollection));
Line 9536: cssVersion = "_" + Convert.ToString( ( (NameValueCollection)oJson )["version"] );
Line 9537: } catch (Exception e) {
Line 9538: Response.Write( "Error @dsp_system.aspx - Please provide a valid CSS config." );
Line 9539: Response.End();
Line 9540: }
Line 9541: }
Line 9542:
Line 9543: string mobileSuffix = ( isMobile ? "_mobile" : "" );
Line 9544:
Line 9545: Response.Write(" <link href='/octopus/design/css/" + shopId + cssVersion + mobileSuffix + ".css' rel='stylesheet' type='text/css' />");
Line 9546:
Line 9547:
Line 9548:
Line 9549: #line default
Line 9550: #line hidden
Line 9551: this.WriteUTF8ResourceString(@__w, 47553, 924, true);
Line 9552:
Line 9553: #line 415 "C:\octopus\https\current\dsp_system.aspx"
Line 9554: @__w.Write( thisConfig );
Line 9555:
Line 9556:
Line 9557: #line default
Line 9558: #line hidden
Line 9559: this.WriteUTF8ResourceString(@__w, 48477, 886, true);
Line 9560:
Line 9561: #line 438 "C:\octopus\https\current\dsp_system.aspx"
Line 9562: @__w.Write( shop.WDS );
Line 9563:
Line 9564:
Line 9565: #line default
Line 9566: #line hidden
Line 9567: @__w.Write("\";\r\n})();\r\n\r\n\t// ]]>\r\n\t</script>\r\n\r\n");
Line 9568:
Line 9569: #line 444 "C:\octopus\https\current\dsp_system.aspx"
Line 9570:
Line 9571:
Line 9572: Response.Write("\r\n " + shop.getConfig("inside-head"));
Line 9573: Response.Write( shop.getConfig("CustomHeaderTags") );
Line 9574: Response.Write( shop.getConfig("CustomHeaderTagsHttps") );
Line 9575:
Line 9576:
Line 9577:
Line 9578: #line default
Line 9579: #line hidden
Line 9580:
Line 9581: #line 452 "C:\octopus\https\current\dsp_system.aspx"
Line 9582: if( Sd_facebook["status"] == "active") {
Line 9583:
Line 9584: #line default
Line 9585: #line hidden
Line 9586: this.WriteUTF8ResourceString(@__w, 49363, 411, true);
Line 9587:
Line 9588: #line 459 "C:\octopus\https\current\dsp_system.aspx"
Line 9589: @__w.Write( Sd_facebook["pixel_id"] );
Line 9590:
Line 9591:
Line 9592: #line default
Line 9593: #line hidden
Line 9594: @__w.Write("\');\r\nfbq(\'track\', \'PageView\');\r\n</script>\r\n<noscript><img height=\"1\" width=\"1\" st" +
Line 9595: "yle=\"display:none\"src=\"https://www.facebook.com/tr?id=");
Line 9596:
Line 9597: #line 462 "C:\octopus\https\current\dsp_system.aspx"
Line 9598: @__w.Write( Sd_facebook["pixel_id"] );
Line 9599:
Line 9600:
Line 9601: #line default
Line 9602: #line hidden
Line 9603: @__w.Write("&ev=PageView&noscript=1\"/></noscript>\r\n");
Line 9604:
Line 9605: #line 463 "C:\octopus\https\current\dsp_system.aspx"
Line 9606: }
Line 9607:
Line 9608: #line default
Line 9609: #line hidden
Line 9610:
Line 9611: #line 465 "C:\octopus\https\current\dsp_system.aspx"
Line 9612:
Line 9613:
Line 9614: dynamic htmlInjection = JsonConvert.DeserializeObject<JObject>( shop.getConfig("HTMLInjection") );
Line 9615: if( htmlInjection != null ) Response.Write( htmlInjection.before_closing_head );
Line 9616:
Line 9617:
Line 9618:
Line 9619: #line default
Line 9620: #line hidden
Line 9621:
Line 9622: #line 472 "C:\octopus\https\current\dsp_system.aspx"
Line 9623: if( social.google != null ) {
Line 9624:
Line 9625: #line default
Line 9626: #line hidden
Line 9627: this.WriteUTF8ResourceString(@__w, 49774, 421, true);
Line 9628:
Line 9629: #line 479 "C:\octopus\https\current\dsp_system.aspx"
Line 9630: @__w.Write( social.google.containerID );
Line 9631:
Line 9632:
Line 9633: #line default
Line 9634: #line hidden
Line 9635: @__w.Write("\');</script>\r\n<!-- GOOGLE_TAG_MANAGER -->\r\n");
Line 9636:
Line 9637: #line 481 "C:\octopus\https\current\dsp_system.aspx"
Line 9638: }
Line 9639:
Line 9640: #line default
Line 9641: #line hidden
Line 9642: @__w.Write("\r\n\r\n</head>\r\n<body class=\"ssl\">\r\n\r\n");
Line 9643:
Line 9644: #line 486 "C:\octopus\https\current\dsp_system.aspx"
Line 9645: if( social.google != null ) {
Line 9646:
Line 9647: #line default
Line 9648: #line hidden
Line 9649: @__w.Write("\r\n<!-- GOOGLE_TAG_MANAGER -->\r\n<noscript><iframe src=\"https://www.googletagmanage" +
Line 9650: "r.com/ns.html?id=");
Line 9651:
Line 9652: #line 488 "C:\octopus\https\current\dsp_system.aspx"
Line 9653: @__w.Write( social.google.containerID );
Line 9654:
Line 9655:
Line 9656: #line default
Line 9657: #line hidden
Line 9658: @__w.Write("\"\r\nheight=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe></noscrip" +
Line 9659: "t>\r\n<!-- GOOGLE_TAG_MANAGER -->\r\n");
Line 9660:
Line 9661: #line 491 "C:\octopus\https\current\dsp_system.aspx"
Line 9662: }
Line 9663:
Line 9664: #line default
Line 9665: #line hidden
Line 9666:
Line 9667: #line 493 "C:\octopus\https\current\dsp_system.aspx"
Line 9668:
Line 9669:
Line 9670: if( htmlInjection != null ) Response.Write( htmlInjection.after_opening_body );
Line 9671:
Line 9672:
Line 9673:
Line 9674: #line default
Line 9675: #line hidden
Line 9676: @__w.Write("\r\n\r\n<script type=\"text/javascript\" src=\"js/zen_mouse.js\"></script>\r\n<script type=" +
Line 9677: "\"text/javascript\" src=\"js/zen_popup.js\"></script>\r\n");
Line 9678: this.WriteUTF8ResourceString(@__w, 50195, 5640, false);
Line 9679:
Line 9680: #line 503 "C:\octopus\https\current\dsp_system.aspx"
Line 9681: /* Response.Write("[(thisConfig => " + thisConfig + "), (cartId => " + cartId + "),(wrId => " + wrId + ")]"); */
Line 9682:
Line 9683: #line default
Line 9684: #line hidden
Line 9685: @__w.Write("\r\n\r\n<div id=\"container\" class=\"fullMode\">\r\n <div id=\"container_header\">\r\n <di" +
Line 9686: "v class=\"pad\">\r\n");
Line 9687:
Line 9688: #line 1 "C:\octopus\http\current\shared\_logged.aspx"
Line 9689: Line 9690: Line 9691: bool lgd_logged = LOGGED(shopId, userId);Line 9692: bool lgd_visible = true;Line 9693: Line 9694: if( lgd_visible && !lgd_logged && mainInclude == "CRT" ) {Line 9695: lgd_visible = false;Line 9696: }Line 9697: if( lgd_visible && mainInclude == "SGN" ) {Line 9698: lgd_visible = false;Line 9699: }Line 9700: Line 9701: if( lgd_visible ) {Line 9702: Response.Write( "<div id='nav-your-account'>" + Environment.NewLine );Line 9703: Response.Write( "<span class='nav_title'>Olá, </span>" + Environment.NewLine );Line 9704: Line 9705: if( lgd_logged ) {Line 9706: conn = new SqlConnection(shop.Path);Line 9707: conn.Open();Line 9708: Line 9709: query = "SELECT name FROM sys_users WHERE (codUser = @userId);";Line 9710: cmd = new SqlCommand(query, conn);Line 9711: cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int));Line 9712: cmd.Parameters["@userId"].Value = userId;Line 9713: Line 9714: if( cmd.ExecuteScalar() != DBNull.Value && cmd.ExecuteScalar() != "" ) {Line 9715: Response.Write( " <span class='nav_usr'>" + Convert.ToString( cmd.ExecuteScalar() ).Split(' ')[0] + "</span>" + Environment.NewLine );Line 9716: Response.Write(Line 9717: "<span class='nav_logout'><a href='/octopus/shared/_logout.aspx?sid=" + shopId + "&uid=" + userId + "'>SAIR</a></span>"Line 9718: );Line 9719: }Line 9720: Line 9721: conn.Close();Line 9722: } else {Line 9723: Response.Write("<span class='nav_login'><a href='/account/'>Faça seu login</a></span>");Line 9724: }Line 9725: Line 9726: Response.Write( "</div>" + Environment.NewLine );Line 9727: }Line 9728: Line 9729:
Line 9730:
Line 9731: #line default
Line 9732: #line hidden
Line 9733: @__w.Write("\r\n </div>\r\n </div>\r\n <div id=\"container_body\">\r\n <div class=\"pad\">\r\n\r\n");
Line 9734:
Line 9735: #line 1 "C:\octopus\http\current\shared\_logo.aspx"
Line 9736:
Line 9737:
Line 9738: string logo_target = "";
Line 9739:
Line 9740: string logo_relative_path = "/octopus/design/images/"+ shopId +"/logo";
Line 9741: if(isMobile) logo_relative_path += "_mobile";
Line 9742:
Line 9743: string logo_physical_path = Server.MapPath(logo_relative_path);
Line 9744:
Line 9745: conn = new SqlConnection(shop.Path);
Line 9746: conn.Open();
Line 9747:
Line 9748: query = "SELECT sys_menu0.* FROM sys_menu0 WHERE sys_menu0.cod0Menu = 1";
Line 9749: cmd = new SqlCommand(query, conn);
Line 9750: rdr = cmd.ExecuteReader();
Line 9751: if(rdr.Read()) {
Line 9752: if( (bool)rdr["sysChild"] ) {
Line 9753: if( is_https ) {
Line 9754: logo_target = shop.Http + thisConfig + (string)rdr["target"];
Line 9755: } else {
Line 9756: logo_target = shop.Http.Replace("/octopus/", "") + Convert.ToString(rdr["target"]);
Line 9757: }
Line 9758: } else {
Line 9759: logo_target = (string)rdr["target"];
Line 9760: logo_target = logo_target.Replace("[? thisConfig ?]", thisConfig);
Line 9761: }
Line 9762: }
Line 9763: rdr.Close();
Line 9764: conn.Close();
Line 9765:
Line 9766: // handle HTTPS -> HTTP
Line 9767: if( is_https && userId > 0 ) {
Line 9768: if( !Regex.Match(logo_target, @"(\?|\&)uid=\d+").Success )
Line 9769: logo_target += ( logo_target.IndexOf("?") == -1 ? "?uid=" : "&uid=" ) + userId;
Line 9770: if( !Regex.Match(logo_target, @"(\?|\&)cid=\d+").Success )
Line 9771: logo_target += ( logo_target.IndexOf("?") == -1 ? "?cid=" : "&cid=" ) + cartId;
Line 9772: }
Line 9773:
Line 9774: if(File.Exists(logo_physical_path +".png")) {
Line 9775: logo_relative_path += ".png";
Line 9776: } else if(File.Exists(logo_physical_path +".jpg")) {
Line 9777: logo_relative_path += ".jpg";
Line 9778: } else if (File.Exists(logo_physical_path +".gif")) {
Line 9779: logo_relative_path += ".gif";
Line 9780: }
Line 9781:
Line 9782:
Line 9783:
Line 9784: #line default
Line 9785: #line hidden
Line 9786: @__w.Write("\r\n<div id=\"logo\">\r\n\t<a id=\"logo_link\" href=\"");
Line 9787:
Line 9788: #line 49 "C:\octopus\http\current\shared\_logo.aspx"
Line 9789: @__w.Write( logo_target );
Line 9790:
Line 9791:
Line 9792: #line default
Line 9793: #line hidden
Line 9794: @__w.Write("\" onmouseover=\"window.status=\'acessar: homepage\';return true;\" onmouseout=\"window" +
Line 9795: ".status=\'\';return true;\" aria-label=\"home\">\r\n\t\t<img id=\"logo_img\" src=\"");
Line 9796:
Line 9797: #line 50 "C:\octopus\http\current\shared\_logo.aspx"
Line 9798: @__w.Write( logo_relative_path );
Line 9799:
Line 9800:
Line 9801: #line default
Line 9802: #line hidden
Line 9803: @__w.Write("\" alt=\"\" />\r\n\t</a>\r\n</div>\r\n");
Line 9804:
Line 9805: #line 515 "C:\octopus\https\current\dsp_system.aspx"
Line 9806: if(!isMobile) {
Line 9807:
Line 9808: #line default
Line 9809: #line hidden
Line 9810: @__w.Write("<div id=\"title\"><span id=\"title_name\">");
Line 9811:
Line 9812: #line 1 "C:\octopus\http\current\shared\_title.aspx"
Line 9813: @__w.Write( shop.Title );
Line 9814:
Line 9815:
Line 9816: #line default
Line 9817: #line hidden
Line 9818: @__w.Write("</span></div>\r\n");
Line 9819:
Line 9820: #line 1 "C:\octopus\http\current\shared\_date.aspx"
Line 9821: DateTime dateTime = DateTime.Now;
Line 9822:
Line 9823: #line default
Line 9824: #line hidden
Line 9825: @__w.Write("\r\n<div id=\"date\"><span id=\"date_weekday\">");
Line 9826:
Line 9827: #line 2 "C:\octopus\http\current\shared\_date.aspx"
Line 9828: @__w.Write( dateTime.ToString("dddd") );
Line 9829:
Line 9830:
Line 9831: #line default
Line 9832: #line hidden
Line 9833: @__w.Write(",</span><span id=\"date_short\">");
Line 9834:
Line 9835: #line 2 "C:\octopus\http\current\shared\_date.aspx"
Line 9836: @__w.Write( dateTime.ToString("dd.MM.yyyy") );
Line 9837:
Line 9838:
Line 9839: #line default
Line 9840: #line hidden
Line 9841: @__w.Write("</span></div>\r\n");
Line 9842:
Line 9843: #line 518 "C:\octopus\https\current\dsp_system.aspx"
Line 9844: }
Line 9845:
Line 9846: #line default
Line 9847: #line hidden
Line 9848:
Line 9849: #line 519 "C:\octopus\https\current\dsp_system.aspx"
Line 9850: if( !isMobile ) {
Line 9851:
Line 9852: #line default
Line 9853: #line hidden
Line 9854: @__w.Write("<div id=\"menu0\">\r\n <ul>\r\n");
Line 9855:
Line 9856: #line 3 "C:\octopus\http\current\shared\_menu0.aspx"
Line 9857:
Line 9858:
Line 9859: i = 0;
Line 9860: conn = new SqlConnection(shop.Path);
Line 9861: conn.Open();
Line 9862:
Line 9863: query = "SELECT sys_menu0.* FROM sys_menu0 ORDER BY sys_menu0.dspOrder, sys_menu0.[desc]";
Line 9864: cmd = new SqlCommand(query, conn);
Line 9865: rdr = cmd.ExecuteReader();
Line 9866:
Line 9867: while(rdr.Read()) {
Line 9868: if((bool)rdr["sysChild"]) {
Line 9869: if( rdr["target"] != DBNull.Value && Convert.ToString(rdr["target"]) != "" ) {
Line 9870: iTarget = Convert.ToString(rdr["target"]);
Line 9871: if( iTarget.Substring(0, 1) == "&" ) {
Line 9872: iTarget = String.Format( "{0}/?{1}", shop.Http.Replace("/octopus/", ""), iTarget.Substring(1) );
Line 9873: } else {
Line 9874: iTarget = shop.Http.Replace("/octopus/", "") + iTarget;
Line 9875: }
Line 9876: } else {
Line 9877: iTarget = shop.Http;
Line 9878: }
Line 9879: } else {
Line 9880: iTarget = (string)rdr["target"];
Line 9881: iTarget = iTarget.Replace("[? thisConfig ?]", thisConfig);
Line 9882: iTarget = iTarget.Replace("[? cartId ?]", cartId);
Line 9883: }
Line 9884:
Line 9885: // handle HTTPS -> HTTP
Line 9886: if( is_https && userId > 0 ) {
Line 9887: if( !Regex.Match(iTarget, @"(\?|\&)uid=\d+").Success )
Line 9888: iTarget += ( iTarget.IndexOf("?") == -1 ? "?uid=" : "&uid=" ) + userId;
Line 9889: if( !Regex.Match(iTarget, @"(\?|\&)cid=\d+").Success )
Line 9890: iTarget += ( iTarget.IndexOf("?") == -1 ? "?cid=" : "&cid=" ) + cartId;
Line 9891: }
Line 9892:
Line 9893: Response.Write(" <li><span id=\"mn0_"+ i +"\" class=\"mn0\"><a href=\"" + iTarget + "\" onmouseover=\"window.status='acessar: "+ (string)rdr["desc"] +"';return true;\" onmouseout=\"window.status='';return true;\"><span>"+ (string)rdr["desc"] +"</span></a></span></li>\n");
Line 9894: i++;
Line 9895: }
Line 9896: rdr.Close();
Line 9897:
Line 9898: conn.Close();
Line 9899:
Line 9900:
Line 9901:
Line 9902: #line default
Line 9903: #line hidden
Line 9904: @__w.Write("\r\n </ul>\r\n</div>\r\n");
Line 9905:
Line 9906: #line 521 "C:\octopus\https\current\dsp_system.aspx"
Line 9907: }
Line 9908:
Line 9909: #line default
Line 9910: #line hidden
Line 9911:
Line 9912: #line 1 "C:\octopus\http\current\shared\_menuU.aspx"
Line 9913: Line 9914: Line 9915: string mnu_pwd = "";Line 9916: if( null != Request.Cookies["pass"] && Convert.ToString(Request.Cookies["pass"].Value).Length > 0 )Line 9917: mnu_pwd = "&pwd=" + ZenTools.Encrypt(Convert.ToString(Request.Cookies["pass"].Value), "10jc0mm$3c");Line 9918: Line 9919: string mnu_cart_url = shop.Http + thisConfig;Line 9920: Line 9921:
Line 9922:
Line 9923: #line default
Line 9924: #line hidden
Line 9925: @__w.Write("\n<div id=\"menuU\">\n\t<input id=\"menuU-toggler\" type=\"checkbox\" value=\"active\" style" +
Line 9926: "=\"display:none;\" />\n\t<label for=\"menuU-toggler\"></label>\n\t<ul>\n\t\t<li id=\"mnU_0_p" +
Line 9927: "arent\">\n\t\t\t<span id=\"mnU_0\" class=\"mnU\">\n\t\t\t\t<a href=\'");
Line 9928:
Line 9929: #line 16 "C:\octopus\http\current\shared\_menuU.aspx"
Line 9930: @__w.Write( shop.Http.Replace("/octopus/", "") );
Line 9931:
Line 9932:
Line 9933: #line default
Line 9934: #line hidden
Line 9935: @__w.Write("/account/\' rel=\"nofollow\">\n\t\t\t\t\t<span>meu cadastro</span>\n\t\t\t\t</a>\n\t\t\t</span>\n\t\t<" +
Line 9936: "/li>\n\t\t<li id=\"mnU_1_parent\">\n\t\t\t<span id=\"mnU_1\" class=\"mnU\">\n\t\t\t\t<a href=\'");
Line 9937:
Line 9938: #line 23 "C:\octopus\http\current\shared\_menuU.aspx"
Line 9939: @__w.Write( shop.Http.Replace("/octopus/", "") );
Line 9940:
Line 9941:
Line 9942: #line default
Line 9943: #line hidden
Line 9944: @__w.Write("/account/orders\' rel=\"nofollow\">\n\t\t\t\t\t<span>meus pedidos</span>\n\t\t\t\t</a>\n\t\t\t</spa" +
Line 9945: "n>\n\t\t</li>\n");
Line 9946:
Line 9947: #line 28 "C:\octopus\http\current\shared\_menuU.aspx"
Line 9948: Line 9949: Line 9950: if(isMobile) {Line 9951: if( mainInclude != "DTL" && mainInclude != "EDTL" ) {Line 9952: if(LOGGED(shopId, userId)) {Line 9953: Response.Write("<li id='mnu-account'><span id='mnU_2' class='mnU'><a href='/octopus/shared/_logout.aspx?sid=" + shopId + "&uid=" + userId + "'><span>sair</span></a></span></li>");Line 9954: } else {Line 9955: Response.Write("<li id='mnu-signin'><span id='mnU_2' class='mnU'><a href='/account/'><span>entrar</span></a></span></li>");Line 9956: }Line 9957: }Line 9958: } else {Line 9959: Line 9960:
Line 9961:
Line 9962: #line default
Line 9963: #line hidden
Line 9964: @__w.Write("\n\t\t<li id=\"mnU_2_parent\"><span id=\"mnU_2\" class=\"mnU\"><a href=\"javascript:closeCa" +
Line 9965: "rt(");
Line 9966:
Line 9967: #line 41 "C:\octopus\http\current\shared\_menuU.aspx"
Line 9968: Response.Write("'" + mnu_cart_url + "',"+ Convert.ToString(shop.UseEG).ToLower());
Line 9969:
Line 9970: #line default
Line 9971: #line hidden
Line 9972: @__w.Write(");\" onmouseover=\"window.status=\'acessar: fechar compra\';return true\" onmouseout=\"" +
Line 9973: "window.status=\'\';return true\"><span>meu carrinho</span></a></span></li>\n");
Line 9974:
Line 9975: #line 42 "C:\octopus\http\current\shared\_menuU.aspx"
Line 9976: Line 9977: Line 9978: }Line 9979: Line 9980:
Line 9981:
Line 9982: #line default
Line 9983: #line hidden
Line 9984: @__w.Write("\n\n\t</ul>\n</div>\n");
Line 9985:
Line 9986: #line 523 "C:\octopus\https\current\dsp_system.aspx"
Line 9987: if(shop.UseBN) {
Line 9988:
Line 9989: #line default
Line 9990: #line hidden
Line 9991:
Line 9992: #line 1 "C:\octopus\http\current\shared\_banners.aspx"
Line 9993:
Line 9994:
Line 9995: bool useCachedBanners = false;
Line 9996: int bnCacheCount = 0;
Line 9997: string bnCacheKey = String.Format("OCTOPUS_{0}_BANNER_{1}", shopId, (isMobile ? "M_" : ""));
Line 9998:
Line 9999: if (
Line 10000: Application[bnCacheKey + "COUNT"] != null &&
Line 10001: Application[bnCacheKey + "COUNT"] != "" &&
Line 10002: Convert.ToString(Application[bnCacheKey + "DTINS"]) == DateTime.Now.ToString("yyyy-MM-dd")
Line 10003:) {
Line 10004: bnCacheCount = Convert.ToInt32( Application[bnCacheKey + "COUNT"] );
Line 10005: useCachedBanners = true;
Line 10006:}
Line 10007:
Line 10008:if ( Request.QueryString["ignoreCache"] != null && Convert.ToString(Request.QueryString["ignoreCache"]).Equals("true") ) {
Line 10009: useCachedBanners = false;
Line 10010:}
Line 10011:
Line 10012:if ( shop.getConfig("ignoreBannerCache") != null && !Convert.ToString(shop.getConfig("ignoreBannerCache")).Equals("") ) {
Line 10013: useCachedBanners = false;
Line 10014:}
Line 10015:
Line 10016:if (!useCachedBanners) {
Line 10017: i = 0;
Line 10018: conn = new SqlConnection(shop.Path);
Line 10019: conn.Open();
Line 10020:
Line 10021: if (isMobile) {
Line 10022: query = "SELECT [pKey], [value], [promotion], [isFixed], ISNULL([permission], '') AS permission, ISNULL([filter], '') AS filter, ISNULL([dtA], CAST('1900-01-01 00:00:00' AS SmallDateTime)) AS dtA, ISNULL([dtB], CAST('1900-01-01 00:00:00' AS SmallDateTime)) AS dtB FROM [sys_bn] WHERE [pKey] >= 1000 ORDER BY [pKey]";
Line 10023: } else {
Line 10024: query = "SELECT [pKey], [value], [promotion], [isFixed], ISNULL([permission], '') AS permission, ISNULL([filter], '') AS filter, ISNULL([dtA], CAST('1900-01-01 00:00:00' AS SmallDateTime)) AS dtA, ISNULL([dtB], CAST('1900-01-01 00:00:00' AS SmallDateTime)) AS dtB FROM [sys_bn] WHERE [pKey] < 1000 OR [pKey] >= 2000 ORDER BY [pKey]";
Line 10025: }
Line 10026:
Line 10027: cmd = new SqlCommand(query, conn);
Line 10028: rdr = cmd.ExecuteReader();
Line 10029:
Line 10030: while (rdr.Read()) {
Line 10031:
Line 10032: Application[bnCacheKey + i + "_CONTENT"] = "<div id='banner_"+ ( (int)rdr["pKey"] >= 2000 ? (int)rdr["pKey"] : i ) +"'>"+ Convert.ToString(rdr["value"]).Replace("[? thisConfig ?]", thisConfig).Replace("[? cartId ?]", cartId).Replace("[? request_passport ?]", asyncPassport) +"</div>\n<!-- CACHED BANNER GENERATED AT: " + DateTime.Now + " -->\n\n";
Line 10033: Application[bnCacheKey + i + "_PROMOTIONAL"] = "<div id='banner_"+ ( (int)rdr["pKey"] >= 2000 ? (int)rdr["pKey"] : i ) +"'>"+ Convert.ToString(rdr["promotion"]).Replace("[? thisConfig ?]", thisConfig).Replace("[? cartId ?]", cartId).Replace("[? request_passport ?]", asyncPassport) +"</div>\n<!-- CACHED BANNER GENERATED AT: " + DateTime.Now + " -->\n\n";
Line 10034: Application[bnCacheKey + i + "_ISFIXED"] = Convert.ToString(rdr["isFixed"]);
Line 10035: Application[bnCacheKey + i + "_PERMISSION"] = Convert.ToString(rdr["permission"]);
Line 10036: Application[bnCacheKey + i + "_FILTER"] = Convert.ToString(rdr["filter"]);
Line 10037: Application[bnCacheKey + i + "_DTA"] = Convert.ToDateTime(rdr["dtA"]).ToString("yyyy-MM-dd") + " 00:00:00";
Line 10038: Application[bnCacheKey + i + "_DTB"] = Convert.ToDateTime(rdr["dtB"]).ToString("yyyy-MM-dd") + " 23:59:59";
Line 10039: i++;
Line 10040: }
Line 10041:
Line 10042: bnCacheCount = i;
Line 10043: Application[bnCacheKey + "COUNT"] = i;
Line 10044: Application[bnCacheKey + "DTINS"] = DateTime.Now.ToString("yyyy-MM-dd");
Line 10045:
Line 10046: rdr.Close();
Line 10047: conn.Close();
Line 10048:}
Line 10049:
Line 10050:for ( i = 0; i <= bnCacheCount; i++ ) {
Line 10051: if ( Convert.ToBoolean(Application[bnCacheKey + i + "_ISFIXED"]) ) {
Line 10052: if ( Convert.ToDateTime(Application[bnCacheKey + i + "_DTA"]) <= DateTime.Now && DateTime.Now <= Convert.ToDateTime(Application[bnCacheKey + i + "_DTB"]) ) {
Line 10053: Response.Write( Application[bnCacheKey + i + "_PROMOTIONAL"] );
Line 10054: } else {
Line 10055: Response.Write( Application[bnCacheKey + i + "_CONTENT"] );
Line 10056: }
Line 10057: } else {
Line 10058: if ( Convert.ToString( Application[bnCacheKey + i + "_PERMISSION"] ).Equals("") && framed ) {
Line 10059: if ( Convert.ToDateTime(Application[bnCacheKey + i + "_DTA"]) <= DateTime.Now && DateTime.Now <= Convert.ToDateTime(Application[bnCacheKey + i + "_DTB"]) ) {
Line 10060: Response.Write( Application[bnCacheKey + i + "_PROMOTIONAL"] );
Line 10061: } else {
Line 10062: Response.Write( Application[bnCacheKey + i + "_CONTENT"] );
Line 10063: }
Line 10064: } else {
Line 10065:// Response.Write( "<!--" + Environment.NewLine );
Line 10066:// Response.Write( "querystring: " + Convert.ToString( Request.QueryString ) + Environment.NewLine );
Line 10067:// Response.Write( "filter: " + Convert.ToString( Application[bnCacheKey + i + "_FILTER"] ) + Environment.NewLine );
Line 10068:// Response.Write( "-->" + Environment.NewLine );
Line 10069:
Line 10070: if (
Line 10071: Generics.FilterBanner(
Line 10072: mainInclude,
Line 10073: Convert.ToString( Request.QueryString ) + "$",
Line 10074: Convert.ToString( Application[bnCacheKey + i + "_PERMISSION"] ),
Line 10075: Convert.ToString( Application[bnCacheKey + i + "_FILTER"] )
Line 10076: )
Line 10077: ) {
Line 10078: if ( Convert.ToDateTime(Application[bnCacheKey + i + "_DTA"]) <= DateTime.Now && DateTime.Now <= Convert.ToDateTime(Application[bnCacheKey + i + "_DTB"]) ) {
Line 10079: Response.Write( Application[bnCacheKey + i + "_PROMOTIONAL"] );
Line 10080: } else {
Line 10081: Response.Write( Application[bnCacheKey + i + "_CONTENT"] );
Line 10082: }
Line 10083: }
Line 10084: }
Line 10085: }
Line 10086:}
Line 10087:
Line 10088:
Line 10089:
Line 10090: #line default
Line 10091: #line hidden
Line 10092:
Line 10093: #line 523 "C:\octopus\https\current\dsp_system.aspx"
Line 10094: }
Line 10095:
Line 10096: #line default
Line 10097: #line hidden
Line 10098:
Line 10099: #line 524 "C:\octopus\https\current\dsp_system.aspx"
Line 10100:
Line 10101:
Line 10102:switch(mainInclude) {
Line 10103: case "SGN":
Line 10104:
Line 10105:
Line 10106: #line default
Line 10107: #line hidden
Line 10108:
Line 10109: #line 1 "C:\octopus\https\current\_signin.aspx"
Line 10110:
Line 10111:
Line 10112:if( redirectMainInclude != "HMP" ) {
Line 10113: if( null != Request["rmi"] && !Request["rmi"].Equals("") )
Line 10114: redirectMainIncludeNext = Convert.ToString(Request["rmi"]);
Line 10115:
Line 10116: if( null != Request["mi"] && !Request["mi"].Equals("") )
Line 10117: redirectMainInclude = Convert.ToString(Request["mi"]);
Line 10118:}
Line 10119:
Line 10120:if(null!=Request["tracker"] && !Request["tracker"].Equals("")) {
Line 10121: HttpCookie cookie = new HttpCookie("tracker");
Line 10122: cookie.Value = "useTracker";
Line 10123: Response.Cookies.Add(cookie);
Line 10124:}
Line 10125:
Line 10126:string hdyfuv = "";
Line 10127:conn = new SqlConnection(shop.Path);
Line 10128:conn.Open();
Line 10129:query = "SELECT id, name FROM sys_hdyfuv ORDER BY name";
Line 10130:cmd = new SqlCommand(query, conn);
Line 10131:rdr = cmd.ExecuteReader();
Line 10132:
Line 10133:while(rdr.Read()) {
Line 10134: hdyfuv += "<option value="+ Convert.ToInt32(rdr[0]) +">" + Convert.ToString(rdr[1]) + "</option>";
Line 10135:}
Line 10136:
Line 10137:rdr.Close();
Line 10138:conn.Close();
Line 10139:
Line 10140:
Line 10141:
Line 10142: #line default
Line 10143: #line hidden
Line 10144: @__w.Write("\r\n\r\n<div id=\"signin\" class=\"full\">\r\n\t<h1><span>Identificação</span>" +
Line 10145: "</h1>\r\n\t<div class=\"hr\"><hr /></div>\r\n");
Line 10146:
Line 10147: #line 36 "C:\octopus\https\current\_signin.aspx"
Line 10148: if( msg.Length > 0 ) {
Line 10149:
Line 10150: #line default
Line 10151: #line hidden
Line 10152: @__w.Write("\r\n\t<p id=\"signin-message\" class=\"");
Line 10153:
Line 10154: #line 37 "C:\octopus\https\current\_signin.aspx"
Line 10155: @__w.Write( msgType );
Line 10156:
Line 10157:
Line 10158: #line default
Line 10159: #line hidden
Line 10160: @__w.Write("\" align=\"center\"><strong>");
Line 10161:
Line 10162: #line 37 "C:\octopus\https\current\_signin.aspx"
Line 10163: @__w.Write( msg );
Line 10164:
Line 10165:
Line 10166: #line default
Line 10167: #line hidden
Line 10168: @__w.Write("</strong></p>\r\n");
Line 10169:
Line 10170: #line 38 "C:\octopus\https\current\_signin.aspx"
Line 10171: }
Line 10172:
Line 10173: #line default
Line 10174: #line hidden
Line 10175: @__w.Write("\r\n\t<div id=\"signin-body\" class=\"full-body\">\r\n\t\t<div id=\"signin-identification\" cl" +
Line 10176: "ass=\"signin\">\r\n\t\t\t<div id=\"signin-identification-already-user\">\r\n\t\t\t\t<form id=\"a" +
Line 10177: "lready-user-form\" name=\"alreadyUserForm\" method=\"post\" action=\"/octopus/");
Line 10178:
Line 10179: #line 42 "C:\octopus\https\current\_signin.aspx"
Line 10180: @__w.Write( thisConfig );
Line 10181:
Line 10182:
Line 10183: #line default
Line 10184: #line hidden
Line 10185: @__w.Write("&pni=1&mi=SGN&rmi=");
Line 10186:
Line 10187: #line 42 "C:\octopus\https\current\_signin.aspx"
Line 10188: @__w.Write( redirectMainInclude );
Line 10189:
Line 10190:
Line 10191: #line default
Line 10192: #line hidden
Line 10193:
Line 10194: #line 42 "C:\octopus\https\current\_signin.aspx"
Line 10195: if(redirectMainIncludeNext.Length>0)Response.Write("&rmin="+ redirectMainIncludeNext);
Line 10196:
Line 10197: #line default
Line 10198: #line hidden
Line 10199:
Line 10200: #line 42 "C:\octopus\https\current\_signin.aspx"
Line 10201: if(null!=Request.QueryString["idG"])Response.Write("&idG="+ (string)Request.QueryString["idG"]);
Line 10202:
Line 10203: #line default
Line 10204: #line hidden
Line 10205:
Line 10206: #line 42 "C:\octopus\https\current\_signin.aspx"
Line 10207: if(null!=Request.QueryString["action"])Response.Write("&action="+ (string)Request.QueryString["action"]);
Line 10208:
Line 10209: #line default
Line 10210: #line hidden
Line 10211: this.WriteUTF8ResourceString(@__w, 55835, 400, false);
Line 10212:
Line 10213: #line 48 "C:\octopus\https\current\_signin.aspx"
Line 10214: @__w.Write( Request["email"] );
Line 10215:
Line 10216:
Line 10217: #line default
Line 10218: #line hidden
Line 10219: this.WriteUTF8ResourceString(@__w, 56235, 408, true);
Line 10220:
Line 10221: #line 55 "C:\octopus\https\current\_signin.aspx"
Line 10222: @__w.Write( thisConfig );
Line 10223:
Line 10224:
Line 10225: #line default
Line 10226: #line hidden
Line 10227: this.WriteUTF8ResourceString(@__w, 56643, 385, true);
Line 10228:
Line 10229: #line 64 "C:\octopus\https\current\_signin.aspx"
Line 10230: @__w.Write( thisConfig );
Line 10231:
Line 10232:
Line 10233: #line default
Line 10234: #line hidden
Line 10235: @__w.Write("&mi=FGT&action=MAIL\"><font>Esqueci meu email</font></a></li>\r\n\t\t\t\t\t\t<li><a id=\"si" +
Line 10236: "gnin-help-change-email\" href=\"/octopus/");
Line 10237:
Line 10238: #line 65 "C:\octopus\https\current\_signin.aspx"
Line 10239: @__w.Write( thisConfig );
Line 10240:
Line 10241:
Line 10242: #line default
Line 10243: #line hidden
Line 10244: this.WriteUTF8ResourceString(@__w, 57028, 358, true);
Line 10245:
Line 10246: #line 71 "C:\octopus\https\current\_signin.aspx"
Line 10247: @__w.Write( thisConfig );
Line 10248:
Line 10249:
Line 10250: #line default
Line 10251: #line hidden
Line 10252: @__w.Write("&mi=RGS&rmi=");
Line 10253:
Line 10254: #line 71 "C:\octopus\https\current\_signin.aspx"
Line 10255: @__w.Write( redirectMainInclude );
Line 10256:
Line 10257:
Line 10258: #line default
Line 10259: #line hidden
Line 10260:
Line 10261: #line 71 "C:\octopus\https\current\_signin.aspx"
Line 10262: if(redirectMainIncludeNext.Length>0)Response.Write("&rmin="+ redirectMainIncludeNext);
Line 10263:
Line 10264: #line default
Line 10265: #line hidden
Line 10266:
Line 10267: #line 71 "C:\octopus\https\current\_signin.aspx"
Line 10268: if(null!=Request.QueryString["idG"])Response.Write("&idG="+ (string)Request.QueryString["idG"]);
Line 10269:
Line 10270: #line default
Line 10271: #line hidden
Line 10272:
Line 10273: #line 71 "C:\octopus\https\current\_signin.aspx"
Line 10274: if(null!=Request.QueryString["action"])Response.Write("&action="+ (string)Request.QueryString["action"]);
Line 10275:
Line 10276: #line default
Line 10277: #line hidden
Line 10278: this.WriteUTF8ResourceString(@__w, 57386, 316, true);
Line 10279:
Line 10280: #line 76 "C:\octopus\https\current\_signin.aspx"
Line 10281: @__w.Write( Request["eml"] );
Line 10282:
Line 10283:
Line 10284: #line default
Line 10285: #line hidden
Line 10286: this.WriteUTF8ResourceString(@__w, 57702, 3016, false);
Line 10287:
Line 10288: #line 174 "C:\octopus\https\current\_signin.aspx"
Line 10289: @__w.Write( thisConfig );
Line 10290:
Line 10291:
Line 10292: #line default
Line 10293: #line hidden
Line 10294: @__w.Write("&pni=1&mi=SGN&rmi=");
Line 10295:
Line 10296: #line 174 "C:\octopus\https\current\_signin.aspx"
Line 10297: @__w.Write( redirectMainInclude );
Line 10298:
Line 10299:
Line 10300: #line default
Line 10301: #line hidden
Line 10302:
Line 10303: #line 174 "C:\octopus\https\current\_signin.aspx"
Line 10304: if(redirectMainIncludeNext.Length>0)Response.Write("&rmin="+ redirectMainIncludeNext);
Line 10305:
Line 10306: #line default
Line 10307: #line hidden
Line 10308:
Line 10309: #line 174 "C:\octopus\https\current\_signin.aspx"
Line 10310: if(null!=Request.QueryString["idG"])Response.Write("&idG="+ (string)Request.QueryString["idG"]);
Line 10311:
Line 10312: #line default
Line 10313: #line hidden
Line 10314:
Line 10315: #line 174 "C:\octopus\https\current\_signin.aspx"
Line 10316: if(null!=Request.QueryString["action"])Response.Write("&action="+ (string)Request.QueryString["action"]);
Line 10317:
Line 10318: #line default
Line 10319: #line hidden
Line 10320: this.WriteUTF8ResourceString(@__w, 60718, 1080, false);
Line 10321:
Line 10322: #line 221 "C:\octopus\https\current\_signin.aspx"
Line 10323: @__w.Write( shopId );
Line 10324:
Line 10325:
Line 10326: #line default
Line 10327: #line hidden
Line 10328: this.WriteUTF8ResourceString(@__w, 61798, 690, false);
Line 10329:
Line 10330: #line 246 "C:\octopus\https\current\_signin.aspx"
Line 10331: @__w.Write( shop.Title );
Line 10332:
Line 10333:
Line 10334: #line default
Line 10335: #line hidden
Line 10336: @__w.Write("\", \"screenName\": \"login\" });\r\n}\r\n/* GOOGLE_DEPRECATED */\r\n\r\n// ]]>\r\n</script>\r\n\r\n" +
Line 10337: "");
Line 10338:
Line 10339: #line 253 "C:\octopus\https\current\_signin.aspx"
Line 10340:@__w.Write( Generics.ClosePointer(shopId,2) );
Line 10341:
Line 10342:
Line 10343: #line default
Line 10344: #line hidden
Line 10345: @__w.Write("\r\n");
Line 10346:
Line 10347: #line 528 "C:\octopus\https\current\dsp_system.aspx"
Line 10348:
Line 10349: break;
Line 10350:
Line 10351: case "GR":
Line 10352:
Line 10353:
Line 10354: #line default
Line 10355: #line hidden
Line 10356: @__w.Write("<form id=\"main_form\" name=\"main_form\" method=\"post\" action=\"#\">\n");
Line 10357:
Line 10358: #line 2 "C:\octopus\https\current\_GR-frmReview.aspx"
Line 10359: Line 10360:i = 0;Line 10361:strdModule.Clear();Line 10362:Line 10363:
Line 10364:
Line 10365: #line default
Line 10366: #line hidden
Line 10367:
Line 10368: #line 1 "C:\octopus\http\current\shared\_GR-subShared.aspx"
Line 10369:
Line 10370:
Line 10371:conn = new SqlConnection(shop.Path);
Line 10372:conn.Open();
Line 10373:
Line 10374:query = "SELECT config "
Line 10375: + "FROM sys_configs "
Line 10376: + "WHERE idModule = @idModule";
Line 10377:
Line 10378:cmd = new SqlCommand(query, conn);
Line 10379:cmd.Parameters.Add(new SqlParameter("@idModule", SqlDbType.NVarChar));
Line 10380:cmd.Parameters["@idModule"].Value = "GR";
Line 10381:
Line 10382:strdModule = ZenTools.PopulateDictionary( ( (string)cmd.ExecuteScalar() ).Trim() );
Line 10383:
Line 10384:conn.Close();
Line 10385:
Line 10386:
Line 10387:
Line 10388: #line default
Line 10389: #line hidden
Line 10390:
Line 10391: #line 6 "C:\octopus\https\current\_GR-frmReview.aspx"
Line 10392: Line 10393:Line 10394:string GR_item_img_src = "";Line 10395:string GR_item_img_alt = "";Line 10396:Line 10397:string GR_frmReview = "";Line 10398:GR_frmReview += "<input type=\"hidden\" name=\"idG\" value=\""+ idGrid +"\">\n";Line 10399:GR_frmReview += "<div id=\"GR_frmReview\" class=\"full\">\n";Line 10400:Line 10401:if( msg.Length > 0 )Line 10402: GR_frmReview += " <p class='" + msgType + "' align='center'>" + msg + "</p>";Line 10403:Line 10404:GR_frmReview += " <h1><span>"+ strdModule["h1"] +"</span></h1>\n";Line 10405:GR_frmReview += " <div class=\"hr\"><hr /></div>\n";Line 10406:Line 10407:conn = new SqlConnection(shop.Path);Line 10408:conn.Open();Line 10409: query = "SELECT tbl_prod.[desc] AS ProdName ";Line 10410: query += "FROM tbl_prod INNER JOIN tbl_grid ON tbl_prod.codProd = tbl_grid.codProd INNER JOIN tbl_details ON tbl_prod.codProd = tbl_details.codProd ";Line 10411: query += "WHERE (tbl_grid.codGrid = @idGrid) AND (tbl_details.codTitle = 1)";Line 10412: cmd = new SqlCommand(query, conn);Line 10413: cmd.Parameters.Add(new SqlParameter("@idGrid", SqlDbType.Int));Line 10414: cmd.Parameters["@idGrid"].Value = idGrid;Line 10415: rdr = cmd.ExecuteReader();Line 10416: if(rdr.Read()) {Line 10417: GR_frmReview += " <div id=\"GR_frmReview_product\">\n";Line 10418:Line 10419: GR_item_img_src = Details.getProductImgSrc(shopId, idGrid, shop, out GR_item_img_alt);Line 10420: if( GR_item_img_alt == "" )Line 10421: GR_item_img_alt = Convert.ToString(rdr["ProdName"]);Line 10422:Line 10423: GR_frmReview += string.Format(Line 10424: @"Line 10425:<div id='GR_frmReview_product_img'>Line 10426: <img src='{0}' alt='{1}' />Line 10427:</div>Line 10428: ",Line 10429: GR_item_img_src.Replace("{size}", strdModule["frmReview_imgSize"]),Line 10430: GR_item_img_alt Line 10431: );Line 10432:Line 10433: GR_frmReview += " <div id=\"GR_frmReview_product_txt\"><p id=\"GR_frmReview_product_txt_name\">"+ (string)rdr["ProdName"] +"</p><p id=\"GR_frmReview_product_txt_details\">"+ strdModule["frmReview_terms"].Replace("[?sys_contact ", "<a href=\""+ shop.Http + thisConfig +"&mi=CNT\">").Replace(" sys_contact?]", "</a>").Replace("[?sys_help ", "<a href=\""+ shop.Http + thisConfig +"&mi=HLP\">").Replace(" sys_help?]", "</a>") +"</p></div>\n";Line 10434: GR_frmReview += " </div>\n";Line 10435: }Line 10436: rdr.Close();Line 10437:conn.Close();Line 10438:Line 10439:string GR_frmReview_ratio = "";Line 10440:GR_frmReview_ratio += "<select id=\"GR_frmReview_form_ratio\" class=\"required\" name=\"ratio\">";Line 10441:for(int j=5; j>0; j--)GR_frmReview_ratio += strdModule["frmReview_tOption"].Replace("#", Convert.ToString(j));Line 10442:GR_frmReview_ratio += "</select>";Line 10443:Line 10444:GR_frmReview += " <div id=\"GR_frmReview_form\">\n";Line 10445:GR_frmReview += " <h2>"+ strdModule["frmReview_h2"] +"</h2>\n";Line 10446:GR_frmReview += " <ol>\n";Line 10447:GR_frmReview += " <li>"+ strdModule["frmReview_t1stQuestion"].Replace("[? GR_frmReview_ratio ?]", GR_frmReview_ratio) +"</li>\n";Line 10448:GR_frmReview += " <li>"+ strdModule["frmReview_t2ndQuestion"].Replace("[? GR_frmReview_title ?]", "<input id=\"GR_frmReview_form_title\" class=\"required\" name=\"title\" type=\"text\" maxlength=\"255\" /> "+ strdModule["frmReview_titleCaption"]) +"</li>\n";Line 10449:GR_frmReview += " <li>"+ strdModule["frmReview_t3rdQuestion"].Replace("[? GR_frmReview_review ?]", "<textarea id=\"GR_frmReview_form_review\" class=\"required\" name=\"review\"></textarea>") +"</li>\n";Line 10450:GR_frmReview += " </ol>\n";Line 10451:GR_frmReview += " \n";Line 10452:GR_frmReview += " </div>\n";Line 10453:GR_frmReview += " <div id=\"GR_frmReview_submit\"><a class=\"button\" href=\"#\" onclick=\"frmMain_submit();return false;\" onmouseover=\"window.status='processar: "+ strdModule["question"] +"';return true;\"><img src=\"design/images/"+ shopId +"/form_prc.gif\" alt=\"\" /></a></div>\n";Line 10454:GR_frmReview += "</div>\n";Line 10455:Line 10456:Response.Write(GR_frmReview);Line 10457:
Line 10458:
Line 10459: #line default
Line 10460: #line hidden
Line 10461: @__w.Write("\n</form>\n<script type=\"text/javascript\">\nfunction frmMain_submit() {\n\tvar form = " +
Line 10462: "document.main_form;\n\tform.action = \"default.aspx");
Line 10463:
Line 10464: #line 76 "C:\octopus\https\current\_GR-frmReview.aspx"
Line 10465: @__w.Write( thisConfig );
Line 10466:
Line 10467:
Line 10468: #line default
Line 10469: #line hidden
Line 10470: @__w.Write("&pni=1&mi=GR&rmi=DTL\";\n\n\tvar aBlank = [\"title\", \"review\"];\n\tfor(var i=0, len=aBla" +
Line 10471: "nk.length; i<len; i++) {\n\t\tif(form[aBlank[i]].value == \"\") {\n\t\t\tform[aBlank[i]]." +
Line 10472: "focus();\n\t\t\talert(\'");
Line 10473:
Line 10474: #line 82 "C:\octopus\https\current\_GR-frmReview.aspx"
Line 10475: @__w.Write( strdModule["frmReview_alert"] );
Line 10476:
Line 10477:
Line 10478: #line default
Line 10479: #line hidden
Line 10480: @__w.Write("\');\n\t\t\treturn false;\n\t\t}\n\t}\n\tif( confirm(\'");
Line 10481:
Line 10482: #line 86 "C:\octopus\https\current\_GR-frmReview.aspx"
Line 10483: @__w.Write( strdModule["frmReview_confirm"] );
Line 10484:
Line 10485:
Line 10486: #line default
Line 10487: #line hidden
Line 10488: @__w.Write("\') )\n\t\tform.submit();\n}\n</script>\n");
Line 10489:
Line 10490: #line 532 "C:\octopus\https\current\dsp_system.aspx"
Line 10491:
Line 10492: break;
Line 10493:
Line 10494: case "ASQ":
Line 10495:
Line 10496:
Line 10497: #line default
Line 10498: #line hidden
Line 10499: @__w.Write("<form id=\"main_form\" name=\"main_form\" method=\"post\" action=\"#\">\n");
Line 10500:
Line 10501: #line 2 "C:\octopus\https\current\_ASQ-frmQuestion.aspx"
Line 10502: Line 10503:i = 0;Line 10504:strdModule.Clear();Line 10505:Line 10506:
Line 10507:
Line 10508: #line default
Line 10509: #line hidden
Line 10510:
Line 10511: #line 1 "C:\octopus\http\current\shared\_ASQ-subShared.aspx"
Line 10512:
Line 10513:conn = new SqlConnection(shop.Path);
Line 10514:conn.Open();
Line 10515: query = "SELECT config ";
Line 10516: query += "FROM sys_configs ";
Line 10517: query += "WHERE idModule = @idModule";
Line 10518: cmd = new SqlCommand(query, conn);
Line 10519: cmd.Parameters.Add(new SqlParameter("@idModule", SqlDbType.NVarChar));
Line 10520: cmd.Parameters["@idModule"].Value = "ASQ";
Line 10521: strdModule = ZenTools.PopulateDictionary((string)cmd.ExecuteScalar());
Line 10522:conn.Close();
Line 10523:
Line 10524:
Line 10525: #line default
Line 10526: #line hidden
Line 10527:
Line 10528: #line 6 "C:\octopus\https\current\_ASQ-frmQuestion.aspx"
Line 10529: Line 10530:Line 10531:string ASQ_item_img_src = "";Line 10532:string ASQ_item_img_alt = "";Line 10533:Line 10534:string ASQ_frmQuestion = "";Line 10535:ASQ_frmQuestion += "<input type=\"hidden\" name=\"idG\" value=\""+ idGrid +"\">\n";Line 10536:ASQ_frmQuestion += "<div id=\"ASQ_frmQuestion\" class=\"full\">\n";Line 10537:ASQ_frmQuestion += " <h1><span>"+ strdModule["h1"] +"</span></h1>\n";Line 10538:ASQ_frmQuestion += " <div class=\"hr\"><hr /></div>\n";Line 10539:Line 10540:conn = new SqlConnection(shop.Path);Line 10541:conn.Open();Line 10542: query = "SELECT tbl_prod.[desc] AS ProdName, tbl_details.[desc] AS ProdDetails ";Line 10543: query += "FROM tbl_prod INNER JOIN tbl_grid ON tbl_prod.codProd = tbl_grid.codProd INNER JOIN tbl_details ON tbl_prod.codProd = tbl_details.codProd ";Line 10544: query += "WHERE (tbl_grid.codGrid = @idGrid) AND (tbl_details.codTitle = 1)";Line 10545: cmd = new SqlCommand(query, conn);Line 10546: cmd.Parameters.Add(new SqlParameter("@idGrid", SqlDbType.Int));Line 10547: cmd.Parameters["@idGrid"].Value = idGrid;Line 10548: rdr = cmd.ExecuteReader();Line 10549: if(rdr.Read()) {Line 10550: ASQ_frmQuestion += " <div id=\"ASQ_frmQuestion_product\">\n";Line 10551:Line 10552: ASQ_item_img_src = Details.getProductImgSrc(shopId, idGrid, shop, out ASQ_item_img_alt);Line 10553: if( ASQ_item_img_alt == "" )Line 10554: ASQ_item_img_alt = Convert.ToString(rdr["ProdName"]);Line 10555:Line 10556: ASQ_frmQuestion += string.Format(Line 10557: @"Line 10558:<div id='ASQ_frmQuestion_product_img'>Line 10559: <img src='{0}' alt='{1}' />Line 10560:</div>Line 10561: ",Line 10562: ASQ_item_img_src.Replace("{size}", strdModule["frmQuestion_imgSize"]),Line 10563: ASQ_item_img_alt Line 10564: );Line 10565:Line 10566: ASQ_frmQuestion += " <div id=\"ASQ_frmQuestion_product_txt\"><p id=\"ASQ_frmQuestion_product_txt_name\">"+ (string)rdr["ProdName"] +"</p><p id=\"ASQ_frmQuestion_product_txt_details\">"+ (string)rdr["ProdDetails"] +"</p>\n";Line 10567: ASQ_frmQuestion += " <div id=\"ASQ_frmQuestion_product_notes\"><p class=\"p1\"><strong>Utilize esse espaço apenas para sanar suas dúvidas referente ao produto clicado.</strong></p><p class=\"p2\">Caso você possua alguma dúvida sobre o site, por favor entre em contato ou verifique se o <a href=\"/octopus/" + thisConfig + "&mi=HLP\">auto-atendimento</a> possui alguma resposta para o que você está procurando.</p><p class=\"p3\">Todas as perguntas serão vizualizadas e caso não sigam nossas especificações não serão publicadas.</div>\n";Line 10568: ASQ_frmQuestion += " </div>\n";Line 10569: ASQ_frmQuestion += " </div>\n";Line 10570: }Line 10571: rdr.Close();Line 10572:Line 10573: query = "SELECT sys_users.name, sys_users.city, sys_users.state, sys_users.country ";Line 10574: query += "FROM sys_users ";Line 10575: query += "WHERE sys_users.codUser = @userId";Line 10576: cmd = new SqlCommand(query, conn);Line 10577: cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int));Line 10578: cmd.Parameters["@userId"].Value = userId;Line 10579: rdr = cmd.ExecuteReader();Line 10580: if(rdr.Read()) {Line 10581: ASQ_frmQuestion += " <div id=\"ASQ_frmQuestion_form\">\n";Line 10582: ASQ_frmQuestion += " <table>\n";Line 10583: ASQ_frmQuestion += " <tr><th><label for=\"ASQ_frmQuestion_question\">"+ strdModule["frmQuestion_lblQuestion"] +":</label></th></tr>\n";Line 10584: ASQ_frmQuestion += " <tr><td><textarea id=\"ASQ_frmQuestion_question\" name=\"question\" class=\"required\"></textarea></td></tr>\n";Line 10585: ASQ_frmQuestion += " <tr><td>"+ strdModule["customer_signature_mask"].Replace("[? user_name ?]", Convert.ToString(rdr["name"])).Replace("[? user_city ?]", Convert.ToString(rdr["city"])).Replace("[? user_state ?]", Convert.ToString(rdr["state"])).Replace("[? user_country ?]", Convert.ToString(rdr["country"])).Replace("[? question_date ?]", DateTime.Now.ToString(strdModule["dateformat"])) +"</td></tr>\n";Line 10586: ASQ_frmQuestion += " </table>\n";Line 10587: ASQ_frmQuestion += " </div>\n";Line 10588: }Line 10589: rdr.Close();Line 10590:conn.Close();Line 10591:Line 10592:ASQ_frmQuestion += " <div id=\"ASQ_frmQuestion_submit\"><a class=\"button\" href=\"#\" onclick=\"frmMain_submit();return false;\" onmouseover=\"window.status='processar: "+ strdModule["question"] +"';return true;\"><img src=\"design/images/"+ shopId +"/form_prc.gif\" alt=\"\" /></a></div>\n";Line 10593:ASQ_frmQuestion += "</div>\n";Line 10594:Line 10595:Response.Write(ASQ_frmQuestion);Line 10596:
Line 10597:
Line 10598: #line default
Line 10599: #line hidden
Line 10600: @__w.Write("\n</form>\n<script type=\"text/javascript\">\nfunction frmMain_submit() {\n var form" +
Line 10601: " = document.main_form;\n\n\tform.method = \"post\";\n\tform.action = \"default.aspx");
Line 10602:
Line 10603: #line 80 "C:\octopus\https\current\_ASQ-frmQuestion.aspx"
Line 10604: @__w.Write( thisConfig );
Line 10605:
Line 10606:
Line 10607: #line default
Line 10608: #line hidden
Line 10609: @__w.Write("&pni=1&mi=ASQ&rmi=DTL\";\n\n\tif(form.question.value == \"\") {\n\t\tform.question.focus()" +
Line 10610: ";\n\t\talert(\"");
Line 10611:
Line 10612: #line 84 "C:\octopus\https\current\_ASQ-frmQuestion.aspx"
Line 10613: @__w.Write( strdModule["frmQuestion_alert"] );
Line 10614:
Line 10615:
Line 10616: #line default
Line 10617: #line hidden
Line 10618: @__w.Write("\");\n\t\treturn false;\n\t}\n\n\tif(confirm(\"");
Line 10619:
Line 10620: #line 88 "C:\octopus\https\current\_ASQ-frmQuestion.aspx"
Line 10621: @__w.Write( strdModule["frmQuestion_confirm"] );
Line 10622:
Line 10623:
Line 10624: #line default
Line 10625: #line hidden
Line 10626: @__w.Write("\"))form.submit();\n}\n</script>\n");
Line 10627:
Line 10628: #line 536 "C:\octopus\https\current\dsp_system.aspx"
Line 10629:
Line 10630: break;
Line 10631:
Line 10632: case "SMR":
Line 10633:
Line 10634:
Line 10635: #line default
Line 10636: #line hidden
Line 10637:
Line 10638: #line 1 "C:\octopus\http\current\shared\_Order.Body.aspx"
Line 10639: Line 10640:Line 10641:int order_codCli = 0;Line 10642:int orderId = 0;Line 10643:Line 10644:if( null != Request["oid"] && !Request["oid"].Equals("") ) {Line 10645: if( Convert.ToBoolean(Request["coded"]) ) {Line 10646: orderId = Convert.ToInt32( CaesarRef.decode(Request["oid"]) );Line 10647: } else {Line 10648: orderId = Convert.ToInt32(Request["oid"]);Line 10649: }Line 10650:}Line 10651:Line 10652:string order_ref = "";Line 10653:bool order_isGift = false;Line 10654:decimal order_charge = 0;Line 10655:decimal order_stCharge = 0;Line 10656:decimal order_factor = 1;Line 10657:decimal order_vtransl = 0;Line 10658:decimal order_discBt = 0;Line 10659:string order_payment = "";Line 10660:int order_codPayment = 0;Line 10661:int order_parcels1 = 0;Line 10662:decimal order_interest1 = 0;Line 10663:decimal order_ccvtransl1 = 0;Line 10664:decimal order_ccValue1 = 0;Line 10665:string order_ccFlag1 = "";Line 10666:int order_parcels2 = 0;Line 10667:decimal order_interest2 = 0;Line 10668:decimal order_ccvtransl2 = 0;Line 10669:decimal order_ccValue2 = 0;Line 10670:string order_ccFlag2 = "";Line 10671:int order_items = 0;Line 10672:decimal order_total = 0;Line 10673:int order_status = 1;Line 10674:string order_address1 = "";Line 10675:string order_address2 = "";Line 10676:string order_notes = "";Line 10677:DateTime order_date = DateTime.Now;Line 10678:int order_codUser = 0;Line 10679:string order_coupon = "";Line 10680:string order_sBox = "";Line 10681:string order_instructions = "";Line 10682:string order_json = "";Line 10683:string order_item_json = "{}";Line 10684:int order_ccNumber = 0;Line 10685:Line 10686:dynamic order = JsonConvert.DeserializeObject<JObject>("{}");Line 10687:Line 10688:string payment_config = shop.getConfig("Payment");Line 10689:if( payment_config == "" )Line 10690: payment_config = "{}";Line 10691:Line 10692:dynamic payment = JsonConvert.DeserializeObject<JObject>(payment_config);Line 10693:Line 10694:string user_email = "";Line 10695:string user_pNotes = "";Line 10696:string shippingCode = Convert.ToString(Request["c"]);Line 10697:Line 10698:bool popDisplay = false;Line 10699:string popName = "";Line 10700:string popPath = "";Line 10701:int popOld = 0;Line 10702:if( null != Request.QueryString["old"] && !Request.QueryString["old"].Equals("") )Line 10703: popOld = 1;Line 10704:Line 10705:bool isAdm = false;Line 10706:int access = 0;Line 10707:if( null != Request.QueryString["acluser"] && !Request.QueryString["acluser"].Equals("") )Line 10708: access = shop.getAccess(Convert.ToString(Request.QueryString["acluser"]), "pedidos");Line 10709:Line 10710: if( !access.Equals(0) )Line 10711: isAdm = true;Line 10712:Line 10713:decimal iPrice = 0;Line 10714:decimal promotionFixedDiscount = 0;Line 10715:decimal t_price = 0;Line 10716:decimal p_price = 0;Line 10717:int t_rowspan = 3;Line 10718:Line 10719:string flag = "";Line 10720:Line 10721:/* GOOGLE_DEPRECATED */Line 10722:string googlePurchConv = "";Line 10723:bool hideGoogleConfig = false;Line 10724:if( Request.QueryString["nogoogle"] != null && !Request.QueryString["nogoogle"].Equals("") )Line 10725: hideGoogleConfig = Convert.ToBoolean(Request.QueryString["nogoogle"]);Line 10726:Line 10727:// google paramsLine 10728:StringBuilder Sb_GTP = new StringBuilder(); // StringBuilder Google Transaction ProductsLine 10729:Line 10730:string summary_ecomm_prodid = "";Line 10731:string summary_ecomm_pagetype = "purchase";Line 10732:string summary_ecomm_prodvalue = "";Line 10733:string summary_ecomm_totalvalue = "";Line 10734:/* GOOGLE_DEPRECATED */Line 10735:Line 10736:/* GOOGLE_TAG_MANAGER */Line 10737:JArray gtm_purchase_products = JsonConvert.DeserializeObject<JArray>("[]");Line 10738:/* GOOGLE_TAG_MANAGER */Line 10739:Line 10740:string useOrderBodyExtraFields = shop.getConfig("UseOrderBodyExtraFields");Line 10741:Line 10742:conn = new SqlConnection(shop.Path);Line 10743:conn.Open();Line 10744:Line 10745:query = @"Line 10746:SELECTLine 10747: sys_orders.codUser, sys_orders.ref, sys_orders.isGift, sys_orders.chargeLine 10748: , sys_orders.stCharge, sys_orders.factor, sys_orders.vtranslLine 10749: , sys_orders.discBt, sys_orders.codPayment, sys_orders.parcelsLine 10750: , sys_orders.interest, sys_orders.ccvtransl, sys_orders.statusLine 10751: , sys_orders.address1, sys_orders.address2, sys_orders.notesLine 10752: , sys_orders.[date], sys_orders.codUser, sys_orders.json, sys_payInfos.sBoxLine 10753: , sys_payInfos.instructions, sys_users.email, sys_users.notes AS pNotesLine 10754:FROM sys_ordersLine 10755: INNER JOIN sys_payInfos ON sys_orders.codPayment = sys_payInfos.codPaymentLine 10756: INNER JOIN sys_users ON sys_orders.codUser = sys_users.codUserLine 10757:WHERE (sys_orders.codOrder = @sys_orders_codOrder)Line 10758:";Line 10759:cmd = new SqlCommand(query, conn);Line 10760:cmd.Parameters.Add(new SqlParameter("@sys_orders_codOrder", SqlDbType.Int));Line 10761:cmd.Parameters["@sys_orders_codOrder"].Value = orderId;Line 10762:rdr = cmd.ExecuteReader();Line 10763:Line 10764:if(rdr.Read()) {Line 10765: order_codCli = Convert.ToInt32(rdr["codUser"]);Line 10766: order_ref = CaesarRef.encode( Convert.ToString(rdr["ref"]) );Line 10767: order_isGift = Convert.ToBoolean(rdr["isGift"]);Line 10768: order_charge = Convert.ToDecimal(rdr["charge"]);Line 10769: order_stCharge = Convert.ToDecimal(rdr["stCharge"]);Line 10770: order_factor = Convert.ToDecimal(rdr["factor"]);Line 10771: order_vtransl = Convert.ToDecimal(rdr["vtransl"]);Line 10772: order_discBt = Convert.ToDecimal(rdr["discBt"]);Line 10773: order_codPayment = Convert.ToInt32(rdr["codPayment"]);Line 10774: order_parcels1 = Convert.ToInt32(rdr["parcels"]);Line 10775: order_interest1 = Convert.ToDecimal(rdr["interest"]);Line 10776: order_ccvtransl1 = Convert.ToDecimal(rdr["ccvtransl"]);Line 10777: order_status = Convert.ToInt32(rdr["status"]);Line 10778: order_address1 = HttpUtility.HtmlEncode( Convert.ToString(rdr["address1"]) );Line 10779: order_address2 = HttpUtility.HtmlEncode( Convert.ToString(rdr["address2"]) );Line 10780: order_notes = Convert.ToString(rdr["notes"]);Line 10781: order_date = Convert.ToDateTime(rdr["date"]);Line 10782: order_codUser = Convert.ToInt32(rdr["codUser"]);Line 10783: order_sBox = shop.ShopTags(Convert.ToString(rdr["sBox"]));Line 10784: order_instructions = shop.ShopTags(Convert.ToString(rdr["instructions"]));Line 10785:Line 10786: if( rdr["json"] != DBNull.Value )Line 10787: order_json = Convert.ToString(rdr["json"]);Line 10788: if(order_json != "")Line 10789: order = JsonConvert.DeserializeObject<JObject>(order_json);Line 10790:Line 10791: user_email = Convert.ToString(rdr["email"]);Line 10792: user_pNotes = Convert.ToString(rdr["pNotes"]);Line 10793:}Line 10794:rdr.Close();Line 10795:Line 10796:if(shop.UseCM) {Line 10797: query = "SELECT [value] FROM rel_ordersWcm WHERE codOrder = "+ orderId;Line 10798: cmd = new SqlCommand(query, conn);Line 10799: rdr = cmd.ExecuteReader();Line 10800: if(rdr.Read()) {Line 10801: order_address2 += "<b>[? cm_title ?]</b>\n"+ (string)rdr["value"] +"\n\n";Line 10802: }Line 10803: rdr.Close();Line 10804:Line 10805: if(order_address2.IndexOf("[? cm_title ?]") > -1) {Line 10806: query = "SELECT title FROM sys_cm_setup";Line 10807: cmd = new SqlCommand(query, conn);Line 10808: rdr = cmd.ExecuteReader();Line 10809: if(rdr.Read())order_address2=order_address2.Replace("[? cm_title ?]",(string)rdr["title"]);Line 10810: rdr.Close();Line 10811: }Line 10812:}Line 10813:Line 10814:if(shop.UseDG && order_isGift) {Line 10815: query = "SELECT orderMask FROM sys_dg_setup";Line 10816: cmd = new SqlCommand(query, conn);Line 10817: rdr = cmd.ExecuteReader();Line 10818: if(rdr.Read())order_address2 += (string)rdr["orderMask"] +"\n";Line 10819: rdr.Close();Line 10820:}Line 10821:Line 10822:if(shop.UseCN) {Line 10823: query = "SELECT [value] FROM rel_ordersWcn WHERE codOrder = "+ orderId;Line 10824: cmd = new SqlCommand(query, conn);Line 10825: rdr = cmd.ExecuteReader();Line 10826: if(rdr.Read()) {Line 10827: order_address2 += "[? cn_orderMask ?] <b>"+ (string)rdr["value"] +"</b>\n";Line 10828: }Line 10829: rdr.Close();Line 10830:Line 10831: if(order_address2.IndexOf("[? cn_orderMask ?]") > -1) {Line 10832: query = "SELECT orderMask FROM sys_cn_setup";Line 10833: cmd = new SqlCommand(query, conn);Line 10834: rdr = cmd.ExecuteReader();Line 10835: if(rdr.Read())order_address2=order_address2.Replace("[? cn_orderMask ?]",(string)rdr["orderMask"]);Line 10836: rdr.Close();Line 10837: }Line 10838:}Line 10839:conn.Close();Line 10840:Line 10841:if(order_notes.IndexOf("[TRANSPORTADORA:] {Sob consulta}") > -1) {Line 10842: order_status = -1;Line 10843: order_codPayment = -1;Line 10844:}Line 10845:Line 10846:string order_status_desc = "";Line 10847:switch(order_status) {Line 10848: case -1:Line 10849: order_status_desc = "Consulta";Line 10850: break;Line 10851:Line 10852: case 0:Line 10853: order_status_desc = "Cancelado";Line 10854: break;Line 10855:Line 10856: case 1:Line 10857: order_status_desc = "Aguardando pagamento";Line 10858: break;Line 10859:Line 10860: case 2:Line 10861: order_status_desc = "Em análise";Line 10862: break;Line 10863:Line 10864: case 3:Line 10865: order_status_desc = "Pago";Line 10866: break;Line 10867:Line 10868: case 4:Line 10869: order_status_desc = "Enviado para transportadora";Line 10870: break;Line 10871:Line 10872: case 5:Line 10873: order_status_desc = "Finalizado";Line 10874: break;Line 10875:}Line 10876:Line 10877:conn = new SqlConnection(shop.Path);Line 10878:conn.Open();Line 10879:query = "SELECT name, sBox, instructions FROM sys_payInfos WHERE codPayment = " + order_codPayment;Line 10880:cmd = new SqlCommand(query, conn);Line 10881:rdr = cmd.ExecuteReader();Line 10882:Line 10883:if(rdr.Read()) {Line 10884: order_payment = (string)rdr["name"];Line 10885:Line 10886: if(order_codPayment == -1) {Line 10887: order_sBox = shop.ShopTags((string)rdr["sBox"]);Line 10888: order_instructions = shop.ShopTags((string)rdr["instructions"]);Line 10889: }Line 10890:}Line 10891:Line 10892:rdr.Close();Line 10893:conn.Close();Line 10894:Line 10895:// handle payment buttonLine 10896:switch(order_codPayment) {Line 10897: case 1: // Cartão de CréditoLine 10898: if(Line 10899: order_status == 1 &&Line 10900: order.payment_note != null &&Line 10901: order.payment_note.status == null &&Line 10902: (DateTime.Now - order_date).Days < 5Line 10903: ) {Line 10904: try {Line 10905: if( payment.config.credit_card[ Convert.ToString(order.payment_note.brand) ] != null ) {Line 10906: string gateway = payment.config.credit_card[ Convert.ToString(order.payment_note.brand) ].gateway;Line 10907: if( payment.gateways[gateway].retry != null && Convert.ToBoolean(payment.gateways[gateway].retry) ) {Line 10908: popDisplay = true;Line 10909: popPath = string.Format(Line 10910:"/octopus/next/payment{0}?sid={1}&oid={2}", payment.gateways[gateway].uri, shopId, orderIdLine 10911: );Line 10912: }Line 10913: }Line 10914: } catch(Exception ex){Line 10915: Response.Write("<!-- Invalid `Payment` config. -->");Line 10916: }Line 10917: }Line 10918: break;Line 10919:Line 10920: case 2: // Transferência EletrônicaLine 10921: case 3: // Financiamento EletrônicoLine 10922: break;Line 10923:Line 10924: case 4: // Boleto BancárioLine 10925: if(order.pagarme != null && order.pagarme.boleto_url != null ) {Line 10926: popDisplay = true;Line 10927: popPath = order.pagarme.boleto_url;Line 10928: }Line 10929:Line 10930: if( order.bradesco != null &&Line 10931: order.bradesco.boleto != null &&Line 10932: order.bradesco.boleto.url_acesso != nullLine 10933: ) {Line 10934: popDisplay = true;Line 10935: popPath = order.bradesco.boleto.url_acesso;Line 10936: }Line 10937: break;Line 10938:Line 10939: case 5: // Depósito BancárioLine 10940: case 6: // Faturado EmpresaLine 10941: case 7: // BPag (DEPRECATED)Line 10942: case 8: // UOL PagSeguroLine 10943: case 9: // PixLine 10944: case 10: // 2 Cartões (DEPRECATED)Line 10945: case 11: // SubmarinoLine 10946: case 12: // BNDESLine 10947: case 13: // Cartão de DébitoLine 10948: case 14: // MarketplacesLine 10949: break;Line 10950:Line 10951: case 15: // PPLine 10952: if( order_status == 1 ) {Line 10953: popDisplay = true;Line 10954: popPath = string.Format("/octopus/next/payment/paypal/?sid={0}&oid={1}", shopId, orderId);Line 10955: popName = "PayPal";Line 10956: }Line 10957: break;Line 10958:}Line 10959:Line 10960:if(order_factor!=1)t_rowspan++;Line 10961:if(order_interest1!=0)t_rowspan++;Line 10962:Line 10963:string summary_header = "";Line 10964:summary_header += " <div id=\"summary_header\">\n";Line 10965:summary_header += " <div id=\"order_id\">\n";Line 10966:summary_header += " <h3>Número do pedido</h3>\n";Line 10967:summary_header += " <span>";Line 10968:Line 10969:if(order_ref.Length < 6)Line 10970: summary_header += ZenTools.Right("0000000"+ order_ref,6);Line 10971:elseLine 10972: summary_header += order_ref;Line 10973:Line 10974:summary_header += "</span>\n";Line 10975:summary_header += "<div id=\"order_id_note\"><p>Uma cópia do pedido foi enviada ao seu endereço de email: <a href='mailto:" + user_email + "'><b>"+ user_email +"</b></a></p></div>\n";Line 10976:summary_header += " </div>\n";Line 10977:summary_header += " <div id=\"order_inf\">\n";Line 10978:summary_header += " <h3>"+ order_payment +"</h3>\n";Line 10979:summary_header += " <span>"+ order_sBox +"</span>\n";Line 10980:summary_header += " <h3>Instruções</h3>\n";Line 10981:summary_header += " <span>"+ order_instructions +"</span>\n";Line 10982:summary_header += " </div>\n";Line 10983:Line 10984:if(order_status == 1 && popDisplay) {Line 10985: summary_header += "<div id=\"order_pop\">\n";Line 10986:Line 10987: switch(order_codPayment) {Line 10988: case 1: // Cartão de creditoLine 10989: summary_header += string.Format(Line 10990:"<button type='button' name='btnPrcPayment' onclick=\"prcPayment('{0}')\">Processar pagamento</button>\n", popPathLine 10991: );Line 10992: break;Line 10993:Line 10994: case 4: // BoletoLine 10995: summary_header += string.Format(Line 10996:"<a href='{0}'><span>Clique aqui para imprimir o boleto bancário</span></a>\n", popPathLine 10997: );Line 10998: break;Line 10999:Line 11000: default: // Outras formas de pagamentoLine 11001: summary_header += string.Format(Line 11002:"<a href='{0}'><span>Clique aqui para iniciar o pagamento</span></a>\n", popPathLine 11003: );Line 11004: break;Line 11005: }Line 11006:Line 11007: summary_header += "</div>\n";Line 11008:}Line 11009:Line 11010:if( order_codPayment == 5 )Line 11011: summary_header += shop.bankAccounts(false);Line 11012:Line 11013:summary_header += " </div>\n";Line 11014:Line 11015:i = 0;Line 11016:string ga_ecommerce = "_gaq.push(['_addTrans', '" + order_ref + "', '" + shop.Title.Replace("'", "\\'") + "', '{order_total}', '0', '{order_charge}', '', '', 'Brasil']);\n";Line 11017:string summary_body = "";Line 11018:summary_body += " <div id=\"summary_body\">\n";Line 11019:summary_body += " <h2>Seu pedido</h2><span>["+ ZenTools.PrintDate(order_date) +" "+ ZenTools.PrintTime(order_date) +"]</span>\n";Line 11020:summary_body += " <div class=\"hr\"><hr /></div>\n";Line 11021:summary_body += " <div id=\"summary_body_products\">\n";Line 11022:summary_body += " <table>\n";Line 11023:summary_body += " <tr>\n";Line 11024:summary_body += " <th class=\"cart_body_col_ref\">Ref.</th>\n";Line 11025:summary_body += " <th class=\"cart_body_col_desc\">Descrição</th>\n";Line 11026:Line 11027:Line 11028:Line 11029:// extra fields presentationLine 11030:if( useOrderBodyExtraFields != "" ) {Line 11031: try {Line 11032: object o = JavaScriptDeserializer.DeserializeFromJson( useOrderBodyExtraFields, typeof(NameValueCollection) );Line 11033: string[] _enum = ((NameValueCollection)o)["__ENUM__"].Split('|');Line 11034: for(i = 0; i < _enum.Length; i++) {Line 11035: summary_body += String.Format("<th class='cart_body_col_ext'>{0}</th>\n", _enum[i]);Line 11036: }Line 11037: } catch(Exception ex) {Line 11038: // nothing to do.Line 11039: }Line 11040:}Line 11041:Line 11042:Line 11043:Line 11044:summary_body += " <th class=\"cart_body_col_qty\">Qtd.</th>\n";Line 11045:summary_body += " <th class=\"cart_body_col_unitPrc\">Preço unit.</th>\n";Line 11046:Line 11047:conn = new SqlConnection(shop.Path);Line 11048:conn.Open();Line 11049:Line 11050:query = "SELECT TOP 1 json FROM sys_ordersBodies WHERE codOrder = @sys_ordersBodies_codOrder";Line 11051:cmd = new SqlCommand(query, conn);Line 11052:cmd.Parameters.Add(new SqlParameter("@sys_ordersBodies_codOrder", SqlDbType.Int));Line 11053:cmd.Parameters["@sys_ordersBodies_codOrder"].Value = orderId;Line 11054:if( cmd.ExecuteScalar() != DBNull.Value ) {Line 11055: order_item_json = Convert.ToString(cmd.ExecuteScalar());Line 11056:}Line 11057:Line 11058:Line 11059:Line 11060:// load item taxes presentationLine 11061:string[] taxes_enum = null;Line 11062:try {Line 11063: object o = JavaScriptDeserializer.DeserializeFromJson( order_item_json, typeof(NameValueCollection) );Line 11064: if( ((NameValueCollection)o)["taxes"] != null && ((NameValueCollection)o)["taxes"] != "" ) {Line 11065: o = JavaScriptDeserializer.DeserializeFromJson( ((NameValueCollection)o)["taxes"], typeof(NameValueCollection) );Line 11066: taxes_enum = ((NameValueCollection)o)["enumerate"].Split(',');Line 11067: for(i = 0; i < taxes_enum.Length; i++) {Line 11068: object tax = JavaScriptDeserializer.DeserializeFromJson( ((NameValueCollection)o)[ taxes_enum[i] ], typeof(NameValueCollection) );Line 11069: summary_body += String.Format( "<th class=\"cart_body_col_tax\">{0}</th>\n", ((NameValueCollection)tax)["presentation"] );Line 11070: }Line 11071: }Line 11072:} catch( Exception ex ) {Line 11073: summary_body += "<!-- load item taxes failed: " + ex.Message + " -->\n";Line 11074:}Line 11075:Line 11076:dynamic firstItemClob = JsonConvert.DeserializeObject<JObject>("{}");Line 11077:try{Line 11078: firstItemClob = JsonConvert.DeserializeObject<JObject>(order_item_json);Line 11079:} catch( Exception ex ) {Line 11080: /* Nothing to do */Line 11081:}Line 11082:Line 11083:Line 11084:Line 11085:summary_body += " <th class=\"cart_body_col_rowTot\">Total</th>\n";Line 11086:summary_body += " </tr>\n";Line 11087:Line 11088:query = @"Line 11089:SELECT codOrder, ref, name, prc, qt, jsonLine 11090:FROM sys_ordersBodiesLine 11091:WHERE codOrder = @sys_ordersBodies_codOrderLine 11092:ORDER BY dspOrder ASC, nameLine 11093:";Line 11094:Line 11095:cmd = new SqlCommand(query, conn);Line 11096:cmd.Parameters.Add(new SqlParameter("@sys_ordersBodies_codOrder", SqlDbType.Int));Line 11097:cmd.Parameters["@sys_ordersBodies_codOrder"].Value = orderId;Line 11098:Line 11099:rdr = cmd.ExecuteReader();Line 11100:while(rdr.Read()) {Line 11101: if(0==i%2) {Line 11102: iClass = "tbl_row_0";Line 11103: } else {Line 11104: iClass = "tbl_row_1";Line 11105: }Line 11106:Line 11107: iValue="";Line 11108: if( null != rdr["ref"] && !Convert.ToString(rdr["ref"]).Equals("") )Line 11109: iValue += Convert.ToString(rdr["ref"]);Line 11110:Line 11111: iPrice = (decimal)rdr["prc"];Line 11112:Line 11113: order_item_json = "{}";Line 11114: if( rdr["json"] != DBNull.Value ) {Line 11115: order_item_json = Convert.ToString(rdr["json"]);Line 11116: }Line 11117:Line 11118: summary_body += " <tr class=\""+iClass+"\">\n";Line 11119: summary_body += " <td class=\"cart_body_col_ref\">"+ iValue +"</td>\n";Line 11120: summary_body += " <td class=\"cart_body_col_desc\">";Line 11121: summary_body += (string)rdr["name"];Line 11122:Line 11123:Line 11124:Line 11125: // promotion checkLine 11126: if( rdr["json"] != DBNull.Value && Convert.ToString(rdr["json"]) != "" ) {Line 11127: try {Line 11128: object oJson = JavaScriptDeserializer.DeserializeFromJson( Convert.ToString(rdr["json"]), typeof(NameValueCollection));Line 11129: if( ((NameValueCollection)oJson)["Promotion"] != "" ) {Line 11130: oJson = JavaScriptDeserializer.DeserializeFromJson(((NameValueCollection)oJson)["Promotion"], typeof(NameValueCollection));Line 11131: summary_body += " [ " + Convert.ToString(((NameValueCollection)oJson)["name"]) + " ]";Line 11132: if( ((NameValueCollection)oJson)["discountType"] == "fixed" ) {Line 11133: promotionFixedDiscount += Convert.ToDecimal( ((NameValueCollection)oJson)["discountValue"].Replace(".", ",") );Line 11134: }Line 11135: }Line 11136: } catch( Exception ex ) {}Line 11137: }Line 11138:Line 11139:Line 11140:Line 11141: summary_body += "</td>\n";Line 11142:Line 11143:Line 11144:Line 11145: // extra fields valuesLine 11146: if( useOrderBodyExtraFields != "" ) {Line 11147: try{Line 11148: object o = JavaScriptDeserializer.DeserializeFromJson( useOrderBodyExtraFields, typeof(NameValueCollection) );Line 11149: string[] _enum = ((NameValueCollection)o)["__ENUM__"].Split('|');Line 11150: string _value = "";Line 11151: string _ref = "";Line 11152: if( Convert.ToString(rdr["ref"]) != null && Convert.ToString(rdr["ref"]) != "") {Line 11153: _ref = Convert.ToString(rdr["ref"]);Line 11154: }Line 11155:Line 11156: for(i = 0; i < _enum.Length; i++) {Line 11157: if( ((NameValueCollection)o)[ZenTools.idize(_ref)] != null ) {Line 11158: object f = JavaScriptDeserializer.DeserializeFromJson( ((NameValueCollection)o)[ZenTools.idize(_ref)], typeof(NameValueCollection) );Line 11159: _value = ((NameValueCollection)f)[_enum[i]];Line 11160: } else {Line 11161: _value = getValueFromProductDetails(shop.Path, _enum[i], _ref);Line 11162: }Line 11163:Line 11164: if( isAdm ) {Line 11165: summary_body += String.Format(Line 11166: "<td class='cart_body_col_ext'><input class='a' name='exf|{0}|{1}' value='{2}' /></td>\n",Line 11167: ZenTools.idize(_ref), _enum[i], _valueLine 11168: );Line 11169: } else {Line 11170: summary_body += String.Format("<td class='cart_body_col_ext'>{0}</td>\n", _value);Line 11171: }Line 11172: _value = "";Line 11173: }Line 11174: } catch(Exception ex) {Line 11175: summary_body += "<td class='cart_body_col_ext'> </td>\n";Line 11176: }Line 11177: }Line 11178:Line 11179:Line 11180:Line 11181:// if( isAdm && !Convert.ToString(rdr["ref"]).Equals("") && null != Convert.ToString(rdr["ref"]) && shop.getConfig("admUpdOrder").Equals("true") ) {Line 11182:// summary_body += " <td class=\"cart_body_col_qty\"><input id='summary_body_products_qt_"+ i +"' name='" + Convert.ToString(rdr["ref"]) + "' type='text' class='a' value='" + (int)rdr["qt"] + "' maxlength='4' size='5' onchange='updateQt(" + (int)rdr["codOrder"] + ", this);' onfocus='setOld(this);' /></td>\n";Line 11183:// } else {Line 11184:// summary_body += " <td class=\"cart_body_col_qty\">"+ Convert.ToString(rdr["qt"]) +"</td>\n";Line 11185:// }Line 11186: summary_body += " <td class=\"cart_body_col_qty\">"+ Convert.ToString(rdr["qt"]) +"</td>\n";Line 11187:Line 11188: summary_body += " <td class=\"cart_body_col_unitPrc\">"+ shop.CurrType + string.Format("{0:0."+ ndd +"}",iPrice) +"</td>\n";Line 11189:Line 11190:Line 11191:Line 11192: // load item taxes valuesLine 11193: decimal subtotal_fixed = 0;Line 11194:Line 11195: try {Line 11196:Line 11197: object o = JavaScriptDeserializer.DeserializeFromJson( order_item_json, typeof(NameValueCollection) );Line 11198: if( ((NameValueCollection)o)["taxes"] != null && ((NameValueCollection)o)["taxes"] != "" ) {Line 11199: o = JavaScriptDeserializer.DeserializeFromJson( ((NameValueCollection)o)["taxes"], typeof(NameValueCollection) );Line 11200:Line 11201: taxes_enum = ((NameValueCollection)o)["enumerate"].Split(',');Line 11202: for(i = 0; i < taxes_enum.Length; i++) {Line 11203: object tax = JavaScriptDeserializer.DeserializeFromJson( ((NameValueCollection)o)[ taxes_enum[i] ], typeof(NameValueCollection) );Line 11204: decimal v = Convert.ToDecimal( ((NameValueCollection)tax)["value"].Replace(".", ",") );Line 11205:Line 11206: if( Convert.ToBoolean(((NameValueCollection)tax)["apply_in_prc"]) ) {Line 11207: iPrice = v;Line 11208: subtotal_fixed = subtotal_fixed + iPrice;Line 11209: } else {Line 11210: iPrice = iPrice + v;Line 11211: }Line 11212:Line 11213: summary_body += String.Format(Line 11214: "<td class=\"cart_body_col_tax tax_{0}\">{1}</td>\n"Line 11215: , taxes_enum[i].ToLower()Line 11216: , shop.CurrType + string.Format("{0:0." + ndd + "}", v)Line 11217: );Line 11218: }Line 11219:Line 11220: }Line 11221:Line 11222: } catch(Exception ex) {Line 11223: summary_body += "<!-- load item taxes failed! -->\n";Line 11224: }Line 11225:Line 11226:Line 11227:Line 11228: summary_body += " <td class=\"cart_body_col_rowTot\">"+ shop.CurrType + string.Format( "{0:0.00}", iPrice * (int)rdr["qt"] ) + "</td>\n";Line 11229: summary_body += " </tr>\n";Line 11230:Line 11231: if( subtotal_fixed > 0 ) {Line 11232: t_price = t_price + subtotal_fixed * (int)rdr["qt"];Line 11233: } else {Line 11234: t_price = t_price + iPrice * (int)rdr["qt"];Line 11235: }Line 11236:Line 11237: order_items += (int)rdr["qt"];Line 11238:Line 11239:Line 11240: /* GOOGLE_DEPRECATED */Line 11241: // google stuffLine 11242: Sb_GTP.Append(",{ ");Line 11243: Sb_GTP.Append(Line 11244: String.Format(Line 11245: "\"sku\": \"{0}\", \"name\": \"{1}\", \"price\": {2}, \"quantity\": {3}"Line 11246: , iValueLine 11247: , Server.HtmlEncode( (string)rdr["name"] )Line 11248: , string.Format( "{0:0.00}", Math.Round(iPrice, 2) ).Replace(".","").Replace(",",".")Line 11249: , Convert.ToString(rdr["qt"])Line 11250: )Line 11251: );Line 11252: Sb_GTP.Append(" }");Line 11253:Line 11254: ga_ecommerce += "_gaq.push(['_addItem',";Line 11255: ga_ecommerce += "'" + order_ref + "',";Line 11256: ga_ecommerce += "'" + iValue + "',";Line 11257: ga_ecommerce += "'" + ( (string)rdr["name"] ).Replace("'", "\\'") + "',";Line 11258: ga_ecommerce += "'',";Line 11259: ga_ecommerce += "'" + string.Format("{0:0.00}", Math.Round(iPrice, 2)).Replace(".","").Replace(",",".") + "',";Line 11260: ga_ecommerce += "'" + Convert.ToString(rdr["qt"]) + "'";Line 11261: ga_ecommerce += "]);\n";Line 11262:Line 11263: summary_ecomm_prodid += ",'" + Generics.getCodGridByRef(shop.Path, iValue) + "'";Line 11264: summary_ecomm_prodvalue += ",'" + string.Format("{0:0.00}", Math.Round(iPrice, 2)).Replace(".","").Replace(",",".") + "'";Line 11265: /* GOOGLE_DEPRECATED */Line 11266:Line 11267: /* GOOGLE_TAG_MANAGER */Line 11268: dynamic product = JsonConvert.DeserializeObject<JObject>("{}");Line 11269: product.id = iValue;Line 11270: product.name = Convert.ToString(rdr["name"]);Line 11271: product.price = string.Format( "{0:0.00}", iPrice ).Replace(",", ".");Line 11272: product.quantity = Convert.ToInt32( rdr["qt"] );Line 11273: if( Convert.ToString( product.id ) != "" )Line 11274: load_by_sku( shop.Path, product );Line 11275: gtm_purchase_products.Add( product );Line 11276: /* GOOGLE_TAG_MANAGER */Line 11277:Line 11278: i++;Line 11279:}Line 11280:rdr.Close();Line 11281:Line 11282:Line 11283:Line 11284:// apply promotion fixed discountLine 11285:if( promotionFixedDiscount > 0 && t_price > promotionFixedDiscount ) {Line 11286: t_price = t_price - promotionFixedDiscount;Line 11287:}Line 11288:Line 11289:/* GOOGLE_DEPRECATED */Line 11290:if( summary_ecomm_prodid != "" ) {Line 11291: summary_ecomm_prodid = summary_ecomm_prodid.Substring(1);Line 11292:}Line 11293:if( summary_ecomm_prodvalue != "" ) {Line 11294: summary_ecomm_prodvalue = summary_ecomm_prodvalue.Substring(1);Line 11295:}Line 11296:/* GOOGLE_DEPRECATED */Line 11297:Line 11298:rdr.Close();Line 11299:conn.Close();Line 11300:Line 11301:summary_body += " </table>\n";Line 11302:Line 11303:Line 11304:Line 11305:// show fixed discountsLine 11306:if( promotionFixedDiscount > 0 ) {Line 11307: summary_body += " <div class='promotion-fixed-discount'>";Line 11308: summary_body += " <table>\n";Line 11309: summary_body += " <tr>\n";Line 11310: summary_body += " <td width=\"50%\" class=\"lft_half\"><span></span></td>\n";Line 11311: summary_body += " <td width=\"50%\" class=\"rgt_half\">\n";Line 11312: summary_body += " <table>\n";Line 11313: summary_body += " <tr><th>Desconto de promoções:</th><td>"+ shop.CurrType + string.Format(Line 11314: "{0:0.00}"Line 11315: , promotionFixedDiscountLine 11316: ) +"</td></tr>\n";Line 11317: summary_body += " </table>\n";Line 11318: summary_body += " </td>\n";Line 11319: summary_body += " </tr>\n";Line 11320: summary_body += " </table>\n";Line 11321: summary_body += " </div>";Line 11322:}Line 11323:Line 11324:summary_body += " </div>\n";Line 11325:Line 11326:if( shop.UseDC ) {Line 11327: conn = new SqlConnection(shop.Path);Line 11328: conn.Open();Line 11329:Line 11330: query = "SELECT name, code, [value] FROM rel_ordersWdc_n_gc WHERE (codOrder = @rel_ordersWdc_n_gc_codOrder)";Line 11331:Line 11332: cmd = new SqlCommand(query, conn);Line 11333: cmd.Parameters.Add(new SqlParameter("@rel_ordersWdc_n_gc_codOrder", SqlDbType.Int));Line 11334: cmd.Parameters["@rel_ordersWdc_n_gc_codOrder"].Value = orderId;Line 11335:Line 11336: rdr = cmd.ExecuteReader();Line 11337: if(rdr.Read()) {Line 11338: summary_body += " <div class=\"hr\"><hr /></div>\n";Line 11339: summary_body += " <div id=\"summary_dc_n_gc\">\n";Line 11340: do {Line 11341: order_coupon = Convert.ToString(rdr["code"]);Line 11342:Line 11343: summary_body += " <table>\n";Line 11344: summary_body += " <tr>\n";Line 11345: summary_body += " <td width=\"50%\" class=\"lft_half\">\n";Line 11346: summary_body += " <ul>\n";Line 11347: summary_body += " <li class=\"label\"><span>"+ (string)rdr["name"] +"</span></li>\n";Line 11348: summary_body += " <li class=\"field\"><span>"+ order_coupon +"</span></li>\n";Line 11349: summary_body += " </ul>\n";Line 11350: summary_body += " </td>\n";Line 11351: summary_body += " <td width=\"50%\" class=\"rgt_half\">\n";Line 11352: summary_body += " <table><tr><th>"+ (string)rdr["name"] +"</th><td>"+ shop.CurrType + string.Format("{0:0.00}",(decimal)rdr["value"]) +"</td></tr></table>\n";Line 11353: summary_body += " </td>\n";Line 11354: summary_body += " </tr>\n";Line 11355: summary_body += " </table>\n";Line 11356: t_price -= (decimal)rdr["value"];Line 11357: } while(rdr.Read());Line 11358: summary_body += " </div>\n";Line 11359: }Line 11360: rdr.Close();Line 11361:Line 11362: conn.Close();Line 11363:}Line 11364:Line 11365:summary_body += " <div class=\"hr\"><hr /></div>\n";Line 11366:Line 11367://--( Buy together discount )---------------------------------------------------Line 11368:if( order_discBt > 0 ) {Line 11369: summary_body += " <div class=\"hr\"><hr /></div>\n";Line 11370: summary_body += " <div id=\"summary_dc_n_gc\">\n";Line 11371: summary_body += " <table>\n";Line 11372: summary_body += " <tr>\n";Line 11373: summary_body += " <td width=\"50%\" class=\"lft_half\">\n";Line 11374: summary_body += " </td>\n";Line 11375: summary_body += " <td width=\"50%\" class=\"rgt_half\">\n";Line 11376: summary_body += " <table><tr><th>Desconto compre junto:</th><td>"+ shop.CurrType + string.Format("{0:0.00}", order_discBt) +"</td></tr></table>\n";Line 11377: summary_body += " </td>\n";Line 11378: summary_body += " </tr>\n";Line 11379: summary_body += " </table>\n";Line 11380: summary_body += " </div>\n";Line 11381: summary_body += " <div class=\"hr\"><hr /></div>\n";Line 11382:Line 11383: t_price -= order_discBt;Line 11384:}Line 11385:Line 11386:summary_body += " <div id=\"summary_total\">\n";Line 11387:summary_body += " <table>\n";Line 11388:summary_body += " <tr>\n";Line 11389:summary_body += " <td width=\"50%\" class=\"lft_half\"><span></span></td>\n";Line 11390:summary_body += " <td width=\"50%\" class=\"rgt_half\">\n";Line 11391:summary_body += " <table>\n";Line 11392:if(isAdm) summary_body += " <tr><th>Itens:</th><td>"+ order_items +"</td></tr>\n";Line 11393:summary_body += " <tr><th>Subtotal:</th><td>"+ shop.CurrType + string.Format("{0:0.00}",t_price) +"</td></tr>\n";Line 11394:Line 11395:Line 11396:Line 11397:// load order taxesLine 11398:try {Line 11399:Line 11400: object o = JavaScriptDeserializer.DeserializeFromJson( order_json, typeof(NameValueCollection) );Line 11401: if( ((NameValueCollection)o)["taxes"] != null && ((NameValueCollection)o)["taxes"] != "" ) {Line 11402: o = JavaScriptDeserializer.DeserializeFromJson( ((NameValueCollection)o)["taxes"], typeof(NameValueCollection) );Line 11403:Line 11404: taxes_enum = ((NameValueCollection)o)["enumerate"].Split(',');Line 11405: for(i = 0; i <= taxes_enum.Length -1; i++) {Line 11406: object tax = JavaScriptDeserializer.DeserializeFromJson( ((NameValueCollection)o)[ taxes_enum[i] ], typeof(NameValueCollection) );Line 11407: decimal v = Convert.ToDecimal(((NameValueCollection)tax)["value"].Replace(".", ","));Line 11408:Line 11409: t_price = t_price + v;Line 11410:Line 11411: summary_body += String.Format(Line 11412: "<tr><th>{0}:</th><td>{1}</td></tr>\n"Line 11413: , ((NameValueCollection)tax)["presentation"]Line 11414: , shop.CurrType + string.Format("{0:0.00}", v)Line 11415: );Line 11416: }Line 11417: }Line 11418:Line 11419:} catch( Exception ex ) {Line 11420: summary_body += "<!-- load order taxes failed! -->\n";Line 11421:}Line 11422:Line 11423:Line 11424:Line 11425:if(order_factor!=1) {Line 11426: if( order_factor < 1 ) {Line 11427: summary_body += " <tr><th>Desconto "+ string.Format("{0:0.00}", Math.Round( (1-order_factor) * 100, 2) ) +"%:</th><td>"+ shop.CurrType + string.Format( "{0:0.00}", Math.Round( t_price - (t_price * order_factor), 2 ) ) +"</td></tr>\n";Line 11428: } else {Line 11429: summary_body += " <tr><th>Acréscimo "+ string.Format("{0:0.00}", Math.Round( (order_factor-1) * 100, 2) ) +"%:</th><td>"+ shop.CurrType + string.Format("{0:0.00}", (t_price * order_factor) - t_price) + "</td></tr>\n";Line 11430: }Line 11431:Line 11432: t_price *= order_factor;Line 11433:}Line 11434:Line 11435:if( order_vtransl != 0 ) {Line 11436: if( order_vtransl < 0 ) {Line 11437: summary_body += " <tr><th>Desconto:</th><td>"+ shop.CurrType + string.Format("{0:0.00}", Math.Abs(order_vtransl) ) +"</td></tr>\n";Line 11438: } else {Line 11439: summary_body += " <tr><th>Acréscimo:</th><td>"+ shop.CurrType + string.Format("{0:0.00}", order_vtransl) +"</td></tr>\n";Line 11440: }Line 11441:Line 11442: t_price += order_vtransl;Line 11443:}Line 11444:Line 11445:if(!isAdm) {Line 11446: if(order_stCharge != 0) {Line 11447: summary_body += " <tr id='shipping_st_label'><th>DIFAL:</th><td>"+ shop.CurrType + string.Format("{0:0."+ ndd +"}",order_stCharge) +"</td></tr>\n";Line 11448: }Line 11449:} else {Line 11450: summary_body += " <tr id='shipping_st_label' " + ( ( !shop.useST ) ? "style='display:none;'" : "" ) + "><th>DIFAL:</th><td><input name='order_stCharge' class='a' type='text' value='"+ string.Format("{0:0."+ ndd +"}",order_stCharge) +"' /></td></tr>\n";Line 11451:}Line 11452:Line 11453://if(!isAdm) {Line 11454:// if(order_charge != 0) {Line 11455:// summary_body += " <tr><th>Frete:</th><td>"+ shop.CurrType + string.Format("{0:0.00}",order_charge) +"</td></tr>\n";Line 11456:// }Line 11457://} else {Line 11458:// summary_body += " <tr><th>Frete:</th><td><input name='order_charge' class='a' type='text' value='"+ string.Format("{0:0.00}",order_charge) +"' /></td></tr>\n";Line 11459://}Line 11460:if( order_charge != 0 )Line 11461: summary_body += "<tr><th>Frete:</th><td>"+ shop.CurrType + string.Format("{0:0.00}",order_charge) +"</td></tr>\n";Line 11462:Line 11463:Line 11464:Line 11465:t_price += order_stCharge + order_charge + order_ccvtransl1 + order_ccvtransl2;Line 11466:// t_price += order_charge + order_ccvtransl1 + order_ccvtransl2;Line 11467:Line 11468:if( order_codPayment == 10 ) { // Modo 2 cartões de créditoLine 11469: // Cartão de crédito 1Line 11470: if(order_interest1 != 0) {Line 11471: p_price = Details.Juros_Composto(order_ccValue1, order_interest1/100, order_parcels1);Line 11472: order_total = order_parcels1 * p_price;Line 11473: summary_body += " <tr><th>" + order_ccFlag1 + " - " + order_parcels1 +"x parcela(s):</th><td>"+ shop.CurrType + string.Format("{0:0.00}", p_price) +" C/JUROS (TAXA DE "+ string.Format("{0:0."+ ndd +"}", order_interest1 ) +"% A.M.)</td></tr>\n";Line 11474: } else {Line 11475: order_total = order_ccValue1;Line 11476: summary_body += " <tr><th>" + order_ccFlag1 + " - " + order_parcels1 +"x parcela(s):</th><td>"+ shop.CurrType + string.Format("{0:0.00}", order_ccValue1 / order_parcels1) +"</td></tr>";Line 11477: }Line 11478:Line 11479: // Cartão de crédito 2Line 11480: if(order_interest2 != 0) {Line 11481: p_price = Details.Juros_Composto(order_ccValue2, order_interest2/100, order_parcels2);Line 11482: order_total += order_parcels2 * p_price;Line 11483: summary_body += " <tr><th>" + order_ccFlag2 + " - " + order_parcels2 +"x parcela(s):</th><td>"+ shop.CurrType + string.Format("{0:0.00}", p_price) +" C/JUROS (TAXA DE "+ string.Format("{0:0.00}", order_interest2 ) +"% A.M.)</td></tr>\n";Line 11484: } else {Line 11485: order_total += order_ccValue2;Line 11486: summary_body += " <tr><th>" + order_ccFlag2 + " - " + order_parcels2 +"x parcela(s):</th><td>"+ shop.CurrType + string.Format("{0:0.00}", order_ccValue2 / order_parcels2) +"</td></tr>";Line 11487: }Line 11488:} else {Line 11489: if( order_parcels1 > 1 ) {Line 11490: if(order_interest1 != 0) {Line 11491: p_price = Details.Juros_Composto(t_price, order_interest1/100, order_parcels1);Line 11492: order_total = order_parcels1 * p_price;Line 11493: summary_body += "<tr class='summary_total_parcels'><th>"+ order_parcels1 +"x parcela(s):</th><td>"+ shop.CurrType + string.Format("{0:0.00}", p_price) +" C/JUROS (TAXA DE "+ string.Format("{0:0.00}", order_interest1 ) +"% A.M.)</td></tr>\n";Line 11494: } else {Line 11495: order_total = t_price;Line 11496: summary_body += "<tr class='summary_total_parcels'><th>"+ order_parcels1 +"x parcela(s):</th><td>"+ shop.CurrType + string.Format("{0:0.00}", order_total / order_parcels1) +"</td></tr>";Line 11497: }Line 11498: } else {Line 11499: order_total = t_price;Line 11500: }Line 11501:}Line 11502:Line 11503:summary_body += " <tr><th>Total:</th><td>"+ shop.CurrType + string.Format( "{0:0.00}", order_total ) +"</td></tr>\n";Line 11504:Line 11505:Line 11506:Line 11507:Line 11508:Line 11509:summary_body += " </table>\n";Line 11510:summary_body += " </td>\n";Line 11511:summary_body += " </tr>\n";Line 11512:summary_body += " </table>\n";Line 11513:summary_body += " </div>\n";Line 11514:summary_body += "</div>\n";Line 11515:Line 11516:Line 11517:Line 11518:/* plano_funeral? */Line 11519:if(Line 11520: firstItemClob != nullLine 11521:&& firstItemClob.product != nullLine 11522:&& firstItemClob.product.clob != nullLine 11523:&& firstItemClob.product.clob.plano_funeral != nullLine 11524:) {Line 11525:Line 11526: summary_body += string.Format(Line 11527:@"Line 11528:<div id='plano-funeral-contrato'>Line 11529: <a href='/meu-contrato/{0}.pdf' target='_blank'><span>Ver contrato</span></a>Line 11530: <a href='/plano-funeral/retry/?id={1}' target='_blank'><span>Gerar contrato</span></a>Line 11531: <a href='/plano-funeral/contrato-pedido/?id={1}' target='_blank'><span>Contrato HTML</span></a>Line 11532:</div>Line 11533:", ZenTools.md5( (string)firstItemClob.product.idProduct )Line 11534: , string.Format("{0}-{1}-{2}", order_codUser, orderId, Guid.NewGuid() )Line 11535: );Line 11536:}Line 11537:Line 11538:Line 11539:Line 11540:ga_ecommerce += "_gaq.push(['_trackTrans']);\n";Line 11541:Line 11542:summary_ecomm_totalvalue = string.Format("{0:0.00}",order_total - order_charge).Replace(".","").Replace(",",".");Line 11543:order_total = Convert.ToDecimal(string.Format("{0:0.00}", order_total));Line 11544:Line 11545:if(!isAdm) {Line 11546: if( userId != order_codUser ) Response.Redirect("/octopus/?sid=" + shopId + "&mi=LRT&m=Pedido não pertencente ao usuário conectado.");Line 11547:}Line 11548:Line 11549:/* GOOGLE_DEPRECATED */Line 11550:ga_ecommerce = ga_ecommerce.Replace(Line 11551: "{order_total}", string.Format("{0:0."+ ndd +"}", order_total - (order_charge + order_stCharge)).Replace(".","").Replace(",",".")Line 11552:);Line 11553:ga_ecommerce = ga_ecommerce.Replace("{order_stCharge}", string.Format("{0:0."+ ndd +"}", order_stCharge).Replace(".","").Replace(",","."));Line 11554:// ga_ecommerce = ga_ecommerce.Replace(Line 11555: // "{order_total}", string.Format("{0:0.00}", order_total - order_charge).Replace(".","").Replace(",",".")Line 11556:// );Line 11557:ga_ecommerce = ga_ecommerce.Replace("{order_charge}", string.Format("{0:0.00}", order_charge).Replace(".","").Replace(",","."));Line 11558:/* GOOGLE_DEPRECATED */Line 11559:Line 11560:
Line 11561:
Line 11562: #line default
Line 11563: #line hidden
Line 11564: @__w.Write("\r\n<form id=\"main_form\" name=\"main_form\" method=\"post\" action=\"#\">\r\n<div id=\"summa" +
Line 11565: "ry\" class=\"full\">\r\n<!--\r\n");
Line 11566:
Line 11567: #line 5 "C:\octopus\https\current\_summary.aspx"
Line 11568:
Line 11569:
Line 11570:string[] server_variables = Request.ServerVariables.AllKeys;
Line 11571:for(int idx = 0; idx < server_variables.Length; idx++ ) {
Line 11572: if( server_variables[idx].Length >= 5 && server_variables[idx].Substring(0, 5) == "HTTP_" ) {
Line 11573: Response.Write( server_variables[idx] + " : ");
Line 11574: Response.Write( Server.HtmlEncode(Request.ServerVariables[server_variables[idx]]) );
Line 11575: Response.Write(Environment.NewLine);
Line 11576: }
Line 11577:}
Line 11578:
Line 11579:
Line 11580:
Line 11581: #line default
Line 11582: #line hidden
Line 11583: @__w.Write("\r\n-->\r\n <h1><span>");
Line 11584:
Line 11585: #line 18 "C:\octopus\https\current\_summary.aspx"
Line 11586: @__w.Write( order_status_desc );
Line 11587:
Line 11588:
Line 11589: #line default
Line 11590: #line hidden
Line 11591: @__w.Write("</span></h1>\r\n <div class=\"hr\"><hr /></div>\r\n <div id=\"summary-body\" class=\"ful" +
Line 11592: "l-body\">\r\n");
Line 11593:
Line 11594: #line 21 "C:\octopus\https\current\_summary.aspx"
Line 11595:
Line 11596:
Line 11597:string ccGateway = shop.getCcGateway(flag);
Line 11598:
Line 11599:if( order_codPayment == 1 && order_status <= 1 ) {
Line 11600: if( shop.getConfig("UseCreditCardPaymentCheck") != "" ) {
Line 11601: try {
Line 11602: object Config = JavaScriptDeserializer.DeserializeFromJson( shop.getConfig("UseCreditCardPaymentCheck"), typeof(NameValueCollection));
Line 11603:
Line 11604: // check attempts and timeout
Line 11605: int attempts = 0;
Line 11606: if( ZenTools.getNote("ATTEMPTS", order_notes).Trim() != "" ) {
Line 11607: attempts = Convert.ToInt32(ZenTools.getNote("ATTEMPTS", order_notes).Trim());
Line 11608: }
Line 11609:
Line 11610: if(
Line 11611: attempts >= Convert.ToInt32(((NameValueCollection)Config)["retryLimit"])
Line 11612: || DateTime.Now > ( Convert.ToDateTime(order_date).AddMinutes(Convert.ToDouble(((NameValueCollection)Config)["timeout"])) )
Line 11613: ) {
Line 11614: if( ((NameValueCollection)Config)["cancel"] == "false" ) {
Line 11615: Response.Redirect(
Line 11616: shop.Https + thisConfig + "&mi=MRD&msgtype=error&msg=" + Server.UrlEncode("Número de tentativas para pagamento excedido.")
Line 11617: );
Line 11618: Response.End();
Line 11619: } else {
Line 11620: // cancel order
Line 11621: string ret = ZenTools.WebReq( shop.Https + "~~updStock.asp?sid=" + shopId + "&oidst=" + orderId + ";0&origin=CREDIT_CARD_PAYMENT_CHECK" );
Line 11622: if( ret == "SUCCESS" ) {
Line 11623: // redirect user
Line 11624: Response.Redirect( shop.Https + thisConfig + "&mi=MRD&msgtype=error&msg=" + Server.UrlEncode("Seu pedido foi cancelado. Por favor refaça o pedido e tente novamente.") );
Line 11625: Response.End();
Line 11626: }
Line 11627: }
Line 11628: }
Line 11629:
Line 11630: // show message
Line 11631: Response.Write( " <div id='summary-body-payment-status' class='error' style='text-align: center;'>\n" );
Line 11632: Response.Write( " <span><strong>Pagamento não Aprovado.</strong></span><br />\n" );
Line 11633: Response.Write( " <a href='/octopus/?sid=" + shopId + "&oid=" + orderId + "&mi=PAY' alt='alterar forma de pagamento' title='alterar forma de pagamento'>CLIQUE AQUI PARA ALTERAR A FORMA DE PAGAMENTO</a>\n" );
Line 11634: Response.Write( " </div>\n");
Line 11635:
Line 11636: } catch(Exception e) {
Line 11637: Response.Write( "<!-- " + e.Message + " : " + e.Source + " : " + e.StackTrace + "-->" );
Line 11638: }
Line 11639: } else {
Line 11640: string incoming_msg = (
Line 11641: order_status <= 1 ? "Pagamento não Aprovado. Contate a sua operadora de cartão de crédito para maiores informações." : "Pagamento Aprovado."
Line 11642: );
Line 11643: if( Request.QueryString["imsg"] != null && Request.QueryString["imsg"] != "" ) {
Line 11644: incoming_msg = Convert.ToString(Request.QueryString["imsg"]);
Line 11645: }
Line 11646: Response.Write( "<div id='summary-body-payment-status' class='" + (order_status <= 1 ? "error" : "success" ) + "' style='text-align: center;'>\n" );
Line 11647: Response.Write( String.Format("<strong>{0}</strong>\n", incoming_msg) );
Line 11648: Response.Write( "</div>\n" );
Line 11649: }
Line 11650:}
Line 11651:
Line 11652:if( !isMobile && shop.UseEbit) {
Line 11653: conn = new SqlConnection(shop.Path);
Line 11654: conn.Open();
Line 11655:
Line 11656: query = "SELECT [value] FROM sys_ebit";
Line 11657: cmd = new SqlCommand(query, conn);
Line 11658: rdr = cmd.ExecuteReader();
Line 11659:
Line 11660: if(rdr.Read())Response.Write(" <div id=\"eBit\">"+ (string)rdr["value"] +"</div>");
Line 11661:
Line 11662: rdr.Close();
Line 11663: conn.Close();
Line 11664:}
Line 11665:
Line 11666:// Facebook Pixel Code stuff
Line 11667:fb_content_ids = summary_ecomm_prodid;
Line 11668:fb_value = Convert.ToString(order_total).Replace(",", ".");
Line 11669:
Line 11670:
Line 11671:
Line 11672: #line default
Line 11673: #line hidden
Line 11674:
Line 11675: #line 97 "C:\octopus\https\current\_summary.aspx"
Line 11676:@__w.Write( summary_header );
Line 11677:
Line 11678:
Line 11679: #line default
Line 11680: #line hidden
Line 11681: @__w.Write("\r\n");
Line 11682:
Line 11683: #line 98 "C:\octopus\https\current\_summary.aspx"
Line 11684:@__w.Write( summary_body );
Line 11685:
Line 11686:
Line 11687: #line default
Line 11688: #line hidden
Line 11689: @__w.Write("\r\n <div id=\"summary_footer\">\r\n\t<table>\r\n\t <tr>\r\n\t\t<th width=\"50%\">Dados do clie" +
Line 11690: "nte</th>\r\n\t\t<th width=\"50%\">Dados de entrega</th>\r\n\t </tr>\r\n\t <tr>\r\n\t\t<td vali" +
Line 11691: "gn=\"top\"><pre>");
Line 11692:
Line 11693: #line 106 "C:\octopus\https\current\_summary.aspx"
Line 11694: @__w.Write( order_address1 );
Line 11695:
Line 11696:
Line 11697: #line default
Line 11698: #line hidden
Line 11699: @__w.Write("</pre></td>\r\n\t\t<td valign=\"top\"><pre>");
Line 11700:
Line 11701: #line 107 "C:\octopus\https\current\_summary.aspx"
Line 11702: @__w.Write( order_address2 );
Line 11703:
Line 11704:
Line 11705: #line default
Line 11706: #line hidden
Line 11707: @__w.Write("</pre></td>\r\n\t </tr>\r\n\t</table>\r\n\t<br />\r\n\t<table>\r\n\t <tr><th>Observações</th><" +
Line 11708: "/tr>\r\n\t <tr><td>");
Line 11709:
Line 11710: #line 113 "C:\octopus\https\current\_summary.aspx"
Line 11711: @__w.Write( order_notes.Replace("\n","<br />") );
Line 11712:
Line 11713:
Line 11714: #line default
Line 11715: #line hidden
Line 11716: @__w.Write("</td></tr>\r\n\t</table>\r\n </div>\r\n<script type=\"text/javascript\">\r\n// <![CDATA[\r\n\r" +
Line 11717: "\n/* GOOGLE_DEPRECATED */\r\n");
Line 11718:
Line 11719: #line 120 "C:\octopus\https\current\_summary.aspx"
Line 11720: if( DateTime.Now <= order_date.AddMinutes(1) ) {
Line 11721:
Line 11722: #line default
Line 11723: #line hidden
Line 11724: @__w.Write("\r\nvar gtag = gtag || function(){};\r\ngtag(\'event\', \'purchase\', {\r\n\t\"transaction_id" +
Line 11725: "\": \"");
Line 11726:
Line 11727: #line 123 "C:\octopus\https\current\_summary.aspx"
Line 11728: @__w.Write( order_ref );
Line 11729:
Line 11730:
Line 11731: #line default
Line 11732: #line hidden
Line 11733: @__w.Write("\",\r\n\t\"affiliation\": \"");
Line 11734:
Line 11735: #line 124 "C:\octopus\https\current\_summary.aspx"
Line 11736: @__w.Write( shop.Title );
Line 11737:
Line 11738:
Line 11739: #line default
Line 11740: #line hidden
Line 11741: @__w.Write("\",\r\n\t\"value\": ");
Line 11742:
Line 11743: #line 125 "C:\octopus\https\current\_summary.aspx"
Line 11744: @__w.Write( summary_ecomm_totalvalue );
Line 11745:
Line 11746:
Line 11747: #line default
Line 11748: #line hidden
Line 11749: @__w.Write(",\r\n\t\"currency\": \"BRL\",\r\n\t\"tax\": 0,\r\n\t\"shipping\": ");
Line 11750:
Line 11751: #line 128 "C:\octopus\https\current\_summary.aspx"
Line 11752: @__w.Write( string.Format("{0:0.00}", Math.Round(order_charge, 2)).Replace(".","").Replace(",",".") );
Line 11753:
Line 11754:
Line 11755: #line default
Line 11756: #line hidden
Line 11757: @__w.Write(",\r\n\t\"list_name\": \"Search Results\",\r\n\t\"items\": [");
Line 11758:
Line 11759: #line 130 "C:\octopus\https\current\_summary.aspx"
Line 11760: @__w.Write( Sb_GTP.ToString().Substring(1).Replace("\"sku\":", "\"id\":") );
Line 11761:
Line 11762:
Line 11763: #line default
Line 11764: #line hidden
Line 11765: @__w.Write("]\r\n});\r\n");
Line 11766:
Line 11767: #line 132 "C:\octopus\https\current\_summary.aspx"
Line 11768: }
Line 11769:
Line 11770: #line default
Line 11771: #line hidden
Line 11772: @__w.Write("\r\n\r\nvar google_tag_params = {\r\n\t\'ecomm_prodid\': [");
Line 11773:
Line 11774: #line 135 "C:\octopus\https\current\_summary.aspx"
Line 11775: @__w.Write( summary_ecomm_prodid );
Line 11776:
Line 11777:
Line 11778: #line default
Line 11779: #line hidden
Line 11780: @__w.Write("],\r\n\t\'ecomm_pagetype\': \'purchase\',\r\n\t\'ecomm_totalvalue\': ");
Line 11781:
Line 11782: #line 137 "C:\octopus\https\current\_summary.aspx"
Line 11783: @__w.Write( summary_ecomm_totalvalue );
Line 11784:
Line 11785:
Line 11786: #line default
Line 11787: #line hidden
Line 11788: @__w.Write(" \r\n};\r\n\r\nvar dataLayer = dataLayer || [];\r\ndataLayer.push({\r\n\t\'transactionId\': \'");
Line 11789:
Line 11790: #line 142 "C:\octopus\https\current\_summary.aspx"
Line 11791: @__w.Write( order_ref );
Line 11792:
Line 11793:
Line 11794: #line default
Line 11795: #line hidden
Line 11796: @__w.Write("\',\r\n\t\'transactionAffiliation\': \'");
Line 11797:
Line 11798: #line 143 "C:\octopus\https\current\_summary.aspx"
Line 11799: @__w.Write( shop.Title );
Line 11800:
Line 11801:
Line 11802: #line default
Line 11803: #line hidden
Line 11804: @__w.Write("\',\r\n\t\'transactionTotal\': ");
Line 11805:
Line 11806: #line 144 "C:\octopus\https\current\_summary.aspx"
Line 11807: @__w.Write( summary_ecomm_totalvalue );
Line 11808:
Line 11809:
Line 11810: #line default
Line 11811: #line hidden
Line 11812: @__w.Write(",\r\n\t\'transactionShipping\': ");
Line 11813:
Line 11814: #line 145 "C:\octopus\https\current\_summary.aspx"
Line 11815: @__w.Write( string.Format("{0:0.00}", Math.Round(order_charge, 2)).Replace(".","").Replace(",",".") );
Line 11816:
Line 11817:
Line 11818: #line default
Line 11819: #line hidden
Line 11820: @__w.Write(",\r\n\t\'transactionProducts\': [");
Line 11821:
Line 11822: #line 146 "C:\octopus\https\current\_summary.aspx"
Line 11823: @__w.Write( Sb_GTP.ToString().Substring(1) );
Line 11824:
Line 11825:
Line 11826: #line default
Line 11827: #line hidden
Line 11828: @__w.Write("]\r\n});\r\n\r\nif( typeof ga !== \"undefined\" ) {\r\n\tga(\"send\", \"screenview\", { \"appName" +
Line 11829: "\": \"");
Line 11830:
Line 11831: #line 150 "C:\octopus\https\current\_summary.aspx"
Line 11832: @__w.Write( shop.Title );
Line 11833:
Line 11834:
Line 11835: #line default
Line 11836: #line hidden
Line 11837: @__w.Write("\", \"screenName\": \"success\" });\r\n}\r\n\r\n");
Line 11838:
Line 11839: #line 153 "C:\octopus\https\current\_summary.aspx"
Line 11840:
Line 11841:
Line 11842:if( shop.getConfig("Google-Ecommerce").Length > 0 && !hideGoogleConfig) {
Line 11843:
Line 11844:
Line 11845:
Line 11846: #line default
Line 11847: #line hidden
Line 11848: @__w.Write("\r\nvar _gaq = _gaq || [\r\n\t[\'_setAccount\', \'");
Line 11849:
Line 11850: #line 159 "C:\octopus\https\current\_summary.aspx"
Line 11851: @__w.Write( shop.getConfig("Google-Ecommerce") );
Line 11852:
Line 11853:
Line 11854: #line default
Line 11855: #line hidden
Line 11856: @__w.Write("\'],\r\n\t[\'_trackPageview\']\r\n];\r\n");
Line 11857:
Line 11858: #line 162 "C:\octopus\https\current\_summary.aspx"
Line 11859:@__w.Write( ga_ecommerce );
Line 11860:
Line 11861:
Line 11862: #line default
Line 11863: #line hidden
Line 11864: @__w.Write("\r\n");
Line 11865:
Line 11866: #line 163 "C:\octopus\https\current\_summary.aspx"
Line 11867:
Line 11868:
Line 11869:}
Line 11870:
Line 11871:
Line 11872:
Line 11873: #line default
Line 11874: #line hidden
Line 11875: @__w.Write("\r\n/* GOOGLE_DEPRECATED */\r\n\r\n// ]]>\r\n</script>\r\n\r\n </div>\r\n</div>\r\n</form>\r\n");
Line 11876:
Line 11877: #line 176 "C:\octopus\https\current\_summary.aspx"
Line 11878:
Line 11879:
Line 11880:Response.Write( Generics.ClosePointer(shopId,4) );
Line 11881:
Line 11882:/* GOOGLE_DEPRECATED */
Line 11883:googlePurchConv = Convert.ToString( shop.getConfig("Google-PurchConv") );
Line 11884:if( googlePurchConv.Length > 0 && !hideGoogleConfig ) {
Line 11885: googlePurchConv = googlePurchConv.Replace("[? order_ref ?]", order_ref );
Line 11886: googlePurchConv = googlePurchConv.Replace("[? order_total ?]", Convert.ToString(order_total).Replace(",", ".") );
Line 11887: Response.Write( googlePurchConv );
Line 11888:}
Line 11889:
Line 11890:Response.Write( shop.getConfig("Google-SSL") );
Line 11891:
Line 11892:if( google_merchant_id != "" ) {
Line 11893: string estimated_delivery_date = order_date.AddDays(16).ToString("yyyy-MM-dd");
Line 11894: try {
Line 11895: object o = JavaScriptDeserializer.DeserializeFromJson(ZenTools.getNote("TRANSPORTADORA", order_notes), typeof(NameValueCollection));
Line 11896: int d = Convert.ToInt32( ((NameValueCollection)o)["eta"].Split(' ')[0] );
Line 11897: estimated_delivery_date = order_date.AddDays(d).ToString("yyyy-MM-dd");
Line 11898: } catch(Exception ex) {
Line 11899: // Transporter data parser error.
Line 11900: }
Line 11901:
Line 11902:
Line 11903:
Line 11904: #line default
Line 11905: #line hidden
Line 11906: this.WriteUTF8ResourceString(@__w, 62488, 266, true);
Line 11907:
Line 11908: #line 207 "C:\octopus\https\current\_summary.aspx"
Line 11909: @__w.Write( google_merchant_id );
Line 11910:
Line 11911:
Line 11912: #line default
Line 11913: #line hidden
Line 11914: @__w.Write(",\r\n\t\t\t\"order_id\": \"");
Line 11915:
Line 11916: #line 208 "C:\octopus\https\current\_summary.aspx"
Line 11917: @__w.Write( order_ref );
Line 11918:
Line 11919:
Line 11920: #line default
Line 11921: #line hidden
Line 11922: @__w.Write("\",\r\n\t\t\t\"email\": \"");
Line 11923:
Line 11924: #line 209 "C:\octopus\https\current\_summary.aspx"
Line 11925: @__w.Write( user_email );
Line 11926:
Line 11927:
Line 11928: #line default
Line 11929: #line hidden
Line 11930: @__w.Write("\",\r\n\t\t\t\"delivery_country\": \"BR\",\r\n\t\t\t\"estimated_delivery_date\": \"");
Line 11931:
Line 11932: #line 211 "C:\octopus\https\current\_summary.aspx"
Line 11933: @__w.Write( estimated_delivery_date );
Line 11934:
Line 11935:
Line 11936: #line default
Line 11937: #line hidden
Line 11938: @__w.Write("\"\r\n\t\t});\r\n\t});\r\n}\r\n</script>\r\n");
Line 11939:
Line 11940: #line 216 "C:\octopus\https\current\_summary.aspx"
Line 11941:
Line 11942:
Line 11943:}
Line 11944:
Line 11945:/* GOOGLE_DEPRECATED */
Line 11946:
Line 11947:
Line 11948: #line default
Line 11949: #line hidden
Line 11950:
Line 11951: #line 222 "C:\octopus\https\current\_summary.aspx"
Line 11952:
Line 11953:
Line 11954:if( social.google != null && ZenTools.getNote("GTM_PURCHASE_SENDED", order_notes) != "true" ) {
Line 11955: Generics.setNote( shop.Path, orderId, "GTM_PURCHASE_SENDED", "true");
Line 11956:
Line 11957:
Line 11958:
Line 11959: #line default
Line 11960: #line hidden
Line 11961: @__w.Write("\r\n<script>\r\n/* GOOGLE_TAG_MANAGER */\r\ndataLayer.push({\r\n\t\'ecommerce\': {\r\n\t\t\'purch" +
Line 11962: "ase\': {\r\n\t\t\t\'actionField\': {\r\n\t\t\t\t\'id\': \'");
Line 11963:
Line 11964: #line 234 "C:\octopus\https\current\_summary.aspx"
Line 11965: @__w.Write( order_ref );
Line 11966:
Line 11967:
Line 11968: #line default
Line 11969: #line hidden
Line 11970: @__w.Write("\',\r\n\t\t\t\t\'affiliation\': \'");
Line 11971:
Line 11972: #line 235 "C:\octopus\https\current\_summary.aspx"
Line 11973: @__w.Write( shop.Title );
Line 11974:
Line 11975:
Line 11976: #line default
Line 11977: #line hidden
Line 11978: @__w.Write("\',\r\n\t\t\t\t\'revenue\': \'");
Line 11979:
Line 11980: #line 236 "C:\octopus\https\current\_summary.aspx"
Line 11981: @__w.Write( string.Format( "{0:0.00}", order_total - order_charge).Replace(",", ".") );
Line 11982:
Line 11983:
Line 11984: #line default
Line 11985: #line hidden
Line 11986: @__w.Write("\',\r\n\t\t\t\t\'shipping\': \'");
Line 11987:
Line 11988: #line 237 "C:\octopus\https\current\_summary.aspx"
Line 11989: @__w.Write( string.Format( "{0:0.00}", order_charge ).Replace(",", ".") );
Line 11990:
Line 11991:
Line 11992: #line default
Line 11993: #line hidden
Line 11994: @__w.Write("\',\r\n\t\t\t\t\'coupon\': \'");
Line 11995:
Line 11996: #line 238 "C:\octopus\https\current\_summary.aspx"
Line 11997: @__w.Write( order_coupon );
Line 11998:
Line 11999:
Line 12000: #line default
Line 12001: #line hidden
Line 12002: @__w.Write("\'\r\n\t\t\t},\r\n\t\t\t\'products\': ");
Line 12003:
Line 12004: #line 240 "C:\octopus\https\current\_summary.aspx"
Line 12005: @__w.Write( gtm_purchase_products.ToString() );
Line 12006:
Line 12007:
Line 12008: #line default
Line 12009: #line hidden
Line 12010: @__w.Write("\r\n\t\t}\r\n\t}\r\n});\r\n/* GOOGLE_TAG_MANAGER */\r\n</script>\r\n");
Line 12011:
Line 12012: #line 246 "C:\octopus\https\current\_summary.aspx"
Line 12013: }
Line 12014:
Line 12015: #line default
Line 12016: #line hidden
Line 12017:
Line 12018: #line 540 "C:\octopus\https\current\dsp_system.aspx"
Line 12019:
Line 12020: break;
Line 12021:
Line 12022: case "PAY":
Line 12023:
Line 12024:
Line 12025: #line default
Line 12026: #line hidden
Line 12027: @__w.Write("<div id=\"billing\" class=\"full\">\n <h1><span>FORMAS DE PAGAMENTO</span></h1>\n <di" +
Line 12028: "v class=\"hr\"><hr /></div>\n <div id=\"billing-body\" class=\"full-body\">\n\t<div id=\"" +
Line 12029: "billing-payment\">\n");
Line 12030:
Line 12031: #line 6 "C:\octopus\https\current\_payment.aspx"
Line 12032: Line 12033:Line 12034:Line 12035:Line 12036:if( msg != "" ) {Line 12037: Response.Write( " <div class='error'>\n" );Line 12038: Response.Write( " <p class='error-title' style='text-align: center;'>Por favor antes de prosseguir algumas informações necessitam de sua atenção:</p>\n" );Line 12039: Response.Write( " <ul>\n" );Line 12040: Response.Write( " <li class='error-list'>" + msg + "</li>\n" );Line 12041: Response.Write( " </ul>\n" );Line 12042: Response.Write( " </div>\n" );Line 12043:}Line 12044:Line 12045:Line 12046:Line 12047:orderId = 0;Line 12048:if( null != Request.QueryString["oid"] && !Request.QueryString["oid"].Equals("") ) {Line 12049: orderId = Convert.ToInt32(Request.QueryString["oid"]);Line 12050:} else {Line 12051: Response.Write( "Please provide a @oid param." );Line 12052: Response.End();Line 12053:}Line 12054:Line 12055:int pay_codUser = 0; Line 12056:int pay_codPayment = 0; Line 12057:int pay_status = 0;Line 12058:int pay_parcels = 0; Line 12059:int pay_items = 0; Line 12060:decimal pay_charge = 0; Line 12061:decimal pay_stCharge = 0; Line 12062:decimal pay_factor = 1; Line 12063:decimal pay_vtransl = 0; Line 12064:decimal pay_dcValue = 0; Line 12065:decimal pay_discBt = 0; Line 12066:decimal pay_interest = 0; Line 12067:decimal pay_ccvtransl = 0; Line 12068:decimal pay_ccValue = 0; Line 12069:decimal pay_itemsTotal = 0; Line 12070:decimal pay_promFxDisc = 0; Line 12071:decimal pay_parcelPrc = 0; Line 12072:decimal pay_subTotal = 0; Line 12073:decimal pay_total = 0; Line 12074:string pay_name = ""; Line 12075:string pay_notes = ""; Line 12076:bool pay_isEOF = false; Line 12077:bool pay_print = false;Line 12078:Line 12079:DateTime pay_date = DateTime.Now;Line 12080:StringBuilder Sb_ps = new StringBuilder(); // payment shortcutsLine 12081:StringBuilder Sb_p = new StringBuilder(); // paymentsLine 12082:Line 12083:conn = new SqlConnection(shop.Path);Line 12084:conn.Open();Line 12085:Line 12086:query = "SELECT "Line 12087: + "sys_orders.codUser, "Line 12088: + "sys_orders.status, "Line 12089: + "sys_orders.charge, "Line 12090: + "sys_orders.stCharge, "Line 12091: + "sys_orders.factor, "Line 12092: + "sys_orders.vtransl, "Line 12093: + "sys_orders.discBt, "Line 12094: + "sys_orders.parcels, "Line 12095: + "sys_orders.interest, "Line 12096: + "sys_orders.ccvtransl, "Line 12097: + "sys_orders.[date], "Line 12098: + "sys_orders.notes "Line 12099: + "FROM sys_orders "Line 12100: + "INNER JOIN sys_payInfos ON sys_orders.codPayment = sys_payInfos.codPayment "Line 12101: + "INNER JOIN sys_users ON sys_orders.codUser = sys_users.codUser "Line 12102: + "WHERE (sys_orders.codOrder = @sys_orders_codOrder)"Line 12103: ;Line 12104:Line 12105:cmd = new SqlCommand(query, conn);Line 12106:cmd.Parameters.Add(new SqlParameter("@sys_orders_codOrder", SqlDbType.Int));Line 12107:cmd.Parameters["@sys_orders_codOrder"].Value = orderId;Line 12108:rdr = cmd.ExecuteReader();Line 12109:Line 12110:if(rdr.Read()) {Line 12111: pay_codUser = Convert.ToInt32(rdr["codUser"]);Line 12112: pay_status = Convert.ToInt32(rdr["status"]);Line 12113: pay_charge = Convert.ToDecimal(rdr["charge"]);Line 12114: pay_stCharge = Convert.ToDecimal(rdr["stCharge"]);Line 12115: pay_factor = Convert.ToDecimal(rdr["factor"]);Line 12116: pay_vtransl = Convert.ToDecimal(rdr["vtransl"]);Line 12117: pay_discBt = Convert.ToDecimal(rdr["discBt"]);Line 12118: pay_parcels = Convert.ToInt32(rdr["parcels"]);Line 12119: pay_interest = Convert.ToDecimal(rdr["interest"]);Line 12120: pay_ccvtransl = Convert.ToDecimal(rdr["ccvtransl"]);Line 12121: pay_date = Convert.ToDateTime(rdr["date"]);Line 12122: pay_notes = Convert.ToString(rdr["notes"]);Line 12123:}Line 12124:rdr.Close();Line 12125:Line 12126:if( pay_status != 1 ) {Line 12127: conn.Close();Line 12128: Response.Redirect(Line 12129: String.Format(Line 12130: "{0}{1}&mi=MRD&msgtype=error&msg={2}",Line 12131: shop.Https, thisConfig , Server.UrlEncode("Houve algum problema:[br]Você tentou iniciar o pagamento de um pedido que já foi pago ou está cancelado.")Line 12132: )Line 12133: );Line 12134: Response.End();Line 12135:}Line 12136:Line 12137:Line 12138:Line 12139:Line 12140:Line 12141:try {Line 12142: object Config = JavaScriptDeserializer.DeserializeFromJson( shop.getConfig("UseCreditCardPaymentCheck"), typeof(NameValueCollection));Line 12143:Line 12144: // check attempts and timeoutLine 12145: int attempts = 0;Line 12146: if( ZenTools.getNote("ATTEMPTS", pay_notes).Trim() != "" ) {Line 12147: attempts = Convert.ToInt32(ZenTools.getNote("ATTEMPTS", pay_notes).Trim());Line 12148: }Line 12149:Line 12150: if(Line 12151: pay_status == 1 &&Line 12152: ((NameValueCollection)Config)["cancel"] == "true" &&Line 12153: (Line 12154: attempts >= Convert.ToInt32(((NameValueCollection)Config)["retryLimit"]) ||Line 12155: DateTime.Now > ( Convert.ToDateTime(pay_date).AddMinutes( Convert.ToDouble(((NameValueCollection)Config)["timeout"]) ) )Line 12156: )Line 12157: ) {Line 12158: // cancel orderLine 12159: string ret = ZenTools.WebReq( shop.Https + "~~updStock.asp?sid=" + shopId + "&oidst=" + orderId + ";0&origin=CREDIT_CARD_PAYMENT_CHECK" );Line 12160: if( ret == "SUCCESS" ) {Line 12161: // redirect userLine 12162: Response.Redirect( shop.Https + thisConfig + "&mi=MRD&msgtype=error&msg=" + Server.UrlEncode("Seu pedido foi cancelado. Por favor refaça o pedido e tente novamente.") );Line 12163: Response.End();Line 12164: }Line 12165: }Line 12166:} catch(Exception e) {Line 12167: Response.Write( "<!-- " + e.Message + " : " + e.Source + " : " + e.StackTrace + "-->" );Line 12168:}Line 12169:Line 12170:Line 12171:Line 12172:Line 12173:Line 12174:query = "SELECT codOrder, ref, name, prc, qt, json FROM sys_ordersBodies "Line 12175: + "WHERE codOrder = @sys_ordersBodies_codOrder ORDER BY dspOrder, name"Line 12176: ;Line 12177:cmd = new SqlCommand(query, conn);Line 12178:cmd.Parameters.Add(new SqlParameter("@sys_ordersBodies_codOrder", SqlDbType.Int));Line 12179:cmd.Parameters["@sys_ordersBodies_codOrder"].Value = orderId;Line 12180:rdr = cmd.ExecuteReader();Line 12181:Line 12182:while(rdr.Read()) {Line 12183: // promotion checkLine 12184: if( rdr["json"] != DBNull.Value && Convert.ToString(rdr["json"]) != "" ) {Line 12185: try {Line 12186: object oJson = JavaScriptDeserializer.DeserializeFromJson( Convert.ToString(rdr["json"]), typeof(NameValueCollection));Line 12187: if( ((NameValueCollection)oJson)["Promotion"] != "" ) {Line 12188: oJson = JavaScriptDeserializer.DeserializeFromJson(((NameValueCollection)oJson)["Promotion"], typeof(NameValueCollection));Line 12189: if( ((NameValueCollection)oJson)["discountType"] == "fixed" ) {Line 12190: pay_promFxDisc += Convert.ToDecimal(((NameValueCollection)oJson)["discountValue"]);Line 12191: }Line 12192: }Line 12193: } catch( Exception ex ) {}Line 12194: }Line 12195:Line 12196: pay_itemsTotal += (decimal)rdr["prc"] * (int)rdr["qt"];Line 12197:}Line 12198:Line 12199:rdr.Close();Line 12200:Line 12201:Line 12202:Line 12203:if( shop.UseDC ) {Line 12204: query = "SELECT SUM([value]) AS dcValue FROM rel_ordersWdc_n_gc WHERE (codOrder = @rel_ordersWdc_n_gc_codOrder)";Line 12205:Line 12206: cmd = new SqlCommand(query, conn);Line 12207: cmd.Parameters.Add(new SqlParameter("@rel_ordersWdc_n_gc_codOrder", SqlDbType.Int));Line 12208: cmd.Parameters["@rel_ordersWdc_n_gc_codOrder"].Value = orderId;Line 12209: if( cmd.ExecuteScalar() != DBNull.Value ) {Line 12210: pay_dcValue = Convert.ToDecimal(cmd.ExecuteScalar());Line 12211: }Line 12212:}Line 12213:Line 12214:conn.Close();Line 12215:Line 12216:Line 12217:Line 12218:Line 12219:Line 12220://--[ CALCULATE ORDER SUBTOTAL: BEGIN ]-----------------------------------------Line 12221:Line 12222:pay_subTotal = pay_itemsTotal - pay_dcValue;Line 12223:Line 12224:// promotion fixed discountLine 12225:pay_subTotal = pay_subTotal - pay_promFxDisc;Line 12226:Line 12227:// buy together discountLine 12228:pay_subTotal = pay_subTotal - pay_discBt;Line 12229:Line 12230://--[ CALCULATE ORDER SUBTOTAL: END ]----------------------------------------------Line 12231:Line 12232:Line 12233:Line 12234:Line 12235:Line 12236:Billing Payment = new Billing();Line 12237:Line 12238:conn = new SqlConnection(shop.Path);Line 12239:conn.Open();Line 12240:Line 12241:query = "SELECT codPayment, payment, name, factor, vtransl FROM sys_payInfos WHERE (codPayment > 0) AND (active = 1) ORDER BY dspOrder ASC";Line 12242:Line 12243:cmd = new SqlCommand(query, conn);Line 12244:rdr = cmd.ExecuteReader();Line 12245:Line 12246:while(rdr.Read()) {Line 12247: pay_print = false;Line 12248:Line 12249: // payment acronym translate PT -> ENLine 12250: pay_name = Payment.paymentAcronymTranslate( Convert.ToString(rdr["payment"]) ).ToLower();Line 12251:Line 12252: // check available paymentsLine 12253: switch( pay_name.ToUpper() ) {Line 12254: case "CC": if( shop.UseCC ) pay_print = true; break;Line 12255: case "ET": if( shop.UseET ) pay_print = true; break;Line 12256: case "EF": if( shop.UseEF ) pay_print = true; break;Line 12257: case "BB": if( shop.UseBB ) pay_print = true; break;Line 12258: case "BD": if( shop.UseBD ) pay_print = true; break;Line 12259: case "IO": if( shop.UseIO ) pay_print = true; break;Line 12260: case "BP": if( !shop.getConfig("BPag").Equals("") ) pay_print = true; break;Line 12261: case "PS": if( !shop.getConfig("UolPagSeguro").Equals("") ) pay_print = true; break;Line 12262: case "PD": if( !shop.getConfig("PagamentoDigital").Equals("") ) pay_print = true; break;Line 12263: case "C2":Line 12264: Response.Write("Not implemented yet.");Line 12265: Response.End();Line 12266: break;Line 12267: case "CB": pay_print = true; break;Line 12268: case "DC": if( shop.UseCielo || shop.UseBrasPag ) pay_print = true; break;Line 12269: }Line 12270:Line 12271: if(pay_print) { // print available payment option shortcutLine 12272: Sb_ps.Append( " <li><a id='billing_payment_option_shortcut_" + pay_name + "' href='#billing_payment_" + pay_name.ToLower() + "'><span>" + Convert.ToString(rdr["name"]).ToUpper() + "</span></a></li>\n" );Line 12273:Line 12274: // print available payment optionLine 12275: Sb_p.Append( " <div class='hr'><hr /></div>\n" );Line 12276: Sb_p.Append( " <div id='billing_container_" + pay_name + "'>\n" );Line 12277: Sb_p.Append( " <a id='billing_payment_" + pay_name + "'>" + Convert.ToString(rdr["name"]).ToUpper() + "</a>\n" );Line 12278:Line 12279: Sb_p.Append( " <span class='paymentPrice'>" );Line 12280:Line 12281: pay_factor = Convert.ToDecimal(rdr["factor"]);Line 12282: pay_vtransl = Convert.ToDecimal(rdr["vtransl"]);Line 12283:Line 12284: pay_total = ( pay_subTotal * pay_factor ) + pay_vtransl;Line 12285: pay_total += pay_stCharge + pay_charge;Line 12286: Sb_p.Append( shop.CurrType + string.Format("{0:0.00}", Math.Round(pay_total, 2) ) );Line 12287:Line 12288: if(pay_factor < 1) Sb_p.Append( " (" + Convert.ToInt32( ( 1 - pay_factor ) * 100 ) +"% de desconto )" );Line 12289: if(pay_factor > 1) Sb_p.Append( " (" + Convert.ToInt32( ( pay_factor -1 ) * 100 ) + "% de acréscimo )" );Line 12290:Line 12291: if(pay_vtransl != 0) {Line 12292: Sb_p.Append( " (" + ((pay_vtransl > 0) ? shop.CurrType + string.Format("{0:0.00}",Math.Abs(pay_vtransl)) + " de acréscimo" : shop.CurrType + string.Format("{0:0.00}",Math.Abs(pay_vtransl)) + " de desconto") +")" );Line 12293: }Line 12294:Line 12295: Sb_p.Append( "</span><br />\n" );Line 12296:Line 12297: // print available payment formLine 12298: Sb_p.Append(Line 12299: String.Format(Line 12300: "<form id='billing-form-{0}' name='form_{0}' method='post' action='/octopus/{1}&pni=1&mi=PAY&oid={2}&op={3}&rmi=SMR'>\n"Line 12301: , pay_nameLine 12302: , thisConfigLine 12303: , orderIdLine 12304: , Convert.ToString(rdr["codPayment"])Line 12305: )Line 12306: );Line 12307:Line 12308: switch( pay_name.ToUpper() ) {Line 12309:Line 12310: case "CC":Line 12311: Sb_p.Append( " <input id='credit-card-payment-config' type='hidden' name='ccPaymentConfig' value='" + shop.ccLib + "' />\n" );Line 12312: Sb_p.Append( " <input id='credit-card-dynamic-flag' type='hidden' name='dynamicFlag' value='Default' />\n" );Line 12313: Sb_p.Append( " <font class='title'>Importante: </font>Pedidos parcelados, devem ter cartão com limite maior que o total deste pedido, não importando o valor das parcelas.<br />\n" );Line 12314: Sb_p.Append( " <font class='title'>Atenção: </font>Caso você tenha um programa anti pop-up, desative-o antes de finalizar sua compra com esta forma de pagamento.<br />\n" );Line 12315: Sb_p.Append( " <table>\n" );Line 12316: Sb_p.Append( " <tr>\n" );Line 12317: Sb_p.Append( " <td align='center' valign='top' colspan='2'>\n" );Line 12318: Sb_p.Append( " <div id='credit-card-option'>\n" );Line 12319: Sb_p.Append( " <label for='billing-selected-flag'>\n" );Line 12320:Line 12321: Sb_p.Append( Payment.getCreditCardOptions( shop.CurrType, ndd, shop.Path, shopId, 0, pay_total, UserSetup.UserGroup(shop.Path, userId), 0 ) );Line 12322:Line 12323: Sb_p.Append( " </label>\n" );Line 12324: Sb_p.Append( " </div>\n" );Line 12325: Sb_p.Append( " </td>\n" );Line 12326: Sb_p.Append( " </tr>\n" );Line 12327: Sb_p.Append( " <tr>\n" );Line 12328: Sb_p.Append( " <td width='60%'>\n" );Line 12329:Line 12330: Sb_p.Append( Payment.getCreditCardFormTable( "", "", "", "", "", "1" ) );Line 12331:Line 12332: Sb_p.Append( " </td>\n" );Line 12333: Sb_p.Append( " <td width='40%' align='right'>\n" );Line 12334: Sb_p.Append( " <input id='billing-submit-" + pay_name + "' class='click_once' type='image' src='/octopus/design/images/" + shopId + "/form_prc_cc.png' alt='Prosseguir com cartão de crédito' />\n" );Line 12335: Sb_p.Append( " </td>\n" );Line 12336: Sb_p.Append( " </tr>\n" );Line 12337: Sb_p.Append( " </table>\n" );Line 12338: break;Line 12339:Line 12340:Line 12341:Line 12342: case "ET":Line 12343: i = 0;Line 12344: pay_isEOF = true;Line 12345:Line 12346: SqlConnection hConn = new SqlConnection(ConfigurationSettings.AppSettings["coreConn"]);Line 12347: hConn.Open();Line 12348:Line 12349: query = "SELECT tbl_et.* FROM tbl_et INNER JOIN rel_coreET ON tbl_et.codET = rel_coreET.codET WHERE (rel_coreET.sid = @shopId) ORDER BY tbl_et.codET";Line 12350:Line 12351: SqlCommand hCmd = new SqlCommand(query, hConn);Line 12352: hCmd.Parameters.Add(new SqlParameter("@shopId", SqlDbType.Int));Line 12353: hCmd.Parameters["@shopId"].Value = shopId;Line 12354:Line 12355: SqlDataReader hRdr = hCmd.ExecuteReader();Line 12356:Line 12357: Sb_p.Append( " <table>\n" );Line 12358:Line 12359: while(hRdr.Read()) {Line 12360: Sb_p.Append( " <tr>\n" );Line 12361: Sb_p.Append( " <td align='center'>\n" );Line 12362: Sb_p.Append( " <input id='et-option-" + i + "' type='radio' name='et' value='"+ hRdr["codET"] +"'" );Line 12363:Line 12364: if(Line 12365: Request.QueryString["et"] != null &&Line 12366: Request.QueryString["et"] != "" &&Line 12367: Convert.ToInt32(Request.QueryString["et"]) == Convert.ToInt32(hRdr["codET"])Line 12368: ) {Line 12369: Sb_p.Append( " checked='checked' " );Line 12370: }Line 12371:Line 12372: Sb_p.Append( "/>\n" );Line 12373:Line 12374: Sb_p.Append( " <label for='et-option-" + i + "'><img src='design/images/" + hRdr["src"] + "' alt='' /></label>\n" );Line 12375: Sb_p.Append( " </td>\n" );Line 12376: Sb_p.Append( " <td><b>" + hRdr["name"] + "</b><br />" + hRdr["info"] + "</td>\n" );Line 12377: Sb_p.Append( " </tr>\n" );Line 12378: Sb_p.Append( " <tr><td colspan='2'> <br /></td></tr>\n" );Line 12379: pay_isEOF = false;Line 12380: i = i + 1;Line 12381: }Line 12382:Line 12383: hRdr.Close();Line 12384: hConn.Close();Line 12385:Line 12386: if( !pay_isEOF ) {Line 12387: Sb_p.Append( " <tr>\n" );Line 12388: Sb_p.Append( " <td colspan='2' align='right'>\n" );Line 12389: Sb_p.Append( " <input data-mode='ET' class='prc click_once' id='billing-submit-et' type='image' src='/octopus/design/images/" + shopId + "/form_prc_et.png' />\n" );Line 12390: Sb_p.Append( " </td>\n" );Line 12391: Sb_p.Append( " </tr>\n" );Line 12392: } else {Line 12393: Sb_p.Append( " <tr><td>No records found.</td></tr>\n" );Line 12394: }Line 12395:Line 12396: Sb_p.Append( " </table>\n" );Line 12397: break;Line 12398:Line 12399:Line 12400:Line 12401: case "EF":Line 12402: i = 0;Line 12403: pay_isEOF = true;Line 12404:Line 12405: Sb_p.Append( " <table>\n" );Line 12406:Line 12407: hConn = new SqlConnection(ConfigurationSettings.AppSettings["coreConn"]);Line 12408: hConn.Open();Line 12409:Line 12410: query = "SELECT tbl_ef.* FROM tbl_ef INNER JOIN rel_coreEF ON tbl_ef.codEF = rel_coreEF.codEF WHERE (rel_coreEF.sid = @shopId) ORDER BY tbl_ef.codEF";Line 12411:Line 12412: hCmd = new SqlCommand(query, hConn);Line 12413: hCmd.Parameters.Add(new SqlParameter("@shopId", SqlDbType.Int));Line 12414: hCmd.Parameters["@shopId"].Value = shopId;Line 12415:Line 12416: hRdr = hCmd.ExecuteReader();Line 12417:Line 12418: while(hRdr.Read()) {Line 12419: Sb_p.Append( " <tr>\n");Line 12420: Sb_p.Append( " <td align=\"center\">\n" );Line 12421:Line 12422: Sb_p.Append( " <input id='ef-option-" + i + "' type='radio' name='ef' value='"+ hRdr["codEF"] +"'" );Line 12423:Line 12424: if(Line 12425: Request.QueryString["ef"] != null &&Line 12426: Request.QueryString["ef"] != "" &&Line 12427: Convert.ToInt32(Request.QueryString["ef"]) == Convert.ToInt32(hRdr["codEF"])Line 12428: ) {Line 12429: Sb_p.Append( " checked='checked' " );Line 12430: }Line 12431:Line 12432: Sb_p.Append( " />\n" );Line 12433:Line 12434: Sb_p.Append( " <label for='ef-option-" + i + "'><img src='design/images/" + hRdr["src"] + "' /></td>\n" );Line 12435: Sb_p.Append( " </td>\n" );Line 12436: Sb_p.Append( " <td><b>"+ hRdr["name"] +"</b><br />"+ hRdr["info"] +"</td>\n" );Line 12437: Sb_p.Append( " </tr>\n" );Line 12438: Sb_p.Append( " <tr><td colspan='3'> <br /></td></tr>\n" );Line 12439: pay_isEOF = false;Line 12440: i = i + 1;Line 12441: }Line 12442:Line 12443: hRdr.Close();Line 12444: hConn.Close();Line 12445:Line 12446: if( !pay_isEOF ) {Line 12447: Sb_p.Append( " <tr>\n" );Line 12448: Sb_p.Append( " <td colspan='2' align='right'>\n" );Line 12449: Sb_p.Append( " <input data-mode='EF' class='prc click_once' id='billing-submit-ef' type='image' src='/octopus/design/images/" + shopId + "/form_prc_ef.png' />\n" );Line 12450: Sb_p.Append( " </td>\n" );Line 12451: Sb_p.Append( " </tr>\n" );Line 12452: } else {Line 12453: Sb_p.Append( " <tr><td>No records found.</td></tr>\n" );Line 12454: }Line 12455:Line 12456: Sb_p.Append( " </table>\n" );Line 12457: break;Line 12458:Line 12459:Line 12460:Line 12461: case "BB":Line 12462: string bbMsg = "Opção válida apenas para pagamento à vista. Acrescente "Line 12463: + "<b>3 dias úteis</b> ao prazo de entrega informado no "Line 12464: + "site, pois esse é o prazo máximo estipulado pelo "Line 12465: + "banco para disponibilizar a confirmação de pagamento. "Line 12466: + "Se você pagar o boleto com <b>cheque</b>, acrescente "Line 12467: + "<b>4 dias úteis</b>.<br /><font class='title'>Atenção: "Line 12468: + "</font>Caso você tenha um programa anti pop-up, "Line 12469: + "desative-o antes de finalizar sua compra com esta "Line 12470: + "forma de pagamento.<br />";Line 12471:Line 12472: hConn = new SqlConnection(ConfigurationSettings.AppSettings["coreConn"]);Line 12473: hConn.Open();Line 12474:Line 12475: query = "SELECT tbl_bb.* FROM rel_coreBB INNER JOIN tbl_bb ON rel_coreBB.codBB = tbl_bb.codBB WHERE (rel_coreBB.sid = @shopId );";Line 12476:Line 12477: hCmd = new SqlCommand(query, hConn);Line 12478: hCmd.Parameters.Add(new SqlParameter("@shopId", SqlDbType.Int));Line 12479: hCmd.Parameters["@shopId"].Value = shopId;Line 12480:Line 12481: hRdr = hCmd.ExecuteReader();Line 12482:Line 12483: if(hRdr.Read()) {Line 12484: Sb_p.Append( " <table>\n" );Line 12485: Sb_p.Append( " <tr>\n" );Line 12486: Sb_p.Append( " <td>\n" );Line 12487: Sb_p.Append( " <img src='design/images/" + hRdr["src"] + "' />\n");Line 12488: Sb_p.Append( " <input type='hidden' name='bb' value='" + hRdr["codBB"] + "' />\n" );Line 12489: Sb_p.Append( " </td>\n" );Line 12490: Sb_p.Append( " <td>" + bbMsg + "</td>\n" );Line 12491: Sb_p.Append( " </tr>\n" );Line 12492: Sb_p.Append( " <tr>\n" );Line 12493: Sb_p.Append( " <td colspan='2' align='right'>\n" );Line 12494: Sb_p.Append( " <input data-mode='BB' class='billing prc validations_off click_once' id='billing-submit-bb' type='image' src='/octopus/design/images/" + shopId + "/form_prc_bb.png' />\n" );Line 12495: Sb_p.Append( " </td>\n" );Line 12496: Sb_p.Append( " </tr>\n" );Line 12497: Sb_p.Append( " </table>\n" );Line 12498: }Line 12499:Line 12500: hRdr.Close();Line 12501: hConn.Close();Line 12502: break;Line 12503:Line 12504:Line 12505:Line 12506: case "BD":Line 12507: Sb_p.Append( shop.bankAccounts(true) );Line 12508: break;Line 12509:Line 12510:Line 12511:Line 12512: case "IO":Line 12513: Sb_p.Append( " <table>\n" );Line 12514: Sb_p.Append( " <tr>\n" );Line 12515: Sb_p.Append( " <td><img src='design/images/io.gif' alt='' /></td>\n" );Line 12516: Sb_p.Append( " <td><font class='title'>Opção válida apenas para revendedores</font>. A forma de pagamento faturada será combinada entre as partes posteriormente.</td>\n" );Line 12517: Sb_p.Append( " </tr>\n" );Line 12518: Sb_p.Append( " <tr>\n" );Line 12519: Sb_p.Append( " <td><span></span></td>\n" );Line 12520: Sb_p.Append( " <td>\n" );Line 12521: Sb_p.Append( " <div id='io_list'>\n" );Line 12522: Sb_p.Append( " <table>\n" );Line 12523:Line 12524: hConn = new SqlConnection(shop.Path);Line 12525: hConn.Open();Line 12526:Line 12527: query = "SELECT COUNT(*) FROM sys_io_list";Line 12528: hCmd = new SqlCommand(query, hConn);Line 12529: int tt = Convert.ToInt32(hCmd.ExecuteScalar());Line 12530:Line 12531: query = "SELECT codIO, dspValue, dspFactor FROM sys_io_list WHERE (value <= @total) ORDER BY dspOrder";Line 12532: hCmd = new SqlCommand(query, hConn);Line 12533:Line 12534: hCmd.Parameters.Add(new SqlParameter("@total", SqlDbType.Money));Line 12535: hCmd.Parameters["@total"].Value = pay_total;Line 12536:Line 12537: hRdr = hCmd.ExecuteReader();Line 12538:Line 12539: while(hRdr.Read()) {Line 12540: Sb_p.Append(" <tr>\n" );Line 12541: Sb_p.Append(" <td class='tbl_row_" + i++ % 2 + "'>\n" );Line 12542: Sb_p.Append(" <span class='io_list_button'>\n" );Line 12543:Line 12544: Sb_p.Append(" <input id='io_radio_" + (int)hRdr["codIO"] + "' type='radio' name='ioPt' value='"+ (int)hRdr["codIO"] +"'/>\n" );Line 12545:Line 12546: Sb_p.Append(" <label for='io_radio_" + (int)hRdr["codIO"] + "'>\n" );Line 12547: Sb_p.Append(" <span class=\"io_list_value\">"+ (string)hRdr["dspValue"] +"</span>\n" );Line 12548: Sb_p.Append(" <span class=\"io_list_factor\">("+ (string)hRdr["dspFactor"] +")</span>\n" );Line 12549: Sb_p.Append(" </label>\n" );Line 12550: Sb_p.Append(" </span>\n" );Line 12551: Sb_p.Append(" </td>\n" );Line 12552: Sb_p.Append(" </tr>\n" );Line 12553: }Line 12554:Line 12555: hRdr.Close();Line 12556: hConn.Close();Line 12557:Line 12558: Sb_p.Append( " </table>\n" );Line 12559: Sb_p.Append( " </div>\n" );Line 12560: Sb_p.Append( " </td>\n" );Line 12561: Sb_p.Append( " </tr>\n" );Line 12562: Sb_p.Append( " <tr>\n" );Line 12563: Sb_p.Append( " <td colspan='2' align='right'>\n" );Line 12564: Sb_p.Append( " <input data-mode='IO' class='prc click_once' id='billing-submit-io' type='image' src='/octopus/design/images/" + shopId + "/form_prc_io.png' />\n" );Line 12565: Sb_p.Append( " </td>\n" );Line 12566: Sb_p.Append( " </tr>\n" );Line 12567: Sb_p.Append( " </table>\n" );Line 12568: break;Line 12569:Line 12570:Line 12571:Line 12572: case "BP":Line 12573: Sb_p.Append( " <p>A plataforma BPag é uma solução abrangente desenvolvida pela BoldCron para gerenciar todo o processo de pagamentos on-line, da escolha do meio de pagamento até a comunicação com as instituições financeiras no Brasil, Estados Unidos, Europa e América Latina, incluindo suas rotinas de recorrência, conciliação financeira, anti-fraude e relatórios.</p>\n" );Line 12574: Sb_p.Append( " <p>O BPag Gateway é o componente desta plataforma responsável por fazer a integração entre a loja virtual e as instituições financeiras, processando e gerenciando os pagamentos. Desta forma, o e-commerce precisa se comunicar com apenas um sistema para que as vendas de seus produtos e serviços sejam feitas por meio de cartões de crédito e débito, financiamento, boleto bancário etc., no Brasil e no exterior.</p>\n" );Line 12575: Sb_p.Append( " <table>\n" );Line 12576: Sb_p.Append( " <tr>\n" );Line 12577: Sb_p.Append( " <td align='right'>\n" );Line 12578: Sb_p.Append( " <input data-mode='BPag' class='prc validations_off click_once' id='billing-submit-bpag' type='image' src='/octopus/design/images/" + shopId + "/form_prc_bpag.png' />\n" );Line 12579: Sb_p.Append( " </td>\n" );Line 12580: Sb_p.Append( " </tr>\n" );Line 12581: Sb_p.Append( " </table>\n" );Line 12582: break;Line 12583:Line 12584:Line 12585:Line 12586: case "PS":Line 12587: Sb_p.Append( " <table>\n" );Line 12588: Sb_p.Append( " <tr>\n" );Line 12589: Sb_p.Append( " <td>\n" );Line 12590: Sb_p.Append( " <p><IMG src='https://pagseguro.uol.com.br/Imagens/Banners/btnPreferenciaCartoesBR_620x40.gif' title='Este site aceita pagamentos com Visa, MasterCard, Diners, American Express, Hipercard, Aura, Bradesco, Itaú, Unibanco, Banco do Brasil, Banco Real, saldo em conta PagSeguro e boleto.' border='0' /></p>\n" );Line 12591: Sb_p.Append( " <p>PagSeguro é um sistema de pagamentos online que permite que indivíduos e empresas possam enviar e receber pagamentos com eficiência e segurança.</p>\n" );Line 12592: Sb_p.Append( " </td>\n" );Line 12593: Sb_p.Append( " </tr>\n" );Line 12594: Sb_p.Append( " <tr>\n" );Line 12595: Sb_p.Append( " <td align='right'>\n" );Line 12596: Sb_p.Append( " <input data-mode='PagSeguro' class='prc validations_off click_once' id='billing-submit-pagseguro' type='image' src='/octopus/design/images/" + shopId + "/form_prc_ups.png' />\n" );Line 12597: Sb_p.Append( " </td>\n" );Line 12598: Sb_p.Append( " </tr>\n" );Line 12599: Sb_p.Append( " </table>\n" );Line 12600: break;Line 12601:Line 12602:Line 12603:Line 12604: case "PD":Line 12605: Sb_p.Append( " <table>\n" );Line 12606: Sb_p.Append( " <tr>\n" );Line 12607: Sb_p.Append( " <td>\n" );Line 12608: Sb_p.Append( " <p><img src='/octopus/design/images/b_cash.png' title='BCash' alt='BCash' /></p>\n" );Line 12609: Sb_p.Append( " <p>\n" );Line 12610: Sb_p.Append( " A BCash, uma empresa do grupo Buscapé, propicia uma experiência de compra extremamente amigável e segura.<br />\n" );Line 12611: Sb_p.Append( " Acesse agora e faça seu pagamento escolhendo dentre as várias opções disponíveis de cartão de crédito parcelado, boleto bancário e transferência eletrônica.\n" );Line 12612: Sb_p.Append( " </p>\n" );Line 12613: Sb_p.Append( " </td>\n" );Line 12614: Sb_p.Append( " </tr>\n" );Line 12615: Sb_p.Append( " <tr>\n" );Line 12616: Sb_p.Append( " <td align='right'>\n" );Line 12617: Sb_p.Append( " <input data-mode='PagDigital' class='prc validations_off click_once' id='billing-submit-pagdigital' type='image' src='/octopus/design/images/" + shopId + "/form_prc_bc.png' />\n" );Line 12618: Sb_p.Append( " </td>\n" );Line 12619: Sb_p.Append( " </tr>\n" );Line 12620: Sb_p.Append( " </table>\n" );Line 12621: break;Line 12622:Line 12623:Line 12624:Line 12625: case "C2":Line 12626: Sb_p.Append( "Not implemented.\n" );Line 12627: break;Line 12628:Line 12629:Line 12630:Line 12631: case "CB":Line 12632: Sb_p.Append( " <table>\n" );Line 12633: Sb_p.Append( " <tr>\n" );Line 12634: Sb_p.Append( " <td>\n" );Line 12635: Sb_p.Append( " <p><img src='/octopus/design/images/bndes.png' title='Cartão BNDES' alt='Cartão BNDES' /></p>\n" );Line 12636: Sb_p.Append( " <p>\n" );Line 12637: Sb_p.Append( " Opção válida para titulares do cartão BNDES. Selecione esta forma de pagamento e aguarde nosso contato.<br />\n" );Line 12638: Sb_p.Append( " </p>\n" );Line 12639: Sb_p.Append( " </td>\n" );Line 12640: Sb_p.Append( " </tr>\n" );Line 12641: Sb_p.Append( " <tr>\n" );Line 12642: Sb_p.Append( " <td align='right'>\n" );Line 12643: Sb_p.Append( " <input data-mode='bndes' class='prc validations_off click_once' id='billing-submit-cb' type='image' src='/octopus/design/images/" + shopId + "/form_prc_cc.png' />\n" );Line 12644: Sb_p.Append( " </td>\n" );Line 12645: Sb_p.Append( " </tr>\n" );Line 12646: Sb_p.Append( " </table>\n" );Line 12647: break;Line 12648: }Line 12649:Line 12650: Sb_p.Append( " </form>\n" );Line 12651: Sb_p.Append( " <a class='payment_options_top' href='#billing-payment' title='selecionar outra forma de pagamento'>selecionar outra forma de pagamento</a>\n" );Line 12652: Sb_p.Append( " </div>\n" );Line 12653: }Line 12654:}Line 12655:Line 12656:rdr.Close();Line 12657:conn.Close();Line 12658:Line 12659:
Line 12660:
Line 12661: #line default
Line 12662: #line hidden
Line 12663: @__w.Write("\n\n\t <ul id=\'billing_payments_options_shortcuts\'>\n");
Line 12664:
Line 12665: #line 636 "C:\octopus\https\current\_payment.aspx"
Line 12666:@__w.Write( Sb_ps.ToString() );
Line 12667:
Line 12668:
Line 12669: #line default
Line 12670: #line hidden
Line 12671: @__w.Write("\n\t </ul>\n\n\t <div id=\'billing_payments_options\'>\n");
Line 12672:
Line 12673: #line 640 "C:\octopus\https\current\_payment.aspx"
Line 12674:@__w.Write( Sb_p.ToString() );
Line 12675:
Line 12676:
Line 12677: #line default
Line 12678: #line hidden
Line 12679: this.WriteUTF8ResourceString(@__w, 62754, 6509, false);
Line 12680:
Line 12681: #line 915 "C:\octopus\https\current\_payment.aspx"
Line 12682:@__w.Write( Generics.ClosePointer(shopId, 4) );
Line 12683:
Line 12684:
Line 12685: #line default
Line 12686: #line hidden
Line 12687: @__w.Write("\n");
Line 12688:
Line 12689: #line 544 "C:\octopus\https\current\dsp_system.aspx"
Line 12690:
Line 12691: break;
Line 12692:
Line 12693: case "RGS":
Line 12694: case "MDT":
Line 12695:
Line 12696:
Line 12697: #line default
Line 12698: #line hidden
Line 12699:
Line 12700: #line 1 "C:\octopus\https\current\_register.aspx"
Line 12701:
Line 12702:
Line 12703:string customer_action = "a";
Line 12704:if(mainInclude.Equals("MDT"))
Line 12705: customer_action = "u";
Line 12706:
Line 12707:if(null!=Request.QueryString["rmi"]&&!Request.QueryString["rmi"].Equals(""))redirectMainInclude=Request.QueryString["rmi"];
Line 12708:
Line 12709:
Line 12710:
Line 12711://--( User type )---------------------------------------------------------------
Line 12712:string register_utp = "F";
Line 12713:string register_stdUtp = "";
Line 12714:
Line 12715:if( customer_action == "u" ) {
Line 12716: conn = new SqlConnection(shop.Path);
Line 12717: conn.Open();
Line 12718:
Line 12719: query = "SELECT userType FROM sys_users WHERE sys_users.codUser = @codUser;";
Line 12720: cmd = new SqlCommand(query, conn);
Line 12721: cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));
Line 12722: cmd.Parameters["@codUser"].Value = userId;
Line 12723: register_utp = Convert.ToString(cmd.ExecuteScalar());
Line 12724:
Line 12725: conn.Close();
Line 12726:} else {
Line 12727:
Line 12728: // clear old login information
Line 12729: Response.Cookies["uid"].Expires = DateTime.Now.AddHours(-1);
Line 12730: Response.Cookies["pass"].Expires = DateTime.Now.AddHours(-1);
Line 12731: thisConfig = Regex.Replace(thisConfig, @"&uid=+\d+", "");
Line 12732: userId = 0;
Line 12733:
Line 12734: if( shop.getConfig("StdUsrType").Length > 0 && ( shop.getConfig("StdUsrType") == "F" || shop.getConfig("StdUsrType") == "J" ) ){
Line 12735: register_utp = shop.getConfig("StdUsrType");
Line 12736: register_stdUtp = register_utp;
Line 12737: } else {
Line 12738: if( Request.QueryString["utp"] != "" && ( Convert.ToString(Request.QueryString["utp"]) == "F" || Convert.ToString(Request.QueryString["utp"]) == "J" ) ){
Line 12739: register_utp = Convert.ToString(Request.QueryString["utp"]);
Line 12740: }
Line 12741: }
Line 12742:}
Line 12743:
Line 12744:
Line 12745:
Line 12746://--( New Customer )------------------------------------------------------------
Line 12747:string new_customer_email = "";
Line 12748:string new_customer_code = "";
Line 12749:
Line 12750:if(
Line 12751: null != Request.Form["codeBase"] && !Request.Form["codeBase"].Equals("") &&
Line 12752: null != Request.Form["codeSuffix"] && !Request.Form["codeSuffix"].Equals("")
Line 12753:) {
Line 12754: new_customer_code = Convert.ToString(Request.Form["codeBase"]) + Convert.ToString(Request.Form["codeSuffix"]);
Line 12755:
Line 12756: if( null != Request.Form["email"] && !Request.Form["email"].Equals("") ) {
Line 12757: if( Convert.ToString(Request.Form["email"]).IndexOf("@") > -1 ) {
Line 12758: new_customer_email = Convert.ToString(Request.Form["email"]);
Line 12759: }
Line 12760: }
Line 12761:
Line 12762: if( new_customer_email.Length > 0 && new_customer_code.Length > 0 ) {
Line 12763: if( UserSetup.loginCheck(shop.Path, new_customer_email) ) {
Line 12764: string goBack = Convert.ToString(Request.ServerVariables["HTTP_REFERER"]);
Line 12765:
Line 12766: if( goBack.IndexOf("&msgtype=") > -1 )
Line 12767: goBack = goBack.Substring(0, goBack.IndexOf("&msgtype=") );
Line 12768:
Line 12769: Response.Redirect( goBack + "&msgtype=error&msg=Email já cadastrado. Caso no se lembre sua senha, clique em 'Esqueci minha senha'." );
Line 12770: }
Line 12771: if(!fromQtn) Quotation.Add(shop.Path, new_customer_email, new_customer_code, cartId);
Line 12772: }
Line 12773:}
Line 12774:
Line 12775:
Line 12776:
Line 12777:string this_userType_href = "/octopus/" + thisConfig + "&mi=RGS&rmi=" + redirectMainInclude + "&rmin=" + redirectMainIncludeNext + "&utp={utp}";
Line 12778:if( new_customer_email == "" && new_customer_code == "" ) {
Line 12779: if(
Line 12780: Request.QueryString["email"] != null && Request.QueryString["email"] != "" &&
Line 12781: Request.QueryString["code"] != null && Request.QueryString["code"] != ""
Line 12782: ) {
Line 12783: new_customer_email = Convert.ToString(Request.QueryString["email"]);
Line 12784: new_customer_code = Convert.ToString(Request.QueryString["code"]);
Line 12785: }
Line 12786:}
Line 12787:this_userType_href += "&email=" + new_customer_email + "&code=" + new_customer_code;
Line 12788:
Line 12789:
Line 12790:
Line 12791:
Line 12792:
Line 12793: #line default
Line 12794: #line hidden
Line 12795: @__w.Write("\r\n<form id=\"register\" name=\"main_form\" method=\"post\" action=\"/octopus/");
Line 12796:
Line 12797: #line 92 "C:\octopus\https\current\_register.aspx"
Line 12798: @__w.Write( thisConfig );
Line 12799:
Line 12800:
Line 12801: #line default
Line 12802: #line hidden
Line 12803: @__w.Write("&mi=RGS&pni=1&rmi=");
Line 12804:
Line 12805: #line 92 "C:\octopus\https\current\_register.aspx"
Line 12806: @__w.Write( redirectMainInclude );
Line 12807:
Line 12808:
Line 12809: #line default
Line 12810: #line hidden
Line 12811: @__w.Write("&a=");
Line 12812:
Line 12813: #line 92 "C:\octopus\https\current\_register.aspx"
Line 12814: @__w.Write( customer_action );
Line 12815:
Line 12816:
Line 12817: #line default
Line 12818: #line hidden
Line 12819: @__w.Write("&idG=");
Line 12820:
Line 12821: #line 92 "C:\octopus\https\current\_register.aspx"
Line 12822: @__w.Write( idGrid );
Line 12823:
Line 12824:
Line 12825: #line default
Line 12826: #line hidden
Line 12827: @__w.Write("\" class=\"fValidator-form\">\r\n <div id=\"register\" class=\"full\">\r\n\t<h1><span>CADAST" +
Line 12828: "RO DE USUÁRIO</span></h1>\r\n\t<div class=\"hr\"><hr /></div>\r\n\t<div id=\"register-bod" +
Line 12829: "y\" class=\"full-body\">\r\n\r\n");
Line 12830:
Line 12831: #line 98 "C:\octopus\https\current\_register.aspx"
Line 12832:@__w.Write( ( msg.Length > -1 ? "<p class='" + msgType + "' align='center'><font style='font-size:20px;'>" + msg + "</font></p>" : "" ) );
Line 12833:
Line 12834:
Line 12835: #line default
Line 12836: #line hidden
Line 12837: this.WriteUTF8ResourceString(@__w, 69263, 268, false);
Line 12838:
Line 12839: #line 107 "C:\octopus\https\current\_register.aspx"
Line 12840: @__w.Write( register_utp.ToLower() );
Line 12841:
Line 12842:
Line 12843: #line default
Line 12844: #line hidden
Line 12845: @__w.Write("\">\r\n\t\t <ul class=\"utp_tabs\">\r\n");
Line 12846:
Line 12847: #line 109 "C:\octopus\https\current\_register.aspx"
Line 12848:
Line 12849:
Line 12850:if( userId > 0 && customer_action == "u") {
Line 12851: Response.Write( "<li class='utp_tab utp_tab_activated'><a id='utp_" + register_utp.ToLower() + "'>" + ( register_utp == "F" ? "PESSOA FÍSICA" : "PESSOA JURÍDICA" ) + "</a></li>" + Environment.NewLine );
Line 12852:} else {
Line 12853: if( register_stdUtp == "" || register_stdUtp == "F" ) {
Line 12854: Response.Write( "<li class='utp_tab " + ( register_utp == "F" ? "utp_tab_activated" : "" ) + "'><a id='utp_f' href='" + this_userType_href.Replace("{utp}", "F") + "' alt='pessoa física' title='pessoa física' >PESSOA FÍSICA</a></li>" + Environment.NewLine );
Line 12855: }
Line 12856:
Line 12857: if( register_stdUtp == "" || register_stdUtp == "J" ) {
Line 12858: Response.Write( "<li class='utp_tab " + ( register_utp == "J" ? "utp_tab_activated" : "" ) + "'><a id='utp_j' href='" + this_userType_href.Replace("{utp}", "J") + "' alt='pessoa jurídica' title='pessoa jurídica' >PESSOA JURÍDICA</a></li>" + Environment.NewLine );
Line 12859: }
Line 12860:}
Line 12861:
Line 12862:
Line 12863:
Line 12864: #line default
Line 12865: #line hidden
Line 12866: @__w.Write("\r\n\t\t </ul>\r\n\t\t <input type=\"hidden\" name=\"utp\" value=\"");
Line 12867:
Line 12868: #line 125 "C:\octopus\https\current\_register.aspx"
Line 12869: @__w.Write( register_utp );
Line 12870:
Line 12871:
Line 12872: #line default
Line 12873: #line hidden
Line 12874: @__w.Write("\" />\r\n\t\t</div>\r\n");
Line 12875:
Line 12876: #line 127 "C:\octopus\https\current\_register.aspx"
Line 12877:
Line 12878:
Line 12879:// display form
Line 12880:Response.Write(
Line 12881: ZenTools.SyncWebRequest(
Line 12882: String.Format(
Line 12883: "{0}shared/__register_utp_forms.aspx{1}&a={2}&utp={3}&email={4}&code={5}"
Line 12884: , shop.Https, thisConfig, customer_action, register_utp, new_customer_email, new_customer_code
Line 12885: )
Line 12886: )
Line 12887:);
Line 12888:
Line 12889:
Line 12890:
Line 12891: #line default
Line 12892: #line hidden
Line 12893:
Line 12894: #line 143 "C:\octopus\https\current\_register.aspx"
Line 12895:@__w.Write( ( msgType != "success" ? "<div id='register_prc' align='right'><input type='image' id='register-form-submit' src='/octopus/design/images/" + shopId + "/form_prc.gif' /></div>" : "" ) );
Line 12896:
Line 12897:
Line 12898: #line default
Line 12899: #line hidden
Line 12900: this.WriteUTF8ResourceString(@__w, 69531, 952, false);
Line 12901:
Line 12902: #line 175 "C:\octopus\https\current\_register.aspx"
Line 12903: @__w.Write( shop.Phone );
Line 12904:
Line 12905:
Line 12906: #line default
Line 12907: #line hidden
Line 12908: @__w.Write(" ou email ");
Line 12909:
Line 12910: #line 175 "C:\octopus\https\current\_register.aspx"
Line 12911: @__w.Write( shop.Email );
Line 12912:
Line 12913:
Line 12914: #line default
Line 12915: #line hidden
Line 12916: this.WriteUTF8ResourceString(@__w, 70483, 381, false);
Line 12917:
Line 12918: #line 183 "C:\octopus\https\current\_register.aspx"
Line 12919: @__w.Write( shop.Phone );
Line 12920:
Line 12921:
Line 12922: #line default
Line 12923: #line hidden
Line 12924: @__w.Write(" ou email ");
Line 12925:
Line 12926: #line 183 "C:\octopus\https\current\_register.aspx"
Line 12927: @__w.Write( shop.Email );
Line 12928:
Line 12929:
Line 12930: #line default
Line 12931: #line hidden
Line 12932: this.WriteUTF8ResourceString(@__w, 70864, 3520, false);
Line 12933:
Line 12934: #line 290 "C:\octopus\https\current\_register.aspx"
Line 12935: @__w.Write( userId );
Line 12936:
Line 12937:
Line 12938: #line default
Line 12939: #line hidden
Line 12940: this.WriteUTF8ResourceString(@__w, 74384, 1314, false);
Line 12941:
Line 12942: #line 332 "C:\octopus\https\current\_register.aspx"
Line 12943: if( mainInclude == "RGS" && Sd_facebook["status"] == "active" ) Response.Write( Sd_facebook["CompleteRegistration"] );
Line 12944:
Line 12945: #line default
Line 12946: #line hidden
Line 12947: this.WriteUTF8ResourceString(@__w, 75698, 413, true);
Line 12948:
Line 12949: #line 353 "C:\octopus\https\current\_register.aspx"
Line 12950: @__w.Write( shopId );
Line 12951:
Line 12952:
Line 12953: #line default
Line 12954: #line hidden
Line 12955: this.WriteUTF8ResourceString(@__w, 76111, 835, true);
Line 12956:
Line 12957: #line 382 "C:\octopus\https\current\_register.aspx"
Line 12958: @__w.Write( shopId );
Line 12959:
Line 12960:
Line 12961: #line default
Line 12962: #line hidden
Line 12963: this.WriteUTF8ResourceString(@__w, 76946, 3687, false);
Line 12964:
Line 12965: #line 496 "C:\octopus\https\current\_register.aspx"
Line 12966: @__w.Write( shop.Https );
Line 12967:
Line 12968:
Line 12969: #line default
Line 12970: #line hidden
Line 12971: @__w.Write("/shared/__transp_add.aspx?sid=");
Line 12972:
Line 12973: #line 496 "C:\octopus\https\current\_register.aspx"
Line 12974: @__w.Write( shopId );
Line 12975:
Line 12976:
Line 12977: #line default
Line 12978: #line hidden
Line 12979: this.WriteUTF8ResourceString(@__w, 80633, 280, false);
Line 12980:
Line 12981: #line 505 "C:\octopus\https\current\_register.aspx"
Line 12982: @__w.Write( shop.Https );
Line 12983:
Line 12984:
Line 12985: #line default
Line 12986: #line hidden
Line 12987: @__w.Write("/shared/__transp_list.aspx?sid=");
Line 12988:
Line 12989: #line 505 "C:\octopus\https\current\_register.aspx"
Line 12990: @__w.Write( shopId );
Line 12991:
Line 12992:
Line 12993: #line default
Line 12994: #line hidden
Line 12995: this.WriteUTF8ResourceString(@__w, 80913, 865, true);
Line 12996:
Line 12997: #line 549 "C:\octopus\https\current\dsp_system.aspx"
Line 12998:
Line 12999: break;
Line 13000:
Line 13001: case "MRD":
Line 13002:
Line 13003:
Line 13004: #line default
Line 13005: #line hidden
Line 13006: @__w.Write("<div id=\"orders\" class=\"full\">\r\n");
Line 13007:
Line 13008: #line 2 "C:\octopus\https\current\_orders.aspx"
Line 13009:
Line 13010:
Line 13011:if( msg != "" ) {
Line 13012: Response.Write( "<p class='" + msgType + "' style='text-align:center;'><strong>" + msg + "</strong></p>\n" );
Line 13013:}
Line 13014:
Line 13015:
Line 13016:
Line 13017: #line default
Line 13018: #line hidden
Line 13019: this.WriteUTF8ResourceString(@__w, 81778, 635, false);
Line 13020:
Line 13021: #line 23 "C:\octopus\https\current\_orders.aspx"
Line 13022:@__w.Write( ZenTools.SyncWebRequest( shop.Http +"__orders_list.aspx?sid="+ shopId +"&uid="+ userId +"&cid="+ cartId) );
Line 13023:
Line 13024:
Line 13025: #line default
Line 13026: #line hidden
Line 13027: @__w.Write("\r\n\t\t</table>\r\n\r\n\t</div>\r\n</div>\r\n<script type=\"text/javascript\">\r\n\tfunction popDe" +
Line 13028: "t(c,n) {\r\n\t\twindow.open(\r\n\t\t\t\"/octopus/shared/_order.aspx?sid=");
Line 13029:
Line 13030: #line 31 "C:\octopus\https\current\_orders.aspx"
Line 13031: @__w.Write( shopId );
Line 13032:
Line 13033:
Line 13034: #line default
Line 13035: #line hidden
Line 13036: @__w.Write("&uid=");
Line 13037:
Line 13038: #line 31 "C:\octopus\https\current\_orders.aspx"
Line 13039: @__w.Write( userId );
Line 13040:
Line 13041:
Line 13042: #line default
Line 13043: #line hidden
Line 13044: @__w.Write("&oid=\"+ c +\"&old=1&coded=true\",n,\"width=870,height=768,top=0,left=0,resizable=yes" +
Line 13045: ",toolbar=no,scrollbars=yes\"\r\n\t\t);\r\n\t}\r\n</script>\r\n");
Line 13046:
Line 13047: #line 553 "C:\octopus\https\current\dsp_system.aspx"
Line 13048:
Line 13049: break;
Line 13050:
Line 13051: case "WR":
Line 13052:
Line 13053:
Line 13054: #line default
Line 13055: #line hidden
Line 13056: @__w.Write("<form id=\"main_form\" name=\"main_form\" method=\"post\" action=\"#\">\n");
Line 13057:
Line 13058: #line 2 "C:\octopus\https\current\_weddingRegistry.aspx"
Line 13059: Line 13060:Line 13061:string action = "";Line 13062:if(null != Request.QueryString["action"] && !Request.QueryString["action"].Equals("")) action = Convert.ToString(Request.QueryString["action"]);Line 13063:Line 13064:Response.Write(Line 13065: ZenTools.SyncWebRequest(Line 13066: shop.Https + "~~weddingregistry.asp?" + Regex.Replace( Convert.ToString(Request.QueryString), @"uid=\d+", "" ) +Line 13067: ( ( Convert.ToString( Request.QueryString ).IndexOf("wrid") != (-1) ) ? ("&cid=" + cartId) : crossConfig ) +Line 13068: ( ( Convert.ToString( Request.QueryString ).IndexOf("ltp").Equals(-1) ) ? "<p=wedding" : "" ) +Line 13069: "&uid=" + UID()Line 13070: )Line 13071:);Line 13072:Line 13073:if( action == "delete") {Line 13074: /* --( Kill list cookies )--------------------------------------------------- */Line 13075: Response.Cookies["wrid"].Expires = DateTime.Now;Line 13076: Response.Cookies["wrid"].Value = "-1";Line 13077: Response.Cookies["ltp"].Expires = DateTime.Now;Line 13078: Response.Cookies["ltp"].Value = "none";Line 13079:}Line 13080:Line 13081:
Line 13082:
Line 13083: #line default
Line 13084: #line hidden
Line 13085: @__w.Write("\n</form>\n");
Line 13086:
Line 13087: #line 557 "C:\octopus\https\current\dsp_system.aspx"
Line 13088:
Line 13089: break;
Line 13090:
Line 13091: case "WL":
Line 13092:
Line 13093:
Line 13094: #line default
Line 13095: #line hidden
Line 13096: @__w.Write("<form id=\"main_form\" name=\"main_form\" method=\"post\" action=\"#\">\n");
Line 13097:
Line 13098: #line 2 "C:\octopus\https\current\_wishlistRegistry.aspx"
Line 13099: Line 13100:Line 13101:action = "";Line 13102:if(null != Request.QueryString["action"] && !Request.QueryString["action"].Equals("")) action = Convert.ToString(Request.QueryString["action"]);Line 13103:Line 13104:Response.Write(Line 13105: ZenTools.SyncWebRequest(Line 13106: shop.Https + "~~wishlistregistry.asp?" + Regex.Replace( Convert.ToString(Request.QueryString), @"uid=\d+", "" ) +Line 13107: ( ( Convert.ToString( Request.QueryString ).IndexOf("wrid") != (-1) ) ? ("&cid=" + cartId) : crossConfig ) +Line 13108: ( ( listType.Equals("none") ) ? "<p=wishlist" : "" ) +Line 13109: "&uid=" + UID()Line 13110: )Line 13111:);Line 13112:Line 13113:if( action == "delete" || action == "detach" ) {Line 13114: /* --( Kill list cookies )------------------------------------------- */Line 13115: Response.Cookies["wrid"].Expires = DateTime.Now;Line 13116: Response.Cookies["wrid"].Value = "-1";Line 13117: Response.Cookies["ltp"].Expires = DateTime.Now;Line 13118: Response.Cookies["ltp"].Value = "none";Line 13119:}Line 13120:Line 13121:
Line 13122:
Line 13123: #line default
Line 13124: #line hidden
Line 13125: @__w.Write("\n</form>\n");
Line 13126:
Line 13127: #line 561 "C:\octopus\https\current\dsp_system.aspx"
Line 13128:
Line 13129: break;
Line 13130:
Line 13131: case "BL":
Line 13132:
Line 13133:
Line 13134: #line default
Line 13135: #line hidden
Line 13136: @__w.Write("<form id=\"main_form\" name=\"main_form\" method=\"post\" action=\"#\">\n");
Line 13137:
Line 13138: #line 2 "C:\octopus\https\current\_babylistRegistry.aspx"
Line 13139: Line 13140:Line 13141:action = "";Line 13142:if(null != Request.QueryString["action"] && !Request.QueryString["action"].Equals("")) action = Convert.ToString(Request.QueryString["action"]);Line 13143:Line 13144:/*Line 13145:Response.Write(Line 13146: shop.Https + "~~wishlistregistry.asp?" + Request.QueryString +Line 13147: ( ( Convert.ToString( Request.QueryString ).IndexOf("wrid") != (-1) ) ? ("&cid=" + cartId) : crossConfig ) +Line 13148: ( ( Convert.ToString( Request.QueryString ).IndexOf("ltp").Equals(-1) ) ? "<p=babylist" : "" )Line 13149:);Line 13150:Response.End();Line 13151:*/Line 13152:
Line 13153:Response.Write(Line 13154: ZenTools.SyncWebRequest(Line 13155: shop.Https + "~~wishlistregistry.asp?" + Request.QueryString +Line 13156: ( ( Convert.ToString( Request.QueryString ).IndexOf("wrid") != (-1) ) ? ("&cid=" + cartId) : crossConfig ) +Line 13157: ( ( Convert.ToString( Request.QueryString ).IndexOf("ltp").Equals(-1) ) ? "<p=babylist" : "" )Line 13158: )Line 13159:);
Line 13160:Line 13161:if( action == "delete") {Line 13162: /* --( Kill list cookies )----------------------------------------------- */Line 13163: Response.Cookies["wrid"].Expires = DateTime.Now;Line 13164: Response.Cookies["wrid"].Value = "-1";Line 13165: Response.Cookies["ltp"].Expires = DateTime.Now;Line 13166: Response.Cookies["ltp"].Value = "none";Line 13167:}Line 13168:
Line 13169:
Line 13170:
Line 13171: #line default
Line 13172: #line hidden
Line 13173: @__w.Write("\n</form>\n");
Line 13174:
Line 13175: #line 565 "C:\octopus\https\current\dsp_system.aspx"
Line 13176:
Line 13177: break;
Line 13178:
Line 13179: case "LRT":
Line 13180:
Line 13181:
Line 13182: #line default
Line 13183: #line hidden
Line 13184:
Line 13185: #line 1 "C:\octopus\http\current\shared\_alert.aspx"
Line 13186:
Line 13187:
Line 13188:string alert_href = "javascript:history.go(" + ( ( Request.QueryString["hb"] == null ) ? "-1" : Request.QueryString["hb"] ) + ");";
Line 13189:
Line 13190:if(null != Request.QueryString["href"] && !Request.QueryString["href"].Equals(""))
Line 13191: alert_href = Convert.ToString(Request.QueryString["href"]).Replace("[amp]","&");
Line 13192:
Line 13193:
Line 13194:
Line 13195: #line default
Line 13196: #line hidden
Line 13197: this.WriteUTF8ResourceString(@__w, 82413, 261, true);
Line 13198:
Line 13199: #line 15 "C:\octopus\http\current\shared\_alert.aspx"
Line 13200: @__w.Write( Convert.ToString(Request.QueryString["m"]).Replace("[br]","<br />") );
Line 13201:
Line 13202:
Line 13203: #line default
Line 13204: #line hidden
Line 13205: this.WriteUTF8ResourceString(@__w, 82674, 471, false);
Line 13206:
Line 13207: #line 23 "C:\octopus\http\current\shared\_alert.aspx"
Line 13208: @__w.Write( alert_href );
Line 13209:
Line 13210:
Line 13211: #line default
Line 13212: #line hidden
Line 13213: @__w.Write("\"><span>Clique AQUI para tentar novamente.</span></a></h2>\r\n <div class=\"h" +
Line 13214: "r\"><hr /></div>\r\n <p>Ao persistir o problema, envie um email reportando-o" +
Line 13215: " para: <a href=\"mailto:");
Line 13216:
Line 13217: #line 25 "C:\octopus\http\current\shared\_alert.aspx"
Line 13218: @__w.Write( shop.Email );
Line 13219:
Line 13220:
Line 13221: #line default
Line 13222: #line hidden
Line 13223: @__w.Write("?subject=[");
Line 13224:
Line 13225: #line 25 "C:\octopus\http\current\shared\_alert.aspx"
Line 13226: @__w.Write( shop.Title );
Line 13227:
Line 13228:
Line 13229: #line default
Line 13230: #line hidden
Line 13231: @__w.Write("] Problema ocorrido no sistema.\">");
Line 13232:
Line 13233: #line 25 "C:\octopus\http\current\shared\_alert.aspx"
Line 13234: @__w.Write( shop.Email );
Line 13235:
Line 13236:
Line 13237: #line default
Line 13238: #line hidden
Line 13239: @__w.Write("</a>.</p>\r\n </div>\r\n</div>\r\n");
Line 13240:
Line 13241: #line 569 "C:\octopus\https\current\dsp_system.aspx"
Line 13242:
Line 13243: break;
Line 13244:
Line 13245: case "FGT":
Line 13246:
Line 13247:
Line 13248: #line default
Line 13249: #line hidden
Line 13250: @__w.Write("<div id=\"signin-forgot\" class=\"full\">\n <h1><span>Identificação</" +
Line 13251: "span></h1>\n <div class=\"hr\"><hr /></div>\n");
Line 13252:
Line 13253: #line 4 "C:\octopus\https\current\_signinForgot.aspx"
Line 13254: if( msg.Length > 0 ) {
Line 13255:
Line 13256: #line default
Line 13257: #line hidden
Line 13258: @__w.Write("\n <p class=\"");
Line 13259:
Line 13260: #line 5 "C:\octopus\https\current\_signinForgot.aspx"
Line 13261: @__w.Write( msgType );
Line 13262:
Line 13263:
Line 13264: #line default
Line 13265: #line hidden
Line 13266: @__w.Write("\" align=\"center\"><strong>");
Line 13267:
Line 13268: #line 5 "C:\octopus\https\current\_signinForgot.aspx"
Line 13269: @__w.Write( msg );
Line 13270:
Line 13271:
Line 13272: #line default
Line 13273: #line hidden
Line 13274: @__w.Write("</strong></p>\n");
Line 13275:
Line 13276: #line 6 "C:\octopus\https\current\_signinForgot.aspx"
Line 13277: }
Line 13278:
Line 13279: #line default
Line 13280: #line hidden
Line 13281: @__w.Write("\n <div id=\"signin-forgot-body\" class=\"full-body\">\n\n\n");
Line 13282:
Line 13283: #line 10 "C:\octopus\https\current\_signinForgot.aspx"
Line 13284: Line 13285:Line 13286:action = Convert.ToString(Request.QueryString["action"]);Line 13287:Line 13288:switch(action) {Line 13289: case "PWD":Line 13290:Line 13291:
Line 13292:
Line 13293: #line default
Line 13294: #line hidden
Line 13295: this.WriteUTF8ResourceString(@__w, 83145, 382, false);
Line 13296:
Line 13297: #line 23 "C:\octopus\https\current\_signinForgot.aspx"
Line 13298: @__w.Write( thisConfig);
Line 13299:
Line 13300:
Line 13301: #line default
Line 13302: #line hidden
Line 13303: this.WriteUTF8ResourceString(@__w, 83527, 1440, false);
Line 13304:
Line 13305: #line 60 "C:\octopus\https\current\_signinForgot.aspx"
Line 13306: Line 13307:Line 13308: break;Line 13309: Line 13310: case "MAIL":Line 13311:Line 13312:
Line 13313:
Line 13314: #line default
Line 13315: #line hidden
Line 13316: this.WriteUTF8ResourceString(@__w, 84967, 303, false);
Line 13317:
Line 13318: #line 72 "C:\octopus\https\current\_signinForgot.aspx"
Line 13319: @__w.Write( thisConfig);
Line 13320:
Line 13321:
Line 13322: #line default
Line 13323: #line hidden
Line 13324: this.WriteUTF8ResourceString(@__w, 85270, 1152, false);
Line 13325:
Line 13326: #line 96 "C:\octopus\https\current\_signinForgot.aspx"
Line 13327: Line 13328:Line 13329: break;Line 13330: Line 13331: case "MAILUPD":Line 13332:Line 13333:
Line 13334:
Line 13335: #line default
Line 13336: #line hidden
Line 13337: this.WriteUTF8ResourceString(@__w, 86422, 296, false);
Line 13338:
Line 13339: #line 108 "C:\octopus\https\current\_signinForgot.aspx"
Line 13340: @__w.Write( thisConfig);
Line 13341:
Line 13342:
Line 13343: #line default
Line 13344: #line hidden
Line 13345: this.WriteUTF8ResourceString(@__w, 86718, 264, true);
Line 13346:
Line 13347: #line 112 "C:\octopus\https\current\_signinForgot.aspx"
Line 13348: @__w.Write( (string)Request.QueryString["eml"] );
Line 13349:
Line 13350:
Line 13351: #line default
Line 13352: #line hidden
Line 13353: this.WriteUTF8ResourceString(@__w, 86982, 420, true);
Line 13354:
Line 13355: #line 118 "C:\octopus\https\current\_signinForgot.aspx"
Line 13356: @__w.Write( thisConfig );
Line 13357:
Line 13358:
Line 13359: #line default
Line 13360: #line hidden
Line 13361: this.WriteUTF8ResourceString(@__w, 87402, 2427, false);
Line 13362:
Line 13363: #line 173 "C:\octopus\https\current\_signinForgot.aspx"
Line 13364: Line 13365:Line 13366: break;Line 13367: Line 13368: default:Line 13369: string msg_href = "javascript:history.go(-1);";Line 13370: Line 13371: if( msgType == "success" )Line 13372: msg_href = "/octopus/" + thisConfig;Line 13373:Line 13374:
Line 13375:
Line 13376: #line default
Line 13377: #line hidden
Line 13378: @__w.Write("\n <div id=\"signin-forgot-message\">\n <p><a href=\"");
Line 13379:
Line 13380: #line 185 "C:\octopus\https\current\_signinForgot.aspx"
Line 13381: @__w.Write( msg_href );
Line 13382:
Line 13383:
Line 13384: #line default
Line 13385: #line hidden
Line 13386: @__w.Write("\">Voltar</a></p>\n </div>\n");
Line 13387:
Line 13388: #line 187 "C:\octopus\https\current\_signinForgot.aspx"
Line 13389: Line 13390:Line 13391: break;Line 13392:}Line 13393:Line 13394:
Line 13395:
Line 13396: #line default
Line 13397: #line hidden
Line 13398: this.WriteUTF8ResourceString(@__w, 89829, 597, true);
Line 13399:
Line 13400: #line 573 "C:\octopus\https\current\dsp_system.aspx"
Line 13401:
Line 13402:
Line 13403: break;
Line 13404:
Line 13405: case "TMS":
Line 13406:
Line 13407:
Line 13408: #line default
Line 13409: #line hidden
Line 13410: @__w.Write("<form id=\"main_form\" name=\"main_form\" method=\"post\" action=\"#\">\n");
Line 13411:
Line 13412: #line 2 "C:\octopus\https\current\_testimonials.aspx"
Line 13413: Line 13414:Line 13415:Response.Write( ZenTools.SyncWebRequest( shop.Https + "~~testimonials.asp?" + Request.QueryString ) );Line 13416:Line 13417:
Line 13418:
Line 13419: #line default
Line 13420: #line hidden
Line 13421: @__w.Write("\n</form>\n");
Line 13422:
Line 13423: #line 578 "C:\octopus\https\current\dsp_system.aspx"
Line 13424:
Line 13425: break;
Line 13426:
Line 13427: case "PRDA":
Line 13428: break;
Line 13429:
Line 13430: default:
Line 13431: if( bllStep.Equals(1) ) {
Line 13432:
Line 13433:
Line 13434: #line default
Line 13435: #line hidden
Line 13436:
Line 13437: #line 1 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13438: customer_action = "u";
Line 13439:
Line 13440: #line default
Line 13441: #line hidden
Line 13442:
Line 13443: #line 1 "C:\octopus\http\current\shared\__user_shared.aspx"
Line 13444:
Line 13445:
Line 13446:int customer_pg = 1;
Line 13447:string customer_utp = "F";
Line 13448:int customer_sm = 1;
Line 13449:int customer_transp = 1;
Line 13450:string customer_cpny = "";
Line 13451:string customer_name = "";
Line 13452:string customer_occ = "";
Line 13453:string customer_dep = "";
Line 13454:string customer_email = "";
Line 13455:string customer_pass = "";
Line 13456:int customer_d = 1;
Line 13457:int customer_m = 1;
Line 13458:int customer_y = 1900;
Line 13459:string customer_birth = "";
Line 13460:string customer_sex = "M";
Line 13461:string customer_id1 = "";
Line 13462:string customer_id2 = "";
Line 13463:string customer_ph1 = "";
Line 13464:string customer_ph2 = "";
Line 13465:string customer_ad = "";
Line 13466:string customer_num = "";
Line 13467:string customer_add = "";
Line 13468:string customer_di = "";
Line 13469:string customer_ci = "";
Line 13470:string customer_st = "";
Line 13471:string customer_cn = "";
Line 13472:string customer_code = "";
Line 13473:string customer_notes = "";
Line 13474:string customer_pNotes = "";
Line 13475:int customer_nl = 0;
Line 13476:bool user_shared_isAdm = false;
Line 13477:if( Request.QueryString["adm"] == "true" ) {
Line 13478: user_shared_isAdm = true;
Line 13479:}
Line 13480:
Line 13481:StringDictionary pNotesDictionary = new StringDictionary();
Line 13482:
Line 13483:if(customer_action.Equals("u")) {
Line 13484: conn = new SqlConnection(shop.Path);
Line 13485: conn.Open();
Line 13486:
Line 13487: if( user_shared_isAdm ) {
Line 13488: query = "SELECT * FROM sys_users WHERE sys_users.codUser = @codUser;";
Line 13489: } else {
Line 13490: query = "SELECT * FROM sys_users WHERE sys_users.codUser = @codUser AND sys_users.active = 1;";
Line 13491: }
Line 13492: cmd = new SqlCommand(query, conn);
Line 13493: cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));
Line 13494: cmd.Parameters["@codUser"].Value = userId;
Line 13495: rdr = cmd.ExecuteReader();
Line 13496: if(rdr.Read()) {
Line 13497: customer_pg = (int)rdr["codGroup"];
Line 13498: customer_utp = (string)rdr["userType"];
Line 13499: customer_sm = (int)rdr["codSalesman"];
Line 13500: customer_transp = (int)rdr["codTransp"];
Line 13501: customer_cpny = Convert.ToString(rdr["company"]);
Line 13502: customer_name = (string)rdr["name"];
Line 13503: customer_occ = Convert.ToString(rdr["occupation"]);
Line 13504: customer_dep = Convert.ToString(rdr["department"]);
Line 13505: customer_email = (string)rdr["email"];
Line 13506: customer_pass = ( rdr["pass"] != DBNull.Value ? (string)rdr["pass"] : "" );
Line 13507:
Line 13508: if( rdr["birthday"] != DBNull.Value && rdr["birthday"] != "" ) {
Line 13509: customer_d = Convert.ToDateTime(rdr["birthday"]).Day;
Line 13510: customer_m = Convert.ToDateTime(rdr["birthday"]).Month;
Line 13511: customer_y = Convert.ToDateTime(rdr["birthday"]).Year;
Line 13512: }
Line 13513: customer_birth = Convert.ToString(customer_y + "-" + customer_m + "-" + customer_d);
Line 13514:
Line 13515: customer_sex = (string)rdr["sex"];
Line 13516: customer_id1 = (string)rdr["id1"];
Line 13517: customer_id2 = (string)rdr["id2"];
Line 13518: customer_ph1 = (string)rdr["phone1"];
Line 13519:
Line 13520: if( rdr["phone2"] != DBNull.Value ) {
Line 13521: customer_ph2 = (string)rdr["phone2"];
Line 13522: }
Line 13523:
Line 13524: customer_ad = (string)rdr["address"];
Line 13525: customer_num = (string)rdr["number"];
Line 13526: customer_add = Convert.ToString(rdr["additional"]);
Line 13527: customer_di = (string)rdr["district"];
Line 13528: customer_ci = (string)rdr["city"];
Line 13529: customer_st = (string)rdr["state"];
Line 13530: customer_cn = (string)rdr["country"];
Line 13531: customer_code = (string)rdr["zipcode"];
Line 13532: customer_notes = Convert.ToString(rdr["notes"]);
Line 13533: customer_pNotes = Convert.ToString(rdr["privateNotes"]);
Line 13534:
Line 13535: if(customer_pNotes.Length>0) {
Line 13536: string[] pNotesArray = customer_pNotes.Split('\n');
Line 13537: string[] dicPair;
Line 13538: for(int j=0;j<pNotesArray.Length;j++) {
Line 13539: dicPair = pNotesArray[j].Split(':');
Line 13540: pNotesDictionary.Add(dicPair[0].Replace("[",""),dicPair[1].Replace("]",""));
Line 13541: }
Line 13542: }
Line 13543: }
Line 13544: rdr.Close();
Line 13545:
Line 13546: query = "SELECT active FROM sys_nl_list WHERE email = @email";
Line 13547: cmd = new SqlCommand(query, conn);
Line 13548: cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar));
Line 13549: cmd.Parameters["@email"].Value = customer_email;
Line 13550: customer_nl = Convert.ToInt32(cmd.ExecuteScalar());
Line 13551: rdr.Close();
Line 13552:
Line 13553: conn.Close();
Line 13554:}
Line 13555:
Line 13556:
Line 13557:
Line 13558: #line default
Line 13559: #line hidden
Line 13560:
Line 13561: #line 2 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13562: Line 13563:Line 13564:// handle cross-device cartLine 13565:if( cartId != Convert.ToString(userId) ) {Line 13566: cartId = Convert.ToString(userId);Line 13567: Response.Cookies["cid"].Value = cartId;Line 13568: Response.Cookies["cid"].Expires = DateTime.Today.AddDays(1d);Line 13569:}Line 13570:Line 13571:// carrinho abandonadoLine 13572:if( !fromQtn )Line 13573: Quotation.Add(shop.Path, customer_email, customer_code, cartId);Line 13574:Line 13575:if( shop.Type < 2 )Line 13576: Response.Redirect( "/octopus/?sid=" + shopId + "&mi=BLL&rmi=SMR&tid=50&pni=1&op=-1&c=" + code + "&uid=" + userId );Line 13577:Line 13578:if( transporterId == 52 && shop.getConfig("SkipBilling") == "true" )Line 13579: Response.Redirect( "/octopus/?sid=" + shopId + "&mi=BLL&rmi=SMR&tid=52&pni=1&op=-1&c=" + code + "&uid=" + userId );Line 13580:Line 13581:if( Cart.ShippingCharge(shopId,cartId,userId,code,transporterId,shop.Http) == "" ) {Line 13582:Line 13583:
Line 13584:
Line 13585: #line default
Line 13586: #line hidden
Line 13587: @__w.Write("\n <div id=\'billing-transporter-not-found\'>\n <span>Oops! A transportad" +
Line 13588: "ora selecionada não está mais disponível. Por favor selecione uma nova transport" +
Line 13589: "adora.</span>\n <a href=\'");
Line 13590:
Line 13591: #line 26 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13592: @__w.Write( shop.Http );
Line 13593:
Line 13594:
Line 13595: #line default
Line 13596: #line hidden
Line 13597: @__w.Write("?mi=CRT&cid=");
Line 13598:
Line 13599: #line 26 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13600: @__w.Write( cartId );
Line 13601:
Line 13602:
Line 13603: #line default
Line 13604: #line hidden
Line 13605: @__w.Write("&uid=");
Line 13606:
Line 13607: #line 26 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13608: @__w.Write( userId );
Line 13609:
Line 13610:
Line 13611: #line default
Line 13612: #line hidden
Line 13613: @__w.Write("&f=0&funil=carrinho\'>IR PARA O CARRINHO</a>\n </div>\n </div>\n </div>\n</di" +
Line 13614: "v>\n </body>\n</html>\n");
Line 13615:
Line 13616: #line 33 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13617: Line 13618:Line 13619: Response.End();Line 13620:}Line 13621:Line 13622:
Line 13623:
Line 13624: #line default
Line 13625: #line hidden
Line 13626: @__w.Write("\n<form id=\"billing-confirmation-form\" name=\"confirmationForm\" method=\"post\" actio" +
Line 13627: "n=\"/octopus/");
Line 13628:
Line 13629: #line 39 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13630: @__w.Write( thisConfig );
Line 13631:
Line 13632:
Line 13633: #line default
Line 13634: #line hidden
Line 13635: @__w.Write("&mi=BLL&bllstp=2&funil=pagamento\">\n\n<div id=\"billing\" class=\"full\">\n <h1><span>C" +
Line 13636: "ONFIRMAR DADOS PARA ENTREGA</span></h1>\n <div class=\"hr\"><hr /></div>\n <div id" +
Line 13637: "=\"billing-body\" class=\"full-body\">\n\t<div id=\"billing-confirmation\">\n");
Line 13638:
Line 13639: #line 46 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13640: Line 13641:Line 13642:string order_contact = "";Line 13643:string order_address = "";Line 13644:string order_district = "";Line 13645:string order_additional = "";Line 13646:string order_num = "";Line 13647:string order_city = "";Line 13648:string order_state = "";Line 13649:string order_country = "";Line 13650:string order_code = code;Line 13651:string stockMessage = "";Line 13652:string readOnly = "";Line 13653:bool order_termsChk = false;Line 13654:Line 13655:Line 13656:Line 13657:Line 13658:Line 13659:/*--[ manage server side validations - BEGIN ]--------------------------------*/Line 13660:Line 13661:string key_stp1 = "bll_stp1_" + cartId;Line 13662:StringDictionary FormData = new StringDictionary();Line 13663:Line 13664:if( Request.Cookies[key_stp1] != null && Request.Cookies[key_stp1].Value != "" ) {Line 13665: //try {Line 13666: object oJson = JavaScriptDeserializer.DeserializeFromJson( ZenTools.Decrypt( Convert.ToString(Request.Cookies[key_stp1].Value).Replace(' ', '+'), shop.EncryptPass ), typeof(NameValueCollection));Line 13667: string errorsList = Convert.ToString( ((NameValueCollection)oJson)["errors"] );Line 13668: string fieldsOK = Convert.ToString( ((NameValueCollection)oJson)["fieldsOK"] );Line 13669:Line 13670: // errors listLine 13671: if( errorsList != null && errorsList != "" ) {Line 13672: Response.Write( " <div class='error'>\n" );Line 13673: Response.Write( " <p class='error-title' style='text-align: center;'>Por favor antes de prosseguir algumas informações necessitam de sua atenção:</p>\n" );Line 13674: Response.Write( " <ul>\n" );Line 13675:Line 13676: foreach( string error in errorsList.Split('|') ) {Line 13677: Response.Write( " <li class='error-list'>" + shop.mappingErrors(error) + "</li>\n" );Line 13678: }Line 13679:Line 13680: Response.Write( " </ul>\n" );Line 13681: Response.Write( " </div>\n" );Line 13682:Line 13683: // fieldsOKLine 13684: foreach( string field in fieldsOK.Split('&') ) {Line 13685: string[] arr = field.Split('=');Line 13686: if( arr.Length == 2 ) {Line 13687: FormData.Add( arr[0], arr[1] );Line 13688: }Line 13689: }Line 13690: }Line 13691:// } catch(Exception e){Line 13692:// Response.Write( " <div class='error'>\n" );Line 13693:// Response.Write( " <p class='error-title' style='text-align: center;'>Por favor antes de prosseguir algumas informaes necessitam de sua ateno:</p>\n" );Line 13694:// Response.Write( " <ul>\n" );Line 13695:// Response.Write( " <li class='error-list'>Verifique os dados digitados e tente novamente.</li>\n" );Line 13696:// Response.Write( " </ul>\n" );Line 13697:// Response.Write( " </div>\n" );Line 13698:// }Line 13699:Line 13700: // remove errors cookieLine 13701: Response.Cookies[key_stp1].Expires = DateTime.Now.AddHours(-1);Line 13702:}Line 13703:Line 13704:/*--[ manage server side validations - END ]----------------------------------*/Line 13705:Line 13706:Line 13707:Line 13708:Line 13709:Line 13710:if( wrId > 0 ) {Line 13711: Response.Write( ZenTools.SyncWebRequest( shop.Http + ZenTools.getListController(listType) + thisConfig + "&action=cartNotes&wrid=" + wrId ) );Line 13712: string[] fix = ZenTools.SyncWebRequest( shop.Https + ZenTools.getListController(listType) + thisConfig + "&action=grab&wrid=" + wrId + "&props=Name;AddressNumber;Additional" ).Split(';');Line 13713: order_contact = fix[0];Line 13714: order_num = fix[1];Line 13715: order_additional = fix[2];Line 13716:} else {Line 13717: if( order_code == customer_code ) { // delivery address = customer addressLine 13718: if( customer_utp.Equals("F") ) {Line 13719: order_contact = customer_name;Line 13720: } else {Line 13721: order_contact = customer_cpny;Line 13722: }Line 13723:Line 13724: order_address = customer_ad;Line 13725: order_num = customer_num;Line 13726: order_additional = customer_add;Line 13727: order_district = customer_di;Line 13728: order_city = customer_ci;Line 13729: order_state = customer_st;Line 13730: } else { // try recover filled form dataLine 13731: order_contact = FormData["co"];Line 13732: order_num = FormData["num"];Line 13733: order_address = FormData["ad"];Line 13734: order_additional = FormData["add"];Line 13735: order_district = FormData["di"];Line 13736: order_city = FormData["ci"];Line 13737: order_state = FormData["st"];Line 13738:Line 13739: if( FormData["termsChk"] != null && FormData["termsChk"] != "" ) {Line 13740: order_termsChk = Convert.ToBoolean(FormData["termsChk"]);Line 13741: }Line 13742:Line 13743: // load by zipcodeLine 13744: try {Line 13745: string sJson = ZenTools.SyncWebRequest(shop.Http + "shared/__cep2address.asp?sid=" + shopId + "&cep=" + order_code);Line 13746: if( sJson != "{}" ) {Line 13747: object oJson = JavaScriptDeserializer.DeserializeFromJson(sJson, typeof(NameValueCollection));Line 13748:Line 13749: if( order_address == null || order_address == "" ) {Line 13750: order_address = Convert.ToString(((NameValueCollection)oJson)["logradouro"]);Line 13751:Line 13752: if( order_address.Length > 49 ) {Line 13753: order_address = order_address.Substring(0, 49); // sigep limitLine 13754: }Line 13755: }Line 13756:Line 13757: if( order_district == null || order_district == "" ) {Line 13758: order_district = Convert.ToString(((NameValueCollection)oJson)["bairro"]);Line 13759:Line 13760: if( order_district.Length > 29 ) {Line 13761: order_district = order_district.Substring(0, 29); // sigep limitLine 13762: }Line 13763: }Line 13764:Line 13765: if( order_city == null || order_city == "" ) {Line 13766: order_city = Convert.ToString(((NameValueCollection)oJson)["cidade"]);Line 13767:Line 13768: if( order_city.Length > 29 ) {Line 13769: order_city = order_city.Substring(0, 29); // sigep limitLine 13770: }Line 13771: }Line 13772:Line 13773: if( order_state == null || order_state == "" ) {Line 13774: order_state = Convert.ToString(((NameValueCollection)oJson)["uf"]);Line 13775: }Line 13776:Line 13777: order_country = "Brasil";Line 13778: }Line 13779: } catch( Exception ex ) { /* preencher Endereço manualmente */ }Line 13780: }Line 13781:}Line 13782:Line 13783:// checagem para CEPs invlidosLine 13784:if(Line 13785: wrId <= 0Line 13786: && transporterId != 0Line 13787: && transporterId != 52Line 13788: && transporterId != 502Line 13789: && ( order_address == null || order_address == "" )Line 13790: && ( order_district == null || order_district == "" )Line 13791: && ( order_city == null || order_city == "" )Line 13792: && ( order_state == null || order_state == "" )Line 13793:) {Line 13794: // tentar localizar estado pelos 3 digitos iniciais do CEPLine 13795: conn = new SqlConnection(ConfigurationSettings.AppSettings["correioConn"]);Line 13796: conn.Open();Line 13797:Line 13798: query = "SELECT uf FROM tbl_uf WHERE (a <= @c) AND (@c <= b)";Line 13799: cmd = new SqlCommand(query, conn);Line 13800: cmd.Parameters.Add(new SqlParameter("@c", SqlDbType.NVarChar));Line 13801: cmd.Parameters["@c"].Value = order_code.Substring(0, 3) + "00000";Line 13802: order_state = Convert.ToString(cmd.ExecuteScalar());Line 13803: conn.Close();Line 13804:Line 13805: if( order_state == null || order_state == "" ) {Line 13806: Response.Redirect(Line 13807: String.Format(Line 13808: "/octopus/{0}&mi=LRT&href={1}&m={2}"Line 13809: , thisConfigLine 13810: , Server.UrlEncode( String.Format( "{0}{1}&mi=CRT&f=0", shop.Http, thisConfig.Replace("&", "[amp]") ) )Line 13811: , Server.UrlEncode( "O CEP digitado para a entrega parece ser inválido.[br]Por favor confira os dados digitados e tente novamente." )Line 13812: )Line 13813: );Line 13814: }Line 13815:}Line 13816:Line 13817:switch(transporterId) {Line 13818: case 0:Line 13819: case 52: // Retirar na loja e ListasLine 13820: if( wrId > 0 ) {Line 13821: Response.Write( "<br /><br /><h2>O ENDEREÇO DE ENTREGA SERÁ O MESMO DA LISTA ( DESEJOS / CASAMENTO / CHÁ DE BEBÊ ).</h2><br /><br />\n" );Line 13822: }Line 13823:Line 13824: if( transporterId == 52 ) {Line 13825: Response.Write( "<br /><br /><h2>RETIRAR NA LOJA.</h2><br /><br />\n" );Line 13826: }Line 13827:Line 13828:
Line 13829:
Line 13830: #line default
Line 13831: #line hidden
Line 13832: this.WriteUTF8ResourceString(@__w, 90426, 442, true);
Line 13833:
Line 13834: #line 244 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13835: Line 13836:Line 13837: break;Line 13838:Line 13839: case 501: // Nome e telefone da transportadoraLine 13840:Line 13841:
Line 13842:
Line 13843: #line default
Line 13844: #line hidden
Line 13845: this.WriteUTF8ResourceString(@__w, 90868, 267, true);
Line 13846:
Line 13847: #line 256 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13848: @__w.Write( FormData["transporter"] );
Line 13849:
Line 13850:
Line 13851: #line default
Line 13852: #line hidden
Line 13853: this.WriteUTF8ResourceString(@__w, 91135, 430, false);
Line 13854:
Line 13855: #line 268 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13856: @__w.Write( order_contact );
Line 13857:
Line 13858:
Line 13859: #line default
Line 13860: #line hidden
Line 13861: @__w.Write("\" maxlength=\"50\" />\n\t\t </td>\n\t\t</tr>\n\t\t<tr>\n\t\t <td><b>Endereço:</b></td>\n\t\t <t" +
Line 13862: "d colspan=\"3\">\n<input id=\"billing-address\" type=\"text\" class=\"a required\" name=\"" +
Line 13863: "ad\" size=\"40\" maxlength=\"50\" value=\"");
Line 13864:
Line 13865: #line 274 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13866: @__w.Write( order_address );
Line 13867:
Line 13868:
Line 13869: #line default
Line 13870: #line hidden
Line 13871: @__w.Write("\" />\n\t\t </td>\n\t\t</tr>\n\t\t<tr>\n\t\t <td><b>Número:</b></td>\n\t\t <td colspan=\"3\">\n<i" +
Line 13872: "nput id=\"billing-num\" type=\"text\" class=\"a required\" name=\"num\" size=\"10\" value=" +
Line 13873: "\"");
Line 13874:
Line 13875: #line 280 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13876: @__w.Write( order_num );
Line 13877:
Line 13878:
Line 13879: #line default
Line 13880: #line hidden
Line 13881: @__w.Write("\" maxlength=\"5\" />\n\t\t </td>\n\t\t</tr>\n\t\t<tr>\n\t\t <td>Complemento:</td>\n\t\t <td col" +
Line 13882: "span=\"3\">\n<input id=\"billing-additional\" type=\"text\" class=\"a\" name=\"add\" size=\"" +
Line 13883: "20\" value=\"");
Line 13884:
Line 13885: #line 286 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13886: @__w.Write( order_additional );
Line 13887:
Line 13888:
Line 13889: #line default
Line 13890: #line hidden
Line 13891: this.WriteUTF8ResourceString(@__w, 91565, 274, true);
Line 13892:
Line 13893: #line 296 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13894: @__w.Write( order_district );
Line 13895:
Line 13896:
Line 13897: #line default
Line 13898: #line hidden
Line 13899: @__w.Write("\" />\n\t\t </td>\n\t\t <td colspan=\"2\"><span></span></td>\n\t\t</tr>\n\t\t<tr>\n\t\t <td widt" +
Line 13900: "h=\"20%\"><b>Cidade:</b></td>\n\t\t <td width=\"40%\">\n<input id=\"billing-city\" type=\"" +
Line 13901: "text\" class=\"a required\" name=\"ci\" size=\"20\" maxlength=\"30\" value=\"");
Line 13902:
Line 13903: #line 303 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13904: @__w.Write( order_city );
Line 13905:
Line 13906:
Line 13907: #line default
Line 13908: #line hidden
Line 13909: @__w.Write("\" ");
Line 13910:
Line 13911: #line 303 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13912: @__w.Write( ( order_city != null && order_city != "" ? "readonly='true'" : "" ) );
Line 13913:
Line 13914:
Line 13915: #line default
Line 13916: #line hidden
Line 13917: @__w.Write(" />\n\t\t </td>\n\t\t <td width=\"20%\" align=\"right\"><b>Estado: </b></td>\n\t\t <td" +
Line 13918: " width=\"20%\">\n<input type=\"text\" class=\"a required\" name=\"st\" value=\"");
Line 13919:
Line 13920: #line 307 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13921: @__w.Write( order_state );
Line 13922:
Line 13923:
Line 13924: #line default
Line 13925: #line hidden
Line 13926: @__w.Write("\" size=\"4\" maxlength=\"2\" ");
Line 13927:
Line 13928: #line 307 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13929: @__w.Write( ( order_state != null && order_state != "" ? "readonly='true'" : "" ) );
Line 13930:
Line 13931:
Line 13932: #line default
Line 13933: #line hidden
Line 13934: this.WriteUTF8ResourceString(@__w, 91839, 374, false);
Line 13935:
Line 13936: #line 318 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13937: @__w.Write( code );
Line 13938:
Line 13939:
Line 13940: #line default
Line 13941: #line hidden
Line 13942: @__w.Write("\" readonly=\"true\" /></td>\n\t\t <td colspan=\"2\"><span></span></td>\n\t\t</tr>\n\t </tab" +
Line 13943: "le>\n");
Line 13944:
Line 13945: #line 322 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13946: Line 13947:Line 13948: break;Line 13949:Line 13950: case 502: // Retirar na loja com nome e RGLine 13951:Line 13952:
Line 13953:
Line 13954: #line default
Line 13955: #line hidden
Line 13956: @__w.Write("\n\t <p>Favor preencher os campos: nome e RG.</p>\n\t <table>\n\t\t<tr>\n\t\t <td width=" +
Line 13957: "\"20%\"><b>Nome:</b></td>\n\t\t <td colspan=\"3\" width=\"80%\"><input id=\"billing-name\"" +
Line 13958: " type=\"text\" class=\"a required\" name=\"name\" size=\"40\" value=\"");
Line 13959:
Line 13960: #line 333 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13961: @__w.Write( FormData["name"] );
Line 13962:
Line 13963:
Line 13964: #line default
Line 13965: #line hidden
Line 13966: @__w.Write("\" maxlength=\"65\" /></td>\n\t\t</tr>\n\t\t<tr>\n\t\t <td><b>RG:</b></td>\n\t\t <td colspan=\"" +
Line 13967: "3\"><input id=\"billing-id\" type=\"text\" class=\"a required\" name=\"id\" size=\"40\" max" +
Line 13968: "length=\"20\" \"");
Line 13969:
Line 13970: #line 337 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13971: @__w.Write( FormData["id"] );
Line 13972:
Line 13973:
Line 13974: #line default
Line 13975: #line hidden
Line 13976: this.WriteUTF8ResourceString(@__w, 92213, 471, true);
Line 13977:
Line 13978: #line 349 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13979: Line 13980:Line 13981: break;Line 13982:Line 13983: default:Line 13984:Line 13985:
Line 13986:
Line 13987: #line default
Line 13988: #line hidden
Line 13989: @__w.Write("\n\n\t <p id=\"billing-address-message\">Favor preencher os campos: nome, número e co" +
Line 13990: "mplemento (se houver). Para alterar o endereço de entrega, <a href=\"");
Line 13991:
Line 13992: #line 357 "C:\octopus\https\current\_billing_step_1.aspx"
Line 13993: @__w.Write( shop.Http + thisConfig );
Line 13994:
Line 13995:
Line 13996: #line default
Line 13997: #line hidden
Line 13998: @__w.Write("&mi=CRT&f=0\" title=\"Carrinho\">CLIQUE AQUI</a>.</p>\n\t <table>\n\t\t<tr>\n\t\t <td widt" +
Line 13999: "h=\"20%\"><b>Destinatário:</b></td>\n\t\t <td colspan=\"3\" width=\"80%\">\n<input id=\"bi" +
Line 14000: "lling-contact\" type=\"text\" class=\"a required\" name=\"co\" size=\"40\" autocomplete=\"" +
Line 14001: "off\" value=\"");
Line 14002:
Line 14003: #line 362 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14004: @__w.Write( order_contact );
Line 14005:
Line 14006:
Line 14007: #line default
Line 14008: #line hidden
Line 14009: @__w.Write("\" maxlength=\"50\" />\n\t\t </td>\n\t\t</tr>\n\t\t<tr>\n\t\t <td><b>Endereço:</b></td>\n\t\t <t" +
Line 14010: "d colspan=\"3\">\n<input id=\"billing-address\" type=\"text\" class=\"a required\" name=\"" +
Line 14011: "ad\" size=\"40\" maxlength=\"50\" value=\"");
Line 14012:
Line 14013: #line 368 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14014: @__w.Write( order_address );
Line 14015:
Line 14016:
Line 14017: #line default
Line 14018: #line hidden
Line 14019: @__w.Write("\" />\n\t\t </td>\n\t\t</tr>\n\t\t<tr>\n\t\t <td><b>Número:</b></td>\n\t\t <td colspan=\"3\">\n<i" +
Line 14020: "nput id=\"billing-num\" type=\"text\" class=\"a required\" name=\"num\" size=\"10\" value=" +
Line 14021: "\"");
Line 14022:
Line 14023: #line 374 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14024: @__w.Write( order_num );
Line 14025:
Line 14026:
Line 14027: #line default
Line 14028: #line hidden
Line 14029: @__w.Write("\" maxlength=\"5\" />\n\t\t </td>\n\t\t</tr>\n\t\t<tr>\n\t\t <td>Complemento:</td>\n\t\t <td col" +
Line 14030: "span=\"3\">\n<input id=\"billing-additional\" type=\"text\" class=\"a\" name=\"add\" size=\"" +
Line 14031: "40\" value=\"");
Line 14032:
Line 14033: #line 380 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14034: @__w.Write( order_additional );
Line 14035:
Line 14036:
Line 14037: #line default
Line 14038: #line hidden
Line 14039: this.WriteUTF8ResourceString(@__w, 92684, 274, true);
Line 14040:
Line 14041: #line 390 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14042: @__w.Write( order_district );
Line 14043:
Line 14044:
Line 14045: #line default
Line 14046: #line hidden
Line 14047: @__w.Write("\" />\n\t\t </td>\n\t\t <td colspan=\"2\"><span></span></td>\n\t\t</tr>\n\t\t<tr>\n\t\t <td widt" +
Line 14048: "h=\"20%\"><b>Cidade:</b></td>\n\t\t <td width=\"40%\">\n<input id=\"billing-city\" type=\"" +
Line 14049: "text\" class=\"a required\" name=\"ci\" size=\"20\" maxlength=\"30\" value=\"");
Line 14050:
Line 14051: #line 397 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14052: @__w.Write( order_city );
Line 14053:
Line 14054:
Line 14055: #line default
Line 14056: #line hidden
Line 14057: @__w.Write("\" ");
Line 14058:
Line 14059: #line 397 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14060: @__w.Write( ( order_city != null && order_city != "" ? "readonly='true'" : "" ) );
Line 14061:
Line 14062:
Line 14063: #line default
Line 14064: #line hidden
Line 14065: @__w.Write(" />\n\t\t </td>\n\t\t <td width=\"20%\" align=\"right\"><b>Estado: </b></td>\n\t\t <td" +
Line 14066: " width=\"20%\">\n<input type=\"text\" class=\"a required\" name=\"st\" value=\"");
Line 14067:
Line 14068: #line 401 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14069: @__w.Write( order_state );
Line 14070:
Line 14071:
Line 14072: #line default
Line 14073: #line hidden
Line 14074: @__w.Write("\" size=\"4\" maxlength=\"2\" ");
Line 14075:
Line 14076: #line 401 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14077: @__w.Write( ( order_state != null && order_state != "" ? "readonly='true'" : "" ) );
Line 14078:
Line 14079:
Line 14080: #line default
Line 14081: #line hidden
Line 14082: this.WriteUTF8ResourceString(@__w, 92958, 380, false);
Line 14083:
Line 14084: #line 414 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14085: @__w.Write( code );
Line 14086:
Line 14087:
Line 14088: #line default
Line 14089: #line hidden
Line 14090: @__w.Write("\" readonly=\"true\" />\n\t\t </td>\n\t\t <td colspan=\"2\"><span></span></td>\n\t\t</tr>\n\t " +
Line 14091: "</table>\n");
Line 14092:
Line 14093: #line 419 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14094: Line 14095:Line 14096: break;Line 14097:}Line 14098:Line 14099:Line 14100:Line 14101:if(customer_utp.Equals("J")) {Line 14102:Line 14103:
Line 14104:
Line 14105: #line default
Line 14106: #line hidden
Line 14107: @__w.Write("\n\t <table id=\"customer_transp_register\">\n\t\t<tr>\n\t\t <td><b>Transportadora: " +
Line 14108: "</b></td>\n\t\t <td><span id=\"transp_parent\">");
Line 14109:
Line 14110: #line 432 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14111: @__w.Write( Transporters.List(shopId,customer_transp,shop) );
Line 14112:
Line 14113:
Line 14114: #line default
Line 14115: #line hidden
Line 14116: this.WriteUTF8ResourceString(@__w, 93338, 1119, true);
Line 14117:
Line 14118: #line 459 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14119: Line 14120:Line 14121:}Line 14122:Line 14123:Line 14124:Line 14125:if(shop.getConfig("Salesman").Equals("1") && customer_utp == "F") {Line 14126: conn = new SqlConnection(shop.Path);Line 14127: conn.Open();Line 14128:Line 14129: query = "SELECT name FROM sys_salesmen ORDER BY name";Line 14130:Line 14131: cmd = new SqlCommand(query, conn);Line 14132: rdr = cmd.ExecuteReader();Line 14133: Response.Write("<p id='salesman'><strong>" + ( shop.getConfig("SalesmanLabel").Length > 0 ? shop.getConfig("SalesmanLabel") : "SELECIONE O VENDEDOR(A) QUE O(A) ATENDEU:" ) + "</strong> ");Line 14134: Response.Write("<select name='selSalesman'><option value='Não selecionado'>selecionar...</option>\n");Line 14135:Line 14136: while(rdr.Read()) {Line 14137: Response.Write("<option value='" + (string)rdr[0] + "'>" + (string)rdr[0] + "</option>");Line 14138: }Line 14139:Line 14140: Response.Write("</select></p>");Line 14141:Line 14142: rdr.Close();Line 14143: conn.Close();Line 14144:}Line 14145:Line 14146:if( shop.getConfig("ExtendOrderNotes") != "" ) {Line 14147: Response.Write( "<div id='extend-order-notes'>" );Line 14148: Response.Write( "<table>" );Line 14149:Line 14150: try {Line 14151:Line 14152: object oJson = JavaScriptDeserializer.DeserializeFromJson( shop.getConfig("ExtendOrderNotes"), typeof(NameValueCollection) );Line 14153:Line 14154: foreach( string field in (((NameValueCollection)oJson)["fields"]).Split('|') ) {Line 14155: Response.Write( String.Format( "<tr><td><strong>{0}:</strong></td><td>{1}</td></tr>", field, ((NameValueCollection)oJson)[field] ) );Line 14156: }Line 14157:Line 14158: } catch( Exception ex ) { /* do nothing */ }Line 14159:Line 14160: Response.Write( "</table>" );Line 14161: Response.Write( "</div>" );Line 14162:}Line 14163:Line 14164:Line 14165:Line 14166:if(shop.UseDG) {Line 14167: conn = new SqlConnection(shop.Path);Line 14168: conn.Open();Line 14169: query = "SELECT * FROM sys_dg_setup";Line 14170: cmd = new SqlCommand(query, conn);Line 14171: rdr = cmd.ExecuteReader();Line 14172: if(rdr.Read()) {Line 14173: Response.Write("<br />"+ (string)rdr["question"] +"<input type=\"checkbox\" name=\"isGift\" value=\"1\" />"+ (string)rdr["caption"] +"<br />\n");Line 14174: }Line 14175: rdr.Close();Line 14176: conn.Close();Line 14177:}Line 14178:Line 14179:Line 14180:Line 14181:if(shop.UseCM) {Line 14182: conn = new SqlConnection(shop.Path);Line 14183: conn.Open();Line 14184: query = "SELECT * FROM sys_cm_setup";Line 14185: cmd = new SqlCommand(query, conn);Line 14186: rdr = cmd.ExecuteReader();Line 14187:Line 14188: if(rdr.Read()) {Line 14189: Response.Write(" <div id=\"cardMessage\">\n");Line 14190: Response.Write(" <b>"+ (string)rdr["title"] +"</b><br />\n");Line 14191: Response.Write(" "+ (string)rdr["desc"] +"<br />\n");Line 14192: Response.Write(" <textarea id='cm' name=\"cm\" class=\"a\" onKeyPress=\"javascript:cardMessageSentinel();\"></textarea><br />\n");Line 14193: Response.Write(" "+ Convert.ToString(rdr["counterMask"]).Replace("[? maxChar ?]",Convert.ToString(rdr["maxChar"])).Replace("[? display ?]","<input type=\"text\" id='cmct' class=\"a\" name=\"cmCt\" value=\"0\" size=\"3\" disabled=\"disabled\" />") +"<br />\n");Line 14194: Response.Write(" </div>\n");Line 14195: Response.Write("<script type=\"text/javascript\">\n");Line 14196: Response.Write("function cardMessageSentinel() {\n");Line 14197: Response.Write(" var cm = document.getElementById('cm');\n");Line 14198: Response.Write(" var ct = parseInt(cm.value.length);\n");Line 14199: Response.Write(" var ac = document.getElementById('cmct');\n");Line 14200: Response.Write(" ac.value = ct;\n");Line 14201: Response.Write(" if(ct>"+ Convert.ToString((int)rdr["maxChar"]-1) +") cm.value = cm.value.substring(0,"+ Convert.ToString((int)rdr["maxChar"]-1) +");\n");Line 14202: Response.Write("}\n");Line 14203: Response.Write("</script>\n");Line 14204: }Line 14205:Line 14206: rdr.Close();Line 14207: conn.Close();Line 14208:}Line 14209:Line 14210:Line 14211:Line 14212:if(shop.UseCN) {conn = new SqlConnection(shop.Path);Line 14213: conn.Open();Line 14214: query = "SELECT * FROM sys_dg_setup";Line 14215: cmd = new SqlCommand(query, conn);Line 14216: rdr = cmd.ExecuteReader();Line 14217: if(rdr.Read()) {Line 14218: Response.Write(" <br />"+ (string)rdr["question"] +"<input type=\"checkbox\" name=\"isGift\" value=\"1\" />"+ (string)rdr["caption"] +"<br />\n");Line 14219: }Line 14220: rdr.Close();Line 14221: conn.Close();Line 14222: conn = new SqlConnection(shop.Path);Line 14223: conn.Open();Line 14224:Line 14225: query = "SELECT * FROM sys_cn_setup";Line 14226: cmd = new SqlCommand(query, conn);Line 14227: rdr = cmd.ExecuteReader();Line 14228:Line 14229: if(rdr.Read()) {Line 14230: Response.Write(" <div id=\"cellphoneNotification\">\n");Line 14231: Response.Write(" <b>" + (string)rdr["title"] + "</b><br />\n");Line 14232: Response.Write(" " + (string)rdr["desc"] + "<br />\n");Line 14233: Response.Write(" " + Convert.ToString(rdr["mask"]).Replace("[? field ?]","<input type=\"text\" class=\"a\" name=\"cp\" />") + "<br />\n");Line 14234: Response.Write(" </div>\n");Line 14235: }Line 14236:Line 14237: rdr.Close();Line 14238: conn.Close();Line 14239:}Line 14240:Line 14241:Line 14242:Line 14243:
Line 14244:
Line 14245: #line default
Line 14246: #line hidden
Line 14247: @__w.Write("\n\t\t</td>\n\t </tr>\n\t</table>\n");
Line 14248:
Line 14249: #line 587 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14250: Line 14251:Line 14252:if( !shop.getConfig("UseTermsConditions").Equals("") ) {Line 14253:Line 14254:
Line 14255:
Line 14256: #line default
Line 14257: #line hidden
Line 14258: @__w.Write("\n\t <div class=\"hr\"><hr /></div>\n\t <div id=\"billing-confirmation-terms\">\n\t\t<h2 i" +
Line 14259: "d=\"billing-confirmation-terms-title\">* Termos e Condies</h2>\n\t\t<textarea id=\"bil" +
Line 14260: "ling-confirmation-terms-text\" name=\"terms\" value=\"\" readonly=\"true\">");
Line 14261:
Line 14262: #line 595 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14263: @__w.Write( shop.getConfig("UseTermsConditions") );
Line 14264:
Line 14265:
Line 14266: #line default
Line 14267: #line hidden
Line 14268: @__w.Write("</textarea>\n\t\t<p>\n\t\t <input id=\"billing-confirmation-terms-check\" type=\"checkbo" +
Line 14269: "x\" name=\"termsChk\" class=\"a\" value=\"true\" ");
Line 14270:
Line 14271: #line 597 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14272: @__w.Write( ( order_termsChk ? "checked='checked'" : "" ) );
Line 14273:
Line 14274:
Line 14275: #line default
Line 14276: #line hidden
Line 14277: @__w.Write(" />\n\t\t <label for=\"billing-confirmation-terms-check\">Li e aceito os termos e co" +
Line 14278: "ndições.</label>\n\t\t </p>\n\t </div>\n");
Line 14279:
Line 14280: #line 601 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14281: Line 14282:Line 14283:}Line 14284:Line 14285:
Line 14286:
Line 14287: #line default
Line 14288: #line hidden
Line 14289: @__w.Write("\n\t <div id=\"billing_submit\" align=\"right\">\n\t\t<input id=\"billing-confirmation-sub" +
Line 14290: "mit\" type=\"image\" src=\"/octopus/design/images/");
Line 14291:
Line 14292: #line 607 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14293: @__w.Write( shopId );
Line 14294:
Line 14295:
Line 14296: #line default
Line 14297: #line hidden
Line 14298: @__w.Write("/form_prc.gif\">\n\t </div>\n\n\t</div>\n </div>\n</div>\n\n<input id=\'billing-transporte" +
Line 14299: "r-id\' name=\'transporterId\' type=\'hidden\' value=\'");
Line 14300:
Line 14301: #line 614 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14302: @__w.Write( transporterId );
Line 14303:
Line 14304:
Line 14305: #line default
Line 14306: #line hidden
Line 14307: @__w.Write("\' />\n\n</form>\n<script type=\"text/javascript\">\n// <![CDATA[\n\nwindow.addEvent(\"domr" +
Line 14308: "eady\", function() {\n\n");
Line 14309:
Line 14310: #line 622 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14311: if( shop.getConfig("SkipBillingStep1") == "true" ) {
Line 14312:
Line 14313: #line default
Line 14314: #line hidden
Line 14315: @__w.Write("\n\t$(\"billing-confirmation-form\").submit();\n");
Line 14316:
Line 14317: #line 624 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14318: }
Line 14319:
Line 14320: #line default
Line 14321: #line hidden
Line 14322: this.WriteUTF8ResourceString(@__w, 94457, 570, false);
Line 14323:
Line 14324: #line 642 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14325: @__w.Write( shop.Https );
Line 14326:
Line 14327:
Line 14328: #line default
Line 14329: #line hidden
Line 14330: @__w.Write("shared/__transp_add.aspx?sid=");
Line 14331:
Line 14332: #line 642 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14333: @__w.Write( shopId );
Line 14334:
Line 14335:
Line 14336: #line default
Line 14337: #line hidden
Line 14338: this.WriteUTF8ResourceString(@__w, 95027, 291, false);
Line 14339:
Line 14340: #line 651 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14341: @__w.Write( shop.Https );
Line 14342:
Line 14343:
Line 14344: #line default
Line 14345: #line hidden
Line 14346: @__w.Write("shared/__transp_list.aspx?sid=");
Line 14347:
Line 14348: #line 651 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14349: @__w.Write( shopId );
Line 14350:
Line 14351:
Line 14352: #line default
Line 14353: #line hidden
Line 14354: this.WriteUTF8ResourceString(@__w, 95318, 2045, false);
Line 14355:
Line 14356: #line 695 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14357: @__w.Write( shop.Title );
Line 14358:
Line 14359:
Line 14360: #line default
Line 14361: #line hidden
Line 14362: @__w.Write("\", \"screenName\": \"adresses\" });\n}\n/* GOOGLE_DEPRECATED */\n\n// facebook: InitiateC" +
Line 14363: "heckout\n");
Line 14364:
Line 14365: #line 700 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14366: if( Sd_facebook["status"] == "active" ) Response.Write( Sd_facebook["InitiateCheckout"] );
Line 14367:
Line 14368: #line default
Line 14369: #line hidden
Line 14370: @__w.Write("\n\n// ]]>\n</script>\n\n");
Line 14371:
Line 14372: #line 705 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14373:@__w.Write( Generics.ClosePointer(shopId,3) );
Line 14374:
Line 14375:
Line 14376: #line default
Line 14377: #line hidden
Line 14378: @__w.Write("\n<!-- GOOGLE_DEPRECATED -->\n");
Line 14379:
Line 14380: #line 707 "C:\octopus\https\current\_billing_step_1.aspx"
Line 14381:@__w.Write( shop.getConfig("Google-SSL") );
Line 14382:
Line 14383:
Line 14384: #line default
Line 14385: #line hidden
Line 14386: @__w.Write("\n<!-- GOOGLE_DEPRECATED -->\n");
Line 14387:
Line 14388: #line 586 "C:\octopus\https\current\dsp_system.aspx"
Line 14389:
Line 14390: } else {
Line 14391:
Line 14392:
Line 14393: #line default
Line 14394: #line hidden
Line 14395:
Line 14396: #line 1 "C:\octopus\https\current\_billing_step_2.aspx"
Line 14397: customer_action = "u";
Line 14398:
Line 14399: #line default
Line 14400: #line hidden
Line 14401:
Line 14402: #line 1 "C:\octopus\http\current\shared\__user_shared.aspx"
Line 14403:
Line 14404:
Line 14405:int customer_pg = 1;
Line 14406:string customer_utp = "F";
Line 14407:int customer_sm = 1;
Line 14408:int customer_transp = 1;
Line 14409:string customer_cpny = "";
Line 14410:string customer_name = "";
Line 14411:string customer_occ = "";
Line 14412:string customer_dep = "";
Line 14413:string customer_email = "";
Line 14414:string customer_pass = "";
Line 14415:int customer_d = 1;
Line 14416:int customer_m = 1;
Line 14417:int customer_y = 1900;
Line 14418:string customer_birth = "";
Line 14419:string customer_sex = "M";
Line 14420:string customer_id1 = "";
Line 14421:string customer_id2 = "";
Line 14422:string customer_ph1 = "";
Line 14423:string customer_ph2 = "";
Line 14424:string customer_ad = "";
Line 14425:string customer_num = "";
Line 14426:string customer_add = "";
Line 14427:string customer_di = "";
Line 14428:string customer_ci = "";
Line 14429:string customer_st = "";
Line 14430:string customer_cn = "";
Line 14431:string customer_code = "";
Line 14432:string customer_notes = "";
Line 14433:string customer_pNotes = "";
Line 14434:int customer_nl = 0;
Line 14435:bool user_shared_isAdm = false;
Line 14436:if( Request.QueryString["adm"] == "true" ) {
Line 14437: user_shared_isAdm = true;
Line 14438:}
Line 14439:
Line 14440:StringDictionary pNotesDictionary = new StringDictionary();
Line 14441:
Line 14442:if(customer_action.Equals("u")) {
Line 14443: conn = new SqlConnection(shop.Path);
Line 14444: conn.Open();
Line 14445:
Line 14446: if( user_shared_isAdm ) {
Line 14447: query = "SELECT * FROM sys_users WHERE sys_users.codUser = @codUser;";
Line 14448: } else {
Line 14449: query = "SELECT * FROM sys_users WHERE sys_users.codUser = @codUser AND sys_users.active = 1;";
Line 14450: }
Line 14451: cmd = new SqlCommand(query, conn);
Line 14452: cmd.Parameters.Add(new SqlParameter("@codUser", SqlDbType.Int));
Line 14453: cmd.Parameters["@codUser"].Value = userId;
Line 14454: rdr = cmd.ExecuteReader();
Line 14455: if(rdr.Read()) {
Line 14456: customer_pg = (int)rdr["codGroup"];
Line 14457: customer_utp = (string)rdr["userType"];
Line 14458: customer_sm = (int)rdr["codSalesman"];
Line 14459: customer_transp = (int)rdr["codTransp"];
Line 14460: customer_cpny = Convert.ToString(rdr["company"]);
Line 14461: customer_name = (string)rdr["name"];
Line 14462: customer_occ = Convert.ToString(rdr["occupation"]);
Line 14463: customer_dep = Convert.ToString(rdr["department"]);
Line 14464: customer_email = (string)rdr["email"];
Line 14465: customer_pass = ( rdr["pass"] != DBNull.Value ? (string)rdr["pass"] : "" );
Line 14466:
Line 14467: if( rdr["birthday"] != DBNull.Value && rdr["birthday"] != "" ) {
Line 14468: customer_d = Convert.ToDateTime(rdr["birthday"]).Day;
Line 14469: customer_m = Convert.ToDateTime(rdr["birthday"]).Month;
Line 14470: customer_y = Convert.ToDateTime(rdr["birthday"]).Year;
Line 14471: }
Line 14472: customer_birth = Convert.ToString(customer_y + "-" + customer_m + "-" + customer_d);
Line 14473:
Line 14474: customer_sex = (string)rdr["sex"];
Line 14475: customer_id1 = (string)rdr["id1"];
Line 14476: customer_id2 = (string)rdr["id2"];
Line 14477: customer_ph1 = (string)rdr["phone1"];
Line 14478:
Line 14479: if( rdr["phone2"] != DBNull.Value ) {
Line 14480: customer_ph2 = (string)rdr["phone2"];
Line 14481: }
Line 14482:
Line 14483: customer_ad = (string)rdr["address"];
Line 14484: customer_num = (string)rdr["number"];
Line 14485: customer_add = Convert.ToString(rdr["additional"]);
Line 14486: customer_di = (string)rdr["district"];
Line 14487: customer_ci = (string)rdr["city"];
Line 14488: customer_st = (string)rdr["state"];
Line 14489: customer_cn = (string)rdr["country"];
Line 14490: customer_code = (string)rdr["zipcode"];
Line 14491: customer_notes = Convert.ToString(rdr["notes"]);
Line 14492: customer_pNotes = Convert.ToString(rdr["privateNotes"]);
Line 14493:
Line 14494: if(customer_pNotes.Length>0) {
Line 14495: string[] pNotesArray = customer_pNotes.Split('\n');
Line 14496: string[] dicPair;
Line 14497: for(int j=0;j<pNotesArray.Length;j++) {
Line 14498: dicPair = pNotesArray[j].Split(':');
Line 14499: pNotesDictionary.Add(dicPair[0].Replace("[",""),dicPair[1].Replace("]",""));
Line 14500: }
Line 14501: }
Line 14502: }
Line 14503: rdr.Close();
Line 14504:
Line 14505: query = "SELECT active FROM sys_nl_list WHERE email = @email";
Line 14506: cmd = new SqlCommand(query, conn);
Line 14507: cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar));
Line 14508: cmd.Parameters["@email"].Value = customer_email;
Line 14509: customer_nl = Convert.ToInt32(cmd.ExecuteScalar());
Line 14510: rdr.Close();
Line 14511:
Line 14512: conn.Close();
Line 14513:}
Line 14514:
Line 14515:
Line 14516:
Line 14517: #line default
Line 14518: #line hidden
Line 14519: @__w.Write("\n<div id=\"billing\" class=\"full\">\n <h1><span>FORMAS DE PAGAMENTO</span></h1>\n <d" +
Line 14520: "iv class=\"hr\"><hr /></div>\n <div id=\"billing-body\" class=\"full-body\">\n\t<div id=" +
Line 14521: "\"billing-resume\">\n");
Line 14522:
Line 14523: #line 7 "C:\octopus\https\current\_billing_step_2.aspx"
Line 14524: Line 14525:Line 14526:Line 14527:Line 14528:Line 14529:Line 14530:/*--[ MANAGE SERVER SIDE VALIDATIONS - BEGIN ]--------------------------------*/Line 14531:Line 14532:string key_stp1 = "bll_stp1_" + cartId;Line 14533:string key_stp2 = "bll_stp2_" + cartId;Line 14534:StringDictionary FormDataStp1 = new StringDictionary();Line 14535:StringDictionary FormDataStp2 = new StringDictionary();Line 14536:Line 14537:if( Request.Cookies[key_stp2] != null && Request.Cookies[key_stp2].Value != "" ) {Line 14538:Line 14539: try {Line 14540: object oJson = JavaScriptDeserializer.DeserializeFromJson(Line 14541: Server.UrlDecode(Request.Cookies[key_stp2].Value),Line 14542: typeof(NameValueCollection)Line 14543: );Line 14544: string errorsList = Convert.ToString(((NameValueCollection)oJson)["errors"]);Line 14545: string fieldsOK = Convert.ToString(((NameValueCollection)oJson)["fieldsOK"]);Line 14546:Line 14547: // errors listLine 14548: if( errorsList != "" ) {Line 14549: Response.Write( " <div class='error'>\n" );Line 14550: Response.Write( " <p class='error-title' style='text-align: center;'>Por favor antes de prosseguir algumas informações necessitam de sua atenção:</p>\n" );Line 14551: Response.Write( " <ul>\n" );Line 14552:Line 14553: foreach( string error in errorsList.Split('|') ) {Line 14554: Response.Write( " <li class='error-list'>" + shop.mappingErrors(error) + "</li>\n" );Line 14555: }Line 14556:Line 14557: Response.Write( " </ul>\n" );Line 14558: Response.Write( " </div>\n" );Line 14559: }Line 14560:Line 14561: // fieldsOKLine 14562: foreach( string field in fieldsOK.Split('&') ) {Line 14563: string[] arr = field.Split('=');Line 14564: if( arr.Length == 2 ) {Line 14565: FormDataStp2.Add( arr[0], arr[1] );Line 14566: }Line 14567: }Line 14568:Line 14569: // load step 1 form dataLine 14570: if( Request.Cookies[key_stp1] != null && Request.Cookies[key_stp1].Value != "" ) {Line 14571: oJson = JavaScriptDeserializer.DeserializeFromJson(Line 14572: ZenTools.Decrypt(Request.Cookies[key_stp1].Value, shop.EncryptPass ),Line 14573: typeof(NameValueCollection)Line 14574: );Line 14575: fieldsOK = Convert.ToString( ((NameValueCollection)oJson)["fieldsOK"] );Line 14576:Line 14577: foreach( string field in fieldsOK.Split('&') ) {Line 14578: string[] arr = field.Split('=');Line 14579: if( arr.Length == 2 ) {Line 14580: FormDataStp1.Add( arr[0], arr[1] );Line 14581: }Line 14582: }Line 14583: }Line 14584: } catch(Exception e){Line 14585: Response.Write( " <ul>\n" );Line 14586: Response.Write( " <li class='error-list'>Verifique os dados digitados e tente novamente.</li>\n" );Line 14587: Response.Write( " </ul>\n" );Line 14588: }Line 14589:Line 14590: // remove errors cookieLine 14591: Response.Cookies[key_stp2].Expires = DateTime.Now.AddHours(-1);Line 14592:Line 14593:} else {Line 14594:Line 14595: // previous step validationsLine 14596: bool bll2_hasErrors = false;Line 14597: StringBuilder Errors = new StringBuilder();Line 14598: StringBuilder FieldsOk = new StringBuilder();Line 14599:Line 14600: if(Line 14601: ( Request.Form["co"] == null || Convert.ToString(Request.Form["co"]) == "" ) ||Line 14602: ( Request.Form["ad"] == null || Convert.ToString(Request.Form["ad"]) == "" ) ||Line 14603: ( Request.Form["num"] == null || Convert.ToString(Request.Form["num"]) == "" ) ||Line 14604: ( Request.Form["di"] == null || Convert.ToString(Request.Form["di"]) == "" ) ||Line 14605: ( Request.Form["ci"] == null || Convert.ToString(Request.Form["ci"]) == "" ) ||Line 14606: ( Request.Form["st"] == null || Convert.ToString(Request.Form["st"]) == "" )Line 14607: ) {Line 14608: bll2_hasErrors = true;Line 14609: Errors.Append("|bll-00001");Line 14610: }Line 14611:Line 14612: if( !shop.getConfig("UseTermsConditions").Equals("") ) {Line 14613: if( Request.Form["termsChk"] == null || Request.Form["termsChk"] == "" ) {Line 14614: bll2_hasErrors = true;Line 14615: Errors.Append("|bll-00002");Line 14616: }Line 14617: }Line 14618:Line 14619: // load fieldsOKLine 14620: foreach(string key in Request.Form) {Line 14621: FieldsOk.Append( "&" + key + "=" + ZenTools.strFilter( Request.Form[key] ) );Line 14622: }Line 14623:Line 14624: if(bll2_hasErrors) {Line 14625: string err_sJson = "{ \"errors\": \"{$errors}\", \"fieldsOK\": \"{$fieldsOK}\" }";Line 14626:Line 14627: // redirect to previous stepLine 14628: err_sJson = err_sJson.Replace( "{$errors}", Errors.ToString().Substring(1) );Line 14629: err_sJson = err_sJson.Replace( "{$fieldsOK}", FieldsOk.ToString() );Line 14630:Line 14631: Response.Cookies[key_stp1].Value = ZenTools.Encrypt(err_sJson, shop.EncryptPass);Line 14632: Response.Redirect( "/octopus/"+ thisConfig + "&mi=BLL&bllstp=1" );Line 14633: } else {Line 14634: if( Request.Cookies[key_stp1] != null && Request.Cookies[key_stp1].Value != "" ) {Line 14635: Response.Cookies[key_stp1].Expires = DateTime.Now.AddHours(-1);Line 14636: }Line 14637: Response.Cookies[key_stp1].Value = ZenTools.Encrypt( "{ \"fieldsOK\": \"" + FieldsOk.ToString() + "\" }", shop.EncryptPass );Line 14638: }Line 14639:}Line 14640:Line 14641:/*--[ MANAGE SERVER SIDE VALIDATIONS - END ]----------------------------------*/Line 14642:Line 14643:Line 14644:Line 14645:Line 14646:Line 14647:
Line 14648:
Line 14649: #line default
Line 14650: #line hidden
Line 14651: @__w.Write("\n\t <h2>RESUMO DO PEDIDO</h2>\n\t <div class=\"hr\"><hr /></div>\n");
Line 14652:
Line 14653: #line 133 "C:\octopus\https\current\_billing_step_2.aspx"
Line 14654: Line 14655:Line 14656:i = 0;Line 14657:decimal subTotal = 0;Line 14658:decimal ccTotal = 0;Line 14659:decimal shippingCharge = 0;Line 14660:decimal stCharge = 0;Line 14661:decimal factor = 0;Line 14662:decimal vtransl = 0;Line 14663:decimal total = 0;Line 14664:Line 14665:string order_code = Convert.ToString(Request.QueryString["c"]);Line 14666:string order_uf = customer_st;Line 14667:if( Request.Form["st"] != null && Convert.ToString(Request.Form["st"]) != "" ) {Line 14668: order_uf = Convert.ToString(Request.Form["st"]);Line 14669:}Line 14670:Line 14671:string stockMessage = "";Line 14672:string payment = "";Line 14673:Line 14674:int codGroup = UserSetup.UserGroup(shop.Path, userId);Line 14675:Line 14676:bool isEOF = true;Line 14677:bool printPayment = false;Line 14678:Line 14679:int w = 0;Line 14680:int v = 0;Line 14681:XmlDocument PreOrder = new XmlDocument();Line 14682:Line 14683:bool freeShippingRefused = false;Line 14684:if( Request.Cookies["octopus-fsa"] != null && Request.Cookies["octopus-fsa"].Value == "true" && transporterId != 53 ) {Line 14685: freeShippingRefused = true;Line 14686:}Line 14687:Response.Write( " <div id='cart_body'>\n" );Line 14688:Response.Write( Cart.Body(shopId, cartId, userId, true, out subTotal, out w, out v, shop, Prom, order_uf, out PreOrder, freeShippingRefused) );Line 14689:Response.Write( " </div>\n");Line 14690:Line 14691:/* --( Min order check )----------------------------------------------------- */Line 14692:decimal minOrder = shop.MinOrder;Line 14693:if( UserSetup.UserMinOrder(shop.Path, codGroup) > 0 ) {Line 14694: minOrder = UserSetup.UserMinOrder(shop.Path, codGroup);Line 14695:}Line 14696:Line 14697:if( subTotal == 0 ) {Line 14698: Response.Redirect(Line 14699: String.Format(Line 14700: "/octopus/dsp_system.aspx{0}&mi=LRT&href={1}"Line 14701: , thisConfig, shop.Http.Replace("/octopus/", "") + "&m=" + Server.UrlEncode("Valor total dos produtos não pode ser ZERO")Line 14702: )Line 14703: );Line 14704: Response.End();Line 14705:}Line 14706:Line 14707:if( subTotal > 0 && subTotal < minOrder ) {Line 14708: string minValue = shop.CurrType + string.Format("{0:0.00}", Math.Round(minOrder, 2));Line 14709: Response.Redirect( "dsp_system.aspx" + thisConfig + "&mi=LRT&href=" + shop.Http.Replace("/octopus/", "") + "&m=Pedido abaixo do valor minimo.[br] Pedido minimo: " + minValue );Line 14710: Response.End();Line 14711:}Line 14712:Line 14713:/* --( Max order check )----------------------------------------------------- */Line 14714:decimal maxOrder = ( shop.getConfig("UseMaxOrder") != "" ? Convert.ToDecimal(shop.getConfig("UseMaxOrder")) : 0 );Line 14715:if( maxOrder > 0 && subTotal > maxOrder ) {Line 14716: Response.Redirect(Line 14717: String.Format(Line 14718: "/octopus/dsp_system.aspx{0}&mi=LRT&href={1}&m=Pedido acima do valor máximo.[br] Pedido máximo: {2}",Line 14719: thisConfig,Line 14720: shop.Http.Replace("/octopus/", ""),Line 14721: shop.CurrType + string.Format("{0:0.00}", Math.Round(maxOrder, 2))Line 14722: )Line 14723: );Line 14724: Response.End();Line 14725:}Line 14726:Line 14727:if( shop.UseDC && !couponId.Equals("") ) {Line 14728: decimal couponValue = 0;Line 14729:Line 14730: Response.Write(" <div class='hr'><hr /></div>\n");Line 14731: Response.Write(" <div id='cart_dc_n_gc'>\n");Line 14732:Line 14733: if( couponId.Length > 0 ) {Line 14734: if( shop.getConfig("UseWelcomeCoupon").ToLower() == "true" ) {Line 14735: if( !Coupon.used( shop.Path, couponId, "__WELCOME__", userId ) ) {Line 14736: Response.Write( Coupon.Body(shopId, couponId, shop.CurrType, subTotal, ndd, true, out couponValue, shop) );Line 14737: }Line 14738: } else {Line 14739: Response.Write( Coupon.Body(shopId, couponId, shop.CurrType, subTotal, ndd, true, out couponValue, shop) );Line 14740: }Line 14741: }Line 14742:Line 14743: Response.Write(" </div>\n");Line 14744:Line 14745: subTotal -= couponValue;Line 14746:}Line 14747:Line 14748:string btOutput = "";Line 14749:decimal discountBt = 0;Line 14750:int comboId = 0;Line 14751:BuyTogether Bll_Bt = new BuyTogether(shopId, thisConfig, userId, cartId, shop);Line 14752:btOutput = Bll_Bt.getDiscountByCart(cartId, out discountBt, shop);Line 14753:Line 14754:if(discountBt > 0) {Line 14755: Response.Write(" <div class=\"hr\"><hr /></div>\n");Line 14756: Response.Write(" <div id=\"cart_buy_together\">\n");Line 14757: Response.Write( btOutput );Line 14758: Response.Write(" </div>\n");Line 14759: subTotal -= discountBt;Line 14760:}Line 14761:Line 14762:string[] shippingCharge_array = Convert.ToString(Cart.ShippingCharge(shopId,cartId,userId,code,transporterId,shop.Http)).Split(';');Line 14763:bool underConsult = false;Line 14764:Line 14765:if(shippingCharge_array[0] == "cantProceed") {Line 14766: Response.Redirect(shop.Https + thisConfig + "&mi=LRT&m=" + shippingCharge_array[1]);Line 14767:}Line 14768:Line 14769:if(shippingCharge_array[0].IndexOf("{Sob consulta}") > -1) {Line 14770: underConsult = true;Line 14771:}Line 14772:Line 14773:if( null != shippingCharge_array[1] && shippingCharge_array[1].Length > -1 ) {Line 14774: // try {Line 14775: shippingCharge = Convert.ToDecimal(shippingCharge_array[1]);Line 14776: // } catch(Exception e) {Line 14777: // Response.Write(shippingCharge_array[1]);Line 14778: // }Line 14779:}Line 14780:Line 14781:Billing Bll2 = new Billing();Line 14782:Line 14783:SqlConnection hConn;Line 14784:SqlCommand hCmd;Line 14785:SqlDataReader hRdr;Line 14786:Line 14787:StringBuilder Sb1 = new StringBuilder();Line 14788:StringBuilder Sb2 = new StringBuilder();Line 14789:Line 14790:
Line 14791:
Line 14792: #line default
Line 14793: #line hidden
Line 14794: this.WriteUTF8ResourceString(@__w, 97363, 261, true);
Line 14795:
Line 14796: #line 280 "C:\octopus\https\current\_billing_step_2.aspx"
Line 14797: @__w.Write( shop.CurrType );
Line 14798:
Line 14799:
Line 14800: #line default
Line 14801: #line hidden
Line 14802: @__w.Write("<span id=\"cart_total_estimated_price\">");
Line 14803:
Line 14804: #line 280 "C:\octopus\https\current\_billing_step_2.aspx"
Line 14805: @__w.Write( string.Format("{0:0.00}", Math.Round(subTotal, 2)) );
Line 14806:
Line 14807:
Line 14808: #line default
Line 14809: #line hidden
Line 14810: @__w.Write("</span></td>\n\t\t\t\t </tr>\n");
Line 14811:
Line 14812: #line 282 "C:\octopus\https\current\_billing_step_2.aspx"
Line 14813: Line 14814:Line 14815:if( shop.getConfig("Taxes") != "" ) {Line 14816: foreach( XmlNode Tax in PreOrder.SelectNodes("/pre_order/taxes/*") ) {Line 14817: subTotal = subTotal + Convert.ToDecimal(Tax.SelectSingleNode("@value").InnerText);Line 14818: Response.Write(Line 14819: String.Format(Line 14820:@"Line 14821:<tr>Line 14822: <th>{0}:</th>Line 14823: <td><span class='cart_taxes'>{1}</span></td>Line 14824:</tr>Line 14825:"Line 14826: , Tax.SelectSingleNode("@presentation").InnerTextLine 14827: , shop.CurrType + string.Format( "{0:0." + ndd + "}", Convert.ToDecimal(Tax.SelectSingleNode("@value").InnerText) )Line 14828: )Line 14829: );Line 14830: }Line 14831:}Line 14832:Line 14833:if( shop.useST && transporterId != 52 )Line 14834: stCharge = Cart.stCharge(userId, order_code, subTotal, shop);Line 14835:if( stCharge > 0 ) {Line 14836: subTotal += stCharge;Line 14837: Response.Write(" <tr id='shipping_st_label'>\n");Line 14838: Response.Write(" <th>DIFAL:</th>\n");Line 14839: Response.Write(" <td><span id='cart_total_st_charge'>"+ shop.CurrType + string.Format("{0:0."+ ndd +"}",stCharge) +"</span></td>\n");Line 14840: Response.Write(" </tr>\n");Line 14841:}Line 14842:Line 14843:if( shippingCharge > 0 ) {Line 14844: Response.Write(" <tr>\n");Line 14845: Response.Write(" <th>Frete:</th>\n");Line 14846: Response.Write(" <td><span id='cart_total_shipping_charge'>"+ shop.CurrType + string.Format(Line 14847: "{0:0.00}"Line 14848: , Math.Round(shippingCharge, 2)Line 14849: ) + "</span></td>\n");Line 14850: Response.Write(" </tr>\n");Line 14851:}Line 14852:Line 14853:
Line 14854:
Line 14855: #line default
Line 14856: #line hidden
Line 14857: @__w.Write("\n\t\t\t\t <tr>\n\t\t\t\t\t<th>Total:</th>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t");
Line 14858:
Line 14859: #line 326 "C:\octopus\https\current\_billing_step_2.aspx"
Line 14860:@__w.Write( shop.CurrType );
Line 14861:
Line 14862:
Line 14863: #line default
Line 14864: #line hidden
Line 14865: @__w.Write("\n\t\t\t\t\t\t<span id=\"cart_total_order_total\">\n\t\t\t\t\t\t\t");
Line 14866:
Line 14867: #line 328 "C:\octopus\https\current\_billing_step_2.aspx"
Line 14868:@__w.Write( string.Format( "{0:0.00}", Math.Round(subTotal + shippingCharge, 2) ) );
Line 14869:
Line 14870:
Line 14871: #line default
Line 14872: #line hidden
Line 14873: this.WriteUTF8ResourceString(@__w, 97624, 345, false);
Line 14874:
Line 14875: #line 345 "C:\octopus\https\current\_billing_step_2.aspx"
Line 14876: Line 14877:Line 14878:conn = new SqlConnection(shop.Path);Line 14879:conn.Open();Line 14880:Line 14881:query = @"Line 14882: SELECT codPayment, payment, name, factor, vtranslLine 14883: FROM sys_payInfosLine 14884: WHERE codPayment > 0 AND (active = 1)Line 14885: ORDER BY dspOrder ASCLine 14886:";Line 14887:cmd = new SqlCommand(query, conn);Line 14888:rdr = cmd.ExecuteReader();Line 14889:Line 14890:while(rdr.Read()) {Line 14891: printPayment = false;Line 14892:Line 14893: // payment acronym translate PT -> ENLine 14894: payment = Bll2.paymentAcronymTranslate( Convert.ToString(rdr["payment"]) ).ToLower();Line 14895:Line 14896: // check available paymentsLine 14897: switch( payment.ToUpper() ) {Line 14898: case "CC": if( shop.UseCC ) printPayment = true; break;Line 14899: case "ET": if( shop.UseET ) printPayment = true; break;Line 14900: case "EF": if( shop.UseEF ) printPayment = true; break;Line 14901: case "BB": if( shop.UseBB ) printPayment = true; break;Line 14902: case "BD": if( shop.UseBD ) printPayment = true; break;Line 14903: case "IO": if( shop.UseIO && customer_utp == "J" ) printPayment = true; break;Line 14904: case "BP": if( !shop.getConfig("BPag").Equals("") ) printPayment = true; break;Line 14905: case "PS": if( !shop.getConfig("UolPagSeguro").Equals("") ) printPayment = true; break;Line 14906: case "PD": if( !shop.getConfig("PagamentoDigital").Equals("") ) printPayment = true; break;Line 14907: case "C2":Line 14908: if(Line 14909: !underConsult &&Line 14910: !shop.getConfig("Use2CreditCards").Equals("") &&Line 14911: ( shop.UseCielo || shop.UseKomerci )Line 14912: ) {Line 14913: printPayment = true;Line 14914: }Line 14915: break;Line 14916: case "CB": printPayment = true; break;Line 14917: case "DC": if( shop.UseCielo || shop.UseBrasPag ) printPayment = true; break;Line 14918: case "PP": if( shop.getConfig("PayPal") != "" ) printPayment = true; break;Line 14919: }Line 14920:Line 14921: if(printPayment) { // print available payment option shortcutLine 14922: Sb1.Append( " <li><a id='billing_payment_option_shortcut_" + payment + "' href='#billing_payment_" + payment.ToLower() + "'><span>" + Convert.ToString(rdr["name"]).ToUpper() + "</span></a></li>\n" );Line 14923:Line 14924: // print available payment optionLine 14925: Sb2.Append( " <div class='hr'><hr /></div>\n" );Line 14926: Sb2.Append( " <div id='billing_container_" + payment + "'>\n" );Line 14927: Sb2.Append( " <a id='billing_payment_" + payment + "'>" + Convert.ToString(rdr["name"]).ToUpper() + "</a>\n" );Line 14928:Line 14929: factor = Convert.ToDecimal(rdr["factor"]);Line 14930: vtransl = Convert.ToDecimal(rdr["vtransl"]);Line 14931:Line 14932: total = ( subTotal * factor ) + vtransl + shippingCharge;Line 14933:Line 14934: Sb2.Append( "<span class='paymentPrice'>" );Line 14935:Line 14936: Sb2.Append( shop.CurrType + string.Format("{0:0.00}", Math.Round(total, 2) ) );Line 14937:Line 14938: if(factor < 1) Sb2.Append( " (" + Math.Round( ( 1-factor ) * 100, 2) +"% de desconto )" );Line 14939: if(factor > 1) Sb2.Append( " (" + Math.Round( ( factor -1 ) * 100, 2) + "% de acréscimo )" );Line 14940: if(vtransl != 0) {Line 14941: Sb2.Append( " (" + ((vtransl > 0) ? shop.CurrType + string.Format("{0:0.00}",Math.Abs(vtransl)) + " de acréscimo" : shop.CurrType + string.Format("{0:0.00}",Math.Abs(vtransl)) + " de desconto") +")" );Line 14942: }Line 14943:Line 14944: Sb2.Append( "</span><br />\n" );Line 14945:Line 14946:Line 14947:Line 14948: // print available payment formLine 14949: Sb2.Append( "<form id='billing-form-" + payment + "' name='form_" + payment + "' method='post' action='/octopus/" + thisConfig + "&pni=1&mi=BLL&op=" + Convert.ToString(rdr["codPayment"]) + "&rmi=SMR'>\n" );Line 14950:Line 14951: switch( payment.ToUpper() ) {Line 14952:Line 14953:Line 14954:Line 14955: case "CC":Line 14956: Sb2.Append( " <input id='credit-card-payment-config' type='hidden' name='ccPaymentConfig' value='" + shop.ccLib + "' />\n" );Line 14957: Sb2.Append( " <input id='credit-card-dynamic-flag' type='hidden' name='dynamicFlag' value='Default' />\n" );Line 14958: Sb2.Append( " <font class='title'>Importante: </font>Pedidos parcelados, devem ter cartão com limite maior que o total deste pedido, não importando o valor das parcelas.<br />\n" );Line 14959: Sb2.Append( " <font class='title'>Atenção: </font>Caso você tenha um programa anti pop-up, desative-o antes de finalizar sua compra com esta forma de pagamento.<br />\n" );Line 14960: Sb2.Append( " <table>\n" );Line 14961: Sb2.Append( " <tr>\n" );Line 14962: Sb2.Append( " <td align='center' valign='top' colspan='2'>\n" );Line 14963: Sb2.Append( " <div id='credit-card-option'>\n" );Line 14964: Sb2.Append( " <label for='billing-selected-flag'>\n" );Line 14965:Line 14966: Sb2.Append( Bll2.getCreditCardOptions( shop.CurrType, ndd, shop.Path, shopId, Convert.ToInt32(FormDataStp2["cc"]), total, codGroup, 0 ) );Line 14967:Line 14968: Sb2.Append( " </label>\n" );Line 14969: Sb2.Append( " </div>\n" );Line 14970: Sb2.Append( " </td>\n" );Line 14971: Sb2.Append( " </tr>\n" );Line 14972: Sb2.Append( " <tr>\n" );Line 14973: Sb2.Append( " <td width='60%'>\n" );Line 14974:Line 14975: if( !underConsult ) {Line 14976: Sb2.Append(Line 14977: Bll2.getCreditCardFormTable(Line 14978: FormDataStp2["ccName"], FormDataStp2["ccNumber"], FormDataStp2["ccMonth"], FormDataStp2["ccYear"], FormDataStp2["csc"], "1"Line 14979: )Line 14980: );Line 14981: }Line 14982:Line 14983: Sb2.Append( " </td>\n" );Line 14984: Sb2.Append( " <td width='40%' align='right'>\n" );Line 14985: Sb2.Append( " <input id='billing-submit-" + payment + "' class='click_once' type='image' src='/octopus/design/images/" + shopId + "/form_prc_cc.png' alt='Prosseguir com cartão de crédito' disabled='disabled' />\n" );Line 14986: Sb2.Append( " </td>\n" );Line 14987: Sb2.Append( " </tr>\n" );Line 14988: Sb2.Append( " </table>\n" );Line 14989:Line 14990: if(isMobile) {Line 14991: Sb2.Append( "<script>" );Line 14992: Sb2.Append( "window.addEvent('domready', function(){\n" );Line 14993: Sb2.Append( " var container = $('credit-card-option');\n" );Line 14994: Sb2.Append( " var field = $('credit-card-name');\n" );Line 14995: Sb2.Append( " var btn = $('billing-submit-cc');\n" );Line 14996: Sb2.Append( " var focus = function(ev){ btn.scrollIntoView(true);field.focus();field.select(); }\n" );Line 14997: Sb2.Append( " container.getElements('select').each(function(select){\n" );Line 14998: Sb2.Append( " select.addEvent('change', focus);\n" );Line 14999: Sb2.Append( " });\n" );Line 15000: Sb2.Append( "});\n" );Line 15001: Sb2.Append( "</"+"script>" );Line 15002: }Line 15003:Line 15004: if( shop.UseBrasPag ) { // braspag device fingerprint implementationLine 15005: try {Line 15006: object oJson = JavaScriptDeserializer.DeserializeFromJson( shop.getConfig("BrasPag"), typeof(NameValueCollection));Line 15007: string bp_orgId = ((NameValueCollection)oJson)["orgId"];Line 15008: string bp_merchantId = ((NameValueCollection)oJson)["merchantIdCyberSource"];Line 15009:Line 15010: // device fingerprint idLine 15011: Response.Cookies["octopus-dfpid"].Value = Convert.ToString(Guid.NewGuid()).Replace("-", "");Line 15012: string bp_fingerPrint = Request.Cookies["octopus-dfpid"].Value;Line 15013:Line 15014: // png imageLine 15015: Sb2.Append(Line 15016: String.Format(Line 15017:"<p style='background:url(https://h.online-metrix.net/fp/clear.png?org_id={0}&session_id={1}{2}&m=1)'></p><img src='https://h.online-metrix.net/fp/clear.png?org_id={0}&session_id={1}{2}&m=2' alt=''>"Line 15018: , bp_orgId, bp_merchantId, bp_fingerPrintLine 15019: )Line 15020: );Line 15021:Line 15022: // flash codeLine 15023: Sb2.Append(Line 15024: String.Format(Line 15025:"<object type='application/x-shockwave-flash' data='https://h.online-metrix.net/fp/fp.swf?org_id={0}&session_id={1}{2}' width='1' height='1' id='thm_fp'><param name='movie' value='https://h.online-metrix.net/fp/fp.swf?org_id={0}&session_id={1}{2}' /><div></div></object>"Line 15026: , bp_orgId, bp_merchantId, bp_fingerPrintLine 15027: )Line 15028: );Line 15029:Line 15030: // js codeLine 15031: Sb2.Append(Line 15032: String.Format(Line 15033:"<script src='https://h.online-metrix.net/fp/check.js?org_id={0}&session_id={1}{2}' type='text/javascript'></script>"Line 15034: , bp_orgId, bp_merchantId, bp_fingerPrintLine 15035: )Line 15036: );Line 15037:Line 15038: } catch( Exception ex ) {Line 15039: /* load fingerprint failure */Line 15040: }Line 15041: }Line 15042: break;Line 15043:Line 15044:Line 15045:Line 15046: case "DC":Line 15047: Sb2.Append( " <table>\n" );Line 15048: Sb2.Append( " <tr>\n" );Line 15049: Sb2.Append( " <td align='center' valign='top' colspan='2'>\n" );Line 15050: Sb2.Append( " <div id='debit-card-option'>\n" );Line 15051: Sb2.Append( " <label for='billing-selected-flag'>\n" );Line 15052:Line 15053: Sb2.Append( Bll2.getDebitCardOptions( shop.CurrType, ndd, shop.Path, shopId ) );Line 15054:Line 15055: Sb2.Append( " </label>\n" );Line 15056: Sb2.Append( " </div>\n" );Line 15057: Sb2.Append( " </td>\n" );Line 15058: Sb2.Append( " </tr>\n" );Line 15059: Sb2.Append( " <tr>\n" );Line 15060: Sb2.Append( " <td width='60%' align='right'>\n" );Line 15061: Sb2.Append( " <input id='billing-submit-" + payment + "' class='click_once' type='image' src='/octopus/design/images/" + shopId + "/form_prc_dc.png' alt='Prosseguir com cartão de débito' disabled='disabled' />\n" );Line 15062: Sb2.Append( " </td>\n" );Line 15063: Sb2.Append( " </tr>\n" );Line 15064: Sb2.Append( " </table>\n" );Line 15065: break;Line 15066:Line 15067:Line 15068:Line 15069: case "ET":Line 15070: i = 0;Line 15071: isEOF = true;Line 15072:Line 15073: hConn = new SqlConnection(ConfigurationSettings.AppSettings["coreConn"]);Line 15074: hConn.Open();Line 15075:Line 15076: query = @"Line 15077:SELECT tbl_et.*Line 15078:FROM tbl_etLine 15079:INNER JOIN rel_coreET ON tbl_et.codET = rel_coreET.codETLine 15080:WHERE (rel_coreET.sid = @shopId) ORDER BY tbl_et.codETLine 15081: ";Line 15082:Line 15083: hCmd = new SqlCommand(query, hConn);Line 15084: hCmd.Parameters.Add(new SqlParameter("@shopId", SqlDbType.Int));Line 15085: hCmd.Parameters["@shopId"].Value = shopId;Line 15086:Line 15087: hRdr = hCmd.ExecuteReader();Line 15088:Line 15089: Sb2.Append( " <table>\n" );Line 15090:Line 15091: while(hRdr.Read()) {Line 15092: Sb2.Append( " <tr>\n" );Line 15093: Sb2.Append( " <td align='center'>\n" );Line 15094: Sb2.Append( " <input id='et-option-" + i + "' type='radio' name='et' value='"+ hRdr["codET"] +"'" );Line 15095:Line 15096: if(Line 15097: Request.QueryString["et"] != null &&Line 15098: Request.QueryString["et"] != "" &&Line 15099: Convert.ToInt32(Request.QueryString["et"]) == Convert.ToInt32(hRdr["codET"])Line 15100: ) {Line 15101: Sb2.Append( " checked='checked' " );Line 15102: }Line 15103:Line 15104: Sb2.Append( "/>\n" );Line 15105:Line 15106: Sb2.Append( " <label for='et-option-" + i + "'><img src='design/images/" + hRdr["src"] + "' alt='' /></label>\n" );Line 15107: Sb2.Append( " </td>\n" );Line 15108: Sb2.Append( " <td><b>" + hRdr["name"] + "</b><br />" + hRdr["info"] + "</td>\n" );Line 15109: Sb2.Append( " </tr>\n" );Line 15110: Sb2.Append( " <tr><td colspan='2'> <br /></td></tr>\n" );Line 15111: isEOF = false;Line 15112: i = i + 1;Line 15113: }Line 15114:Line 15115: hRdr.Close();Line 15116: hConn.Close();Line 15117:Line 15118: if( !isEOF ) {Line 15119: Sb2.Append( " <tr>\n" );Line 15120: Sb2.Append( " <td colspan='2' align='right'>\n" );Line 15121: Sb2.Append( " <input data-mode='ET' class='billing-prc click_once' id='billing-submit-et' type='image' src='/octopus/design/images/" + shopId + "/form_prc_et.png' disabled='disabled' />\n" );Line 15122: Sb2.Append( " </td>\n" );Line 15123: Sb2.Append( " </tr>\n" );Line 15124: } else {Line 15125: Sb2.Append( " <tr><td>No records found.</td></tr>\n" );Line 15126: }Line 15127:Line 15128: Sb2.Append( " </table>\n" );Line 15129: break;Line 15130:Line 15131:Line 15132:Line 15133: case "EF":Line 15134: i = 0;Line 15135: isEOF = true;Line 15136:Line 15137: Sb2.Append( " <table>\n" );Line 15138:Line 15139: hConn = new SqlConnection(ConfigurationSettings.AppSettings["coreConn"]);Line 15140: hConn.Open();Line 15141:Line 15142: query = "SELECT tbl_ef.* FROM tbl_ef INNER JOIN rel_coreEF ON tbl_ef.codEF = rel_coreEF.codEF WHERE (rel_coreEF.sid = @shopId) ORDER BY tbl_ef.codEF";Line 15143:Line 15144: hCmd = new SqlCommand(query, hConn);Line 15145: hCmd.Parameters.Add(new SqlParameter("@shopId", SqlDbType.Int));Line 15146: hCmd.Parameters["@shopId"].Value = shopId;Line 15147:Line 15148: hRdr = hCmd.ExecuteReader();Line 15149:Line 15150: while(hRdr.Read()) {Line 15151: Sb2.Append( " <tr>\n");Line 15152: Sb2.Append( " <td align=\"center\">\n" );Line 15153: Sb2.Append( " <input id='ef-option-" + i + "' type='radio' name='ef' value='"+ hRdr["codEF"] +"'" );Line 15154:Line 15155: if(Line 15156: Request.QueryString["ef"] != null &&Line 15157: Request.QueryString["ef"] != "" &&Line 15158: Convert.ToInt32(Request.QueryString["ef"]) == Convert.ToInt32(hRdr["codEF"])Line 15159: ) {Line 15160: Sb2.Append( " checked='checked' " );Line 15161: }Line 15162:Line 15163: Sb2.Append( " />\n" );Line 15164:Line 15165: Sb2.Append( " <label for='ef-option-" + i + "'><img src='design/images/" + hRdr["src"] + "' /></td>\n" );Line 15166: Sb2.Append( " </td>\n" );Line 15167: Sb2.Append( " <td><b>"+ hRdr["name"] +"</b><br />"+ hRdr["info"] +"</td>\n" );Line 15168: Sb2.Append( " </tr>\n" );Line 15169: Sb2.Append( " <tr><td colspan='3'> <br /></td></tr>\n" );Line 15170: isEOF = false;Line 15171: i = i + 1;Line 15172: }Line 15173:Line 15174: hRdr.Close();Line 15175: hConn.Close();Line 15176:Line 15177: if( !isEOF ) {Line 15178: Sb2.Append( " <tr>\n" );Line 15179: Sb2.Append( " <td colspan='2' align='right'>\n" );Line 15180: Sb2.Append( " <input data-mode='EF' class='billing-prc click_once' id='billing-submit-ef' type='image' src='/octopus/design/images/" + shopId + "/form_prc_ef.png' disabled='disabled' />\n" );Line 15181: Sb2.Append( " </td>\n" );Line 15182: Sb2.Append( " </tr>\n" );Line 15183: } else {Line 15184: Sb2.Append( " <tr><td>No records found.</td></tr>\n" );Line 15185: }Line 15186:Line 15187: Sb2.Append( " </table>\n" );Line 15188: break;Line 15189:Line 15190:Line 15191:Line 15192: case "BB":Line 15193: string bbMsg = @"Line 15194:Opção válida apenas para pagamento à vista. <span>Acrescente <b>3 dias úteis</b> ao prazo de entrega informado no site, pois esse é oLine 15195:prazo máximo estipulado pelo banco para disponibilizar a confirmação de pagamento. </span>Se você pagar o boleto com <b>cheque</b>, acrescenteLine 15196:<b>4 dias úteis</b>.<br /><font class='title'>Atenção: </font>Caso você tenha um programa anti pop-up, desative-o antes de finalizarLine 15197:sua compra com esta forma de pagamento.<br />Line 15198: ";Line 15199:Line 15200: hConn = new SqlConnection(ConfigurationSettings.AppSettings["coreConn"]);Line 15201: hConn.Open();Line 15202:Line 15203: query = "SELECT tbl_bb.* FROM rel_coreBB INNER JOIN tbl_bb ON rel_coreBB.codBB = tbl_bb.codBB WHERE (rel_coreBB.sid = @shopId );";Line 15204:Line 15205: hCmd = new SqlCommand(query, hConn);Line 15206: hCmd.Parameters.Add(new SqlParameter("@shopId", SqlDbType.Int));Line 15207: hCmd.Parameters["@shopId"].Value = shopId;Line 15208:Line 15209: hRdr = hCmd.ExecuteReader();Line 15210:Line 15211: if(hRdr.Read()) {Line 15212: Sb2.Append( " <table>\n" );Line 15213: Sb2.Append( " <tr>\n" );Line 15214: Sb2.Append( " <td>\n" );Line 15215: Sb2.Append( " <img src='design/images/" + hRdr["src"] + "' />\n");Line 15216: Sb2.Append( " <input type='hidden' name='bb' value='" + hRdr["codBB"] + "' />\n" );Line 15217: Sb2.Append( " </td>\n" );Line 15218: Sb2.Append( " <td>" + bbMsg + "</td>\n" );Line 15219: Sb2.Append( " </tr>\n" );Line 15220: Sb2.Append( " <tr>\n" );Line 15221: Sb2.Append( " <td colspan='2' align='right'>\n" );Line 15222: Sb2.Append( " <input data-mode='BB' class='billing-prc validations_off click_once' id='billing-submit-bb' type='image' src='/octopus/design/images/" + shopId + "/form_prc_bb.png' disabled='disabled' />\n" );Line 15223: Sb2.Append( " </td>\n" );Line 15224: Sb2.Append( " </tr>\n" );Line 15225: Sb2.Append( " </table>\n" );Line 15226: }Line 15227:Line 15228: hRdr.Close();Line 15229: hConn.Close();Line 15230: break;Line 15231:Line 15232:Line 15233:Line 15234: case "BD":Line 15235: Sb2.Append( shop.bankAccounts(true) );Line 15236: break;Line 15237:Line 15238:Line 15239:Line 15240: case "IO":Line 15241: Sb2.Append( " <table>\n" );Line 15242: Sb2.Append( " <tr>\n" );Line 15243: Sb2.Append( " <td><img src='design/images/io.gif' alt='' /></td>\n" );Line 15244: Sb2.Append( " <td><font class='title'>Opção válida apenas para revendedores</font>. A forma de pagamento será combinada entre as partes posteriormente.</td>\n" );Line 15245: Sb2.Append( " </tr>\n" );Line 15246: Sb2.Append( " <tr>\n" );Line 15247: Sb2.Append( " <td><span></span></td>\n" );Line 15248: Sb2.Append( " <td>\n" );Line 15249: Sb2.Append( " <div id='billing_io_list'>\n" );Line 15250: Sb2.Append( " <table>\n" );Line 15251:Line 15252: hConn = new SqlConnection(shop.Path);Line 15253: hConn.Open();Line 15254:Line 15255: query = "SELECT COUNT(*) FROM sys_io_list";Line 15256: hCmd = new SqlCommand(query, hConn);Line 15257: int tt = Convert.ToInt32(hCmd.ExecuteScalar());Line 15258:Line 15259: query = "SELECT codIO, dspValue, dspFactor FROM sys_io_list WHERE (value <= @total) ORDER BY dspOrder";Line 15260: hCmd = new SqlCommand(query, hConn);Line 15261:Line 15262: hCmd.Parameters.Add(new SqlParameter("@total", SqlDbType.Money));Line 15263: hCmd.Parameters["@total"].Value = total;Line 15264:Line 15265: hRdr = hCmd.ExecuteReader();Line 15266:Line 15267: while(hRdr.Read()) {Line 15268: Sb2.Append(" <tr>\n" );Line 15269: Sb2.Append(" <td class='tbl_row_" + i++ % 2 + "'>\n" );Line 15270: Sb2.Append(" <span class='billing_io_list_button'>\n" );Line 15271:Line 15272: Sb2.Append(" <input id='billing_io_radio_" + (int)hRdr["codIO"] + "' type='radio' name='ioPt' value='"+ (int)hRdr["codIO"] +"'" );Line 15273:Line 15274: if(Line 15275: FormDataStp2["ioPt"] != null &&Line 15276: FormDataStp2["ioPt"] != "" &&Line 15277: Convert.ToInt32(FormDataStp2["ioPt"]) == Convert.ToInt32(hRdr["codIO"])Line 15278: ) {Line 15279: Sb2.Append( " checked='checked' " );Line 15280: }Line 15281:Line 15282: Sb2.Append("/>\n" );Line 15283:Line 15284: Sb2.Append(" <label for='billing_io_radio_" + (int)hRdr["codIO"] + "'>\n" );Line 15285: Sb2.Append(" <span class=\"billing_io_list_value\">"+ (string)hRdr["dspValue"] +"</span>\n" );Line 15286: Sb2.Append(" <span class=\"billing_io_list_factor\">("+ (string)hRdr["dspFactor"] +")</span>\n" );Line 15287: Sb2.Append(" </label>\n" );Line 15288: Sb2.Append(" </span>\n" );Line 15289: Sb2.Append(" </td>\n" );Line 15290: Sb2.Append(" </tr>\n" );Line 15291: }Line 15292:Line 15293: hRdr.Close();Line 15294: hConn.Close();Line 15295:Line 15296: Sb2.Append( " </table>\n" );Line 15297: Sb2.Append( " </div>\n" );Line 15298: Sb2.Append( " </td>\n" );Line 15299: Sb2.Append( " </tr>\n" );Line 15300: Sb2.Append( " <tr>\n" );Line 15301: Sb2.Append( " <td colspan='2' align='right'>\n" );Line 15302: Sb2.Append( " <input data-mode='IO' class='billing-prc click_once' id='billing-submit-io' type='image' src='/octopus/design/images/" + shopId + "/form_prc_io.png' disabled='disabled' />\n" );Line 15303: Sb2.Append( " </td>\n" );Line 15304: Sb2.Append( " </tr>\n" );Line 15305: Sb2.Append( " </table>\n" );Line 15306: break;Line 15307:Line 15308:Line 15309:Line 15310: case "BP":Line 15311: Sb2.Append( " <p>A plataforma BPag uma solução abrangente desenvolvida pela BoldCron para gerenciar todo o processo de pagamentos on-line, da escolha do meio de pagamento até a comunicação com as instituições financeiras no Brasil, Estados Unidos, Europa e América Latina, incluindo suas rotinas de recorrência, conciliação financeira, anti-fraude e relatrios.</p>\n" );Line 15312: Sb2.Append( " <p>O BPag Gateway o componente desta plataforma responsável por fazer a integração entre a loja virtual e as instituições financeiras, processando e gerenciando os pagamentos. Desta forma, o e-commerce precisa se comunicar com apenas um sistema para que as vendas de seus produtos e serviços sejam feitas por meio de cartes de crédito e débito, financiamento, boleto bancrio etc., no Brasil e no exterior.</p>\n" );Line 15313: Sb2.Append( " <table>\n" );Line 15314: Sb2.Append( " <tr>\n" );Line 15315: Sb2.Append( " <td align='right'>\n" );Line 15316: Sb2.Append( " <input data-mode='BPag' class='billing-prc validations_off click_once' id='billing-submit-bpag' type='image' src='/octopus/design/images/" + shopId + "/form_prc_bpag.png' disabled='disabled' />\n" );Line 15317: Sb2.Append( " </td>\n" );Line 15318: Sb2.Append( " </tr>\n" );Line 15319: Sb2.Append( " </table>\n" );Line 15320: break;Line 15321:Line 15322:Line 15323:Line 15324: case "PS":Line 15325: Sb2.Append( " <table>\n" );Line 15326: Sb2.Append( " <tr>\n" );Line 15327: Sb2.Append( " <td>\n" );Line 15328: Sb2.Append( " <p><IMG src='https://pagseguro.uol.com.br/Imagens/Banners/btnPreferenciaCartoesBR_620x40.gif' title='Este site aceita pagamentos com Visa, MasterCard, Diners, American Express, Hipercard, Aura, Bradesco, Ita, Unibanco, Banco do Brasil, Banco Real, saldo em conta PagSeguro e boleto.' border='0' /></p>\n" );Line 15329: Sb2.Append( " <p>PagSeguro um sistema de pagamentos online que permite que indivíduos e empresas possam enviar e receber pagamentos com eficiência e segurança.</p>\n" );Line 15330: Sb2.Append( " </td>\n" );Line 15331: Sb2.Append( " </tr>\n" );Line 15332: Sb2.Append( " <tr>\n" );Line 15333: Sb2.Append( " <td align='right'>\n" );Line 15334: Sb2.Append( " <input data-mode='PagSeguro' class='billing-prc validations_off click_once' id='billing-submit-pagseguro' type='image' src='/octopus/design/images/" + shopId + "/form_prc_ups.png' disabled='disabled' />\n" );Line 15335: Sb2.Append( " </td>\n" );Line 15336: Sb2.Append( " </tr>\n" );Line 15337: Sb2.Append( " </table>\n" );Line 15338: break;Line 15339:Line 15340:Line 15341:Line 15342: case "PD":Line 15343: Sb2.Append( " <table>\n" );Line 15344: Sb2.Append( " <tr>\n" );Line 15345: Sb2.Append( " <td>\n" );Line 15346: Sb2.Append( " <p><img src='/octopus/design/images/b_cash.png' title='BCash' alt='BCash' /></p>\n" );Line 15347: Sb2.Append( " <p>\n" );Line 15348: Sb2.Append( "A BCash, uma empresa do grupo Buscapé, propicia uma experiência de compra extremamente amigável e segura.<br />\n" );Line 15349: Sb2.Append( "Acesse agora e faça seu pagamento escolhendo dentre as várias opções disponveis de cartão de crédito parcelado, boleto bancário e transferência eletrônica.\n" );Line 15350: Sb2.Append( " </p>\n" );Line 15351: Sb2.Append( " </td>\n" );Line 15352: Sb2.Append( " </tr>\n" );Line 15353: Sb2.Append( " <tr>\n" );Line 15354: Sb2.Append( " <td align='right'>\n" );Line 15355: Sb2.Append( " <input data-mode='PagDigital' class='billing-prc validations_off click_once' id='billing-submit-pagdigital' type='image' src='/octopus/design/images/" + shopId + "/form_prc_bc.png' disabled='disabled' />\n" );Line 15356: Sb2.Append( " </td>\n" );Line 15357: Sb2.Append( " </tr>\n" );Line 15358: Sb2.Append( " </table>\n" );Line 15359: break;Line 15360:Line 15361:Line 15362:Line 15363: case "C2":Line 15364: Sb2.Append( "Not implemented.\n" );Line 15365: break;Line 15366:Line 15367:Line 15368:Line 15369: case "CB":Line 15370: Sb2.Append( " <table>\n" );Line 15371: Sb2.Append( " <tr>\n" );Line 15372: Sb2.Append( " <td>\n" );Line 15373: Sb2.Append( " <p><img src='/octopus/design/images/bndes.png' title='Cartão BNDES' alt='Cartão BNDES' /></p>\n" );Line 15374: Sb2.Append( " <p>\n" );Line 15375: Sb2.Append( "Opção válida para titulares do cartão BNDES. Selecione esta forma de pagamento e aguarde nosso contato.<br />\n" );Line 15376: Sb2.Append( " </p>\n" );Line 15377: Sb2.Append( " </td>\n" );Line 15378: Sb2.Append( " </tr>\n" );Line 15379: Sb2.Append( " <tr>\n" );Line 15380: Sb2.Append( " <td align='right'>\n" );Line 15381: Sb2.Append( " <input data-mode='bndes' class='billing-prc validations_off click_once' id='billing-submit-cb' type='image' src='/octopus/design/images/" + shopId + "/form_prc_cc.png' disabled='disabled' />\n" );Line 15382: Sb2.Append( " </td>\n" );Line 15383: Sb2.Append( " </tr>\n" );Line 15384: Sb2.Append( " </table>\n" );Line 15385: break;Line 15386:Line 15387:Line 15388:Line 15389: case "PP":Line 15390: Sb2.Append( " <table>\n" );Line 15391: Sb2.Append( " <tr>\n" );Line 15392: Sb2.Append( " <td align='right'>\n" );Line 15393: Sb2.Append( " <input data-mode='paypal' class='billing-prc validations_off click_once' id='billing-submit-pp' type='image' src='/octopus/design/images/" + shopId + "/form_prc_pp.png' disabled='disabled' />\n" );Line 15394: Sb2.Append( " </td>\n" );Line 15395: Sb2.Append( " </tr>\n" );Line 15396: Sb2.Append( " </table>\n" );Line 15397: break;Line 15398:Line 15399:Line 15400:Line 15401: }Line 15402:Line 15403: // billing step 1 dependencies :(Line 15404: if( Request.Form.Count > 0 ) {Line 15405: foreach( string key in Request.Form ) {Line 15406: Sb2.Append(Line 15407: "<input type='hidden' name='" + key + "' value='" + Convert.ToString(Request.Form[key]).Replace("'", "") + "'>\n"Line 15408: );Line 15409: }Line 15410: } else {Line 15411: foreach( DictionaryEntry entry in FormDataStp1 ) {Line 15412: Sb2.Append( "<input type='hidden' name='" + entry.Key + "' value='" + entry.Value + "'>\n" );Line 15413: }Line 15414: }Line 15415:Line 15416: Sb2.Append( " </form>\n" );Line 15417:Line 15418:Line 15419:Line 15420: Sb2.Append( " <a class='payment_options_top' href='#billing_payment' title='selecionar outra forma de pagamento'>selecionar outra forma de pagamento</a>\n" );Line 15421: Sb2.Append( " </div>\n" );Line 15422: }Line 15423:}Line 15424:Line 15425:rdr.Close();Line 15426:conn.Close();Line 15427:Line 15428:
Line 15429:
Line 15430: #line default
Line 15431: #line hidden
Line 15432: @__w.Write("\n\n\t <ul id=\'billing_payments_options_shortcuts\'>\n");
Line 15433:
Line 15434: #line 900 "C:\octopus\https\current\_billing_step_2.aspx"
Line 15435:@__w.Write( Sb1.ToString() );
Line 15436:
Line 15437:
Line 15438: #line default
Line 15439: #line hidden
Line 15440: @__w.Write("\n\t </ul>\n\n\t <div id=\'billing_payments_options\'>\n");
Line 15441:
Line 15442: #line 904 "C:\octopus\https\current\_billing_step_2.aspx"
Line 15443:@__w.Write( Sb2.ToString() );
Line 15444:
Line 15445:
Line 15446: #line default
Line 15447: #line hidden
Line 15448: this.WriteUTF8ResourceString(@__w, 97969, 831, true);
Line 15449:
Line 15450: #line 945 "C:\octopus\https\current\_billing_step_2.aspx"
Line 15451: if( shop.UseBrasPag ) {
Line 15452:
Line 15453: #line default
Line 15454: #line hidden
Line 15455: @__w.Write("\n\n\t\t\tmse = parseInt(new Date().getTime() - t0);\n\t\t\twindow.setTimeout( do_prcCC(ev" +
Line 15456: "), ( mse < delay ? delay - mse : 0 ) );\n\n");
Line 15457:
Line 15458: #line 950 "C:\octopus\https\current\_billing_step_2.aspx"
Line 15459: } else {
Line 15460:
Line 15461: #line default
Line 15462: #line hidden
Line 15463: @__w.Write("\n\n\t\t\tdo_prcCC(ev);\n\n");
Line 15464:
Line 15465: #line 954 "C:\octopus\https\current\_billing_step_2.aspx"
Line 15466: }
Line 15467:
Line 15468: #line default
Line 15469: #line hidden
Line 15470: this.WriteUTF8ResourceString(@__w, 98800, 6137, false);
Line 15471:
Line 15472: #line 1209 "C:\octopus\https\current\_billing_step_2.aspx"
Line 15473: if( social.google != null ) {
Line 15474:
Line 15475: #line default
Line 15476: #line hidden
Line 15477: this.WriteUTF8ResourceString(@__w, 104937, 418, true);
Line 15478:
Line 15479: #line 1221 "C:\octopus\https\current\_billing_step_2.aspx"
Line 15480: }
Line 15481:
Line 15482: #line default
Line 15483: #line hidden
Line 15484: this.WriteUTF8ResourceString(@__w, 105355, 503, true);
Line 15485:
Line 15486: #line 1239 "C:\octopus\https\current\_billing_step_2.aspx"
Line 15487: @__w.Write( shop.Title );
Line 15488:
Line 15489:
Line 15490: #line default
Line 15491: #line hidden
Line 15492: @__w.Write("\", \"screenName\": \"payment\" });\n}\n/* GOOGLE_DEPRECATED */\n\n// facebook: AddPayment" +
Line 15493: "Info\n");
Line 15494:
Line 15495: #line 1244 "C:\octopus\https\current\_billing_step_2.aspx"
Line 15496: if( Sd_facebook["status"] == "active" ) Response.Write( Sd_facebook["AddPaymentInfo"] );
Line 15497:
Line 15498: #line default
Line 15499: #line hidden
Line 15500: @__w.Write("\n\n// ]]>\n</script>\n\n");
Line 15501:
Line 15502: #line 1249 "C:\octopus\https\current\_billing_step_2.aspx"
Line 15503:@__w.Write( Generics.ClosePointer(shopId, 3) );
Line 15504:
Line 15505:
Line 15506: #line default
Line 15507: #line hidden
Line 15508: @__w.Write("\n<!-- GOOGLE_DEPRECATED -->\n");
Line 15509:
Line 15510: #line 1251 "C:\octopus\https\current\_billing_step_2.aspx"
Line 15511:@__w.Write( shop.getConfig("Google-SSL") );
Line 15512:
Line 15513:
Line 15514: #line default
Line 15515: #line hidden
Line 15516: @__w.Write("\n<!-- GOOGLE_DEPRECATED -->\n");
Line 15517:
Line 15518: #line 588 "C:\octopus\https\current\dsp_system.aspx"
Line 15519:
Line 15520: }
Line 15521: break;
Line 15522:}
Line 15523:
Line 15524:
Line 15525:
Line 15526: #line default
Line 15527: #line hidden
Line 15528: this.WriteUTF8ResourceString(@__w, 105858, 316, true);
Line 15529: @__w.Write("\r\n </div>\r\n </div>\r\n");
Line 15530:
Line 15531: #line 597 "C:\octopus\https\current\dsp_system.aspx"
Line 15532:
Line 15533:
Line 15534:if(isMobile) {
Line 15535: Response.Write( Generics.MobileFooter(shop.Path, shop.Http + thisConfig) );
Line 15536:} else {
Line 15537: Response.Write( Generics.ContainerFooter(shop.Path, shop.Http + thisConfig) );
Line 15538:}
Line 15539:
Line 15540:
Line 15541:
Line 15542: #line default
Line 15543: #line hidden
Line 15544: @__w.Write("\r\n</div>\r\n\r\n\r\n<!-- GOOGLE_DEPRECATED -->\r\n");
Line 15545:
Line 15546: #line 610 "C:\octopus\https\current\dsp_system.aspx"
Line 15547:@__w.Write( shop.getConfig("GoogleTagManager") );
Line 15548:
Line 15549:
Line 15550: #line default
Line 15551: #line hidden
Line 15552: this.WriteUTF8ResourceString(@__w, 106174, 369, true);
Line 15553:
Line 15554: #line 629 "C:\octopus\https\current\dsp_system.aspx"
Line 15555:
Line 15556:
Line 15557:if( Sd_facebook["status"] == "active") {
Line 15558: switch(mainInclude) {
Line 15559: case "SMR":
Line 15560:
Line 15561:
Line 15562: #line default
Line 15563: #line hidden
Line 15564: @__w.Write("\r\nfbq(\'track\', \'Purchase\', {\r\n\tcontent_ids: [");
Line 15565:
Line 15566: #line 636 "C:\octopus\https\current\dsp_system.aspx"
Line 15567: @__w.Write( fb_content_ids );
Line 15568:
Line 15569:
Line 15570: #line default
Line 15571: #line hidden
Line 15572: @__w.Write("],\r\n\tcontent_type: \'product\',\r\n\tvalue: ");
Line 15573:
Line 15574: #line 638 "C:\octopus\https\current\dsp_system.aspx"
Line 15575:@__w.Write( fb_value );
Line 15576:
Line 15577:
Line 15578: #line default
Line 15579: #line hidden
Line 15580: @__w.Write(",\r\n\tcurrency: \'BRL\'\r\n});\r\n\t\t\t");
Line 15581:
Line 15582: #line 641 "C:\octopus\https\current\dsp_system.aspx"
Line 15583:
Line 15584: break;
Line 15585:
Line 15586: default:
Line 15587: // Nothing to do.
Line 15588: break;
Line 15589: }
Line 15590:}
Line 15591:
Line 15592:if( useKonduto ) {
Line 15593: try {
Line 15594: object o = JavaScriptDeserializer.DeserializeFromJson(shop.getConfig("Konduto"), typeof(NameValueCollection));
Line 15595:
Line 15596:
Line 15597:
Line 15598: #line default
Line 15599: #line hidden
Line 15600: @__w.Write("\r\nvar __kdt = __kdt || [];\r\n__kdt.push({\'public_key\': \'");
Line 15601:
Line 15602: #line 656 "C:\octopus\https\current\dsp_system.aspx"
Line 15603: @__w.Write( ((NameValueCollection)o)["public_key"]);
Line 15604:
Line 15605:
Line 15606: #line default
Line 15607: #line hidden
Line 15608: this.WriteUTF8ResourceString(@__w, 106543, 294, true);
Line 15609:
Line 15610: #line 664 "C:\octopus\https\current\dsp_system.aspx"
Line 15611: @__w.Write( ( userId > 0 ? Convert.ToString(userId) : "undefined" ) );
Line 15612:
Line 15613:
Line 15614: #line default
Line 15615: #line hidden
Line 15616: this.WriteUTF8ResourceString(@__w, 106837, 462, true);
Line 15617:
Line 15618: #line 679 "C:\octopus\https\current\dsp_system.aspx"
Line 15619:
Line 15620:
Line 15621: } catch(Exception ex){}
Line 15622:}
Line 15623:
Line 15624:
Line 15625:
Line 15626: #line default
Line 15627: #line hidden
Line 15628: @__w.Write("\r\n\r\n// ]]>\r\n</script>\r\n<!-- GOOGLE_DEPRECATED -->\r\n");
Line 15629:
Line 15630: #line 689 "C:\octopus\https\current\dsp_system.aspx"
Line 15631: if( google_merchant_id != "" ) {
Line 15632:
Line 15633: #line default
Line 15634: #line hidden
Line 15635: this.WriteUTF8ResourceString(@__w, 107299, 371, true);
Line 15636:
Line 15637: #line 696 "C:\octopus\https\current\dsp_system.aspx"
Line 15638: @__w.Write( google_merchant_id );
Line 15639:
Line 15640:
Line 15641: #line default
Line 15642: #line hidden
Line 15643: @__w.Write("});\r\n\t});\r\n}\r\n</script>\r\n");
Line 15644:
Line 15645: #line 700 "C:\octopus\https\current\dsp_system.aspx"
Line 15646: }
Line 15647:
Line 15648: #line default
Line 15649: #line hidden
Line 15650: @__w.Write("\r\n<!-- GOOGLE_DEPRECATED -->\r\n\r\n");
Line 15651:
Line 15652: #line 703 "C:\octopus\https\current\dsp_system.aspx"
Line 15653:
Line 15654:
Line 15655:if( htmlInjection != null ) Response.Write( htmlInjection.before_closing_body );
Line 15656:
Line 15657:
Line 15658:
Line 15659: #line default
Line 15660: #line hidden
Line 15661: this.WriteUTF8ResourceString(@__w, 107670, 682, true);
Line 15662: }
Line 15663:
Line 15664: [System.Diagnostics.DebuggerNonUserCodeAttribute()]
Line 15665: protected override void FrameworkInitialize() {
Line 15666: base.FrameworkInitialize();
Line 15667: this.SetStringResourcePointer(global::ASP.dsp_system_aspx.@__stringResource, 0);
Line 15668: this.@__BuildControlTree(this);
Line 15669: this.AddWrappedFileDependencies(global::ASP.dsp_system_aspx.@__fileDependencies);
Line 15670: }
Line 15671:
Line 15672: [System.Diagnostics.DebuggerNonUserCodeAttribute()]
Line 15673: public override int GetTypeHashCode() {
Line 15674: return -551698038;
Line 15675: }
Line 15676:
Line 15677: [System.Diagnostics.DebuggerNonUserCodeAttribute()]
Line 15678: public override void ProcessRequest(System.Web.HttpContext context) {
Line 15679: base.ProcessRequest(context);
Line 15680: }
Line 15681: }
Line 15682:}
Line 15683:
|