Beispiel #1
0
        private void SetupBrowserSpecificScripts()
        {
#if !MONO
            string loweredBrowser = string.Empty;

            if (HttpContext.Current.Request.UserAgent != null)
            {
                loweredBrowser = HttpContext.Current.Request.UserAgent.ToLower();
            }

            if (loweredBrowser.Contains("webkit"))
            {
                //this fixes some ajax updatepanel issues in webkit
                //http://forums.asp.net/p/1252014/2392110.aspx
                try
                {
                    ScriptReference scriptReference = new ScriptReference();
                    scriptReference.Path = Page.ResolveUrl("~/ClientScript/AjaxWebKitFix.js");
                    ScriptManager ajax = ScriptManager.GetCurrent(Page);
                    if (ajax != null)
                    {
                        ajax.Scripts.Add(scriptReference);
                    }
                }
                catch (TypeLoadException)
                { }// this can happen if SP1 is not installed for .NET 3.5
            }
#endif
        }
Beispiel #2
0
        protected override IEnumerable <ScriptReference> GetScriptReferences()
        {
            ScriptReference reference = new ScriptReference(
                "Flan.Controls.UpdatePanelPopupExtender.UpdatePanelPopupBehavior.js", "Flan.Controls");

            return(new ScriptReference[] { reference });
        }
Beispiel #3
0
        protected virtual IEnumerable <ScriptReference> GetScriptReferences()
        {
            ScriptReference reference = new ScriptReference();

            reference.Path = ResolveUrl("~/Controls/DateBox.js");
            return(new ScriptReference[] { reference });
        }
Beispiel #4
0
        protected override IEnumerable <ScriptReference> GetScriptReferences()
        {
            ScriptReference reference = new ScriptReference();

            reference.Path = "~/Controls/AutoPostBackBehavior.js";
            return(new ScriptReference[] { reference });
        }
        public IEnumerable <ScriptReference> GetScriptReferences()
        {
            ScriptReference reference = new ScriptReference();

            reference.Path = Page.ClientScript.GetWebResourceUrl(typeof(ToolbarButton), "Macro.ImageServer.Web.Common.WebControls.UI.ToolbarButton.js");
            return(new ScriptReference[] { reference });
        }
        /// <summary>
        /// Determine is script already registered on script entries memory to be combined.
        /// </summary>
        /// <param name="scriptReference">Script to determine.</param>
        /// <returns>true if registered</returns>
        public bool IsScriptRegistered(ScriptReference scriptReference)
        {
            if (!_scriptEntriesLoaded)
            {
                throw new OperationCanceledException("Script entries not loaded yet.");
            }

            // No script was registered
            if (_scriptReferences == null || _scriptReferences.Count == 0)
            {
                return(false);
            }

            // Determine is script is not loaded because part of excluded script to be combined
            if (_scriptEntries != null &&
                _scriptEntries.Where(s => !s.Loaded)
                .Any(
                    s =>
                    s.Name == scriptReference.Name &&
                    s.LoadAssembly().FullName == scriptReference.Assembly))
            {
                return(false);
            }

            var registered = _scriptReferences.Any(s => s.Name == scriptReference.Name && s.Assembly == scriptReference.Assembly);

            // If not registered, let's check again is script has been removed manually by user
            if (!registered && _removedReferences != null)
            {
                registered = _removedReferences.Any(s => s.Name == scriptReference.Name && s.Assembly == scriptReference.Assembly);
            }

            return(registered);
        }
Beispiel #7
0
        /// <summary>
        /// Get the collection of script references.
        /// </summary>
        /// <returns>The collection of script references.</returns>
        protected override IEnumerable <ScriptReference> GetScriptReferences()
        {
            ScriptReference[] references = new ScriptReference[]
            {
                new ScriptReference()
                {
                    Assembly = this.GetType().Assembly.FullName,
                    Name     = "Nequeo.Web.UI.ScriptControl.Script.jquery.json-2.2.js"
                },
                new ScriptReference()
                {
                    Assembly = this.GetType().Assembly.FullName,
                    Name     = "Nequeo.Web.UI.ScriptControl.Script.jquery.dataTables.js"
                },
                new ScriptReference()
                {
                    Assembly = this.GetType().Assembly.FullName,
                    Name     = "Nequeo.Web.UI.ScriptControl.Script.DataTable.js"

                               /* Use following when client-side script isn't embedded in custom control:
                                * Path = this.ResolveClientUrl("~/DataTable.js")*/}
            };

            // Return the collection of references.
            return(references);
        }
Beispiel #8
0
        public void SetImported(ScriptReference dependency)
        {
            Debug.Assert(_applicationType == true);

            _applicationType = false;
            _dependency      = dependency;
        }
Beispiel #9
0
        protected override IEnumerable <KeyValuePair <VerticalSelection, IRoomPlan> > CreateFloorPlan(IFloorPlanBuilder builder, IReadOnlyDictionary <IRoomPlan, KeyValuePair <VerticalSelection, IVerticalFeature> > overlappingVerticalElements, IReadOnlyList <ConstrainedVerticalSelection> constrainedVerticalElements)
        {
            //IReadOnlyList<IReadOnlyList<Subsection>> sections;
            //IReadOnlyList<IReadOnlyList<Vector2>> overlappingVerticals;

            //todo: TEMPORARY FLOORPLAN DETAILS!
            var sections = new[] {
                new Subsection[0],
                new Subsection[0],
                new Subsection[0],
                new Subsection[0],
                new Subsection[0],
                new Subsection[0],
                new Subsection[0],
                new Subsection[0]
            };
            var overlappingVerticals = new Vector2[][] {
            };

            _designer.Design(
                Random,
                Metadata,
                ScriptReference.Find(Random),
                builder,
                sections,
                HierarchicalParameters.InternalWallThickness(Random),
                overlappingVerticals,
                constrainedVerticalElements
                );

            return(new KeyValuePair <VerticalSelection, IRoomPlan> [0]);
        }
Beispiel #10
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
#if !MONO
            try
            {
                ScriptReference scriptReference = new ScriptReference();
                scriptReference.Path = "~/ClientScript/ajaxupdateprogressspan.js";
                //scriptReference.Assembly = "Cynthia.Web";
                //scriptReference.Name = "ajaxupdateprogressspan.js";
                //scriptReference.ScriptMode = ScriptMode.Release;
                ScriptManager.Scripts.Add(scriptReference);
                ScriptManager.RegisterScriptControl(this);
            }
            catch (TypeLoadException) { } //this can happen if SP1 for .NET 3.5 is not installed
#endif

            if (_progressTemplate == null)
            {
                throw new InvalidOperationException(String.Format("A ProgressTemplate must be specified on UpdateProgress control with ID '{0}'.", ID));
            }

            Control container = new Control();
            _progressTemplate.InstantiateIn(container);
            Controls.Add(container);
        }
        private static ScriptReference CreateFileReference(string url)
        {
            ScriptReference scriptReference = new ScriptReference();

            scriptReference.Path = url;
            return(scriptReference);
        }
Beispiel #12
0
        public static void AddScriptReference(this AjaxHelper ajaxHelper, string scriptName, ScriptMode scriptMode)
        {
            ScriptModel scriptModel = GetScriptModel(ajaxHelper);

            if (String.IsNullOrEmpty(scriptName))
            {
                throw new ArgumentNullException("scriptName");
            }

            ScriptSharpSection configSection = ScriptSharpSection.GetSettings();
            ScriptElement      scriptElement = configSection.Scripts.GetElement(scriptName, scriptModel.ScriptFlavor);
            string             actualFlavor  = String.Empty;

            int flavorIndex = scriptElement.Name.IndexOf('.');

            if (flavorIndex > 0)
            {
                actualFlavor = scriptElement.Name.Substring(flavorIndex + 1);
            }

            ScriptReference scriptReference =
                new ScriptReference(scriptName, scriptElement.Url, scriptMode,
                                    scriptElement.GetDependencyList(), scriptElement.Version + actualFlavor);

            scriptModel.AddScriptReference(scriptReference);
        }
Beispiel #13
0
        private void LoadPageClientScripts()
        {
            if (this.Screen != null)
            {
                if (this.Screen.Scripts.Count > 0)
                {
                    ScriptManager Smgr = ScriptManager.GetCurrent(Page);
                    if (Smgr == null)
                    {
                        throw new Exception("ScriptManager not found.");
                    }

                    foreach (Script s in this.Screen.Scripts)
                    {
                        ScriptReference SRef = new ScriptReference();

                        if (String.IsNullOrEmpty(s.Assembly))
                        {
                            SRef.Path = s.Path;
                        }
                        else
                        {
                            SRef.Name     = s.Name;
                            SRef.Assembly = s.Assembly;
                        }

                        Smgr.Scripts.Add(SRef);
                    }
                }
            }
        }
Beispiel #14
0
        public void SetImported(ScriptReference dependency)
        {
            Debug.Assert(IsApplicationType);

            IsApplicationType = false;
            Dependency        = dependency;
        }
Beispiel #15
0
        public void AssertThat_BaseFloor_CreatesExternalFacades()
        {
            var harness = new ProceduralTestHarness();

            var result = harness.Subdivide(new TestRoot(
                                               ScriptReference.Find <TestBuildingWithSingleFloorWithExternalRoom>().Single(),
                                               new Prism(100, new Vector2(0, 0), new Vector2(0, 100), new Vector2(100, 100), new Vector2(100, 0))
                                               ));

            Assert.IsNotNull(result);

            var building = result.Root.Children.OfType <BaseTestBuilding>().Single();
            var floor    = building.Children.OfType <BaseFloor>().Single();
            var room     = floor.Children.OfType <IPlannedRoom>().Single();

            //Check that 4 room facades were created
            Assert.AreEqual(4, room.Facades.Count);

            //Check that facades are all in the correct locations
            foreach (var keyValuePair in room.Facades)
            {
                //Check the facades are in the right place
                Assert.IsTrue(keyValuePair.Value.Section.Matches(keyValuePair.Key.Section));

                //Check that the facades subdivide after rooms
                Assert.IsTrue(((ProceduralScript)keyValuePair.Value.GetDependencyContext()).Prerequisites().Contains((ProceduralScript)room));
            }

            //Check that 2 external facades were created
            Assert.AreEqual(2, room.Facades.Count(f => f.Key.IsExternal));
        }
Beispiel #16
0
        public static bool Save(BaseScript script, out ScriptReference xmlScriptReference)
        {
            xmlScriptReference = new ScriptReference();

            xmlScriptReference.AddScriptName(new SchemaString(script.GetType().ToString()));

            foreach (FieldInfo field in script.m_Fields)
            {
                ParameterType parameter = new ParameterType();

                parameter.AddName(new SchemaString(field.Name));
                parameter.AddType2(new SchemaString(field.FieldType.ToString()));

                object value = field.GetValue(script);
                if (value != null)
                {
                    parameter.AddValue(Variable.GetConstantFromValue(value));
                }
                else
                {
                    Debug.LogError("Error saving value for field " + field.Name + " in script " + script.GetType().ToString());
                }

                xmlScriptReference.AddParameter(parameter);
            }

            return(true);
        }
Beispiel #17
0
        protected override IEnumerable <ScriptReference> GetScriptReferences()
        {
            ScriptReference reference = new ScriptReference(
                "TicketDesk.Engine.Ajax.Extenders.UpdatePanelPopupExtender.UpdatePanelPopupBehavior.js", "TicketDesk.Engine.Ajax.Extenders");

            return(new ScriptReference[] { reference });
        }
Beispiel #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                ModuleConfiguration.ModuleTitle = "Search the Cape Cod MLS";

                if (DotNetNuke.Framework.AJAX.IsInstalled())
                {
                    DotNetNuke.Framework.AJAX.RegisterScriptManager();

                    ScriptManager objScriptManager = ScriptManager.GetCurrent(this.Page);
                    // Add a reference to the web service
                    ServiceReference objServiceReference = new ServiceReference();
                    ScriptReference  objScriptReference  = new ScriptReference();
                    objScriptReference.Path = @"https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js";
                    objScriptManager.Scripts.Add(objScriptReference);

                    objScriptReference.Path = @"https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js";
                    objScriptManager.Scripts.Add(objScriptReference);
                }



                if (!IsPostBack)
                {
                    GetTowns();
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
        IEnumerable <ScriptReference> IScriptControl.GetScriptReferences()
        {
            if (this.Enabled)
            {
                ScriptReference reference = new ScriptReference();

                if (Page != null)
                {
                    if (this.UseEmbeddedJavascript)
                    {
                        reference.Path = Page.ClientScript.GetWebResourceUrl(this.GetType(), "AjaxControls.Timeout.js");
                    }
                    else if (!String.IsNullOrEmpty(this.JavascriptUrl))
                    {
                        reference.Path = this.JavascriptUrl;
                    }
                    else
                    {
                        return(null);
                    }
                }
                return(new ScriptReference[] { reference });
            }
            else
            {
                return(null);
            }
        }
        private static List <ScriptReference> ConvertScriptReferenceToLocalScript(List <ScriptReference> refs)
        {
            List <ScriptReference> result = new List <ScriptReference>();

            foreach (ScriptReference sr in refs)
            {
                ScriptReference existedRef = null;

                //Path的ClientScriptCacheability.None是个约定,表示不能够进行文件缓存
                if (sr.Path.IndexOf("ClientScriptCacheability.None") == 0)
                {
                    existedRef = sr;
                }
                else
                {
                    if (ConvertedScriptReferencesCache.Instance.TryGetValue(sr.Name, out existedRef) == false)
                    {
                        existedRef = ConvertOneScriptToLocalScript(sr);
                        ConvertedScriptReferencesCache.Instance.Add(existedRef.Name, existedRef);
                    }
                }

                result.Add(existedRef);
            }

            return(result);
        }
Beispiel #21
0
        public IEnumerable <ScriptReference> GetScriptReferences()
        {
            ScriptReference reference = new ScriptReference();

            reference.Path = Page.ClientScript.GetWebResourceUrl(GetType(), "MatrixPACS.ImageServer.Web.Common.WebControls.UI.GridView.js");
            return(new ScriptReference[] { reference });
        }
Beispiel #22
0
        public void AddDependency(ScriptReference dependency)
        {
            ScriptReference existingDependency;

            if (_dependencySet.TryGetValue(dependency.Name, out existingDependency))
            {
                // The dependency already exists ... copy over identifier
                // from the new one to the existing one.

                // This is to support the scenario where a dependency got defined
                // by virtue of the app using a [ScriptReference] to specify path/delayLoad
                // semnatics, and we're finding the imported dependency later on
                // such as when a type with a dependency is referred in the code.

                if ((existingDependency.HasIdentifier == false) &&
                    dependency.HasIdentifier)
                {
                    existingDependency.Identifier = dependency.Identifier;
                }
            }
            else
            {
                _dependencies.Add(dependency);
                _dependencySet[dependency.Name] = dependency;
            }
        }
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            ScriptReference sr = new ScriptReference("~/App_Themes/Includes/JS/Test.js?rel=3_5_x_4_1");

            LoadControls("~/UserControls/Test.ascx", true);
            ScriptManager1.Scripts.Add(sr);
        }
Beispiel #24
0
        /// <summary>
        /// Determine is script already registered on script entries memory to be combined.
        /// </summary>
        /// <param name="scriptReference">Script to determine.</param>
        /// <returns>true if registered</returns>
        public bool IsScriptRegistered(ScriptReference scriptReference)
        {
            if (!_scriptEntriesLoaded)
            {
                throw new OperationCanceledException("Script entries not loaded yet.");
            }

            // No script was registered
            if (_scriptReferences == null || _scriptReferences.Count == 0)
            {
                return(false);
            }

            // Determine is script is not loaded because part of excluded script to be combined
            if (_scriptEntries != null &&
                _scriptEntries.Where(s => !s.Loaded)
                .Any(
                    s =>
                    s.Name == scriptReference.Name &&
                    s.LoadAssembly().FullName == scriptReference.Assembly))
            {
                return(false);
            }

            return(_scriptReferences.Any(s => s.Name == scriptReference.Name && s.Assembly == scriptReference.Assembly));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session[Constants.USER_ID] == null)
            {
                Response.Redirect("../Login.aspx");
            }
            else
            {
                //    ;

                //    Session[Constants.USER_NAME] ;

                //    Session[Constants.NAME];

                ServiceReference objServiceReference = new ServiceReference();

                ScriptReference objScriptReference = new ScriptReference();

                objServiceReference.Path = "~/CarsService.asmx";

                objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

                scrptmgr.Services.Add(objServiceReference);
                scrptmgr.Scripts.Add(objScriptReference);

            }

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["CurrentPage"] = "How it Works Page";
            Session["PageName"] = "";
            Session["CurrentPageConfig"] = null;

            KeyWords.Addkeywordstags(Header);
            GeneralFunc.SetPageDefaults(Page);

            GeneralFunc.SaveSiteVisit();

            ServiceReference objServiceReference = new ServiceReference();

            ScriptReference objScriptReference = new ScriptReference();

            objServiceReference.Path = "~/CarsService.asmx";

            objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

            scrptmgr.Services.Add(objServiceReference);
            scrptmgr.Scripts.Add(objScriptReference);

        }
    }
Beispiel #27
0
        public void AssertThat_BaseFloor_CreatesVerticals()
        {
            var harness = new ProceduralTestHarness();

            var result = harness.Subdivide(new TestRoot(
                                               ScriptReference.Find <TestBuildingWithVerticals>().Single(),
                                               new Prism(100, new Vector2(0, 0), new Vector2(0, 100), new Vector2(100, 100), new Vector2(100, 0))
                                               ));

            Assert.IsNotNull(result);

            var building = result.Root.Children.OfType <BaseTestBuilding>().Single();
            var vertical = building.Children.SelectMany(c => c.Children).OfType <IVerticalFeature>().Single();

            //Vertical from 1 -> 3
            Assert.AreEqual(1, vertical.BottomFloorIndex);
            Assert.AreEqual(3, vertical.TopFloorIndex);

            //Did all the floors in the range get informed of this element?
            Assert.AreEqual(0, ((BlankTestFloor)building.Floor(0)).OverlappingVerticals.Count());
            Assert.AreEqual(0, ((BlankTestFloor)building.Floor(1)).OverlappingVerticals.Count());   //Floor 1 placed the element, so it is *not* informed of it this way!
            Assert.AreEqual(1, ((BlankTestFloor)building.Floor(2)).OverlappingVerticals.Count());
            Assert.AreEqual(1, ((BlankTestFloor)building.Floor(3)).OverlappingVerticals.Count());
            Assert.AreEqual(0, ((BlankTestFloor)building.Floor(4)).OverlappingVerticals.Count());

            //Does vertical container contain vertical for all these floors
            var vContainer = (IVerticalFeatureContainer)building;

            Assert.AreEqual(0, vContainer.Overlapping(0).Count());
            Assert.AreEqual(1, vContainer.Overlapping(1).Count());
            Assert.AreEqual(1, vContainer.Overlapping(2).Count());
            Assert.AreEqual(1, vContainer.Overlapping(3).Count());
            Assert.AreEqual(0, vContainer.Overlapping(4).Count());
        }
 public IEnumerable<ScriptReference> GetScriptReferences()
 {
     List<ScriptReference> refs = new List<ScriptReference>();
     ScriptReference javRef  =  new ScriptReference("~/SmartParts/OpportunitySalesProcess/OpportunitySalesProcess_ClientScript.js");
     refs.Add(javRef);
     return refs;
 }
        protected override System.Collections.Generic.IEnumerable <ScriptReference> GetScriptReferences()
        {
            if (Site != null)
            {
                return(null);
            }
            if ((Page != null) && ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
            {
                return(null);
            }
            List <ScriptReference> scripts = new List <ScriptReference>();

            if (EnableCombinedScript && !(IgnoreCombinedScript))
            {
                ScriptReference combinedScript = new ScriptReference(CombinedScriptName);
                combinedScript.ResourceUICultures = null;
                scripts.Add(combinedScript);
                return(scripts);
            }
            string fileType = ".min.js";

            if (!(EnableMinifiedScript))
            {
                fileType = ".js";
            }
            CultureInfo ci = CultureInfo.CurrentUICulture;

            if (!((ci.Name == "en-US")))
            {
                scripts.Add(CreateScriptReference(String.Format("~/js/sys/culture/{0}.js", ci.Name)));
            }
            scripts.Add(CreateScriptReference(("~/js/sys/jquery-2.2.4" + fileType)));
            scripts.Add(CreateScriptReference("~/js/sys/bootstrap.min.js"));
            scripts.Add(CreateScriptReference(String.Format("~/js/sys/jquery.mobile-{0}{1}", ApplicationServices.JqmVersion, fileType)));
            scripts.Add(CreateScriptReference("~/js/sys/MicrosoftAjax.min.js"));
            scripts.Add(CreateScriptReference("~/js/sys/MicrosoftAjaxWebForms.min.js"));
            scripts.Add(CreateScriptReference(("~/js/daf/daf-resources" + fileType)));
            scripts.Add(CreateScriptReference(("~/js/daf/daf" + fileType)));
            scripts.Add(CreateScriptReference(("~/js/daf/daf-odp" + fileType)));
            if (EnableCombinedScript)
            {
                scripts.Add(CreateScriptReference(("~/js/daf/daf-membership" + fileType)));
            }
            ConfigureScripts(scripts);
            scripts.Add(CreateScriptReference(("~/js/daf/touch" + fileType)));
            scripts.Add(CreateScriptReference(("~/js/daf/touch-edit" + fileType)));
            scripts.Add(CreateScriptReference(("~/js/daf/touch-charts" + fileType)));
            scripts.Add(CreateScriptReference(("~/js/sys/unicode" + fileType)));
            if (!(String.IsNullOrEmpty(ApplicationServices.Current.AddScripts())))
            {
                scripts.Add(CreateScriptReference("~/js/daf/add.min.js"));
            }
            if (Context.Request.Url.Host.Equals("localhost") && File.Exists(Context.Server.MapPath("~/js/codeontime.designer.js")))
            {
                scripts.Add(CreateScriptReference("~/js/codeontime.designer.js"));
            }
            ApplicationServices.Current.ConfigureScripts(scripts);
            return(scripts);
        }
Beispiel #30
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ScriptReference ToScriptReference()
        {
            ScriptReference refr = new ScriptReference();

            refr.Assembly = ComponentType.Assembly.FullName;
            refr.Name     = ResourcePath;
            return(refr);
        }
Beispiel #31
0
        //<Snippet4>
        protected override IEnumerable <ScriptReference> GetScriptReferences()
        {
            ScriptReference reference = new ScriptReference();

            reference.Path = ResolveClientUrl("FocusBehavior.js");

            return(new ScriptReference[] { reference });
        }
    public IEnumerable <ScriptReference> GetScriptReferences()
    {
        List <ScriptReference> refs   = new List <ScriptReference>();
        ScriptReference        javRef = new ScriptReference("~/SmartParts/OpportunitySalesProcess/OpportunitySalesProcess_ClientScript.js");

        refs.Add(javRef);
        return(refs);
    }
Beispiel #33
0
        protected virtual IEnumerable <ScriptReference> GetScriptReferences()
        {
            ScriptReference reference = new ScriptReference();

            reference.Path = ResolveClientUrl("SampleTextBox.js");

            return(new ScriptReference[] { reference });
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["PageName"] = "Unsubscribe";

            ServiceReference objServiceReference = new ServiceReference();

            ScriptReference objScriptReference = new ScriptReference();

            objServiceReference.Path = "~/CarsService.asmx";

            objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

            scrptmgr.Services.Add(objServiceReference);
            scrptmgr.Scripts.Add(objScriptReference);

            if (Request.QueryString.Keys.Count > 0)
            {
                string URL = string.Empty;
                string URL1 = string.Empty;
                if (Request.QueryString.Keys.Count > 0)
                {
                    if (URL != null)
                    {
                        PreferencesBL objPreferencesBL = new PreferencesBL();

                        DataSet dsPreferences = new DataSet();

                        dsPreferences = objPreferencesBL.GetEmailPreferences(Request.QueryString["PreferID"].ToString());

                        if (dsPreferences.Tables[0].Rows.Count > 0)
                        {
                            if (dsPreferences.Tables[0].Rows[0]["IsActive"].ToString() == "True")
                            {
                                objPreferencesBL.SubScribeStatus(Request.QueryString["PreferID"].ToString(), 0);

                                lblalert.Text = "Email Alerts has Unsubscribed Successfully...";
                            }
                            else
                            {
                                lblalert.Text = "Email Alerts has Already Unsubscribed ";

                                //mpealteruser.Show();
                            }
                        }

                        Type cstype = GetType();
                        ClientScriptManager cs = Page.ClientScript;
                        cs.RegisterStartupScript(cstype, "KyRST", "<script type='text/javascript' language='javascript'>pageLoad();</script>");

                    }
                }

            }

        }
    }
Beispiel #35
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Redirect("Login.aspx");
        ServiceReference objServiceReference = new ServiceReference();

        ScriptReference objScriptReference = new ScriptReference();

        objServiceReference.Path = "~/WebService.asmx";

        objScriptReference.Path = "~/Static/Js/CarsJScript.js";

        //scrptmgr.Services.Add(objServiceReference);
        //scrptmgr.Scripts.Add(objScriptReference);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GeneralFunc.SaveSiteVisit();
            GeneralFunc.SetPageDefaults(Page);
            //if (Session[Constants.NAME] == null)
            //{
            //    lnkLogin.Visible = true;
            //    lnkBtnLogout.Visible = false;
            //    lblUserName.Visible = false;
            //    lblWelcome.Visible = false;
            //}
            //else
            //{
            //    lnkLogin.Visible = false;
            //    lnkBtnLogout.Visible = true;
            //    lblUserName.Visible = true;
            //    lblWelcome.Visible = true;
            //    lblUserName.Text = Session[Constants.NAME].ToString();
            //}
            Session["CurrentPage"] = "Home";

            KeyWords.Addkeywordstags(Header);

            Session["PageName"] = "Home";

            Session["CurrentPageConfig"] = null;

            ServiceReference objServiceReference = new ServiceReference();

            ScriptReference objScriptReference = new ScriptReference();

            objServiceReference.Path = "~/CarsService.asmx";

            objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

            scrptmgr.Services.Add(objServiceReference);
            scrptmgr.Scripts.Add(objScriptReference);

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["CurrentPage"] = "Home";

            Session["CurrentPageConfig"] = null;

            ServiceReference objServiceReference = new ServiceReference();

            ScriptReference objScriptReference = new ScriptReference();

            objServiceReference.Path = "~/CarsService.asmx";

            objScriptReference.Path = "~/Static/Js/CarsJScript.js";

            scrptmgr.Services.Add(objServiceReference);
            scrptmgr.Scripts.Add(objScriptReference);

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[Constants.NAME] == null)
        {
            Response.Redirect("Default.aspx");
        }
        else
        {
            if (!IsPostBack)
            {
                Session["CurrentPage"] = "Home";

                Session["CurrentPageConfig"] = null;
                Session["PageName"] = "";

                ServiceReference objServiceReference = new ServiceReference();

                ScriptReference objScriptReference = new ScriptReference();

                objServiceReference.Path = "~/CarsService.asmx";

                objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

                scrptmgr.Services.Add(objServiceReference);
                scrptmgr.Scripts.Add(objScriptReference);

                //lblUserName.Text = Session[Constants.NAME].ToString();

                int UID = Convert.ToInt32(Session[Constants.USER_ID].ToString());
                dsDropDown = objdropdownBL.Usp_Get_DropDown();
                DataSet dsGetIDs = objdropdownBL.USP_GetIdsByUID(UID);
                FillStates();
                if (dsGetIDs.Tables.Count > 0)
                {
                    if (dsGetIDs.Tables[0].Rows.Count > 0)
                    {
                        Session["PostingID"] = dsGetIDs.Tables[0].Rows[0]["postingID"].ToString();
                        Session["CarID"] = dsGetIDs.Tables[0].Rows[0]["CarID"].ToString();
                        Session[Constants.SellerID] = dsGetIDs.Tables[0].Rows[0]["SellerID"].ToString();
                        Session["PaymentID"] = dsGetIDs.Tables[0].Rows[0]["paymentID"].ToString();
                        Session["isActive"] = dsGetIDs.Tables[0].Rows[0]["isActive"].ToString();
                        Session["UserPackID"] = dsGetIDs.Tables[1].Rows[0]["UserPackID"].ToString();
                    }
                }
                if ((Session["CarID"] == null) || (Session["CarID"].ToString() == ""))
                {
                    btnAdd.Visible = true;
                    btnDelete.Visible = false;
                    btnEdit.Visible = false;
                    // btnDeactive.Visible = false;
                    btnEditDetails.Visible = true;
                    btnUpdateDetails.Visible = false;
                    //pnl2Error.Style["display"] = "block";
                    divSrchResBox.Style["display"] = "none";
                    grdMultiSites.Visible = false;
                    lblExistUrlRes.Visible = true;
                    lblExistUrlRes.Text = "Not uploaded";
                }
                else
                {
                    if (Session["isActive"].ToString() == "True")
                    {
                        btnSold.Visible = true;
                        btnWithdraw.Visible = true;
                        btnActive.Visible = false;
                    }
                    else
                    {
                        btnSold.Visible = false;
                        btnWithdraw.Visible = false;
                        btnActive.Visible = true;
                    }
                    DataSet dsCarDetailsInfo = new DataSet();
                    dsCarDetailsInfo = objdropdownBL.USP_GetCarDetailsByIds(Convert.ToInt32(Session["CarID"].ToString()), Convert.ToInt32(Session[Constants.SellerID].ToString()));
                    Session["getcardata"] = dsCarDetailsInfo;
                    btnAdd.Visible = false;
                    btnDelete.Visible = false;
                    btnEdit.Visible = true;
                    Session["SelYear"] = dsCarDetailsInfo.Tables[0].Rows[0]["yearOfMake"].ToString();
                    Session["SelMake"] = dsCarDetailsInfo.Tables[0].Rows[0]["make"].ToString();
                    Session["SelModel"] = dsCarDetailsInfo.Tables[0].Rows[0]["model"].ToString();
                    DataSet dsImages = objdropdownBL.USP_GetImages(Convert.ToInt32(Session["CarID"].ToString()), Convert.ToInt32(Session["PackageID"].ToString()));
                    Session["GetImages"] = dsImages;
                    string SelModelName = Session["SelModel"].ToString();
                    SelModelName = SelModelName.Replace("/", "@");
                    SelModelName = SelModelName.Replace("&", "@");
                    if (dsImages.Tables[0].Rows[0]["Pic0"].ToString() != "0" && dsImages.Tables[0].Rows[0]["Pic0"].ToString() != "")
                    {
                        divAdStock.Style["display"] = "none";
                        ImageName.ImageUrl = "~/CarImages/" + Session["SelYear"].ToString() + "/" + Session["SelMake"].ToString() + "/" + SelModelName + "/" + dsImages.Tables[0].Rows[0]["Pic0Name"].ToString();
                    }
                    else
                    {
                        ImageName.ImageUrl = "~/images/stockMakes/" + Session["SelMake"].ToString() + ".jpg";
                        divAdStock.Style["display"] = "block";
                    }
                    if (dsCarDetailsInfo.Tables[0].Rows[0]["Title"].ToString() == "")
                    {
                        lblTitle.Visible = false;
                    }
                    else
                    {
                        lblTitle.Visible = true;
                        lblTitle.Text = dsCarDetailsInfo.Tables[0].Rows[0]["Title"].ToString();
                    }
                    lblCarName.Text = dsCarDetailsInfo.Tables[0].Rows[0]["yearOfMake"].ToString() + " " + dsCarDetailsInfo.Tables[0].Rows[0]["make"].ToString() + " " + dsCarDetailsInfo.Tables[0].Rows[0]["model"].ToString();
                    //string descripText = dsCarDetailsInfo.Tables[0].Rows[0]["description"].ToString();
                    //if (descripText.Length > 75)
                    //{
                    //    lblDescrip.Text = descripText.Trim().Substring(0, 75) + "...";
                    //}
                    //else
                    //{
                    //    lblDescrip.Text = descripText;
                    //}
                    if (dsCarDetailsInfo.Tables[0].Rows[0]["mileage"].ToString() != "0.00")
                    {
                        lbladmilleage.Visible = true;
                        lblMi.Visible = true;
                        lbladmilleage.Text = dsCarDetailsInfo.Tables[0].Rows[0]["mileage"].ToString();
                    }
                    else
                    {
                        lbladmilleage.Visible = true;
                        lblMi.Visible = false;
                        lbladmilleage.Text = "Unspecified";
                    }
                    if (dsCarDetailsInfo.Tables[0].Rows[0]["price"].ToString() != "0.0000")
                    {
                        lbladPrice.Visible = true;
                        lbladPrice.Text = dsCarDetailsInfo.Tables[0].Rows[0]["price"].ToString();
                    }
                    else
                    {
                        lbladPrice.Visible = true;
                        lbladPrice.Text = "Unspecified";
                    }
                    if (dsCarDetailsInfo.Tables[0].Rows[0]["bodyType"].ToString() != "Unspecified")
                    {
                        lblAdBody.Visible = true;
                        lblAdBody.Text = dsCarDetailsInfo.Tables[0].Rows[0]["bodyType"].ToString();
                    }
                    else
                    {
                        lblAdBody.Visible = true;
                        lblAdBody.Text = "Unspecified";
                    }
                    if (dsCarDetailsInfo.Tables[0].Rows[0]["fuelType"].ToString() != "Unspecified")
                    {
                        lblAdFuel.Visible = true;
                        lblAdFuel.Text = dsCarDetailsInfo.Tables[0].Rows[0]["fuelType"].ToString();
                    }
                    else
                    {
                        lblAdFuel.Visible = true;
                        lblAdFuel.Text = "Unspecified";
                    }

                    ArrayList strDescrip = new ArrayList();
                    string ExtClr = string.Empty;
                    string NoOfDoors = string.Empty;
                    string NoOfCyln = string.Empty;
                    string Trans = string.Empty;
                    strDescrip.Add(dsCarDetailsInfo.Tables[0].Rows[0]["exteriorColor"].ToString());
                    strDescrip.Add(dsCarDetailsInfo.Tables[0].Rows[0]["numberOfDoors"].ToString());
                    strDescrip.Add(dsCarDetailsInfo.Tables[0].Rows[0]["numberOfCylinder"].ToString());
                    strDescrip.Add(dsCarDetailsInfo.Tables[0].Rows[0]["Transmission"].ToString());

                    if (strDescrip[0].ToString() != "Unspecified" && (strDescrip[1].ToString() != "Unspecified" || strDescrip[2].ToString() != "Unspecified" || strDescrip[3].ToString() != "Unspecified"))
                    {
                        ExtClr = strDescrip[0].ToString() + ", ";
                    }
                    else if (strDescrip[0].ToString() != "Unspecified")
                    {
                        ExtClr = strDescrip[0].ToString();
                    }
                    if (strDescrip[1].ToString() != "Unspecified" && (strDescrip[2].ToString() != "Unspecified" || strDescrip[3].ToString() != "Unspecified"))
                    {
                        NoOfDoors = strDescrip[1].ToString() + ", ";
                    }
                    else if (strDescrip[1].ToString() != "Unspecified")
                    {
                        NoOfDoors = strDescrip[1].ToString();
                    }
                    if (strDescrip[2].ToString() != "Unspecified" && strDescrip[3].ToString() != "Unspecified")
                    {
                        NoOfCyln = strDescrip[2].ToString() + ", ";
                    }
                    else if (strDescrip[2].ToString() != "Unspecified")
                    {
                        NoOfCyln = strDescrip[2].ToString();
                    }
                    if (strDescrip[3].ToString() != "Unspecified")
                    {
                        Trans = strDescrip[3].ToString();
                    }
                    lblDescrip.Text = ExtClr + NoOfDoors + NoOfCyln + Trans;

                    divSrchResBox.Style["display"] = "block";
                    int PicCount = 0;
                    for (int i = 1; i < 21; i++)
                    {
                        string ColumnPic = "pic" + i.ToString();
                        if (dsCarDetailsInfo.Tables[0].Rows[0][ColumnPic].ToString() != "0" && dsCarDetailsInfo.Tables[0].Rows[0][ColumnPic].ToString() != "")
                        {
                            PicCount = PicCount + 1;
                        }
                    }
                    lblPhotoUploaded.Text = PicCount.ToString();
                    if (dsCarDetailsInfo.Tables[3].Rows.Count > 0)
                    {
                        lblExistUrlRes.Visible = false;
                        divlblMultiSite.Style["display"] = "none";
                        grdMultiSites.Visible = true;
                        grdMultiSites.DataSource = dsCarDetailsInfo.Tables[3];
                        grdMultiSites.DataBind();

                    }
                    else
                    {
                        grdMultiSites.Visible = false;
                        lblExistUrlRes.Visible = true;
                        lblExistUrlRes.Text = "Not uploaded..!";
                        divlblMultiSite.Style["display"] = "block";
                    }

                }

                DataSet dsUserInfoDetails = objdropdownBL.USP_GetUSerDetailsByUserID(Convert.ToInt32(Session[Constants.USER_ID].ToString()));
                Session["getRegUserdata"] = dsUserInfoDetails;
                tbl1LblsDisplay.Style["display"] = "block";
                tbl2textDisplay.Style["display"] = "none";
                lblRegEmail.Text = Session[Constants.USER_NAME].ToString();
                lblRegEmail2.Text = Session[Constants.USER_NAME].ToString();
                lblUnamePW.Text = Session[Constants.USER_NAME].ToString();
                lblRegPhone.Text = objGeneralFunc.filPhnm(dsUserInfoDetails.Tables[0].Rows[0]["PhoneNumber"].ToString());
                lblRegName.Text = dsUserInfoDetails.Tables[0].Rows[0]["Name"].ToString();
                lblBusinessName.Text = dsUserInfoDetails.Tables[0].Rows[0]["BusinessName"].ToString();
                lblAltEmail.Text = dsUserInfoDetails.Tables[0].Rows[0]["AltEmail"].ToString();
                lblAltPhone.Text = objGeneralFunc.filPhnm(dsUserInfoDetails.Tables[0].Rows[0]["AltPhone"].ToString());

                ArrayList strAddress = new ArrayList();
                strAddress.Add(dsUserInfoDetails.Tables[0].Rows[0]["Address"].ToString().Trim());
                strAddress.Add(dsUserInfoDetails.Tables[0].Rows[0]["City"].ToString().Trim());
                strAddress.Add(dsUserInfoDetails.Tables[0].Rows[0]["State_Code"].ToString());
                strAddress.Add(dsUserInfoDetails.Tables[0].Rows[0]["Zip"].ToString());

                if (strAddress[0].ToString() != "" && (strAddress[1].ToString() != "" || strAddress[2].ToString() != "UN" || strAddress[3].ToString() != ""))
                {
                    lblRegAddress.Text = GeneralFunc.ToProper(strAddress[0].ToString()).Trim() + ", ";
                }
                else
                {
                    lblRegAddress.Text = GeneralFunc.ToProper(strAddress[0].ToString()).Trim();
                }

                if (strAddress[1].ToString() != "" && (strAddress[2].ToString() != "UN" || strAddress[3].ToString() != ""))
                {
                    lblRegCity.Text = GeneralFunc.ToProper(strAddress[1].ToString()).Trim() + ", ";
                }
                else
                {
                    lblRegCity.Text = GeneralFunc.ToProper(strAddress[1].ToString()).Trim();
                }

                if ((strAddress[2].ToString() != "UN") && (strAddress[3].ToString() != ""))
                {
                    lblRegState.Text = strAddress[2].ToString() + " ";
                }
                else if ((strAddress[2].ToString() != "UN") && (strAddress[3].ToString() == ""))
                {
                    lblRegState.Text = strAddress[2].ToString();
                }
                lblRegZip.Text = strAddress[3].ToString();
                btnEditDetails.Visible = true;
                btnUpdateDetails.Visible = false;

                DataSet dsPackDetails = objdropdownBL.USP_GetPackageDetails(Convert.ToInt32(Session["PackageID"]), UID);
                if (dsPackDetails.Tables[0].Rows.Count > 0)
                {
                    lblPackDescrip.Text = dsPackDetails.Tables[0].Rows[0]["Description"].ToString();
                    lblMaxPhotos.Text = dsPackDetails.Tables[0].Rows[0]["Maxphotos"].ToString();
                    Session["MaxPhotos"] = dsPackDetails.Tables[0].Rows[0]["Maxphotos"];
                    if ((dsPackDetails.Tables[0].Rows[0]["dateOfPosting"].ToString() != "") && (dsPackDetails.Tables[0].Rows[0]["PaymentDate"].ToString() != ""))
                    {
                        DateTime PostDate = Convert.ToDateTime(dsPackDetails.Tables[0].Rows[0]["dateOfPosting"].ToString());
                        DateTime PaymentDate = Convert.ToDateTime(dsPackDetails.Tables[0].Rows[0]["PaymentDate"].ToString());
                        if (PostDate > PaymentDate)
                        {
                            lblAdActiveFrom.Text = PostDate.ToString("MM/dd/yyyy");
                        }
                        else if (PostDate <= PaymentDate)
                        {
                            lblAdActiveFrom.Text = PaymentDate.ToString("MM/dd/yyyy");
                        }
                    }
                    //  lblAdActiveFrom.Text = dsPackDetails.Tables[0].Rows[0]["dateOfPosting"].ToString();
                    if (lblAdActiveFrom.Text != "")
                    {
                        TimeSpan timespan = System.DateTime.Now.Subtract(Convert.ToDateTime(lblAdActiveFrom.Text));
                        int daysComplete = Convert.ToInt32(timespan.Days);
                        int RemainDays = Convert.ToInt32(dsPackDetails.Tables[0].Rows[0]["ValidityPeriod"].ToString()) - daysComplete;
                        lblRemainingPeriod.Text = System.DateTime.Now.AddDays(RemainDays).ToString("MM/dd/yyyy");
                    }
                    if (lblPhotoUploaded.Text == "")
                    {
                        lblPhotoUploaded.Text = "0";
                    }

                }
            }
        }
    }
Beispiel #39
0
        public void AddDependency(ScriptReference dependency)
        {
            ScriptReference existingDependency;
            if (_dependencySet.TryGetValue(dependency.Name, out existingDependency)) {
                // The dependency already exists ... copy over identifier
                // from the new one to the existing one.

                // This is to support the scenario where a dependency got defined
                // by virtue of the app using a [ScriptReference] to specify path/delayLoad
                // semnatics, and we're finding the imported dependency later on
                // such as when a type with a dependency is referred in the code.

                if ((existingDependency.HasIdentifier == false) &&
                    dependency.HasIdentifier) {
                    existingDependency.Identifier = dependency.Identifier;
                }
            }
            else {
                _dependencies.Add(dependency);
                _dependencySet[dependency.Name] = dependency;
            }
        }
Beispiel #40
0
        public ScriptReference GetDependency(string name, out bool newReference)
        {
            newReference = false;

            ScriptReference reference;
            if (_dependencySet.TryGetValue(name, out reference) == false) {
                reference = new ScriptReference(name, null);
                newReference = true;
                AddDependency(reference);
            }
            return reference;
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[Constants.NAME] == null)
        {
            Response.Redirect("Default.aspx");
        }
        else
        {
            if (!IsPostBack)
            {
                Session["CurrentPage"] = "Home";
                Session["PageName"] = "";
                Session["CurrentPageConfig"] = null;

                GeneralFunc.SetPageDefaults(Page);

                ServiceReference objServiceReference = new ServiceReference();

                ScriptReference objScriptReference = new ScriptReference();

                objServiceReference.Path = "~/CarsService.asmx";

                objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

                scrptmgr.Services.Add(objServiceReference);
                scrptmgr.Scripts.Add(objScriptReference);

                int getPackageID = Convert.ToInt32(Session["PackageID"].ToString());
                DataSet dsImages = objdropdownBL.USP_GetImages(Convert.ToInt32(Session["CarID"].ToString()), getPackageID);
                Session["GetImages"] = dsImages;
                Session["MaxPhotos"] = dsImages.Tables[1].Rows[0]["Maxphotos"].ToString();
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "maxPhotos();", true);
                btnContinue.Text = "Add Photos Later";
                //lblUserName.Text = Session[Constants.NAME].ToString();

                DisplayImages(dsImages);

            }
        }
    }
Beispiel #42
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[Constants.NAME] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "TransfersInfoBinding();", true);
            if (!IsPostBack)
            {
                Session["CurrentPage"] = "New sale";

                if (LoadIndividualUserRights() == false)
                {
                    Response.Redirect("Login.aspx");
                }
                else
                {
                    ServiceReference objServiceReference = new ServiceReference();

                    ScriptReference objScriptReference = new ScriptReference();

                    objServiceReference.Path = "~/WebService.asmx";

                    objScriptReference.Path = "~/Static/Js/CarsJScript.js";

                    scrptmgr.Services.Add(objServiceReference);
                    scrptmgr.Scripts.Add(objScriptReference);

                    if (Session[Constants.NAME] == null)
                    {
                        lnkBtnLogout.Visible = false;
                        lblUserName.Visible = false;
                    }
                    else
                    {
                        LoadUserRights();
                        lnkBtnLogout.Visible = true;
                        lblUserName.Visible = true;
                        string LogUsername = Session[Constants.NAME].ToString();
                        string CenterCode = Session[Constants.CenterCode].ToString();
                        string UserLogName = Session[Constants.USER_NAME].ToString();
                        if (LogUsername.Length > 20)
                        {
                            lblUserName.Text = LogUsername.ToString().Substring(0, 20);
                            //if (CenterCode.Length > 5)
                            //{
                            //    lblUserName.Text = lblUserName.Text + " (" + CenterCode.ToString().Substring(0, 5) + ")";
                            //}
                            //else
                            //{
                            lblUserName.Text = lblUserName.Text + " (" + CenterCode.ToString() + ")-" + UserLogName.ToString();
                            //}
                        }
                        else
                        {
                            lblUserName.Text = LogUsername;
                            lblUserName.Text = lblUserName.Text + " (" + CenterCode.ToString() + ")-" + UserLogName.ToString();
                        }

                    }
                    if (Session["DsDropDown"] == null)
                    {
                        dsDropDown = objdropdownBL.Usp_Get_DropDown();
                        Session["DsDropDown"] = dsDropDown;
                    }
                    else
                    {
                        dsDropDown = (DataSet)Session["DsDropDown"];
                    }
                    Session["AddAnotherCarSaleCarID"] = null;
                    Session["AddAnotherCarSalePostingID"] = null;
                    Session["AddAnotherCarSaleUserPackID"] = null;
                    Session["AddAnotherCarSaleSellerID"] = null;
                    Session["AddAnotherCarSalePSID1"] = null;
                    Session["AddAnotherCarSalePSID2"] = null;
                    Session["AddAnotherCarSalePaymentID"] = null;
                    lnkTicker.Attributes.Add("href", "javascript:poptastic('Ticker.aspx?CID=" + Session[Constants.CenterCodeID] + "&CNAME=" + Session[Constants.CenterCode] + "');");
                    DataSet dsYears = objHotLeadBL.USP_GetNext12years();

                    fillYears(dsYears);
                    FillYear();
                    FillPackage();
                    FillStates();
                    GetAllModels();
                    GetMakes();
                    GetModelsInfo();
                    FillExteriorColor();
                    FillInteriorColor();
                    GetBody();
                    //FillPaymentDate();
                    FillPDDate();
                    FillBillingStates();
                    FillPhotoSource();
                    FillDescriptionSource();
                    // FillVerifier();
                    //FillAgents();
                    FillVoiceFileLocation();
                    // FillCheckTypes();
                    DataSet dsTransfers = objHotLeadBL.GetLoginTransferAgentsCount();
                    if (dsTransfers.Tables[0].Rows[0]["CountAll"].ToString() == "0")
                    {
                        lblTransferAgentsCount.Text = "Transfer agent(s) are not available";
                    }
                    else
                    {
                        lblTransferAgentsCount.Text = dsTransfers.Tables[0].Rows[0]["CountAll"].ToString() + " Transfer agent(s) available";
                        //System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "lll();", true);
                        DataSet dsTransferAgents = objHotLeadBL.GetAllLoginTransferAgentsDetails();
                        if (dsTransferAgents.Tables[0].Rows.Count > 0)
                        {
                            grdTest.DataSource = dsTransferAgents.Tables[0];
                            grdTest.DataBind();
                        }
                    }
                    DataSet dsDatetime = objHotLeadBL.GetDatetime();
                    DateTime dtNow = Convert.ToDateTime(dsDatetime.Tables[0].Rows[0]["Datetime"].ToString());
                    txtPaymentDate.Text = dtNow.ToString("MM/dd/yyyy");
                    DataSet dsCenterRoles = objHotLeadBL.GetCenterRolesByID(Convert.ToInt32(Session[Constants.CenterCodeID].ToString()));
                    Session["dsCenterRoles"] = dsCenterRoles;
                    if (dsCenterRoles.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < dsCenterRoles.Tables[0].Rows.Count; i++)
                        {
                            if (dsCenterRoles.Tables[0].Rows[i]["CenterRoleID"].ToString() == "1")
                            {
                                if (dsCenterRoles.Tables[0].Rows[i]["CenterRightStatus"].ToString() == "0")
                                {
                                    btnSale.Visible = false;
                                    btnSale2.Visible = false;
                                }
                                else
                                {
                                    btnSale.Visible = true;
                                    btnSale2.Visible = true;
                                }
                            }
                            if (dsCenterRoles.Tables[0].Rows[i]["CenterRoleID"].ToString() == "2")
                            {
                                if (dsCenterRoles.Tables[0].Rows[i]["CenterRightStatus"].ToString() == "0")
                                {
                                    //btnTransfer.Visible = false;
                                    //btnTransfer2.Visible = false;
                                    lblTransferAgentsCount.Visible = false;
                                }
                                else
                                {
                                    //btnTransfer.Visible = true;
                                    //btnTransfer2.Visible = true;
                                    lblTransferAgentsCount.Visible = true;
                                }
                            }
                        }
                    }
                    if ((Session["AddAnotherCarSaleUID"] != null) && (Session["AddAnotherCarSaleUID"].ToString() != ""))
                    {
                        int UID = Convert.ToInt32(Session["AddAnotherCarSaleUID"].ToString());
                        DataSet Cardetais = objHotLeadBL.GetUserByExistUserID(UID);
                        int CarsCount = Convert.ToInt32(Cardetais.Tables[0].Rows.Count.ToString());
                        CarsCount = CarsCount + 1;
                        string CarsHeadText = CarsCount.ToString() + " car details";
                        lblHeadingForAddCar.Text = CarsHeadText.ToString();
                        //ListItem liVer = new ListItem();
                        //liVer.Text = Cardetais.Tables[0].Rows[0]["VerifierAgent"].ToString();
                        //liVer.Value = Cardetais.Tables[0].Rows[0]["VerifierID"].ToString();
                        //ddlVerifier.SelectedIndex = ddlVerifier.Items.IndexOf(liVer);
                        lblVerifier.Text = Cardetais.Tables[0].Rows[0]["SaleVerifierName"].ToString();
                        lblSaleAgent.Text = Cardetais.Tables[0].Rows[0]["SaleAgent"].ToString();
                        Session["AddAnotherCarVerifierID"] = Cardetais.Tables[0].Rows[0]["SaleVerifierID"].ToString();
                        Session["AddAnotherCarSaleAgentID"] = Cardetais.Tables[0].Rows[0]["SaleAgentID"].ToString();
                        txtFirstName.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["sellerName"].ToString());
                        txtLastName.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["LastName"].ToString());
                        txtPhone.Text = objGeneralFunc.filPhnm(Cardetais.Tables[0].Rows[0]["PhoneNum"].ToString());
                        txtEmail.Text = Cardetais.Tables[0].Rows[0]["email"].ToString();
                        txtAddress.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["address1"].ToString());
                        txtCity.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["city"].ToString());
                        if (Cardetais.Tables[0].Rows[0]["EmailExists"].ToString() == "0")
                        {
                            chkbxEMailNA.Checked = true;
                        }
                        else
                        {
                            chkbxEMailNA.Checked = false;
                        }

                        ListItem listState = new ListItem();
                        listState.Value = Cardetais.Tables[0].Rows[0]["StateID"].ToString();
                        listState.Text = Cardetais.Tables[0].Rows[0]["state"].ToString();
                        ddlLocationState.SelectedIndex = ddlLocationState.Items.IndexOf(listState);
                        txtZip.Text = Cardetais.Tables[0].Rows[0]["zip"].ToString();
                        Session["AddAnotherCarSaleUID"] = Cardetais.Tables[0].Rows[0]["uid"].ToString();
                        if (Session["AddCarRedirectFrom"].ToString() == "FromNewCar")
                        {
                            if (Convert.ToInt32(Cardetais.Tables[0].Rows[0]["pmntType"].ToString()) == 1)
                            {
                                rdbtnPayVisa.Checked = true;
                            }
                            else if (Convert.ToInt32(Cardetais.Tables[0].Rows[0]["pmntType"].ToString()) == 2)
                            {
                                rdbtnPayMasterCard.Checked = true;
                            }
                            else if (Convert.ToInt32(Cardetais.Tables[0].Rows[0]["pmntType"].ToString()) == 3)
                            {
                                rdbtnPayAmex.Checked = true;
                            }
                            else if (Convert.ToInt32(Cardetais.Tables[0].Rows[0]["pmntType"].ToString()) == 4)
                            {
                                rdbtnPayDiscover.Checked = true;
                            }
                            else if (Convert.ToInt32(Cardetais.Tables[0].Rows[0]["pmntType"].ToString()) == 5)
                            {
                                rdbtnPayCheck.Checked = true;
                            }
                            else
                            {
                                rdbtnPayPaypal.Checked = true;
                            }
                            if (Convert.ToInt32(Cardetais.Tables[0].Rows[0]["pmntType"].ToString()) == 5)
                            {
                                divcard.Style["display"] = "none";
                                divcheck.Style["display"] = "block";
                                divpaypal.Style["display"] = "none";
                                txtCustNameForCheck.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["bankAccountHolderName"].ToString());
                                txtAccNumberForCheck.Text = Cardetais.Tables[0].Rows[0]["bankAccountNumber"].ToString();
                                txtBankNameForCheck.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["bankName"].ToString());
                                txtRoutingNumberForCheck.Text = Cardetais.Tables[0].Rows[0]["bankRouting"].ToString();
                                //lblAccountType.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["AccountTypeName"].ToString());
                                ListItem liAccType = new ListItem();
                                liAccType.Text = Cardetais.Tables[0].Rows[0]["AccountTypeName"].ToString();
                                liAccType.Value = Cardetais.Tables[0].Rows[0]["bankAccountType"].ToString();
                                ddlAccType.SelectedIndex = ddlAccType.Items.IndexOf(liAccType);

                                //ListItem liCheckType = new ListItem();
                                //liCheckType.Text = Cardetais.Tables[0].Rows[0]["CheckTypeName"].ToString();
                                //liCheckType.Value = Cardetais.Tables[0].Rows[0]["CheckTypeID"].ToString();
                                //ddlCheckType.SelectedIndex = ddlCheckType.Items.IndexOf(liCheckType);
                                //txtCheckNumber.Text = Cardetais.Tables[0].Rows[0]["BankCheckNumber"].ToString();
                            }
                            else if (Convert.ToInt32(Cardetais.Tables[0].Rows[0]["pmntType"].ToString()) == 6)
                            {
                                divcard.Style["display"] = "none";
                                divcheck.Style["display"] = "none";
                                divpaypal.Style["display"] = "block";
                                txtPaytransID.Text = Cardetais.Tables[0].Rows[0]["TransactionID"].ToString();
                                txtpayPalEmailAccount.Text = Cardetais.Tables[0].Rows[0]["PaypalEmail"].ToString();
                            }
                            else
                            {
                                divcard.Style["display"] = "block";
                                divcheck.Style["display"] = "none";
                                divpaypal.Style["display"] = "none";
                                txtCardholderName.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["cardholderName"].ToString());
                                //    lblCardType.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["cardType"].ToString());
                                txtCardholderLastName.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["cardholderLastName"].ToString());
                                CardNumber.Text = Cardetais.Tables[0].Rows[0]["cardNumber"].ToString();
                                string EXpDate = Cardetais.Tables[0].Rows[0]["cardExpDt"].ToString();
                                string[] EXpDt = EXpDate.Split(new char[] { '/' });

                                ListItem liExpMnth = new ListItem();
                                liExpMnth.Text = EXpDt[0].ToString();
                                liExpMnth.Value = EXpDt[0].ToString();
                                ExpMon.SelectedIndex = ExpMon.Items.IndexOf(liExpMnth);

                                ListItem liExpyear = new ListItem();
                                liExpyear.Text = "20" + EXpDt[1].ToString();
                                liExpyear.Value = EXpDt[1].ToString();
                                CCExpiresYear.SelectedIndex = CCExpiresYear.Items.IndexOf(liExpyear);

                                cvv.Text = Cardetais.Tables[0].Rows[0]["cardCode"].ToString();

                                txtbillingaddress.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["billingAdd"].ToString());
                                txtbillingcity.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["billingCity"].ToString());

                                ListItem liBillST = new ListItem();
                                liBillST.Value = Cardetais.Tables[0].Rows[0]["billingState"].ToString();
                                liBillST.Text = Cardetais.Tables[0].Rows[0]["State_Code"].ToString();
                                ddlbillingstate.SelectedIndex = ddlbillingstate.Items.IndexOf(liBillST);
                                txtbillingzip.Text = Cardetais.Tables[0].Rows[0]["billingZip"].ToString();
                            }
                        }
                    }
                    else
                    {
                        Response.Redirect("NewSale.aspx");
                    }
                }
            }
        }
    }
Beispiel #43
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[Constants.NAME] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "TransfersInfoBinding();", true);
            if (!IsPostBack)
            {
                Session["CurrentPage"] = "New sale";

                if (LoadIndividualUserRights() == false)
                {
                    Response.Redirect("Login.aspx");
                }
                else
                {
                    ServiceReference objServiceReference = new ServiceReference();

                    ScriptReference objScriptReference = new ScriptReference();

                    objServiceReference.Path = "~/WebService.asmx";

                    objScriptReference.Path = "~/Static/Js/CarsJScript.js";

                    scrptmgr.Services.Add(objServiceReference);
                    scrptmgr.Scripts.Add(objScriptReference);

                    if (Session[Constants.NAME] == null)
                    {
                        lnkBtnLogout.Visible = false;
                        lblUserName.Visible = false;
                    }
                    else
                    {
                        //LoadUserRights();
                        lnkBtnLogout.Visible = true;
                        lblUserName.Visible = true;
                        string LogUsername = Session[Constants.NAME].ToString();
                        string CenterCode = Session[Constants.CenterCode].ToString();
                        string UserLogName = Session[Constants.USER_NAME].ToString();
                        if (LogUsername.Length > 20)
                        {
                            lblUserName.Text = LogUsername.ToString().Substring(0, 20);
                            //if (CenterCode.Length > 5)
                            //{
                            //    lblUserName.Text = lblUserName.Text + " (" + CenterCode.ToString().Substring(0, 5) + ")";
                            //}
                            //else
                            //{
                            lblUserName.Text = lblUserName.Text + " (" + CenterCode.ToString() + ")-" + UserLogName.ToString();
                            //}
                        }
                        else
                        {
                            lblUserName.Text = LogUsername;

                            lblUserName.Text = lblUserName.Text + " (" + UserLogName.ToString() + ")-" + CenterCode.ToString();
                        }

                    }
                    if (Session["DsDropDown"] == null)
                    {
                        dsDropDown = objdropdownBL.Usp_Get_DropDown();
                        Session["DsDropDown"] = dsDropDown;
                    }
                    else
                    {
                        dsDropDown = (DataSet)Session["DsDropDown"];
                    }
                    Session["NewSaleCarID"] = null;
                    Session["NewSaleUID"] = null;
                    Session["NewSalePostingID"] = null;
                    Session["NewSaleUserPackID"] = null;
                    Session["NewSaleSellerID"] = null;
                    Session["NewSalePSID1"] = null;
                    Session["NewSalePSID2"] = null;
                    Session["NewSalePaymentID"] = null;
                    lnkTicker.Attributes.Add("href", "javascript:poptastic('Ticker.aspx?CID=" + Session[Constants.CenterCodeID] + "&CNAME=" + Session[Constants.CenterCode] + "');");
                    DataSet dsYears = objHotLeadBL.USP_GetNext12years();

                    fillYears(dsYears);
                    FillYear();
                    FillPackage();
                    FillDiscounts();
                    FillStates();
                    GetAllModels();
                    GetMakes();
                    GetModelsInfo();
                    FillExteriorColor();
                    FillInteriorColor();
                    GetBody();
                    //FillPaymentDate();
                    FillPDDate();
                    FillBillingStates();
                    FillPhotoSource();
                    FillDescriptionSource();
                    FillVerifier();
                    FillAgents();
                    FillVoiceFileLocation();
                    // FillCheckTypes();
                    //DataSet dsTransfers = objHotLeadBL.GetLoginTransferAgentsCount();
                    //if (dsTransfers.Tables[0].Rows[0]["CountAll"].ToString() == "0")
                    //{
                    //    lblTransferAgentsCount.Text = "Transfer agent(s) are not available";
                    //}
                    //else
                    //{
                    //    lblTransferAgentsCount.Text = dsTransfers.Tables[0].Rows[0]["CountAll"].ToString() + " Transfer agent(s) available";
                    //    //System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "lll();", true);
                    //    DataSet dsTransferAgents = objHotLeadBL.GetAllLoginTransferAgentsDetails();
                    //    if (dsTransferAgents.Tables[0].Rows.Count > 0)
                    //    {
                    //        grdTest.DataSource = dsTransferAgents.Tables[0];
                    //        grdTest.DataBind();
                    //    }
                    //}
                    DataSet dsDatetime = objHotLeadBL.GetDatetime();
                    DateTime dtNow = Convert.ToDateTime(dsDatetime.Tables[0].Rows[0]["Datetime"].ToString());
                    txtPaymentDate.Text = dtNow.ToString("MM/dd/yyyy");
                    DataSet dsCenterRoles = objHotLeadBL.GetCenterRolesByID(Convert.ToInt32(Session[Constants.CenterCodeID].ToString()));
                    Session["dsCenterRoles"] = dsCenterRoles;
                    if (dsCenterRoles.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < dsCenterRoles.Tables[0].Rows.Count; i++)
                        {
                            if (dsCenterRoles.Tables[0].Rows[i]["CenterRoleID"].ToString() == "1")
                            {
                                if (dsCenterRoles.Tables[0].Rows[i]["CenterRightStatus"].ToString() == "0")
                                {
                                    btnSale.Visible = false;
                                    btnSale2.Visible = false;
                                }
                                else
                                {
                                    btnSale.Visible = true;
                                    btnSale2.Visible = true;
                                }
                            }
                            if (dsCenterRoles.Tables[0].Rows[i]["CenterRoleID"].ToString() == "2")
                            {
                                if (dsCenterRoles.Tables[0].Rows[i]["CenterRightStatus"].ToString() == "0")
                                {
                                    btnTransfer.Visible = false;
                                    btnTransfer2.Visible = false;
                                    lblTransferAgentsCount.Visible = false;
                                }
                                else
                                {
                                    btnTransfer.Visible = true;
                                    btnTransfer2.Visible = true;
                                    lblTransferAgentsCount.Visible = true;
                                }
                            }
                        }
                    }
                    if ((Session["AbandonSalePostingID"] != null) && (Session["AbandonSalePostingID"].ToString() != ""))
                    {
                        int PostingID = Convert.ToInt32(Session["AbandonSalePostingID"].ToString());
                        DataSet Cardetais = objHotLeadBL.GetCarDetailsByPostingID(PostingID);

                        Double PackCost2 = new Double();
                        PackCost2 = Convert.ToDouble(Cardetais.Tables[0].Rows[0]["Price"].ToString());
                        string PackAmount2 = string.Format("{0:0.00}", PackCost2).ToString();
                        string PackName2 = Cardetais.Tables[0].Rows[0]["Description"].ToString();
                        ListItem listPack = new ListItem();
                        listPack.Value = Cardetais.Tables[0].Rows[0]["PackageID"].ToString();
                        listPack.Text = PackName2 + " ($" + PackAmount2 + ")";
                        ddlPackage.SelectedIndex = ddlPackage.Items.IndexOf(listPack);

                        ListItem liVer = new ListItem();
                        liVer.Text = Cardetais.Tables[0].Rows[0]["SaleVerifierName"].ToString();
                        liVer.Value = Cardetais.Tables[0].Rows[0]["SaleVerifierID"].ToString();
                        ddlVerifier.SelectedIndex = ddlVerifier.Items.IndexOf(liVer);

                        txtFirstName.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["sellerName"].ToString());
                        txtLastName.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["LastName"].ToString());
                        txtPhone.Text = objGeneralFunc.filPhnm(Cardetais.Tables[0].Rows[0]["PhoneNum"].ToString());
                        txtEmail.Text = Cardetais.Tables[0].Rows[0]["email"].ToString();
                        txtAddress.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["address1"].ToString());
                        txtCity.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["city"].ToString());
                        if (Cardetais.Tables[0].Rows[0]["EmailExists"].ToString() == "0")
                        {
                            chkbxEMailNA.Checked = true;
                        }
                        else
                        {
                            chkbxEMailNA.Checked = false;
                        }

                        ListItem listState = new ListItem();
                        listState.Value = Cardetais.Tables[0].Rows[0]["StateID"].ToString();
                        listState.Text = Cardetais.Tables[0].Rows[0]["state"].ToString();
                        ddlLocationState.SelectedIndex = ddlLocationState.Items.IndexOf(listState);
                        txtZip.Text = Cardetais.Tables[0].Rows[0]["zip"].ToString();

                        ListItem list2 = new ListItem();
                        list2.Value = Cardetais.Tables[0].Rows[0]["MakeID"].ToString();
                        list2.Text = Cardetais.Tables[0].Rows[0]["make"].ToString();
                        ddlMake.SelectedIndex = ddlMake.Items.IndexOf(list2);
                        GetModelsInfo();

                        ListItem list3 = new ListItem();
                        list3.Text = Cardetais.Tables[0].Rows[0]["model"].ToString();
                        list3.Value = Cardetais.Tables[0].Rows[0]["makeModelID"].ToString();
                        ddlModel.SelectedIndex = ddlModel.Items.IndexOf(list3);

                        ListItem list1 = new ListItem();
                        list1.Text = Cardetais.Tables[0].Rows[0]["yearOfMake"].ToString();
                        list1.Value = Cardetais.Tables[0].Rows[0]["yearOfMake"].ToString();
                        ddlYear.SelectedIndex = ddlYear.Items.IndexOf(list1);

                        ListItem listBody = new ListItem();
                        listBody.Value = Cardetais.Tables[0].Rows[0]["bodyTypeID"].ToString();
                        listBody.Text = Cardetais.Tables[0].Rows[0]["bodyType"].ToString();
                        ddlBodyStyle.SelectedIndex = ddlBodyStyle.Items.IndexOf(listBody);

                        if (Cardetais.Tables[0].Rows[0]["Carprice"].ToString() == "0.0000")
                        {
                            txtAskingPrice.Text = "";
                        }
                        else
                        {
                            txtAskingPrice.Text = string.Format("{0:0}", Convert.ToDouble(Cardetais.Tables[0].Rows[0]["Carprice"].ToString()));
                        }
                        if (txtAskingPrice.Text.Length > 6)
                        {
                            txtAskingPrice.Text = txtAskingPrice.Text.Substring(0, 6);
                        }

                        if (Cardetais.Tables[0].Rows[0]["mileage"].ToString() == "0.00")
                        {
                            txtMileage.Text = "";
                        }
                        else
                        {
                            txtMileage.Text = string.Format("{0:0}", Convert.ToDouble(Cardetais.Tables[0].Rows[0]["mileage"].ToString()));
                        }
                        if (txtMileage.Text.Length > 6)
                        {
                            txtMileage.Text = txtMileage.Text.Substring(0, 6);
                        }

                        string NumberOfCylinder = Cardetais.Tables[0].Rows[0]["numberOfCylinder"].ToString();
                        //if (NumberOfCylinder == "3 Cylinder")
                        //{
                        //    rdbtnCylinders1.Checked = true;
                        //    rdbtnCylinders7.Checked = false;
                        //}
                        //else if (NumberOfCylinder == "4 Cylinder")
                        //{
                        //    rdbtnCylinders2.Checked = true;
                        //    rdbtnCylinders7.Checked = false;
                        //}
                        //else if (NumberOfCylinder == "5 Cylinder")
                        //{
                        //    rdbtnCylinders3.Checked = true;
                        //    rdbtnCylinders7.Checked = false;
                        //}
                        //else if (NumberOfCylinder == "6 Cylinder")
                        //{
                        //    rdbtnCylinders4.Checked = true;
                        //    rdbtnCylinders7.Checked = false;
                        //}
                        //else if (NumberOfCylinder == "7 Cylinder")
                        //{
                        //    rdbtnCylinders5.Checked = true;
                        //    rdbtnCylinders7.Checked = false;
                        //}
                        //else if (NumberOfCylinder == "8 Cylinder")
                        //{
                        //    rdbtnCylinders6.Checked = true;
                        //    rdbtnCylinders7.Checked = false;
                        //}
                        //else
                        //{
                        //    rdbtnCylinders7.Checked = true;
                        //}

                        ListItem list7 = new ListItem();
                        list7.Value = Cardetais.Tables[0].Rows[0]["exteriorColor"].ToString();
                        list7.Text = Cardetais.Tables[0].Rows[0]["exteriorColor"].ToString();
                        ddlExteriorColor.SelectedIndex = ddlExteriorColor.Items.IndexOf(list7);

                        ListItem list8 = new ListItem();
                        list8.Text = Cardetais.Tables[0].Rows[0]["interiorColor"].ToString();
                        list8.Value = Cardetais.Tables[0].Rows[0]["interiorColor"].ToString();
                        ddlInteriorColor.SelectedIndex = ddlInteriorColor.Items.IndexOf(list8);

                        string Transmission = Cardetais.Tables[0].Rows[0]["Transmission"].ToString();
                        //if (Transmission == "Automatic")
                        //{
                        //    rdbtnTrans1.Checked = true;
                        //    rdbtnTrans4.Checked = false;
                        //}
                        //else if (Transmission == "Manual")
                        //{
                        //    rdbtnTrans2.Checked = true;
                        //    rdbtnTrans4.Checked = false;
                        //}
                        //else if (Transmission == "Tiptronic")
                        //{
                        //    rdbtnTrans3.Checked = true;
                        //    rdbtnTrans4.Checked = false;
                        //}
                        //else
                        //{
                        //    rdbtnTrans4.Checked = true;
                        //}
                        //string NumberOfDoors = Cardetais.Tables[0].Rows[0]["numberOfDoors"].ToString();
                        //if (NumberOfDoors == "Two Door")
                        //{
                        //    rdbtnDoor2.Checked = true;
                        //    rdbtnDoor6.Checked = false;
                        //}
                        //else if (NumberOfDoors == "Three Door")
                        //{
                        //    rdbtnDoor3.Checked = true;
                        //    rdbtnDoor6.Checked = false;
                        //}
                        //else if (NumberOfDoors == "Four Door")
                        //{
                        //    rdbtnDoor4.Checked = true;
                        //    rdbtnDoor6.Checked = false;
                        //}

                        //else if (NumberOfDoors == "Five Door")
                        //{
                        //    rdbtnDoor5.Checked = true;
                        //    rdbtnDoor6.Checked = false;
                        //}
                        //else
                        //{
                        //    rdbtnDoor6.Checked = true;
                        //}

                        string DriveTrain = Cardetais.Tables[0].Rows[0]["DriveTrain"].ToString();
                        //if (DriveTrain == "2 wheel drive")
                        //{
                        //    rdbtnDriveTrain1.Checked = true;
                        //    rdbtnDriveTrain5.Checked = false;
                        //}
                        //else if (DriveTrain == "2 wheel drive - front")
                        //{
                        //    rdbtnDriveTrain2.Checked = true;
                        //    rdbtnDriveTrain5.Checked = false;
                        //}
                        //else if (DriveTrain == "All wheel drive")
                        //{
                        //    rdbtnDriveTrain3.Checked = true;
                        //    rdbtnDriveTrain5.Checked = false;
                        //}
                        //else if (DriveTrain == "Rear wheel drive")
                        //{
                        //    rdbtnDriveTrain4.Checked = true;
                        //    rdbtnDriveTrain5.Checked = false;
                        //}
                        //else
                        //{
                        //    rdbtnDriveTrain5.Checked = true;
                        //}
                        txtVin.Text = Cardetais.Tables[0].Rows[0]["VIN"].ToString();

                        int FuelTypeID = Convert.ToInt32(Cardetais.Tables[0].Rows[0]["fuelTypeID"].ToString());
                        //if (FuelTypeID == 1)
                        //{
                        //    rdbtnFuelType1.Checked = true;
                        //    rdbtnFuelType8.Checked = false;
                        //}
                        //else if (FuelTypeID == 2)
                        //{
                        //    rdbtnFuelType2.Checked = true;
                        //    rdbtnFuelType8.Checked = false;
                        //}
                        //else if (FuelTypeID == 3)
                        //{
                        //    rdbtnFuelType3.Checked = true;
                        //    rdbtnFuelType8.Checked = false;
                        //}
                        //else if (FuelTypeID == 4)
                        //{
                        //    rdbtnFuelType4.Checked = true;
                        //    rdbtnFuelType8.Checked = false;
                        //}
                        //else if (FuelTypeID == 5)
                        //{
                        //    rdbtnFuelType5.Checked = true;
                        //    rdbtnFuelType8.Checked = false;
                        //}
                        //else if (FuelTypeID == 6)
                        //{
                        //    rdbtnFuelType6.Checked = true;
                        //    rdbtnFuelType8.Checked = false;
                        //}
                        //else if (FuelTypeID == 7)
                        //{
                        //    rdbtnFuelType7.Checked = true;
                        //    rdbtnFuelType8.Checked = false;
                        //}
                        //else
                        //{
                        //    rdbtnFuelType8.Checked = true;
                        //}
                        int ConditionID = Convert.ToInt32(Cardetais.Tables[0].Rows[0]["vehicleConditionID"].ToString());
                        //if (ConditionID == 1)
                        //{
                        //    rdbtnCondition1.Checked = true;
                        //    rdbtnCondition7.Checked = false;
                        //}
                        //else if (ConditionID == 2)
                        //{
                        //    rdbtnCondition2.Checked = true;
                        //    rdbtnCondition7.Checked = false;
                        //}
                        //else if (ConditionID == 3)
                        //{
                        //    rdbtnCondition3.Checked = true;
                        //    rdbtnCondition7.Checked = false;
                        //}
                        //else if (ConditionID == 4)
                        //{
                        //    rdbtnCondition4.Checked = true;
                        //    rdbtnCondition7.Checked = false;
                        //}
                        //else if (ConditionID == 5)
                        //{
                        //    rdbtnCondition5.Checked = true;
                        //    rdbtnCondition7.Checked = false;
                        //}
                        //else if (ConditionID == 6)
                        //{
                        //    rdbtnCondition6.Checked = true;
                        //    rdbtnCondition7.Checked = false;
                        //}
                        //else
                        //{
                        //    rdbtnCondition7.Checked = true;
                        //}

                        for (int i = 1; i < 54; i++)
                        {
                            if (i != 10)
                            {
                                if (i != 37)
                                {
                                    if (i != 38)
                                    {
                                        string ChkBoxID = "chkFeatures" + i.ToString();
                                        CheckBox ChkedBox = (CheckBox)form1.FindControl(ChkBoxID);
                                        if (Cardetais.Tables[1].Rows.Count >= i)
                                        {
                                            if (Cardetais.Tables[1].Rows[i - 1]["Isactive"].ToString() == "True")
                                            {
                                                ChkedBox.Checked = true;
                                            }
                                            else
                                            {
                                                ChkedBox.Checked = false;
                                            }
                                        }
                                        else
                                        {
                                            ChkedBox.Checked = false;
                                        }
                                    }
                                }
                            }
                        }
                        if (Cardetais.Tables[1].Rows.Count > 9)
                        {
                            if (Cardetais.Tables[1].Rows[9]["Isactive"].ToString() == "True")
                            {
                                rdbtnLeather.Checked = true;
                                rdbtnInteriorNA.Checked = false;
                            }
                        }
                        if (Cardetais.Tables[1].Rows.Count > 36)
                        {
                            if (Cardetais.Tables[1].Rows[36]["Isactive"].ToString() == "True")
                            {
                                rdbtnVinyl.Checked = true;
                                rdbtnInteriorNA.Checked = false;
                            }
                        }
                        if (Cardetais.Tables[1].Rows.Count > 37)
                        {
                            if (Cardetais.Tables[1].Rows[37]["Isactive"].ToString() == "True")
                            {
                                rdbtnCloth.Checked = true;
                                rdbtnInteriorNA.Checked = false;
                            }
                        }
                        if (Cardetais.Tables[1].Rows.Count > 53)
                        {
                            if (Cardetais.Tables[1].Rows[53]["Isactive"].ToString() == "True")
                            {
                                rdbtnInteriorNA.Checked = true;
                            }
                        }
                        txtDescription.Text = Cardetais.Tables[0].Rows[0]["Cardescription"].ToString();
                        string OldNotes = Cardetais.Tables[0].Rows[0]["SaleNotes"].ToString();
                        OldNotes = OldNotes.Replace("<br>", Environment.NewLine);
                        txtSaleNotes.Text = OldNotes;

                        ListItem liSourceofPhotos = new ListItem();
                        liSourceofPhotos.Text = Cardetais.Tables[0].Rows[0]["SourceOfPhotosName"].ToString();
                        liSourceofPhotos.Value = Cardetais.Tables[0].Rows[0]["SourceOfPhotosID"].ToString();
                        ddlPhotosSource.SelectedIndex = ddlPhotosSource.Items.IndexOf(liSourceofPhotos);

                        ListItem liVoiceLocation = new ListItem();
                        liVoiceLocation.Text = Cardetais.Tables[0].Rows[0]["VoiceFileLocationName"].ToString();
                        liVoiceLocation.Value = Cardetais.Tables[0].Rows[0]["VoiceFileLocation"].ToString();
                        ddlVoiceFileLocation.SelectedIndex = ddlVoiceFileLocation.Items.IndexOf(liVoiceLocation);

                        ListItem liSourceofDescription = new ListItem();
                        liSourceofDescription.Text = Cardetais.Tables[0].Rows[0]["SourceOfDescriptionName"].ToString();
                        liSourceofDescription.Value = Cardetais.Tables[0].Rows[0]["SourceOfDescriptionID"].ToString();
                        ddlDescriptionSource.SelectedIndex = ddlDescriptionSource.Items.IndexOf(liSourceofDescription);

                        Session["NewSaleCarID"] = Cardetais.Tables[0].Rows[0]["carid"].ToString();
                        Session["NewSaleUID"] = Cardetais.Tables[0].Rows[0]["uid"].ToString();
                        Session["NewSalePostingID"] = Cardetais.Tables[0].Rows[0]["postingID"].ToString();
                        Session["NewSaleUserPackID"] = Cardetais.Tables[0].Rows[0]["UserPackID"].ToString();
                        Session["NewSaleSellerID"] = Cardetais.Tables[0].Rows[0]["sellerID"].ToString();
                        Session["NewSalePSID1"] = Cardetais.Tables[0].Rows[0]["PSID1"].ToString();
                        if (Cardetais.Tables[0].Rows[0]["PSID2"].ToString() != "")
                        {
                            Session["NewSalePSID2"] = Convert.ToInt32(Cardetais.Tables[0].Rows[0]["PSID2"].ToString());
                        }
                        if (Cardetais.Tables[0].Rows[0]["PaymentID"].ToString() != "")
                        {
                            Session["NewSalePaymentID"] = Convert.ToInt32(Cardetais.Tables[0].Rows[0]["PaymentID"].ToString());
                        }

                    }
                    else
                    {
                        MPEUpdate.Show();
                    }
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["CurrentPage"] = "Home";

            Session["CurrentPageConfig"] = null;
            Session["PageName"] = "";
            GeneralFunc.SetPageDefaults(Page);
            BankDetailsBL objBankDetailsBL = new BankDetailsBL();
            ServiceReference objServiceReference = new ServiceReference();

            ScriptReference objScriptReference = new ScriptReference();

            objServiceReference.Path = "~/CarsService.asmx";

            objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

            scrptmgr.Services.Add(objServiceReference);
            scrptmgr.Scripts.Add(objScriptReference);

            PmntDetailsinfo objPmntDetailsinfo = new PmntDetailsinfo();

            int CarID;

            if ((Session["CarID"] == null) || (Session["CarID"].ToString() == ""))
            {
                CarID = Convert.ToInt32(0);
            }
            else
            {
                CarID = Convert.ToInt32(Session["CarID"].ToString());
            }
            int UID = 0;

            if (Session["RegUSER_ID"] != null)
            {
                UID = Convert.ToInt32(Session["RegUSER_ID"].ToString());
            }

            if (UID != 0)
            {
                int PackageID = Convert.ToInt32(Request.QueryString["item_number"].ToString());

                string packageName = string.Empty;

                if (PackageID == 1)
                {
                    packageName = "Basic - FREE";
                }
                else if (PackageID == 2)
                {
                    packageName = "Standard";
                }
                else if (PackageID == 3)
                {
                    packageName = "Enhanced";
                }
                else if (PackageID == 4)
                {
                    packageName = "Silver Deluxe";
                }
                else if (PackageID == 5)
                {
                    packageName = "Gold Deluxe";
                }
                else if (PackageID == 6)
                {
                    packageName = "Platinum Deluxe";
                }

                lblPackage.Text = packageName;

                if (Session["PayBy"] == null)
                {
                    //Request.QueryString["item_number"]
                    //tx=02R12984CT146441A&st=Completed&amt=0.10&cc=USD&cm=&item_number=2

                    objPmntDetailsinfo.Currency = Request.QueryString["cc"];

                    lblamount.Text = Request.QueryString["amt"];

                    lblCurrency.Text = objPmntDetailsinfo.Currency;

                    lbluser.Text = Session["RegName"].ToString();
                    objPmntDetailsinfo.Amount = lblamount.Text;

                    txtTran.Text = Request.QueryString["tx"];

                    objPmntDetailsinfo.TransactionID = Request.QueryString["tx"];
                    objPmntDetailsinfo.PmntType = 1;

                    if (Request.QueryString["st"] != null)
                    {
                        if (Request.QueryString["st"].ToString() == "Completed")
                        {
                            objPmntDetailsinfo.PmntStatus = 2;
                        }
                        else
                        {
                            objPmntDetailsinfo.PmntStatus = 4;
                        }
                    }
                    else
                    {
                        objPmntDetailsinfo.PmntStatus = 4;
                    }

                    String strHostName = Request.UserHostAddress.ToString();
                    string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
                    objPmntDetailsinfo.IPAddress = strIp;

                    int PostingID = Convert.ToInt32(Session["PostingID"].ToString());
                    int UserPackID = Convert.ToInt32(Session["RegUserPackID"].ToString());
                    bool bnew = objBankDetailsBL.UpdatePmntStatus(objPmntDetailsinfo, PackageID, UID, CarID, UserPackID, PostingID);

                }
                else
                {
                    ///NetCode="+ReturnValues[4].Trim(char.Parse("|"))+"&TransID="+ReturnValues[6].Trim(char.Parse("|"))
                    ///

                    objPmntDetailsinfo.Currency = Request.QueryString["cc"];

                    lblamount.Text = Request.QueryString["amt"];

                    lblCurrency.Text = objPmntDetailsinfo.Currency;

                    lbluser.Text = Session["RegName"].ToString();

                    objPmntDetailsinfo.Amount = lblamount.Text;
                    txtTran.Text = Request.QueryString["NetCode"];

                    objPmntDetailsinfo.TransactionID = Request.QueryString["NetCode"];

                    objPmntDetailsinfo.PmntStatus = 2;

                    objPmntDetailsinfo.CardType = Session["PayBy"].ToString();
                    objPmntDetailsinfo.PmntType = 1;

                    String strHostName = Request.UserHostAddress.ToString();
                    string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
                    objPmntDetailsinfo.IPAddress = strIp;

                    int PostingID = Convert.ToInt32(Session["PostingID"].ToString());
                    int UserPackID = Convert.ToInt32(Session["RegUserPackID"].ToString());
                    bool bnew = objBankDetailsBL.UpdatePmntStatus(objPmntDetailsinfo, PackageID, UID, CarID, UserPackID, PostingID);

                }
                string LoginPassword = Session["RegPassword"].ToString();
                string LoginName = Session["RegUserName"].ToString();
                SendRegisterMail(LoginName, LoginPassword);

            }

            //UpdatePmntStatus(PmntDetailsinfo objPmntDetailsinfo, int PackageID, int UID, int CarID)

        }
    }
        /// <summary>
        /// Reparses meta and link tags that weren't parsed correctly the first time.
        /// Only works inside ContentPlaceHolder controls located inside the head.
        /// 1) Parses literal controls: looks for self-closing and empty meta, link, and script controls. 
        /// Supports Visible and EnableViewState attributes correctly. EnableViewState=false if not specified.
        /// The TemplateControl is re-calculated.
        /// 2) Parses HtmlGenericControls (link, meta, script tags with runat="server"). HtmlGenericControl instances for 'script' can
        /// only exist if added through code, since &lt;script runat="server"&gt; is for server side code. Supports it anyway :)
        /// Supports Visible and EnableViewState attributes correctly. EnableViewState=false if not specified.
        /// The TemplateControl is re-calculated.
        /// Note: script references don't have a built-in control, so we use a custom ScriptReference instance to provide the rebasing support.
        /// </summary>
        /// <param name="p"></param>
        public static void RepairPageHeader(Page p)
        {
            //Aquire a collection of references to each contentplaceholder in the Head section.
            //ContentPlaceHolders do not account for being located in an HtmlHead, and simply
            //perform the normal parsing logic. We will patch this by iterating through incorrectly identified tags such as
            //<link> and <meta>, and replacing them with the proper control type.
            //As a bonus, we also make script references work, but that is an extra - Head doesn't usually do anything special
            //with those anyway.

            //Note that each contentplaceholder usually contains a child ContentPlaceHolder
            if (p.Header != null) {

                ////////////////////// Literal parsing //////////////////////////////
                //Get a collection of all of the LiteralControls in the head
                //This will handle link, meta, and script includes
                List<LiteralControl> toParse = ControlUtils.GetControlsOfType<LiteralControl>(p.Header);

                //handle literal links
                if (toParse != null) {
                    foreach (LiteralControl lc in toParse) {
                        //if the literal is directly inside a content tag, on a content page, the TemplateControl property will
                        //incorrectly point to the MasterPage.
                        //So if we use lc.AppRelativeTemplateSourceDirectory, it doesn't work
                        //However, if we use this.AppRelativeTemplateSourceDirectory and
                        //we have a MasterPage>MasterPage(with relative literal stylesheet reference)>Page
                        //Then the relative stylesheet reference will be broke, relative to the Page.

                        //The solution is to find the child TemplateControl of lc's nearest ContentPlaceHolder parent.
                        //We do this before ParseLiteral control, because this value will be propogated to the
                        //component controls.
                        lc.TemplateControl = ContentPlaceHolderFixes.GetAdjustedParentTemplateControl(lc);

                        //Parse literal control
                        Control c = ParseLiteralControl(lc, lc.Text);
                        //notused:  //Article.SetPathRecursive(c, getAdjustedParent(lc).AppRelativeTemplateSourceDirectory);//used to be this.
                        //Replace
                        lc.Parent.Controls.AddAt(lc.Parent.Controls.IndexOf(lc), c);
                        lc.Parent.Controls.Remove(lc);
                    }
                }

                //handle links with runat="server"
                //We just want the outermost cphs
                List<ContentPlaceHolder> cphList = ControlUtils.GetControlsOfType<ContentPlaceHolder>(p.Header, false, true);

                if (cphList != null) {
                    //There may be multiple CPHs in the head section
                    foreach (ContentPlaceHolder cph in cphList) {

                        //Get a collection of all of the HtmlGenericControls in the current ContentPlaceHolder.
                        List<HtmlGenericControl> toFix = ControlUtils.GetControlsOfType<HtmlGenericControl>(cph);
                        if (toFix == null) continue;

                        //This will handle all link tags, meta tags, or script tags with runat="server"
                        //Also affects script tags parsed in above section (URL resolution)

                        //Iterate through the collection, replacing or modifying the neccesary objects.
                        foreach (HtmlGenericControl hgc in toFix) {
                            HtmlControl replacement = null;
                            switch (hgc.TagName.ToLower()) {
                                case "link":
                                    //Create a replacement HtmlLink object with identical attributes.
                                    //HtmlLink will resolve virtual URLs on the href attribute at render-time, unlike HtmlGenericControl.
                                    replacement = new HtmlLink();

                                    break;
                                case "meta":
                                    //Create a replacement HtmlMeta object with identical attributes.
                                    replacement = new HtmlMeta();
                                    break;

                                case "script":
                                    //Create a new script reference, which resolves the src attribute at render-time
                                    replacement = new ScriptReference();
                                    break;

                            }

                            if (replacement != null) {
                                //Adjust the TemplateControl for the *other* ContentPlaceHolder bug.
                                replacement.TemplateControl = GetAdjustedParentTemplateControl(hgc.TemplateControl);

                                //Turn off ViewState
                                replacement.EnableViewState = false;

                                //Copy attributes
                                foreach (string s in hgc.Attributes.Keys) {
                                    string val = hgc.Attributes[s];
                                    replacement.Attributes.Add(s, val);
                                }
                                //Assign known properties that aren.t collection-backed
                                replacement.EnableViewState = hgc.EnableViewState;
                                replacement.Visible = hgc.Visible;

                                //Insert the new object next to the old, then remove the old.
                                hgc.Parent.Controls.AddAt(hgc.Parent.Controls.IndexOf(hgc), replacement);
                                hgc.Parent.Controls.Remove(hgc);
                            }
                        }
                    }
                }
            }

            /* Analyize TemplateControls. Prints TemplateControl/TemplateSourceDirectory tree for diagnostics.
                List<Control> allcontrols = GetControlsOfType<Control>(this);
                List<TemplateControl> uniqueTemplateControls =new List<TemplateControl>();
                Debug.WriteLine(Page.AppRelativeTemplateSourceDirectory);
                foreach (Control c in allcontrols)
                {
                    //Debug.WriteLine(c.ID + "   (" + c.TemplateControl.ID + ") - " + c.AppRelativeTemplateSourceDirectory);
                    if (!uniqueTemplateControls.Contains(c.TemplateControl)){
                        uniqueTemplateControls.Add(c.TemplateControl);
                        string s = c.TemplateSourceDirectory;
                    }

                }
                StringWriter sw = new StringWriter();
                PrintTree(this.Header, 0, sw);
                this.Header.Controls.AddAt(0, new LiteralControl(Server.HtmlEncode((sw.ToString()))));
            */
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["CurrentPage"] = "Home";
            Session["PageName"] = "";
            Session["CurrentPageConfig"] = null;

            GeneralFunc.SaveSiteVisit();

            GeneralFunc.SetPageDefaults(Page);

            string Make = Request.QueryString[Request.QueryString.Count - 1];

            //string Name = Request.Cookies.Get("UserSettings").Values.Get("Name");
            //string Phone = Request.Cookies.Get("UserSettings").Values.Get("Phone");

            if (Make != null)
            {

                string[] strCarid = Make.Split('-');
                if(strCarid.Length >= 4)
                Hadd.Value = strCarid[3].ToString();

                CarsService obj = new CarsService();

                List<CarsInfo.UsedCarsInfo> objCarInfo = new List<CarsInfo.UsedCarsInfo>();

                ServiceReference objServiceReference = new ServiceReference();

                ScriptReference objScriptReference = new ScriptReference();

                //objServiceReference.Path = "http://cars.hugomirad.com/CarsService.asmx";

                //objScriptReference.Path = "http://cars.hugomirad.com/Static/JS/CarsJScriptNew.js";

                //objServiceReference.Path = "http://localhost:1460/Cars/CarsService.asmx";

                //objScriptReference.Path = "http://localhost:1460/Cars/Static/JS/CarsJScriptNew.js";

                objServiceReference.Path = "../CarsService.asmx";

                objScriptReference.Path = "../Static/Js/CarsJScriptNew.js";

                scrptmgr.Services.Add(objServiceReference);
                scrptmgr.Scripts.Add(objScriptReference);

                if (p == 0)
                {
                    if (strCarid.Length > 1)
                    {
                        string sCarid = strCarid[strCarid.Length - 1];

                        if (GeneralFunc.IsNumeric(sCarid))
                        {

                            if (Request.Cookies.Get("UserSettings") == null)
                            {
                                // ClientScript.RegisterStartupScript(typeof(Page), "KyAUIDFCS", "<script language='javascript' type='text/javascript'>Subscribe();</script>");

                            }

                            objCarInfo = obj.FindCarIDNew(sCarid);

                            FillCarDetails(objCarInfo, sCarid);

                        }
                    }
                }
            }
            else
            {
                Response.Redirect("errorpage.aspx");
            }
        }
    }
        /// <summary>
        /// Parses the specified literal control and returns a replacement control (often PlaceHolder) containing 
        /// the newly parsed controls. Only self-closing tags or tags that only contain whitespace. Creates
        /// HtmlMeta (for &lt;meta&gt;), HtmlLink (for &lt;link&gt;), HtmlGenericControl (for &lt;script&gt;) and uses LiteralControl instances for the rest
        /// </summary>
        /// <param name="c"></param>
        /// <returns></returns>
        private static Control ParseLiteralControl(Control c, string text)
        {
            if (c.Controls.Count > 0) return c;
            PlaceHolder ph = new PlaceHolder();

            int strIndex = 0;

            while (strIndex < text.Length) {
                Match m = CommentsAndSingleTags.Match(text, strIndex);

                //We're at the end. Add the last literal and leave.
                if (!m.Success) {
                    if (text.Length > strIndex) {
                        LiteralControl lastLiteral = new LiteralControl(text.Substring(strIndex, text.Length - strIndex));
                        ph.Controls.Add(lastLiteral);
                    }
                    break;
                }

                //We've hit another comment or tag.
                //Add the text since the last match.
                int spaceSinceLastMatch = m.Index - strIndex;
                if (spaceSinceLastMatch > 0) {
                    LiteralControl inbetween = new LiteralControl(text.Substring(strIndex, spaceSinceLastMatch));//"<!--In between and before matches: (-->" + text.Substring(strIndex,spaceSinceLastMatch) + "<!--)-->");
                    ph.Controls.Add(inbetween);
                }

                //build control
                string matchText = text.Substring(m.Index, m.Length);
                if (m.Groups["comment"].Success) {
                    LiteralControl comment = new LiteralControl(matchText);//"<!--Comment:(-->" + matchText + "<!--)-->");
                    ph.Controls.Add(comment);
                } else if (m.Groups["tagname"].Success) {
                    if (m.Groups["endtagname"].Success) {
                        if (!m.Groups["tagname"].Value.Equals(m.Groups["endtagname"].Value)) {
                            LiteralControl error = new LiteralControl("<!-- fbs Parser Error - end tag does not match start tag : -->" + matchText);
                            ph.Controls.Add(error);
                        }
                    }

                    //Parse tag

                    string tagname = m.Groups["tagname"].Value.Trim().ToLower();

                    //Store the attribute names and values into the attrs collection
                    NameValueCollection attrs = new NameValueCollection();

                    Group anames = m.Groups["attrname"];
                    Group avals = m.Groups["attrval"];
                    if (anames != null && avals != null) {
                        for (int i = 0; i < anames.Captures.Count; i++) {
                            string name = anames.Captures[i].Value;
                            if (i < avals.Captures.Count) {
                                string value = avals.Captures[i].Value;
                                attrs[name] = value;
                            }
                        }
                    }
                    if (tagname.Equals("link") ||
                        tagname.Equals("meta") ||
                        tagname.Equals("script")) {
                        HtmlControl hc = null;
                        switch (tagname) {
                            case "link":
                                hc = new HtmlLink();
                                break;
                            case "meta":
                                hc = new HtmlMeta();
                                break;
                            case "script":
                                hc = new ScriptReference();
                                break;
                        }

                        //Inherit TemplateControl value
                        hc.TemplateControl = c.TemplateControl;
                        //Copt attrs
                        foreach (string key in attrs.AllKeys) {
                            hc.Attributes[key] = attrs[key];
                        }
                        //Apply attributes to known properties that aren't Attributes backed.
                        if (hc.Attributes["visible"] != null) {
                            hc.Visible = hc.Attributes["visible"].Equals("true", StringComparison.OrdinalIgnoreCase);
                            hc.Attributes.Remove("visible");
                        }
                        if (hc.Attributes["EnableViewState"] != null) {
                            hc.EnableViewState = hc.Attributes["EnableViewState"].Equals("true", StringComparison.OrdinalIgnoreCase);
                            hc.Attributes.Remove("EnableViewState");
                        } else hc.EnableViewState = false;

                        ph.Controls.Add(hc);
                    } else {
                        //Just pass unrecognized text through
                        LiteralControl notRecognized = new LiteralControl(matchText);//"<!-- tag name not recognized: (-->" + matchText + "<!--)-->");
                        ph.Controls.Add(notRecognized);
                        break;
                    }

                } else {
                    LiteralControl regexError = new LiteralControl("<!-- regex error: (-->" + matchText + "<!--)-->");
                    ph.Controls.Add(regexError);
                    //Should never happen... Either group Comment or group TagName should be defined.
                }

                strIndex = m.Index + m.Length;

            }
            if (ph.Controls.Count == 1) return ph.Controls[0];
            else return ph;
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[Constants.NAME] == null)
        {
            Response.Redirect("Default.aspx");
        }
        else
        {

            if (!IsPostBack)
            {

                GeneralFunc.SetPageDefaults(Page);
                Session["CurrentPage"] = "Account";
                Session["PageName"] = "";
                Session["CurrentPageConfig"] = null;
                //KeyWords.Addkeywordstags(Header);
                GeneralFunc.SaveSiteVisit();
                ServiceReference objServiceReference = new ServiceReference();

                ScriptReference objScriptReference = new ScriptReference();

                objServiceReference.Path = "~/CarsService.asmx";

                objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

                scrptmgr.Services.Add(objServiceReference);
                scrptmgr.Scripts.Add(objScriptReference);

                //lblUserName.Text = Session[Constants.NAME].ToString();
                int UID = Convert.ToInt32(Session[Constants.USER_ID].ToString());

                dsDropDown = objdropdownBL.Usp_Get_DropDown();

                FillStates();

                DataSet dsUserInfoDetails = objdropdownBL.USP_GetUSerDetailsByUserID(UID);

                Session["getRegUserdata"] = dsUserInfoDetails;

                lblRegName.Text = dsUserInfoDetails.Tables[0].Rows[0]["Name"].ToString();
                lblUserNameData.Text = dsUserInfoDetails.Tables[0].Rows[0]["Name"].ToString();

                lblUserAddPack.Text = dsUserInfoDetails.Tables[0].Rows[0]["Name"].ToString();
                lblUnamePW.Text = dsUserInfoDetails.Tables[0].Rows[0]["UserID"].ToString();
                lblRegEmail2.Text = dsUserInfoDetails.Tables[0].Rows[0]["UserName"].ToString();
                lblRegEmail.Text = dsUserInfoDetails.Tables[0].Rows[0]["UserName"].ToString();
                //lblEmailReg.Text = dsUserInfoDetails.Tables[0].Rows[0]["UserName"].ToString();
                lblRegPhone.Text = objGeneralFunc.filPhnm(dsUserInfoDetails.Tables[0].Rows[0]["PhoneNumber"].ToString());
                if (dsUserInfoDetails.Tables[0].Rows[0]["CreatedDate"].ToString() != "")
                {
                    DateTime dtAddDate = Convert.ToDateTime(dsUserInfoDetails.Tables[0].Rows[0]["CreatedDate"].ToString());
                    lblUserMemberDate.Text = dtAddDate.ToString("MM/dd/yy");
                }

                lblBusinessName.Text = dsUserInfoDetails.Tables[0].Rows[0]["BusinessName"].ToString();
                lblAltEmail.Text = dsUserInfoDetails.Tables[0].Rows[0]["AltEmail"].ToString();
                lblAltPhone.Text = dsUserInfoDetails.Tables[0].Rows[0]["AltPhone"].ToString();

                ArrayList strAddress = new ArrayList();
                strAddress.Add(dsUserInfoDetails.Tables[0].Rows[0]["Address"].ToString().Trim());
                strAddress.Add(dsUserInfoDetails.Tables[0].Rows[0]["City"].ToString().Trim());
                strAddress.Add(dsUserInfoDetails.Tables[0].Rows[0]["State_Code"].ToString());
                strAddress.Add(dsUserInfoDetails.Tables[0].Rows[0]["Zip"].ToString());
                if (strAddress[0].ToString() != "" && (strAddress[1].ToString() != "" || strAddress[2].ToString() != "UN" || strAddress[3].ToString() != ""))
                {
                    lblRegAddress.Text = GeneralFunc.ToProper(strAddress[0].ToString()).Trim() + ", ";
                }
                else
                {
                    lblRegAddress.Text = GeneralFunc.ToProper(strAddress[0].ToString()).Trim();
                }

                if (strAddress[1].ToString() != "" && (strAddress[2].ToString() != "UN" || strAddress[3].ToString() != ""))
                {
                    lblRegCity.Text = GeneralFunc.ToProper(strAddress[1].ToString()).Trim() + ", ";
                }
                else
                {
                    lblRegCity.Text = GeneralFunc.ToProper(strAddress[1].ToString()).Trim();
                }

                if ((strAddress[2].ToString() != "UN") && (strAddress[3].ToString() != ""))
                {
                    lblRegState.Text = strAddress[2].ToString() + " ";
                }
                else if ((strAddress[2].ToString() != "UN") && (strAddress[3].ToString() == ""))
                {
                    lblRegState.Text = strAddress[2].ToString();
                }
                lblRegZip.Text = strAddress[3].ToString();
                grdPackagDetails.DataSource = dsUserInfoDetails.Tables[2];
                grdPackagDetails.DataBind();

                grdCarDetails.DataSource = dsUserInfoDetails.Tables[1];
                grdCarDetails.DataBind();
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GeneralFunc.SaveSiteVisit();

            Session["CurrentPage"] = "Home";
            Session["PageName"] = "";
            Session["CurrentPageConfig"] = null;
            GeneralFunc.SetPageDefaults(Page);

            ServiceReference objServiceReference = new ServiceReference();

            ScriptReference objScriptReference = new ScriptReference();

            objServiceReference.Path = "~/CarsService.asmx";

            objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

            scrptmgr.Services.Add(objServiceReference);
            scrptmgr.Scripts.Add(objScriptReference);

            if (Session[Constants.USER_NAME] != null)
            {
                if (Session[Constants.USER_NAME].ToString() != "")
                {
                    Response.Redirect("Default.aspx");
                }
            }
            dsDropDown = objdropdownBL.Usp_Get_DropDown();

            FillStates();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[Constants.NAME] == null)
        {
            Response.Redirect("Default.aspx");
        }
        else
        {
            if (!IsPostBack)
            {
                Session["CurrentPage"] = "Home";
                Session["PageName"] = "";
                Session["CurrentPageConfig"] = null;

                GeneralFunc.SetPageDefaults(Page);
                ServiceReference objServiceReference = new ServiceReference();

                ScriptReference objScriptReference = new ScriptReference();

                objServiceReference.Path = "~/CarsService.asmx";

                objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

                scrptmgr.Services.Add(objServiceReference);
                scrptmgr.Scripts.Add(objScriptReference);
                Session["UpDatePackageID"] = null;
                //lblUserName.Text = Session[Constants.NAME].ToString();
                dsDropDown = objdropdownBL.Usp_Get_DropDown();
                Session["DsDropDown"] = dsDropDown;
                DataSet dsUserInfoDetails = objdropdownBL.USP_GetUSerDetailsByUserID(Convert.ToInt32(Session[Constants.USER_ID].ToString()));

                GetAllModels();
                GetMakes();
                GetBody();
                FillYear();
                FillFuelTypes();
                FillStates();
                FillExteriorColor();
                FillInteriorColor();
                FillCylinders();
                FillDoors();
                FillTransmissions();
                FillDriveTrain();
                FillCondition();

                if ((Session["PostingID"] != null) && (Session["PostingID"].ToString() != ""))
                {
                    //btnUpdatePackage.Visible = true;
                    DataSet dsCarDetailsInfo = new DataSet();
                    dsCarDetailsInfo = objdropdownBL.USP_GetCustomerDetailsByPostingID(Convert.ToInt32(Session["PostingID"].ToString()));
                    if (dsCarDetailsInfo.Tables[0].Rows.Count > 0)
                    {
                        Session["CarID"] = dsCarDetailsInfo.Tables[0].Rows[0]["carid"].ToString();
                        Session["PackageID"] = dsCarDetailsInfo.Tables[0].Rows[0]["packageID"].ToString();
                        Session["PaymentID"] = dsCarDetailsInfo.Tables[0].Rows[0]["PaymentID"].ToString();
                        Session["UserPackID"] = dsCarDetailsInfo.Tables[0].Rows[0]["UserPackID"].ToString();
                        Session["SellerID"] = dsCarDetailsInfo.Tables[0].Rows[0]["SellerID"].ToString();

                        if (dsCarDetailsInfo.Tables[0].Rows[0]["IsActive"].ToString() == "True")
                        {
                            btnSold.Visible = true;
                            btnWithdraw.Visible = true;
                            btnActive.Visible = false;
                        }
                        else
                        {
                            btnSold.Visible = false;
                            btnWithdraw.Visible = false;
                            btnActive.Visible = true;
                        }

                        FillPackage();
                        ListItem list1 = new ListItem();
                        list1.Text = dsCarDetailsInfo.Tables[0].Rows[0]["yearOfMake"].ToString();
                        list1.Value = dsCarDetailsInfo.Tables[0].Rows[0]["yearOfMake"].ToString();
                        ddlYear.SelectedIndex = ddlYear.Items.IndexOf(list1);

                        ListItem list2 = new ListItem();
                        list2.Value = dsCarDetailsInfo.Tables[0].Rows[0]["MakeID"].ToString();
                        list2.Text = dsCarDetailsInfo.Tables[0].Rows[0]["make"].ToString();
                        ddlMake.SelectedIndex = ddlMake.Items.IndexOf(list2);
                        GetModelsInfo();

                        ListItem list3 = new ListItem();
                        list3.Text = dsCarDetailsInfo.Tables[0].Rows[0]["model"].ToString();
                        list3.Value = dsCarDetailsInfo.Tables[0].Rows[0]["makeModelID"].ToString();
                        ddlModel.SelectedIndex = ddlModel.Items.IndexOf(list3);

                        Session["SelYear"] = dsCarDetailsInfo.Tables[0].Rows[0]["yearOfMake"].ToString();
                        Session["SelMake"] = dsCarDetailsInfo.Tables[0].Rows[0]["make"].ToString();
                        Session["SelModel"] = dsCarDetailsInfo.Tables[0].Rows[0]["model"].ToString();
                        Session["MakeModelID"] = dsCarDetailsInfo.Tables[0].Rows[0]["makeModelID"].ToString();

                        ListItem list4 = new ListItem();
                        list4.Value = dsCarDetailsInfo.Tables[0].Rows[0]["bodyTypeID"].ToString();
                        list4.Text = dsCarDetailsInfo.Tables[0].Rows[0]["bodyType"].ToString();
                        ddlStyle.SelectedIndex = ddlStyle.Items.IndexOf(list4);

                        ListItem list5 = new ListItem();
                        list5.Value = dsCarDetailsInfo.Tables[0].Rows[0]["State_Id"].ToString();
                        list5.Text = dsCarDetailsInfo.Tables[0].Rows[0]["State"].ToString();
                        ddlLocationState.SelectedIndex = ddlLocationState.Items.IndexOf(list5);

                        ListItem list6 = new ListItem();
                        list6.Value = dsCarDetailsInfo.Tables[0].Rows[0]["fuelTypeID"].ToString();
                        list6.Text = dsCarDetailsInfo.Tables[0].Rows[0]["fuelType"].ToString();
                        ddlFuelType.SelectedIndex = ddlFuelType.Items.IndexOf(list6);

                        ListItem list7 = new ListItem();
                        list7.Value = dsCarDetailsInfo.Tables[0].Rows[0]["exteriorColor"].ToString();
                        list7.Text = dsCarDetailsInfo.Tables[0].Rows[0]["exteriorColor"].ToString();
                        ddlExteriorColor.SelectedIndex = ddlExteriorColor.Items.IndexOf(list7);

                        ListItem list8 = new ListItem();
                        list8.Text = dsCarDetailsInfo.Tables[0].Rows[0]["interiorColor"].ToString();
                        list8.Value = dsCarDetailsInfo.Tables[0].Rows[0]["interiorColor"].ToString();
                        ddlInteriorColor.SelectedIndex = ddlInteriorColor.Items.IndexOf(list8);

                        ListItem list9 = new ListItem();
                        list9.Value = dsCarDetailsInfo.Tables[0].Rows[0]["numberOfCylinder"].ToString();
                        list9.Text = dsCarDetailsInfo.Tables[0].Rows[0]["numberOfCylinder"].ToString();
                        ddlCylinderCount.SelectedIndex = ddlCylinderCount.Items.IndexOf(list9);

                        ListItem list10 = new ListItem();
                        list10.Value = dsCarDetailsInfo.Tables[0].Rows[0]["NumberOfDoors"].ToString();
                        list10.Text = dsCarDetailsInfo.Tables[0].Rows[0]["NumberOfDoors"].ToString();
                        ddlDoorCount.SelectedIndex = ddlDoorCount.Items.IndexOf(list10);

                        ListItem list11 = new ListItem();
                        list11.Value = dsCarDetailsInfo.Tables[0].Rows[0]["Transmission"].ToString();
                        list11.Text = dsCarDetailsInfo.Tables[0].Rows[0]["Transmission"].ToString();
                        ddlTransmission.SelectedIndex = ddlTransmission.Items.IndexOf(list11);

                        ListItem list12 = new ListItem();
                        list12.Value = dsCarDetailsInfo.Tables[0].Rows[0]["DriveTrain"].ToString();
                        list12.Text = dsCarDetailsInfo.Tables[0].Rows[0]["DriveTrain"].ToString();
                        ddlDriveTrain.SelectedIndex = ddlDriveTrain.Items.IndexOf(list12);

                        ListItem list13 = new ListItem();
                        list13.Value = dsCarDetailsInfo.Tables[0].Rows[0]["ConditionID"].ToString();
                        list13.Text = dsCarDetailsInfo.Tables[0].Rows[0]["ConditionDescription"].ToString();
                        ddlCondition.SelectedIndex = ddlCondition.Items.IndexOf(list13);

                        //txtSellerName.Text = dsCarDetailsInfo.Tables[0].Rows[0]["sellerName"].ToString();
                        //txtAddress.Text = GeneralFunc.ToProper(dsCarDetailsInfo.Tables[0].Rows[0]["address1"].ToString());
                        txtCity.Text = GeneralFunc.ToProper(dsCarDetailsInfo.Tables[0].Rows[0]["city"].ToString());
                        txtZip.Text = dsCarDetailsInfo.Tables[0].Rows[0]["zip"].ToString();
                        txtSellerPhone.Text = dsCarDetailsInfo.Tables[0].Rows[0]["phone"].ToString();
                        txtSellerEmail.Text = dsCarDetailsInfo.Tables[0].Rows[0]["email"].ToString();

                        if (dsCarDetailsInfo.Tables[0].Rows[0]["price"].ToString() == "0.0000")
                        {
                            txtAskingPrice.Text = "";
                        }
                        else
                        {
                            txtAskingPrice.Text = string.Format("{0:0.00}", Convert.ToDouble(dsCarDetailsInfo.Tables[0].Rows[0]["price"].ToString()));
                        }
                        if (txtAskingPrice.Text.Length > 6)
                        {
                            txtAskingPrice.Text = txtAskingPrice.Text.Substring(0, 6);
                        }

                        if (dsCarDetailsInfo.Tables[0].Rows[0]["mileage"].ToString() == "0.00")
                        {
                            txtMileage.Text = "";
                        }
                        else
                        {
                            txtMileage.Text = string.Format("{0:0.00}", Convert.ToDouble(dsCarDetailsInfo.Tables[0].Rows[0]["mileage"].ToString()));
                        }
                        if (txtMileage.Text.Length > 6)
                        {
                            txtMileage.Text = txtMileage.Text.Substring(0, 6);
                        }

                        txtVin.Text = dsCarDetailsInfo.Tables[0].Rows[0]["VIN"].ToString();
                        txtCondition.Text = dsCarDetailsInfo.Tables[0].Rows[0]["description"].ToString();
                        txtTitle.Text = dsCarDetailsInfo.Tables[0].Rows[0]["Title"].ToString();
                        for (int i = 1; i < 52; i++)
                        {
                            string ChkBoxID = "chkFeatures" + i.ToString();
                            CheckBox ChkedBox = (CheckBox)form1.FindControl(ChkBoxID);
                            if (dsCarDetailsInfo.Tables[3].Rows.Count >= i)
                            {
                                if (dsCarDetailsInfo.Tables[3].Rows[i - 1]["Isactive"].ToString() == "True")
                                {
                                    ChkedBox.Checked = true;
                                }
                                else
                                {
                                    ChkedBox.Checked = false;
                                }
                            }
                            else
                            {
                                ChkedBox.Checked = false;
                            }
                        }
                        if (dsCarDetailsInfo.Tables[4].Rows.Count > 0)
                        {
                            lblExistUrlRes.Visible = false;
                            divlblMultiSite.Style["display"] = "none";
                            grdMultiSites.Visible = true;
                            grdMultiSites.DataSource = dsCarDetailsInfo.Tables[4];
                            grdMultiSites.DataBind();

                        }
                        else
                        {
                            grdMultiSites.Visible = false;
                            lblExistUrlRes.Visible = true;
                            lblExistUrlRes.Text = "Not uploaded..!";
                            divlblMultiSite.Style["display"] = "block";
                        }
                    }
                }
            }

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["RegUserName"] == null)
        {
            Response.Redirect("Default.aspx");
        }
        else
        {
            if (!IsPostBack)
            {
                GeneralFunc.SetPageDefaults(Page);
                Session["CurrentPage"] = "Home";

                Session["CurrentPageConfig"] = null;
                Session["PageName"] = "";

                ServiceReference objServiceReference = new ServiceReference();

                ScriptReference objScriptReference = new ScriptReference();

                objServiceReference.Path = "~/CarsService.asmx";

                objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

                scrptmgr.Services.Add(objServiceReference);

                scrptmgr.Scripts.Add(objScriptReference);

                if (Session["RegName"].ToString().Length > 10)
                {
                    lblHeadName.Text = "Welcome " + Session["RegName"].ToString().Substring(0, 10) + " ";
                }
                else
                {
                    lblHeadName.Text = "Welcome " + Session["RegName"].ToString() + " ";
                }
                Session["UpDatePackageID"] = null;
                //lblUserName.Text = Session[Constants.NAME].ToString();
                dsDropDown = objdropdownBL.Usp_Get_DropDown();
                Session["DsDropDown"] = dsDropDown;
               // DataSet dsUserInfoDetails = objdropdownBL.USP_GetUSerDetailsByUserIDForRegLog(Convert.ToInt32(Session["RegUSER_ID"].ToString()));
                GetAllModels();
                GetMakes();
                GetBody();
                FillYear();
                FillFuelTypes();
                FillStates();
                FillPackage();
                FillExteriorColor();
                FillInteriorColor();
                FillCylinders();
                FillDoors();
                FillTransmissions();
                FillDriveTrain();
                FillCondition();

                if ((Session["PostingID"] != null) && (Session["PostingID"].ToString() != ""))
                {
                    //btnUpdatePackage.Visible = true;
                    FillUpdateInfo();
                }
            }
        }
    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        if (StopProcessing)
        {
            return;
        }

        var page = Page as CMSPage;
        if (page != null)
        {
            page.EnsureScriptManager();
            if (page.ScriptManagerControl != null)
            {
                var script = new ScriptReference("~/CMSScripts/RestoreLostFocus.js");
                page.ScriptManagerControl.Scripts.Add(script);
            }
        }

        CreateHeaderActions();

        // Set method delegates
        fieldAppearance.GetControls = GetControls;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["PageName"] = "PromotionbyStatecity";

            ServiceReference objServiceReference = new ServiceReference();

            ScriptReference objScriptReference = new ScriptReference();

            objServiceReference.Path = "../../CarsService.asmx";

            objScriptReference.Path = "../../Static/Js/CarsJScriptNew.js";

            //objServiceReference.Path = "~/CarsService.asmx";

            //objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

            scrptMgr.Scripts.Add(objScriptReference);
            scrptMgr.Services.Add(objServiceReference);

            if (Request.QueryString.Keys.Count > 1)
            {

                //UserControl UC = (UserControl)Page.LoadControl("~/UserControl/LoginName.ascx");

                //Label lblLang=(Label)UC.FindControl("lblLang");

                //lblLang.Visible = false;

                //LinkButton lnbtnLang = (LinkButton)UC.FindControl("lnbtnLang");
                //lnbtnLang.Visible = false;

                //ChangeLanguage

                string URL = string.Empty;
                string URL1 = string.Empty;
                if (Request.QueryString[0].IndexOf("images") == -1)
                {
                    if (Request.QueryString.Keys.Count > 0)
                    {
                        FillCarsbyState(Request.QueryString[1], Request.QueryString[0]);
                        lblState.Text = Request.QueryString[1];
                        lblCity.Text = Request.QueryString[0];
                        lblState1.Text = Request.QueryString[1];
                        lblCity1.Text = Request.QueryString[0];

                        lblState2.Text  = Request.QueryString[1];
                        lblCity2.Text = Request.QueryString[0];

                        Title = "Sell Used Cars in " + Request.QueryString[0] + ", " + Request.QueryString[1] + "";

                        HtmlMeta tag = new HtmlMeta();

                        tag.Name = "keywords";
                        //tag.Content = "Buy " + lblTitle.Text.ToString() + " at UnitedCarExchange.com";
                        tag.Content = "Sell, Used Cars, Buy, " + Request.QueryString[0] + ", " + Request.QueryString[1] + ".";

                        Header.Controls.Add(tag);

                        HtmlMeta tag1 = new HtmlMeta();
                        tag1.Name = "description";
                        //tag1.Content = EmptyCheck(objCarInfo[0].Description);
                        tag1.Content = "Sell or Buy Used Cars in " + Request.QueryString[0] + ", " + Request.QueryString[1] + " with unitedcarexchange.com - The fastest way to sell your Used car.";
                        Header.Controls.Add(tag1);

                        //Sell or Buy Used Cars in Region, State with unitedcarexchange.com - The fastest way to sell your car.
                    }
                }
            }

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["RegUserName"] == null)
        {
            Response.Redirect("Default.aspx");
        }
        else
        {
            if (!IsPostBack)
            {
                Session["CurrentPage"] = "Home";
                Session["PageName"] = "";
                Session["CurrentPageConfig"] = null;

                ServiceReference objServiceReference = new ServiceReference();

                ScriptReference objScriptReference = new ScriptReference();

                objServiceReference.Path = "~/CarsService.asmx";

                objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

                scrptmgr.Services.Add(objServiceReference);
                scrptmgr.Scripts.Add(objScriptReference);
                DataSet dsYears = objBankDetailsBL.USP_GetNext12years();

                fillYears(dsYears);

                if (Session["RegName"].ToString().Length > 10)
                {
                    lblHeadName.Text = "Welcome " + Session["RegName"].ToString().Substring(0, 10) + " ";
                }
                else
                {
                    lblHeadName.Text = "Welcome " + Session["RegName"].ToString() + " ";
                }
                dsDropDown = objdropdownBL.Usp_Get_DropDown();
                Session["DsDropDown"] = dsDropDown;
                FillStates();
                int UID = Convert.ToInt32(Session["RegUSER_ID"].ToString());
                DataSet dsGetIDs = objdropdownBL.USP_GetIdsByUID(UID);
                if (dsGetIDs.Tables.Count > 0)
                {
                    if (dsGetIDs.Tables[0].Rows.Count > 0)
                    {
                        Session["PaymentID"] = dsGetIDs.Tables[0].Rows[0]["paymentID"].ToString();
                        Session["isActive"] = dsGetIDs.Tables[0].Rows[0]["isActive"].ToString();
                    }
                }

                ///http://UnitedCarExchange.com/PaymentSucces.aspx?
                ///tx=09X07842XS736843C&st=Completed&
                ///amt=0.10&
                ///cc=USD&cm=&
                ///item_number=

                if ((Session["isActive"].ToString() != "True") && (Session["PackageID"].ToString() == "1"))
                {
                    int PostingID = Convert.ToInt32(Session["PostingID"].ToString());
                    int UserPackID = Convert.ToInt32(Session["RegUserPackID"].ToString());
                    bool bnew = objBankDetailsBL.USP_UpdateInfoForFreePackage(PostingID, UserPackID, UID);
                    string LoginPassword = Session["RegPassword"].ToString();
                    string LoginName = Session["RegUserName"].ToString();
                    SendRegisterMail(LoginName, LoginPassword);
                    mdepAlertExists.Show();
                    lblErrorExists.Visible = true;
                    lblErrorExists.Text = "You have selected the free package.Payment details are not required.<br />Click Next";
                }
                else if (Session["isActive"].ToString() == "True")
                {
                    Response.Redirect("account.aspx");
                }
                //if (Session["PaymentID"] != null)
                //{
                //    if (Session["PaymentID"].ToString() != "")
                //    {
                //        Response.Redirect("account.aspx");
                //    }
                //}

            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GeneralFunc.SetPageDefaults(Page);
            //GeneralFunc.SaveSiteVisit();
            Session.Abandon();
            Session[Constants.USER_ID] = null;
            Session[Constants.USER_NAME] = null;
            txtEmail.Focus();

            Session["CurrentPage"] = "Home";
            Session["PageName"] = "";
            Session["CurrentPageConfig"] = null;

            ServiceReference objServiceReference = new ServiceReference();

            ScriptReference objScriptReference = new ScriptReference();

            objServiceReference.Path = "~/CarsService.asmx";

            objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

            scrptmgr.Services.Add(objServiceReference);
            scrptmgr.Scripts.Add(objScriptReference);
            if (Session[Constants.USER_ID] != null)
            {
                //Request.UrlReferrer.AbsolutePath

            }

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //KeyWords.Addkeywordstags(Header);

            //GeneralFunc.SaveSiteVisit();

            Session["PageName"] = "Email Prefereces";

            Session["CurrentPageConfig"] = null;

            GeneralFunc.SaveSiteVisit();

            ServiceReference objServiceReference = new ServiceReference();

            ScriptReference objScriptReference = new ScriptReference();

            objServiceReference.Path = "~/CarsService.asmx";

            objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

            scrptmgr.Services.Add(objServiceReference);
            scrptmgr.Scripts.Add(objScriptReference);

            GeneralFunc.SetPageDefaults(Page);

            GetMakes();

            FillWithin();

            FillModels();

            if (Request.QueryString.Keys.Count > 0)
            {
                string URL = string.Empty;
                string URL1 = string.Empty;
                if (Request.QueryString.Keys.Count > 0)
                {
                    if (URL != null)
                    {

                        GetEmailPreferences(Request.QueryString["PreferID"]);

                    }
                }
                if (Request.QueryString.Keys.Count > 1)
                {
                    URL = Request.QueryString[0];

                    URL1 = Request.QueryString[1];

                    if (URL != null && URL1 != null)
                    {
                        GetEmailPreferences(Request.QueryString["PreferID"]);

                        lblTitle.Text = "Your Email Alerts Successfully Activated..";

                        lblTitle.Visible = true;
                    }
                }
            }
        }
    }
Beispiel #57
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     var page = Page as CMSPage;
     if (page != null)
     {
         page.EnsureScriptManager();
         if (page.ScriptManagerControl != null)
         {
             var script = new ScriptReference("~/CMSScripts/RestoreLostFocus.js");
             page.ScriptManagerControl.Scripts.Add(script);
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[Constants.NAME] == null)
        {
            Response.Redirect("Default.aspx");
        }
        else
        {
            if (!IsPostBack)
            {
                Session["CurrentPage"] = "AddNewMulticar";
                Session["PageName"] = "";
                Session["CurrentPageConfig"] = null;
                KeyWords.Addkeywordstags(Header);
                GeneralFunc.SaveSiteVisit();

                ServiceReference objServiceReference = new ServiceReference();

                ScriptReference objScriptReference = new ScriptReference();

                objServiceReference.Path = "~/CarsService.asmx";

                objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js";

                scrptmgr.Services.Add(objServiceReference);
                scrptmgr.Scripts.Add(objScriptReference);
                Session["UpDatePackageID"] = null;
                //lblUserName.Text = Session[Constants.NAME].ToString();
                dsDropDown = objdropdownBL.Usp_Get_DropDown();
                Session["DsDropDown"] = dsDropDown;
                DataSet dsUserInfoDetails = objdropdownBL.USP_GetUSerDetailsByUserID(Convert.ToInt32(Session[Constants.USER_ID].ToString()));

                int UserPackID = Convert.ToInt32(Session["SelUserPackID"].ToString());
                DataSet dsSellerInfo = objdropdownBL.USP_GetDataByUserPackID(UserPackID);

                if (dsSellerInfo.Tables[1].Rows.Count > 0)
                {
                    // txtSellerName.Text = "";
                    txtSellerPhone.Text = dsSellerInfo.Tables[1].Rows[0]["PhoneNumber"].ToString();
                    //txtAddress.Text = "";
                    txtCity.Text = dsSellerInfo.Tables[1].Rows[0]["City"].ToString();
                    txtZip.Text = dsSellerInfo.Tables[1].Rows[0]["Zip"].ToString();
                    txtSellerEmail.Text = dsSellerInfo.Tables[1].Rows[0]["UserName"].ToString();

                    ListItem li = new ListItem();
                    li.Text = dsSellerInfo.Tables[1].Rows[0]["State_Code"].ToString();
                    li.Value = dsSellerInfo.Tables[1].Rows[0]["sellerID"].ToString();
                    ddlLocationState.SelectedIndex = ddlLocationState.Items.IndexOf(li);

                }
                if (dsSellerInfo.Tables[0].Rows.Count > 0)
                {
                    Session["MultiCarPackID"] = dsSellerInfo.Tables[0].Rows[0]["PackageID"].ToString();
                    Session["MultiCarPackSaleDate"] = dsSellerInfo.Tables[0].Rows[0]["CreateDate"].ToString();
                    Session["MultiCarPackPaymentID"] = dsSellerInfo.Tables[0].Rows[0]["paymentID"].ToString();
                    Session["MultiCarPaydate"] = dsSellerInfo.Tables[0].Rows[0]["PayDate"].ToString();
                    string PackDescrip = dsSellerInfo.Tables[0].Rows[0]["Description"].ToString();
                    lblPackDiv.Style["display"] = "block";
                    lblPackageName.Text = PackDescrip + "(# " + Session["SelUserPackID"].ToString() + ")";

                }

                GetAllModels();
                GetMakes();
                FillYear();
                GetBody();
                FillFuelTypes();
                FillStates();
                FillExteriorColor();
                FillInteriorColor();
                FillCylinders();
                FillDoors();
                FillTransmissions();
                FillDriveTrain();
                FillCondition();

            }

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[Constants.NAME] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "TransfersInfoBinding();", true);
            if (!IsPostBack)
            {
                Session["CurrentPage"] = "QC Module";

                if (LoadIndividualUserRights() == false)
                {
                    Response.Redirect("Login.aspx");
                }
                else
                {
                    ServiceReference objServiceReference = new ServiceReference();

                    ScriptReference objScriptReference = new ScriptReference();

                    objServiceReference.Path = "~/WebService.asmx";

                    objScriptReference.Path = "~/Static/Js/CarsJScript.js";

                    scrptmgr.Services.Add(objServiceReference);
                    scrptmgr.Scripts.Add(objScriptReference);

                    if (Session[Constants.NAME] == null)
                    {
                        lnkBtnLogout.Visible = false;
                        lblUserName.Visible = false;
                    }
                    else
                    {
                        LoadUserRights();
                        lnkBtnLogout.Visible = true;
                        lblUserName.Visible = true;
                        string LogUsername = Session[Constants.NAME].ToString();
                        string CenterCode = Session[Constants.CenterCode].ToString();
                        string UserLogName = Session[Constants.USER_NAME].ToString();
                        if (LogUsername.Length > 20)
                        {
                            lblUserName.Text = LogUsername.ToString().Substring(0, 20);
                            //if (CenterCode.Length > 5)
                            //{
                            //    lblUserName.Text = lblUserName.Text + " (" + CenterCode.ToString().Substring(0, 5) + ")";
                            //}
                            //else
                            //{
                            lblUserName.Text = lblUserName.Text + " (" + CenterCode.ToString() + ")-" + UserLogName.ToString();
                            //}
                        }
                        else
                        {
                            lblUserName.Text = LogUsername;
                            lblUserName.Text = lblUserName.Text + " (" + CenterCode.ToString() + ")-" + UserLogName.ToString();
                        }

                    }
                    if (Session["DsDropDown"] == null)
                    {
                        dsDropDown = objdropdownBL.Usp_Get_DropDown();
                        Session["DsDropDown"] = dsDropDown;
                    }
                    else
                    {
                        dsDropDown = (DataSet)Session["DsDropDown"];
                    }

                    Session["DealerQCEditDealerPaymentID"] = null;
                    Session["DealerQCEditDealerContactID"] = null;
                    Session["DealerQCEditDealerUID"] = null;
                    Session["DealerQCEditDealerCoordinatorID"] = null;
                    // lnkTicker.Attributes.Add("href", "javascript:poptastic('Ticker.aspx?CID=" + Session[Constants.CenterCodeID] + "&CNAME=" + Session[Constants.CenterCode] + "');");
                    DataSet dsYears = objHotLeadBL.USP_GetNext12years();

                    fillYears(dsYears);

                    DataSet dsDatetime = objHotLeadBL.GetDatetime();
                    FillStates();

                    FillPromotionOptions();
                    //FillPaymentDate();
                    //FillPDDate(dsDatetime);
                    FillPaymentDate(dsDatetime);
                    FillTargetDate(dsDatetime);
                    FillCallbackDate(dsDatetime);
                    FillContractSignDate(dsDatetime);
                    FillBillingStates();
                    FillInvoiceBillingStates();

                    FillVoiceFileLocation();
                    // FillCheckTypes();
                    if ((Session["DealerQCDealerSaleID"] != null) && (Session["DealerQCDealerSaleID"].ToString() != ""))
                    {
                        DataSet GetDealerData = objHotLeadBL.GetDealerDetailsByDealerSaleID(Convert.ToInt32(Session["DealerQCDealerSaleID"].ToString()));
                        if (GetDealerData.Tables.Count > 0)
                        {
                            if (GetDealerData.Tables[0].Rows.Count > 0)
                            {
                                if (GetDealerData.Tables[2].Rows.Count > 0)
                                {
                                    RepeaterSurveyEdit.Visible = true;
                                    RepeterSurvey.Visible = false;
                                    RepeaterSurveyEdit.DataSource = GetDealerData.Tables[2];
                                    RepeaterSurveyEdit.DataBind();
                                }
                                else
                                {
                                    FillSurveyQuestions();
                                }
                                if (GetDealerData.Tables[0].Rows[0]["PackageID"].ToString() != "0")
                                {
                                    Double PackCost2 = new Double();
                                    PackCost2 = Convert.ToDouble(GetDealerData.Tables[0].Rows[0]["Price"].ToString());
                                    string PackAmount2 = string.Format("{0:0.00}", PackCost2).ToString();
                                    string PackName2 = GetDealerData.Tables[0].Rows[0]["Description"].ToString();
                                    ListItem listPack = new ListItem();
                                    listPack.Value = GetDealerData.Tables[0].Rows[0]["PackageID"].ToString();
                                    listPack.Text = PackName2 + " ($" + PackAmount2 + ")";
                                    ddlPackage.SelectedIndex = ddlPackage.Items.IndexOf(listPack);
                                }

                                ListItem listStatus = new ListItem();
                                listStatus.Text = GetDealerData.Tables[0].Rows[0]["DealerStatusName"].ToString();
                                listStatus.Value = GetDealerData.Tables[0].Rows[0]["DealerStatusID"].ToString();
                                ddlSaleStatus.SelectedIndex = ddlSaleStatus.Items.IndexOf(listStatus);

                                txtSaleAgent.Text = GetDealerData.Tables[0].Rows[0]["AgentUFirstName"].ToString() + "(" + objGeneralFunc.GetCenterCode(GetDealerData.Tables[0].Rows[0]["AgentCenterID"].ToString()) + ")";
                                txtLeadSource.Text = GetDealerData.Tables[0].Rows[0]["LeadGeneratedBy"].ToString();
                                txtLeadAgent.Text = GetDealerData.Tables[0].Rows[0]["LeadAgent"].ToString();

                                Double PackCost1 = new Double();
                                PackCost1 = Convert.ToDouble(GetDealerData.Tables[0].Rows[0]["PromotionTakeAmount"].ToString());
                                string PackAmount1 = string.Format("{0:0.00}", PackCost1).ToString();
                                string PackName1 = GetDealerData.Tables[0].Rows[0]["PromotionName"].ToString();
                                ListItem list = new ListItem();
                                list.Text = PackName1 + " ($" + PackAmount1 + ")";
                                list.Value = GetDealerData.Tables[0].Rows[0]["PromotionID"].ToString();
                                ddlPromotionOptions.SelectedIndex = ddlPromotionOptions.Items.IndexOf(list);

                                txtDealerShipName.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["DealerShipName"].ToString());
                                txtPhone.Text = objGeneralFunc.filPhnm(GetDealerData.Tables[0].Rows[0]["DealerPhone"].ToString());
                                txtFax.Text = objGeneralFunc.filPhnm(GetDealerData.Tables[0].Rows[0]["DealerFax"].ToString());
                                txtWebAddress.Text = GetDealerData.Tables[0].Rows[0]["DealerWebAddress"].ToString();
                                txtDealerLicenseNumber.Text = GetDealerData.Tables[0].Rows[0]["DealerLicenseNumber"].ToString();
                                txtAddress.Text = GetDealerData.Tables[0].Rows[0]["DealerAddress"].ToString();
                                txtCity.Text = GetDealerData.Tables[0].Rows[0]["DealerCity"].ToString();

                                ListItem listState = new ListItem();
                                listState.Value = GetDealerData.Tables[0].Rows[0]["DealerStateID"].ToString();
                                listState.Text = GetDealerData.Tables[0].Rows[0]["State_Code"].ToString();
                                ddlLocationState.SelectedIndex = ddlLocationState.Items.IndexOf(listState);
                                txtZip.Text = GetDealerData.Tables[0].Rows[0]["DealerZip"].ToString();

                                txtDealerContactName.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["DealerContactName"].ToString());
                                txtDealerJobTitle.Text = GetDealerData.Tables[0].Rows[0]["DealerJobTitle"].ToString();
                                txtContactPhone.Text = objGeneralFunc.filPhnm(GetDealerData.Tables[0].Rows[0]["DealerContactPhone"].ToString());
                                txtContactMobileNumber.Text = objGeneralFunc.filPhnm(GetDealerData.Tables[0].Rows[0]["DealerMobilePhone"].ToString());
                                txtEmail.Text = GetDealerData.Tables[0].Rows[0]["DealerEmail"].ToString();
                                txtSaleNotes.Text = GetDealerData.Tables[0].Rows[0]["SaleNotes"].ToString();

                                Session["DealerQCEditDealerSaleID"] = GetDealerData.Tables[0].Rows[0]["DealerSaleID"].ToString();
                                Session["DealerQCEditDealerUID"] = GetDealerData.Tables[0].Rows[0]["DealerUID"].ToString();
                                Session["DealerQCEditDealerContactID"] = GetDealerData.Tables[0].Rows[0]["DealerContactID"].ToString();
                                Session["DealerQCEditDealerPaymentID"] = GetDealerData.Tables[0].Rows[0]["PaymentID"].ToString();
                                Session["DealerQCEditDealerCoordinatorID"] = GetDealerData.Tables[0].Rows[0]["UCEDealerCoordinatorID"].ToString();
                                Session["DealerQCEditPaymentStatus"] = GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString();
                                if ((GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "1") || (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "7") || (GetDealerData.Tables[0].Rows[0]["SmartzStatus"].ToString() == "1"))
                                {
                                    rdbtnPayVisa.Enabled = false;
                                    rdbtnPayMasterCard.Enabled = false;
                                    rdbtnPayAmex.Enabled = false;
                                    rdbtnPayDiscover.Enabled = false;
                                    rdbtnPayCheck.Enabled = false;
                                    rdbtnInvoice.Enabled = false;
                                    lnkbtnCopyCheckName.Enabled = false;
                                    lnkbtnCopySellerInfo.Enabled = false;
                                    lnkbtnCopyInvoiceInfo.Enabled = false;
                                    ddlPaymentDate.Enabled = false;
                                    txtPDAmountNow.Enabled = false;
                                }

                                if (Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) == 5)
                                {
                                    divcard.Style["display"] = "none";
                                    divcheck.Style["display"] = "block";
                                    divpaypal.Style["display"] = "none";
                                    txtCustNameForCheck.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["bankAccountHolderName"].ToString());
                                    txtAccNumberForCheck.Text = GetDealerData.Tables[0].Rows[0]["bankAccountNumber"].ToString();
                                    txtBankNameForCheck.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["bankName"].ToString());
                                    txtRoutingNumberForCheck.Text = GetDealerData.Tables[0].Rows[0]["bankRouting"].ToString();
                                    //lblAccountType.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["AccountTypeName"].ToString());
                                    ListItem liAccType = new ListItem();
                                    liAccType.Text = GetDealerData.Tables[0].Rows[0]["AccountTypeName"].ToString();
                                    liAccType.Value = GetDealerData.Tables[0].Rows[0]["bankAccountType"].ToString();
                                    ddlAccType.SelectedIndex = ddlAccType.Items.IndexOf(liAccType);

                                    //ListItem liCheckType = new ListItem();
                                    //liCheckType.Text = Cardetais.Tables[0].Rows[0]["CheckTypeName"].ToString();
                                    //liCheckType.Value = Cardetais.Tables[0].Rows[0]["CheckTypeID"].ToString();
                                    //ddlCheckType.SelectedIndex = ddlCheckType.Items.IndexOf(liCheckType);
                                    //txtCheckNumber.Text = Cardetais.Tables[0].Rows[0]["BankCheckNumber"].ToString();
                                    if ((GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "1") || (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "7"))
                                    {
                                        txtCustNameForCheck.Enabled = false;
                                        txtAccNumberForCheck.Enabled = false;
                                        txtBankNameForCheck.Enabled = false;
                                        txtRoutingNumberForCheck.Enabled = false;
                                        ddlAccType.Enabled = false;
                                    }
                                }
                                else if (Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) == 8)
                                {
                                    divcard.Style["display"] = "none";
                                    divcheck.Style["display"] = "none";
                                    divpaypal.Style["display"] = "block";
                                    txtAttentionTo.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["InvoiceAttentionTo"].ToString());
                                    if (GetDealerData.Tables[0].Rows[0]["SendInvoiceID"].ToString() == "1")
                                    {
                                        rdbtnInvoiceEmail.Checked = true;
                                    }
                                    else
                                    {
                                        rdbtnInvoicePostal.Checked = true;
                                    }
                                    txtInvoiceEmail.Text = GetDealerData.Tables[0].Rows[0]["SendInvoiceEmail"].ToString();
                                    txtInvoiceBillingname.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["billingName"].ToString());
                                    tyxtInvoiceAddress.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["billingAdd"].ToString());
                                    txtInvoiceCity.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["billingCity"].ToString());
                                    //txtInvoiceState.Text =
                                    //ddlInvoiceState.SelectedItem.Text = GetDealerData.Tables[0].Rows[0]["billingState"].ToString();
                                    ListItem liBillingSt = new ListItem();
                                    liBillingSt.Text = GetDealerData.Tables[0].Rows[0]["BillingStateName"].ToString();
                                    liBillingSt.Value = GetDealerData.Tables[0].Rows[0]["billingState"].ToString();
                                    ddlInvoiceState.SelectedIndex = ddlInvoiceState.Items.IndexOf(liBillingSt);
                                    txtInvoiceZip.Text = GetDealerData.Tables[0].Rows[0]["billingZip"].ToString();
                                    if ((GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "1") || (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "7") || (GetDealerData.Tables[0].Rows[0]["SmartzStatus"].ToString() == "1"))
                                    {
                                        txtAttentionTo.Enabled = false;
                                        rdbtnInvoiceEmail.Enabled = false;
                                        rdbtnInvoicePostal.Enabled = false;
                                        txtInvoiceEmail.Enabled = false;
                                        txtInvoiceBillingname.Enabled = false;
                                        tyxtInvoiceAddress.Enabled = false;
                                        txtInvoiceCity.Enabled = false;
                                        ddlInvoiceState.Enabled = false;
                                        txtInvoiceZip.Enabled = false;
                                    }
                                }
                                else
                                {
                                    divcard.Style["display"] = "block";
                                    divcheck.Style["display"] = "none";
                                    divpaypal.Style["display"] = "none";
                                    txtCardholderName.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["cardholderName"].ToString());
                                    txtCardholderLastName.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["cardholderLastName"].ToString());
                                    CardNumber.Text = GetDealerData.Tables[0].Rows[0]["cardNumber"].ToString();
                                    string EXpDate = GetDealerData.Tables[0].Rows[0]["cardExpDt"].ToString();
                                    string[] EXpDt = EXpDate.Split(new char[] { '/' });

                                    //txtExpMon.Text = EXpDt[0].ToString();
                                    ListItem liExpMonth = new ListItem();
                                    liExpMonth.Text = EXpDt[0].ToString();
                                    liExpMonth.Value = EXpDt[0].ToString();
                                    ExpMon.SelectedIndex = ExpMon.Items.IndexOf(liExpMonth);

                                    ListItem liExpYear = new ListItem();
                                    liExpYear.Text = "20" + EXpDt[1].ToString();
                                    liExpYear.Value = EXpDt[1].ToString();
                                    CCExpiresYear.SelectedIndex = CCExpiresYear.Items.IndexOf(liExpYear);

                                    // txtCCExpiresYear.Text = "20" + EXpDt[1].ToString();
                                    cvv.Text = GetDealerData.Tables[0].Rows[0]["cardCode"].ToString();

                                    txtbillingaddress.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["billingAdd"].ToString());
                                    txtbillingcity.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["billingCity"].ToString());
                                    //ddlbillingstate.SelectedItem.Text = GetDealerData.Tables[0].Rows[0]["State_Code"].ToString();
                                    ListItem liBillingSt = new ListItem();
                                    liBillingSt.Text = GetDealerData.Tables[0].Rows[0]["BillingStateName"].ToString();
                                    liBillingSt.Value = GetDealerData.Tables[0].Rows[0]["billingState"].ToString();
                                    ddlbillingstate.SelectedIndex = ddlbillingstate.Items.IndexOf(liBillingSt);

                                    txtbillingzip.Text = GetDealerData.Tables[0].Rows[0]["billingZip"].ToString();
                                    if ((GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "1") || (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "7"))
                                    {
                                        txtCardholderName.Enabled = false;
                                        txtCardholderLastName.Enabled = false;
                                        CardNumber.Enabled = false;
                                        ExpMon.Enabled = false;
                                        CCExpiresYear.Enabled = false;
                                        cvv.Enabled = false;
                                        txtbillingaddress.Enabled = false;
                                        txtbillingcity.Enabled = false;
                                        ddlbillingstate.Enabled = false;
                                        txtbillingzip.Enabled = false;
                                    }
                                }
                                txtPDAmountNow.Text = GetDealerData.Tables[0].Rows[0]["Amount"].ToString();
                                txtVoicefileConfirmNo.Text = GetDealerData.Tables[0].Rows[0]["VoiceRecord"].ToString();
                                ListItem liVoiceLoc = new ListItem();
                                liVoiceLoc.Text = GetDealerData.Tables[0].Rows[0]["VoiceFileLocationName"].ToString();
                                liVoiceLoc.Value = GetDealerData.Tables[0].Rows[0]["VoiceFileLocation"].ToString();
                                ddlVoiceFileLocation.SelectedIndex = ddlVoiceFileLocation.Items.IndexOf(liVoiceLoc);

                                if (GetDealerData.Tables[0].Rows[0]["SchedulePaymentDate"].ToString() != "")
                                {
                                    //ListItem liPaydate = new ListItem();
                                    //liPaydate.Text = GetDealerData.Tables[0].Rows[0]["SchedulePaymentDate"].ToString();
                                    //liPaydate.Value = GetDealerData.Tables[0].Rows[0]["SchedulePaymentDate"].ToString();
                                    //ddlPaymentDate.SelectedIndex = ddlPaymentDate.Items.IndexOf(liPaydate);

                                    DateTime PayDate = Convert.ToDateTime(GetDealerData.Tables[0].Rows[0]["SchedulePaymentDate"].ToString());
                                    DateTime dtNow = Convert.ToDateTime(dsDatetime.Tables[0].Rows[0]["Datetime"].ToString());
                                    if (Convert.ToDateTime(PayDate.ToString("MM/dd/yyyy")) < Convert.ToDateTime(dtNow.ToString("MM/dd/yyyy")))
                                    {
                                        ddlPaymentDate.SelectedItem.Text = PayDate.ToString("MM/dd/yyyy");
                                        ddlPaymentDate.SelectedItem.Value = PayDate.ToString("MM/dd/yyyy");
                                    }
                                }
                                if (GetDealerData.Tables[0].Rows[0]["ContractSignDate"].ToString() != "")
                                {
                                    ListItem liContractDate = new ListItem();
                                    liContractDate.Text = GetDealerData.Tables[0].Rows[0]["ContractSignDate"].ToString();
                                    liContractDate.Value = GetDealerData.Tables[0].Rows[0]["ContractSignDate"].ToString();
                                    ddlContractDate.SelectedIndex = ddlContractDate.Items.IndexOf(liContractDate);
                                }
                                ListItem liContractStatus = new ListItem();
                                liContractStatus.Text = GetDealerData.Tables[0].Rows[0]["ContractSignStatusName"].ToString();
                                liContractStatus.Value = GetDealerData.Tables[0].Rows[0]["ContractSignStatusID"].ToString();
                                ddlContractStatus.SelectedIndex = ddlContractStatus.Items.IndexOf(liContractStatus);

                                if (GetDealerData.Tables[1].Rows.Count > 0)
                                {
                                    for (int i = 0; i < GetDealerData.Tables[1].Rows.Count; i++)
                                    {
                                        if (GetDealerData.Tables[1].Rows[i]["ProductOptionName"].ToString() == "Website")
                                        {
                                            if (GetDealerData.Tables[1].Rows[i]["ProductOptionStatus"].ToString() == "True")
                                            {
                                                rdbtnWebsiteYes.Checked = true;
                                            }
                                            else
                                            {
                                                rdbtnWebsiteNo.Checked = true;
                                            }
                                            txtPreferredAddress.Text = GetDealerData.Tables[1].Rows[i]["ProductOptionNotes"].ToString();
                                        }
                                        else if (GetDealerData.Tables[1].Rows[i]["ProductOptionName"].ToString() == "Cars promotion")
                                        {
                                            if (GetDealerData.Tables[1].Rows[i]["ProductOptionStatus"].ToString() == "True")
                                            {
                                                rdbtnCarsPromotionYes.Checked = true;
                                            }
                                            else
                                            {
                                                rdbtnCarsPromotionNo.Checked = true;
                                            }
                                            txtGetCarsFrom.Text = GetDealerData.Tables[1].Rows[i]["ProductOptionNotes"].ToString();
                                        }
                                        else if (GetDealerData.Tables[1].Rows[i]["ProductOptionName"].ToString() == "Leads")
                                        {
                                            if (GetDealerData.Tables[1].Rows[i]["ProductOptionStatus"].ToString() == "True")
                                            {
                                                rdbtnLeadsYes.Checked = true;
                                            }
                                            else
                                            {
                                                rdbtnLeadsNo.Checked = true;
                                            }
                                            txtLeadsToSend.Text = GetDealerData.Tables[1].Rows[i]["ProductOptionNotes"].ToString();
                                        }
                                        else if (GetDealerData.Tables[1].Rows[i]["ProductOptionName"].ToString() == "Other")
                                        {
                                            if (GetDealerData.Tables[1].Rows[i]["ProductOptionStatus"].ToString() == "True")
                                            {
                                                rdbtnOthersYes.Checked = true;
                                            }
                                            else
                                            {
                                                rdbtnOthersNo.Checked = true;
                                            }
                                            txtOthersNotes.Text = GetDealerData.Tables[1].Rows[i]["ProductOptionNotes"].ToString();
                                        }
                                    }
                                }
                            }
                            else
                            {
                                FillSurveyQuestions();
                            }
                        }

                    }

                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[Constants.NAME] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "TransfersInfoBinding();", true);
            if (!IsPostBack)
            {
                Session["CurrentPage"] = "QC Module";

                if (LoadIndividualUserRights() == false)
                {
                    Response.Redirect("Login.aspx");
                }
                else
                {
                    ServiceReference objServiceReference = new ServiceReference();

                    ScriptReference objScriptReference = new ScriptReference();

                    objServiceReference.Path = "~/WebService.asmx";

                    objScriptReference.Path = "~/Static/Js/CarsJScript.js";

                    scrptmgr.Services.Add(objServiceReference);
                    scrptmgr.Scripts.Add(objScriptReference);

                    if (Session[Constants.NAME] == null)
                    {
                        lnkBtnLogout.Visible = false;
                        lblUserName.Visible = false;
                    }
                    else
                    {
                        LoadUserRights();
                        lnkBtnLogout.Visible = true;
                        lblUserName.Visible = true;
                        string LogUsername = Session[Constants.NAME].ToString();
                        string CenterCode = Session[Constants.CenterCode].ToString();
                        string UserLogName = Session[Constants.USER_NAME].ToString();
                        if (LogUsername.Length > 20)
                        {
                            lblUserName.Text = LogUsername.ToString().Substring(0, 20);
                            //if (CenterCode.Length > 5)
                            //{
                            //    lblUserName.Text = lblUserName.Text + " (" + CenterCode.ToString().Substring(0, 5) + ")";
                            //}
                            //else
                            //{
                            lblUserName.Text = lblUserName.Text + " (" + CenterCode.ToString() + ")-" + UserLogName.ToString();
                            //}
                        }
                        else
                        {
                            lblUserName.Text = LogUsername;
                            lblUserName.Text = lblUserName.Text + " (" + CenterCode.ToString() + ")-" + UserLogName.ToString();
                        }

                    }
                    if (Session["DsDropDown"] == null)
                    {
                        dsDropDown = objdropdownBL.Usp_Get_DropDown();
                        Session["DsDropDown"] = dsDropDown;
                    }
                    else
                    {
                        dsDropDown = (DataSet)Session["DsDropDown"];
                    }
                    //lnkTicker.Attributes.Add("href", "javascript:poptastic('Ticker.aspx?CID=" + Session[Constants.CenterCodeID] + "&CNAME=" + Session[Constants.CenterCode] + "');");

                    DataSet dsDatetime = objHotLeadBL.GetDatetime();

                    //FillPaymentDate();
                    //FillPDDate(dsDatetime);
                    Session["ViewDealerQCStatus"] = "";
                    FillTargetDate(dsDatetime);
                    FillCallbackDate(dsDatetime);
                    //FillContractSignDate(dsDatetime);
                    //FillBillingStates();
                    //FillInvoiceBillingStates();
                    FillPayCancelReason();
                    //FillVoiceFileLocation();
                    // FillCheckTypes();
                    if ((Session["DealerQCDealerSaleID"] != null) && (Session["DealerQCDealerSaleID"].ToString() != ""))
                    {
                        DataSet GetDealerData = objHotLeadBL.GetDealerDetailsByDealerSaleID(Convert.ToInt32(Session["DealerQCDealerSaleID"].ToString()));
                        if (GetDealerData.Tables.Count > 0)
                        {
                            if (GetDealerData.Tables[0].Rows.Count > 0)
                            {
                                RepeaterSurveyEdit.Visible = true;
                                RepeaterSurveyEdit.DataSource = GetDealerData.Tables[2];
                                RepeaterSurveyEdit.DataBind();
                            }
                            if ((GetDealerData.Tables[0].Rows[0]["SmartzStatus"].ToString() == "1") || (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "1") || (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "7") || (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "8"))
                            {
                                btnEdit.Visible = false;
                                ddlQCStatus.Visible = false;
                                btnQCUpdate.Visible = false;
                            }
                            if ((GetDealerData.Tables[0].Rows[0]["QCStatusID"].ToString() == "3") || (GetDealerData.Tables[0].Rows[0]["QCStatusID"].ToString() == ""))
                            {
                                btnEdit.Visible = true;
                                ddlQCStatus.Visible = true;
                                btnQCUpdate.Visible = true;
                            }
                            if (((GetDealerData.Tables[0].Rows[0]["QCStatusID"].ToString() == "3") || (GetDealerData.Tables[0].Rows[0]["QCStatusID"].ToString() == "")) && (GetDealerData.Tables[0].Rows[0]["SmartzStatus"].ToString() != "1") && (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "8"))
                            {
                                btnEdit.Visible = true;
                                ddlQCStatus.Visible = true;
                                btnQCUpdate.Visible = true;
                            }
                            if (GetDealerData.Tables[0].Rows[0]["QCStatusName"].ToString() == "")
                            {
                                lblQCStatus.Text = "QC Open";
                            }
                            else
                            {
                                lblQCStatus.Text = GetDealerData.Tables[0].Rows[0]["QCStatusName"].ToString();
                            }
                            txtDealerShipName.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["DealerShipName"].ToString());
                            txtPhone.Text = objGeneralFunc.filPhnm(GetDealerData.Tables[0].Rows[0]["DealerPhone"].ToString());
                            txtFax.Text = objGeneralFunc.filPhnm(GetDealerData.Tables[0].Rows[0]["DealerFax"].ToString());
                            txtWebAddress.Text = GetDealerData.Tables[0].Rows[0]["DealerWebAddress"].ToString();
                            txtDealerLicenseNumber.Text = GetDealerData.Tables[0].Rows[0]["DealerLicenseNumber"].ToString();
                            txtAddress.Text = GetDealerData.Tables[0].Rows[0]["DealerAddress"].ToString();
                            txtCity.Text = GetDealerData.Tables[0].Rows[0]["DealerCity"].ToString();
                            txtLocationState.Text = GetDealerData.Tables[0].Rows[0]["State_Code"].ToString();
                            txtDealerContactName.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["DealerContactName"].ToString());
                            txtDealerJobTitle.Text = GetDealerData.Tables[0].Rows[0]["DealerJobTitle"].ToString();
                            txtContactPhone.Text = objGeneralFunc.filPhnm(GetDealerData.Tables[0].Rows[0]["DealerContactPhone"].ToString());
                            txtContactMobileNumber.Text = objGeneralFunc.filPhnm(GetDealerData.Tables[0].Rows[0]["DealerMobilePhone"].ToString());
                            txtEmail.Text = GetDealerData.Tables[0].Rows[0]["DealerEmail"].ToString();
                            txtSaleNotes.Text = GetDealerData.Tables[0].Rows[0]["SaleNotes"].ToString();

                            if (Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) == 1)
                            {
                                rdbtnPayVisa.Checked = true;
                            }
                            else if (Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) == 2)
                            {
                                rdbtnPayMasterCard.Checked = true;
                            }
                            else if (Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) == 3)
                            {
                                rdbtnPayAmex.Checked = true;
                            }
                            else if (Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) == 4)
                            {
                                rdbtnPayDiscover.Checked = true;
                            }
                            else if (Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) == 5)
                            {
                                rdbtnPayCheck.Checked = true;
                            }
                            else
                            {
                                rdbtnInvoice.Checked = true;
                            }
                            if (Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) == 5)
                            {
                                divcard.Style["display"] = "none";
                                divcheck.Style["display"] = "block";
                                divpaypal.Style["display"] = "none";
                                txtCustNameForCheck.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["bankAccountHolderName"].ToString());
                                txtAccNumberForCheck.Text = GetDealerData.Tables[0].Rows[0]["bankAccountNumber"].ToString();
                                txtBankNameForCheck.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["bankName"].ToString());
                                txtRoutingNumberForCheck.Text = GetDealerData.Tables[0].Rows[0]["bankRouting"].ToString();
                                //lblAccountType.Text = objGeneralFunc.ToProper(Cardetais.Tables[0].Rows[0]["AccountTypeName"].ToString());
                                ListItem liAccType = new ListItem();
                                liAccType.Text = GetDealerData.Tables[0].Rows[0]["AccountTypeName"].ToString();
                                liAccType.Value = GetDealerData.Tables[0].Rows[0]["bankAccountType"].ToString();
                                ddlAccType.SelectedIndex = ddlAccType.Items.IndexOf(liAccType);

                                //ListItem liCheckType = new ListItem();
                                //liCheckType.Text = Cardetais.Tables[0].Rows[0]["CheckTypeName"].ToString();
                                //liCheckType.Value = Cardetais.Tables[0].Rows[0]["CheckTypeID"].ToString();
                                //ddlCheckType.SelectedIndex = ddlCheckType.Items.IndexOf(liCheckType);
                                //txtCheckNumber.Text = Cardetais.Tables[0].Rows[0]["BankCheckNumber"].ToString();
                            }
                            else if (Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) == 8)
                            {
                                divcard.Style["display"] = "none";
                                divcheck.Style["display"] = "none";
                                divpaypal.Style["display"] = "block";
                                txtAttentionTo.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["InvoiceAttentionTo"].ToString());
                                if (GetDealerData.Tables[0].Rows[0]["SendInvoiceID"].ToString() == "1")
                                {
                                    rdbtnInvoiceEmail.Checked = true;
                                }
                                else
                                {
                                    rdbtnInvoiceEmail.Checked = false;
                                }
                                txtInvoiceEmail.Text = GetDealerData.Tables[0].Rows[0]["SendInvoiceEmail"].ToString();
                                txtInvoiceBillingname.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["billingName"].ToString());
                                tyxtInvoiceAddress.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["billingAdd"].ToString());
                                txtInvoiceCity.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["billingCity"].ToString());
                                txtInvoiceState.Text = GetDealerData.Tables[0].Rows[0]["billingState"].ToString();
                                txtInvoiceZip.Text = GetDealerData.Tables[0].Rows[0]["billingZip"].ToString();
                            }
                            else
                            {
                                divcard.Style["display"] = "block";
                                divcheck.Style["display"] = "none";
                                divpaypal.Style["display"] = "none";
                                txtCardholderName.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["cardholderName"].ToString());
                                txtCardholderLastName.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["cardholderLastName"].ToString());
                                CardNumber.Text = GetDealerData.Tables[0].Rows[0]["cardNumber"].ToString();
                                string EXpDate = GetDealerData.Tables[0].Rows[0]["cardExpDt"].ToString();
                                string[] EXpDt = EXpDate.Split(new char[] { '/' });

                                txtExpMon.Text = EXpDt[0].ToString();
                                txtCCExpiresYear.Text = "20" + EXpDt[1].ToString();
                                cvv.Text = GetDealerData.Tables[0].Rows[0]["cardCode"].ToString();

                                txtbillingaddress.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["billingAdd"].ToString());
                                txtbillingcity.Text = objGeneralFunc.ToProper(GetDealerData.Tables[0].Rows[0]["billingCity"].ToString());
                                txtbillingstate.Text = GetDealerData.Tables[0].Rows[0]["State_Code"].ToString();

                                txtbillingzip.Text = GetDealerData.Tables[0].Rows[0]["billingZip"].ToString();
                            }
                            if (GetDealerData.Tables[0].Rows[0]["SchedulePaymentDate"].ToString() != "")
                            {
                                DateTime PayDate = Convert.ToDateTime(GetDealerData.Tables[0].Rows[0]["SchedulePaymentDate"].ToString());
                                txtPaymentDate.Text = PayDate.ToString("MM/dd/yyyy");
                            }
                            txtPDAmountNow.Text = GetDealerData.Tables[0].Rows[0]["Amount"].ToString();
                            txtVoicefileConfirmNo.Text = GetDealerData.Tables[0].Rows[0]["VoiceRecord"].ToString();
                            txtVoiceFileLocation.Text = GetDealerData.Tables[0].Rows[0]["VoiceFileLocationName"].ToString();
                            lblSaleID.Text = GetDealerData.Tables[0].Rows[0]["DealerUID"].ToString();
                            if (GetDealerData.Tables[0].Rows[0]["SaleDate"].ToString() != "")
                            {
                                DateTime Saledt = Convert.ToDateTime(GetDealerData.Tables[0].Rows[0]["SaleDate"].ToString());
                                lblSaleDate.Text = Saledt.ToString("MM/dd/yyyy hh:mm tt");
                            }
                            lblLocation.Text = objGeneralFunc.GetCenterCode(GetDealerData.Tables[0].Rows[0]["AgentCenterID"].ToString());
                            lblSaleAgent.Text = GetDealerData.Tables[0].Rows[0]["AgentUFirstName"].ToString();
                            if (GetDealerData.Tables[0].Rows[0]["QCID"].ToString() != "")
                            {
                                Session["AgentDealerQCQCID"] = Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["QCID"].ToString());
                            }
                            else
                            {
                                Session["AgentDealerQCQCID"] = "";
                            }
                            Session["DealerQCDealerUID"] = GetDealerData.Tables[0].Rows[0]["DealerUID"].ToString();
                            Session["AgentDealerQCPaymentID"] = GetDealerData.Tables[0].Rows[0]["PaymentID"].ToString();
                            Session["AgentDealerQCPaymentTypeID"] = GetDealerData.Tables[0].Rows[0]["pmntType"].ToString();

                            lblLeadSource.Text = objGeneralFunc.WrapTextByMaxCharacters(GetDealerData.Tables[0].Rows[0]["LeadGeneratedBy"].ToString(), 20);
                            lblLeadAgent.Text = objGeneralFunc.WrapTextByMaxCharacters(GetDealerData.Tables[0].Rows[0]["LeadAgent"].ToString(), 20);
                            lblPromotionOption.Text = GetDealerData.Tables[0].Rows[0]["PromotionOptionCode"].ToString();
                            //lblQCStatus.Text = GetDealerData.Tables[0].Rows[0]["QCStatusName"].ToString();
                            lblPaymentStatus.Text = GetDealerData.Tables[0].Rows[0]["PSStatusName"].ToString();
                            lblSaleStatus.Text = GetDealerData.Tables[0].Rows[0]["DealerStatusName"].ToString();
                            string OldNotesPay = GetDealerData.Tables[0].Rows[0]["PaymentNotes"].ToString();
                            OldNotesPay = OldNotesPay.Replace("<br>", Environment.NewLine);
                            txtPaymentNotes.Text = OldNotesPay;
                            Session["DealerQCViewPackageID"] = GetDealerData.Tables[0].Rows[0]["PackageID"].ToString();
                            if (GetDealerData.Tables[0].Rows[0]["PackageID"].ToString() != "0")
                            {
                                Double PackCost2 = new Double();
                                PackCost2 = Convert.ToDouble(GetDealerData.Tables[0].Rows[0]["Price"].ToString());
                                string PackAmount2 = string.Format("{0:0.00}", PackCost2).ToString();
                                string PackName2 = GetDealerData.Tables[0].Rows[0]["Description"].ToString();

                                lblPackage.Text = PackName2 + " ($" + PackAmount2 + ")";

                            }

                            if (GetDealerData.Tables[0].Rows[0]["TargetSignupDate"].ToString() != "")
                            {
                                DateTime Saledt = Convert.ToDateTime(GetDealerData.Tables[0].Rows[0]["TargetSignupDate"].ToString());
                                lblTargetDate.Text = Saledt.ToString("MM/dd/yyyy hh:mm tt");
                            }
                            if (GetDealerData.Tables[0].Rows[0]["CallbackDate"].ToString() != "")
                            {
                                DateTime Saledt = Convert.ToDateTime(GetDealerData.Tables[0].Rows[0]["CallbackDate"].ToString());
                                lblCallbackDate.Text = Saledt.ToString("MM/dd/yyyy hh:mm tt");
                            }
                            if (GetDealerData.Tables[0].Rows[0]["ContractSignDate"].ToString() != "")
                            {
                                DateTime PayDate = Convert.ToDateTime(GetDealerData.Tables[0].Rows[0]["ContractSignDate"].ToString());
                                txtContractDate.Text = PayDate.ToString("MM/dd/yyyy");
                            }
                            txtContractStatus.Text = GetDealerData.Tables[0].Rows[0]["ContractSignStatusName"].ToString();
                            txtOldQcNotes.Text = GetDealerData.Tables[0].Rows[0]["QCNotes"].ToString();
                            if (Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) != 8)
                            {
                                ListItem liPaySt = new ListItem();
                                liPaySt.Text = "FullyPaid";
                                liPaySt.Value = "1";
                                //ddlPmntStatus.SelectedIndex = ddlPmntStatus.Items.IndexOf(liPaySt);
                                ddlPmntStatus.Items.Remove(liPaySt);
                            }
                            else
                            {
                                if (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() != "3")
                                {
                                    if (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() != "4")
                                    {
                                        ListItem liPaySt = new ListItem();
                                        liPaySt.Text = "FullyPaid";
                                        liPaySt.Value = "1";
                                        //ddlPmntStatus.SelectedIndex = ddlPmntStatus.Items.IndexOf(liPaySt);
                                        ddlPmntStatus.Items.Remove(liPaySt);
                                    }
                                }

                            }
                            if (GetDealerData.Tables[0].Rows[0]["QCStatusID"].ToString() == "1")
                            {
                                lblQCStatus.Text = "QC Approved";
                                if ((GetDealerData.Tables[0].Rows[0]["SmartzStatus"].ToString() != "1") && ((GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "1") || (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "7") || (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "8")))
                                {
                                    btnMovedToSmartz.Visible = true;
                                }
                                else if ((GetDealerData.Tables[0].Rows[0]["SmartzStatus"].ToString() != "1") && ((GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "3") || (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "4")))
                                {
                                    btnMovedToSmartz.Visible = false;
                                }
                                else
                                {
                                    btnMovedToSmartz.Visible = false;
                                }
                                if ((GetDealerData.Tables[0].Rows[0]["SmartzStatus"].ToString() == "1") || (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "1") || (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "7") || (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "8"))
                                {
                                    btnProcess.Enabled = false;
                                    btnProcess.Visible = false;
                                    ddlPmntStatus.Visible = false;
                                    btnPmntUpdate.Visible = false;
                                    btnCheckProcess.Visible = false;
                                    btnCheckProcess.Enabled = false;
                                }
                                else
                                {
                                    if ((GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "3") || (GetDealerData.Tables[0].Rows[0]["pmntStatus"].ToString() == "4"))
                                    {
                                        if ((Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) == 1) || (Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) == 2) || (Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) == 3) || (Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) == 4))
                                        {
                                            if (GetDealerData.Tables[0].Rows[0]["Amount"].ToString() != "")
                                            {
                                                Double TotalAmount1 = Convert.ToDouble(GetDealerData.Tables[0].Rows[0]["Amount"].ToString());
                                                string ChkAmount = string.Format("{0:0.00}", TotalAmount1);
                                                if (ChkAmount == "0.00")
                                                {
                                                    btnProcess.Enabled = false;
                                                    btnProcess.Visible = false;
                                                    btnCheckProcess.Visible = false;
                                                    btnCheckProcess.Enabled = false;
                                                }
                                                else
                                                {
                                                    btnProcess.Enabled = true;
                                                    btnProcess.Visible = true;
                                                    btnCheckProcess.Visible = false;
                                                    btnCheckProcess.Enabled = false;
                                                }
                                            }
                                            else
                                            {
                                                btnProcess.Enabled = true;
                                                btnProcess.Visible = true;
                                                btnCheckProcess.Visible = false;
                                                btnCheckProcess.Enabled = false;
                                            }
                                        }
                                        else
                                        {
                                            btnProcess.Enabled = false;
                                            btnProcess.Visible = false;
                                            if (Convert.ToInt32(GetDealerData.Tables[0].Rows[0]["pmntType"].ToString()) == 5)
                                            {
                                                if (GetDealerData.Tables[0].Rows[0]["Amount"].ToString() != "")
                                                {
                                                    Double TotalAmount1 = Convert.ToDouble(GetDealerData.Tables[0].Rows[0]["Amount"].ToString());
                                                    string ChkAmount = string.Format("{0:0.00}", TotalAmount1);
                                                    if (ChkAmount == "0.00")
                                                    {
                                                        btnCheckProcess.Visible = false;
                                                        btnCheckProcess.Enabled = false;
                                                    }
                                                    else
                                                    {
                                                        btnCheckProcess.Visible = true;
                                                        btnCheckProcess.Enabled = true;
                                                    }
                                                }
                                                else
                                                {
                                                    btnCheckProcess.Visible = true;
                                                    btnCheckProcess.Enabled = true;
                                                }
                                            }
                                            else
                                            {
                                                btnCheckProcess.Visible = false;
                                                btnCheckProcess.Enabled = false;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        btnProcess.Enabled = false;
                                        btnProcess.Visible = false;
                                        btnCheckProcess.Visible = false;
                                        btnCheckProcess.Enabled = false;
                                    }
                                    ddlPmntStatus.Visible = true;
                                    btnPmntUpdate.Visible = true;
                                }

                            }
                            else if (GetDealerData.Tables[0].Rows[0]["QCStatusID"].ToString() == "2")
                            {
                                lblQCStatus.Text = "QC Reject";
                                btnProcess.Enabled = false;
                                btnProcess.Visible = false;
                                btnMovedToSmartz.Visible = false;
                            }
                            else if (GetDealerData.Tables[0].Rows[0]["QCStatusID"].ToString() == "4")
                            {
                                lblQCStatus.Text = "QC Returned";
                                btnProcess.Enabled = false;
                                btnProcess.Visible = false;
                                btnMovedToSmartz.Visible = false;
                            }
                            else if (GetDealerData.Tables[0].Rows[0]["QCStatusID"].ToString() == "3")
                            {
                                lblQCStatus.Text = "QC Pending";
                                btnProcess.Enabled = false;
                                btnProcess.Visible = false;
                                btnMovedToSmartz.Visible = false;
                            }
                            else
                            {
                                lblQCStatus.Text = "QC Open";
                                btnProcess.Enabled = false;
                                btnProcess.Visible = false;
                                btnMovedToSmartz.Visible = false;
                            }
                            if (GetDealerData.Tables[1].Rows.Count > 0)
                            {
                                for (int i = 0; i < GetDealerData.Tables[1].Rows.Count; i++)
                                {
                                    if (GetDealerData.Tables[1].Rows[i]["ProductOptionName"].ToString() == "Website")
                                    {
                                        if (GetDealerData.Tables[1].Rows[i]["ProductOptionStatus"].ToString() == "True")
                                        {
                                            rdbtnWebsiteYes.Checked = true;
                                        }
                                        else
                                        {
                                            rdbtnWebsiteNo.Checked = true;
                                        }
                                        txtPreferredAddress.Text = GetDealerData.Tables[1].Rows[i]["ProductOptionNotes"].ToString();
                                    }
                                    else if (GetDealerData.Tables[1].Rows[i]["ProductOptionName"].ToString() == "Cars promotion")
                                    {
                                        if (GetDealerData.Tables[1].Rows[i]["ProductOptionStatus"].ToString() == "True")
                                        {
                                            rdbtnCarsPromotionYes.Checked = true;
                                        }
                                        else
                                        {
                                            rdbtnCarsPromotionNo.Checked = true;
                                        }
                                        txtGetCarsFrom.Text = GetDealerData.Tables[1].Rows[i]["ProductOptionNotes"].ToString();
                                    }
                                    else if (GetDealerData.Tables[1].Rows[i]["ProductOptionName"].ToString() == "Leads")
                                    {
                                        if (GetDealerData.Tables[1].Rows[i]["ProductOptionStatus"].ToString() == "True")
                                        {
                                            rdbtnLeadsYes.Checked = true;
                                        }
                                        else
                                        {
                                            rdbtnLeadsNo.Checked = true;
                                        }
                                        txtLeadsToSend.Text = GetDealerData.Tables[1].Rows[i]["ProductOptionNotes"].ToString();
                                    }
                                    else if (GetDealerData.Tables[1].Rows[i]["ProductOptionName"].ToString() == "Other")
                                    {
                                        if (GetDealerData.Tables[1].Rows[i]["ProductOptionStatus"].ToString() == "True")
                                        {
                                            rdbtnOthersYes.Checked = true;
                                        }
                                        else
                                        {
                                            rdbtnOthersNo.Checked = true;
                                        }
                                        txtOthersNotes.Text = GetDealerData.Tables[1].Rows[i]["ProductOptionNotes"].ToString();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }