//string ImageServerURL = ConfigurationSettings.AppSettings["ImageServerURL"];
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (null != Request.QueryString["siteid"])
                {
                    siteid = Convert.ToInt32(Request.QueryString["siteid"].ToString());
                    Session["signup_siteid"] = siteid;
                }

                if (null != Request.QueryString["userid"])
                {
                    userid = Convert.ToInt32(Request.QueryString["userid"].ToString());
                }
                if (null != Request.QueryString["networkid"])
                {
                    networkid = Request.QueryString["networkid"].ToString();
                    Session["signup_networkid"] = networkid;
                }
                if (null != Request.QueryString["templateid"])
                {
                    templateid = Request.QueryString["templateid"].ToString();
                    //idserver_templateid.Value = templateid;
                    Session.Add("signup_templateid", templateid);
                }
                if (null != Session["signup_templateid"])
                {
                    templateid = Session["signup_templateid"].ToString();
                }

                idserver_templateid.Value = templateid;

                ConfigurationSettings.AppSettings["connString"] = Function.GetnetworkConnectionstring(Request.QueryString["networkid"]);

                dir = Server.MapPath(string.Format("{0}/", "signup")); //BLL.Constants.SaveImagePathSignUp;
                CommonLib.CurrentPage.LinkCSS("http://www.developersllc.com/signup/css/style.css");
                CommonLib.CurrentPage.IncludeScript("http://www.developersllc.com/signup/js/jquery-1.4.4.min.js");

                if (IsPostBack && !string.IsNullOrEmpty(txtgettysearch.Text.ToString()))
                {
                    string systemid       = ConfigurationManager.AppSettings["systemId"];
                    string systemPassword = ConfigurationManager.AppSettings["syspassword"];
                    string gettyuserid    = ConfigurationManager.AppSettings["Username"];
                    string userPassword   = ConfigurationManager.AppSettings["Password"];
                    string imgListCount   = ConfigurationManager.AppSettings["Imagedisplaycount"];
                    string searchterm     = string.Empty;
                    string searchmode     = "horizontal";
                    int    startindex     = 1;
                    try
                    {
                        searchterm = txtgettysearch.Text.ToString();
                        if (rdlandscape.Checked == true)
                        {
                            searchmode = "horizontal";
                        }
                        if (rdportrait.Checked == true)
                        {
                            searchmode = "verticle";
                        }

                        //ltgettyimages.Text = BindImagesData(searchterm, searchmode);
                    }
                    catch (Exception ex)
                    {
                    }
                }
                if (IsPostBack && FileUpload1.PostedFile != null)
                {
                    string FName = Path.GetFileName(FileUpload1.PostedFile.FileName);
                    FName = FName.Replace(' ', '_');
                    FName = CommonLib.FileHandler.GetUniqueFileName(dir, FName);

                    string imgExt = Path.GetExtension(FName);


                    if (imgExt != string.Empty && (imgExt.ToLower() == ".jpg" || imgExt.ToLower() == ".jpeg" || imgExt.ToLower() == ".gif" || imgExt.ToLower() == ".png"))
                    {
                        imageName = DateTime.Now.ToString("yyyyMMddHHmmss") + imgExt;
                    }
                    else
                    {
                        imageName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg";
                    }
                    imgserver = true;
                    img1      = imageName;

                    modifieddate = DateTime.Now.ToString("yyyy/MM/dd");
                    ValidateSiteFolder(sitefldname);
                    CreateImagesFolderInBackend(sitefldname, Convert.ToDateTime(modifieddate).ToString("yyyyMM"), Convert.ToDateTime(modifieddate).ToString("MMMdd"));
                    dir        = string.Format(dir + "{2}/{0}/{1}/", Convert.ToDateTime(modifieddate).ToString("yyyyMM"), Convert.ToDateTime(modifieddate).ToString("MMMdd"), sitefldname);
                    _imagepath = Server.MapPath(string.Format("{0}/{1}/{2}/", sitefldname, monthyearfolder, dayfolder));
                    using (FileStream fs = File.Create(_imagepath + imageName))
                    {
                        SaveFile(FileUpload1.PostedFile.InputStream, fs, imageName);
                        returnimagename     = Function.SaveThumbnailCompress(imageName, _imagepath, "TN", 300, 170);
                        returnimagename_big = Function.SaveThumbnailCompress(imageName, _imagepath, "TN_TN", 600, 340);

                        if (templateid == "1")
                        {
                            returnimagepath = string.Format("{0}{1}/{2}/{3}/{4}", _imgserver, sitefldname, monthyearfolder, dayfolder, returnimagename);
                        }
                        else
                        {
                            returnimagepath = string.Format("{0}{1}/{2}/{3}/{4}", _imgserver, sitefldname, monthyearfolder, dayfolder, returnimagename_big);
                        }
                    }
                    if (!string.IsNullOrEmpty(returnimagepath))
                    {
                        using (Signup objsignup = new Signup())
                        {
                            objsignup.SiteID    = Convert.ToInt32(siteid);
                            objsignup.NetworkID = networkid;
                            if (!string.IsNullOrEmpty(txttitle.Text))
                            {
                                objsignup.ImageTitle = txttitle.Text;
                            }
                            else
                            {
                                objsignup.ImageTitle = imageName;
                            }
                            objsignup.ImageAlttext = txtalttext.Text;
                            objsignup.ImageName    = "TN" + imageName;
                            objsignup.ImageDate    = monthyearfolder + "/" + dayfolder + "/";
                            objsignup.AddedBy      = Convert.ToInt32(userid);
                            objsignup.ImageID      = Convert.ToInt32(idserver_image.Value);
                            if (objsignup.ImageID == 0)
                            {
                                imageid = objsignup.AddImageDetails();
                            }

                            /* else
                             *   objsignup.UpdateImageDetails();*/

                            ltsignupimages.Text = LoadAllImages();
                            CommonLib.JavaScriptHandler.RegisterScriptForSM("ShowLoading('N');", true);
                        }
                    }
                }
                else
                {
                    ltsignupimages.Text = LoadAllImages();
                }
            }
            catch (Exception ex)
            {
                CommonLib.ExceptionHandler.WriteLog(CommonLib.Sections.Client, "gettyclasses signup uploadimageintemplate pageload", ex);
            }
        }