private void LoadSagePage()
 {
     SageBannerController obj = new SageBannerController();
     ddlPagesLoad.DataSource = obj.GetAllPagesOfSageFrame(GetPortalID); ;
     ddlPagesLoad.DataTextField = "PageName";
     ddlPagesLoad.DataValueField = "TabPath";
     ddlPagesLoad.DataBind();
 }
 private void LoadDropDownBanner(int UserModuleID, int PortalID)
 {
     try
     {
         SageBannerController obj=new SageBannerController();
         ddlBannerListToUse.DataSource = obj.LoadBannerOnDropDown(UserModuleID, PortalID,GetCurrentCulture());
         ddlBannerListToUse.DataValueField = "BannerID";
         ddlBannerListToUse.DataTextField = "BannerName";
         ddlBannerListToUse.DataBind();
         ddlBannerListToUse.Items.Insert(0, new ListItem("ChooseBanner", "-1"));
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
 public void LoadBannerListOnGrid(int PortalID, int UserModuleID, string CultureCode)
 {
     SageBannerController obj = new SageBannerController();
     List<SageBannerInfo> bannerInfo = obj.LoadBannerListOnGrid(PortalID, UserModuleID, CultureCode);
     gdvBannerList.DataSource = bannerInfo;
     gdvBannerList.DataBind();
 }
 public void LoadHTMLContentOnGrid(int BannerID)
 {
     SageBannerController obj = new SageBannerController();
     List<SageBannerInfo> info = obj.LoadHTMLContentOnGrid(BannerID, Int32.Parse(SageUserModuleID), GetPortalID, GetCurrentCulture());
     gdvHTMLContent.DataSource = info;
     gdvHTMLContent.DataBind();
 }
 private string GetFileName(int ImageID)
 {
     SageBannerController OBJC = new SageBannerController();
     return OBJC.GetFileName(ImageID);
 }
 private void DeleteBannerContentByID(int ImageId)
 {
     string ImageName = GetFileName(ImageId);
     if (ImageName != string.Empty)
     {
         DeleteImageFromFolder(ImageName);
     }
     SageBannerController obDel = new SageBannerController();
     obDel.DeleteBannerContentByID(ImageId);
     int BannerId = Convert.ToInt32(ViewState["EditBannerID"]);
     LoadBannerImagesOnGrid(BannerId, Int32.Parse(SageUserModuleID), GetPortalID);
     ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Sage_Banner/ModuleLocalText", "BannerImageDeletedsuccesfully"), "", SageMessageType.Success);
 }
 public SageBannerSettingInfo GetSageBannerSetting(int PortalID, int UserModuleID, string CultureCode)
 {
     try
     {
         SageBannerController objC = new SageBannerController();
         return objC.GetSageBannerSettingList(PortalID, UserModuleID,CultureCode);
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
    public void GetBannerImages(int BannerID, int UserModuleID, int PortalID, string CultureCode)
    {
        try
        {
            List<SageBannerInfo> objSageBannerLst = new List<SageBannerInfo>();
            SageBannerController obj = new SageBannerController();
            objSageBannerLst = obj.GetBannerImages(BannerID, UserModuleID, PortalID, CultureCode);
            StringBuilder elem = new StringBuilder();
            elem.Append("<ul id=\"sfSlider\">");
            if (objSageBannerLst.Count > 0)
            {
                foreach (SageBannerInfo banner in objSageBannerLst)
                {
                    if (banner.ImagePath.Length == 0)
                    {
                        elem.Append("<li>");
                        elem.Append(banner.HTMLBodyText);
                        elem.Append("</li>");
                    }
                    else
                    {
                        string target = "#";
                        string readmoreLink = "#";
                        if (banner.LinkToImage != string.Empty)
                        {
                            readmoreLink = banner.LinkToImage;
                            target = "_blank";
                        }
                        else if (banner.ReadMorePage != string.Empty)
                        {
                            readmoreLink = Fullpath + banner.ReadMorePage + Extension;
                        }
                        else
                        {
                            readmoreLink = Fullpath + banner.ReadMorePage + Extension;
                        }
                        elem.Append("<li style=\"position:relative; display:none;\">");
                        elem.Append("<div class='bannerImageWrapper'>");
                        elem.Append("<div class='sfImageholder'>");

                        //Responsive Images

                        elem.Append("<div data-alt=\"SageFrame Banner Images\" data-picture=\"\">");

                        elem.Append("<div data-media=\"(min-width: 0px)\" data-src=");
                        elem.Append(ResolveUrl(modulePath));
                        elem.Append("images/ThumbNail/Small/");
                        elem.Append(banner.ImagePath);
                        elem.Append("></div>");

                        elem.Append("<div data-media=\"(min-width: 320px)\" data-src=");
                        elem.Append(ResolveUrl(modulePath));
                        elem.Append("images/ThumbNail/Medium/");
                        elem.Append(banner.ImagePath);
                        elem.Append("></div>");

                        elem.Append("<div data-media=\"(min-width: 768px)\" data-src=");
                        elem.Append(ResolveUrl(modulePath));
                        elem.Append("images/ThumbNail/Large/");
                        elem.Append(banner.ImagePath);
                        elem.Append("></div>");

                        elem.Append("<div data-media=\"(min-width: 960px)\" data-src=");
                        elem.Append(ResolveUrl(modulePath));
                        elem.Append("images/ThumbNail/Default/");
                        elem.Append(banner.ImagePath);
                        elem.Append("></div>");

                        //elem.Append("<noscript><img alt=\"Sageframe Bannner Images\" src=\"");
                        //elem.Append(ResolveUrl(modulePath));
                        //elem.Append("images/ThumbNail/Default/");
                        //elem.Append(banner.ImagePath);
                        //elem.Append("/></noscript>");
                        elem.Append("</div>");
                        elem.Append("</div>");
                        SEOHelper seoHelper = new SEOHelper();
                        string unwantedTag = seoHelper.RemoveUnwantedHTMLTAG(banner.Description);
                        if (banner.Description != null && banner.Description.Trim() != string.Empty && banner.Description.Trim() != "" && unwantedTag.Trim().Length > 0)
                        {
                            elem.Append("<div  class='sfBannerDesc'><p>");
                            elem.Append(banner.Description + "</p>");
                            elem.Append("<a target=\" " + target + " \" class='sfReadmore' href=\"");
                            elem.Append(readmoreLink);
                            elem.Append("\">");
                            elem.Append("<span>");
                            elem.Append(banner.ReadButtonText);
                            elem.Append("</span></a></div></div></li>");
                        }
                        else
                        {
                            elem.Append("</li>");
                        }
                    }
                }
                bannerCount++;
            }
            else
            {
                bannerCount = 0;
                elem.Append("No Banner To Display");
            }
            elem.Append("</ul>");
            sageSlider.Text = elem.ToString();
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
 public void DeleteHTMLContentByID(int ImageId)
 {
     SageBannerController objDel = new SageBannerController();
     objDel.DeleteHTMLContentByID(ImageId);
     LoadHTMLContentOnGrid(Convert.ToInt32(ViewState["EditBannerID"]));
     BannerCacheClear();
 }
    public void LoadBannerImagesOnGrid(int BannerID, int UserModuleID, int PortalID)
    {
        SageBannerController obj = new SageBannerController();
        gdvBannerImages.DataSource = obj.LoadBannerImagesOnGrid(BannerID, UserModuleID, PortalID, GetCurrentCulture());
        gdvBannerImages.DataBind();
        if (gdvBannerImages.Rows.Count > 0)
        {
            if (gdvBannerImages.PageIndex == 0)
            {
                gdvBannerImages.Rows[0].FindControl("imgListUp").Visible = false;

            }
            if (gdvBannerImages.PageIndex == (gdvBannerImages.PageCount - 1))
            {
                gdvBannerImages.Rows[gdvBannerImages.Rows.Count - 1].FindControl("imgListDown").Visible = false;
            }
        }
    }
    protected void imbSaveEditorContent_Click(object sender, EventArgs e)
    {
        bool isNotEmpty = true;
        string target = Server.MapPath("~/Modules/Sage_Banner/images");
        string thumbTarget = Server.MapPath("~/Modules/Sage_Banner/images/ThumbNail");
        //System.Drawing.Image.GetThumbnailImageAbort thumbnailImageAbortDelegate = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
        if (fluBannerNavigationImage.HasFile)
        {
            isNotEmpty = false;
            fluBannerNavigationImage.SaveAs(System.IO.Path.Combine(target, fluBannerNavigationImage.FileName.Replace(" ", "_")));
            AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
            aspxCommonObj.StoreID = GetStoreID;
            aspxCommonObj.PortalID = GetPortalID;
            aspxCommonObj.CultureName = GetCurrentCultureName;
            InterceptImageController.copyOriginalImageToRespectives(new ImageResizer.ResizeSettings(80, 80, ImageResizer.FitMode.Carve, "jpg"), Path.Combine(target, fluBannerNavigationImage.PostedFile.FileName), Path.Combine(thumbTarget, fluBannerNavigationImage.FileName), aspxCommonObj,IsWaterMark.False);
           
        }
        int ImageID;
        int Bannerid = Convert.ToInt32(ViewState["EditBannerID"]);
        string NavImagepath = "";
        if (Session["EditHTMLContentID"] != null && Session["EditHTMLContentID"].ToString() != string.Empty)
        {
            isNotEmpty = false;
            ImageID = Int32.Parse(Session["EditHTMLContentID"].ToString());
            NavImagepath = Convert.ToString(Session["NavigationImage"]);
        }
        else
        {
            ImageID = 0;
            NavImagepath = Convert.ToString(fluBannerNavigationImage.FileName.Replace(" ", "_"));
        }
        try
        {
            ArrayList arrColl = null;
            arrColl = IsContentValid(txtBody.Text.ToString());
            if (arrColl.Count > 0 && arrColl[0].ToString().ToLower().Trim() == "true")
            {
                isNotEmpty = false;
                string HTMLBodyText = arrColl[1].ToString().Trim();
                SageBannerController objController = new SageBannerController();
                objController.SaveHTMLContent(NavImagepath, HTMLBodyText, Bannerid, UserModuleId, ImageID, GetPortalID, GetCurrentCulture());
            }
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
        if (isNotEmpty)
        {
            ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Sage_Banner/ModuleLocalText", "NoBannerContent"), "", SageMessageType.Error);
        }
        else
        {

            ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Sage_Banner/ModuleLocalText", "BannerHTMLContentSavedSuccessfully"), "", SageMessageType.Success);
            txtBody.Text = string.Empty;
            Session["EditHTMLContentID"] = null;
            Session["NavigationImage"] = null;
            LoadHTMLContentOnGrid(Bannerid);
            BannerCacheClear();
            divHtmlBannerContainer.Attributes.Add("style", "display:block");
            divEditWrapper.Attributes.Add("style", "display:none");
        }
    }
    private void SaveBannerInformation()
    {
        try
        {
            SageBannerInfo obj = new SageBannerInfo();
            obj.BannerName = txtBannerName.Text.Trim();
            obj.BannerDescription = txtBannerDescription.Text;
            obj.UserModuleID = Int32.Parse(SageUserModuleID);
            obj.PortalID = GetPortalID;
            obj.CultureCode = GetCurrentCulture();
            SageBannerController objBcon = new SageBannerController();
            objBcon.SaveBannerInformation(obj);
            LoadBannerListOnGrid(GetPortalID, Int32.Parse(SageUserModuleID), GetCurrentCulture());
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }

    }
 protected void imbSaveBanner_Click(object sender, EventArgs e)
 {
     List<string> arrBanner = new List<string>();
     SageBannerController obj = new SageBannerController();
     List<SageBannerInfo> bannerInfo = obj.LoadBannerListOnGrid(GetPortalID, UserModuleId, GetCurrentCulture());
     if (bannerInfo != null)
     {
         foreach (SageBannerInfo list in bannerInfo)
         {
             if (!arrBanner.Contains(list.BannerName))
             {
                 arrBanner.Add(list.BannerName.ToLower());
             }
         }
     }
     if (arrBanner.Contains(txtBannerName.Text.Trim().ToLower()))
     {
         ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Sage_Banner/ModuleLocalText", "DuplicateName"), "", SageMessageType.Error);
     }
     else
     {
         SaveBannerInformation();
         BannerCacheClear();
         UserControl uc1 = (UserControl)this.FindControl("TabContainerManagePages");
         ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Sage_Banner/ModuleLocalText", "BannerAddedSucessfully"), "", SageMessageType.Success);
     }
     pnlBannercontainer.Attributes.Add("style", "display:none");
     pnlBannerList.Attributes.Add("style", "display:block");
     txtBannerName.Text = "";
 }
    private void SaveBannerContent(int BannerId, int ImageId)
    {
        try
        {
            string fName = fuFileUpload.FileName;
            if (SageFrame.Web.PictureManager.ValidImageExtension(fName))
            {

                //bool isEdit = false;
                SageBannerInfo obj = new SageBannerInfo();
                if (Session["EditImageID"] != null && Session["EditImageID"].ToString() != string.Empty)
                {
                    obj.ImageID = Int32.Parse(Session["EditImageID"].ToString());
                    if (fuFileUpload.HasFile)
                    {
                        obj.ImagePath = fuFileUpload.PostedFile.FileName.Replace(" ", "_");
                        obj.NavigationImage = fuFileUpload.PostedFile.FileName.Replace(" ", "_");
                    }
                    else
                    {
                       // isEdit = true;
                        obj.ImagePath = Convert.ToString(Session["ImageName"]);
                        obj.NavigationImage = Convert.ToString(Session["ImageName"]);
                    }
                }
                else
                {
                    obj.ImageID = 0;
                    obj.ImagePath = fuFileUpload.FileName.Replace(" ", "_");
                    obj.NavigationImage = fuFileUpload.FileName.Replace(" ", "_");
                }
                obj.Caption = string.Empty;
                if (rdbReadMorePageType.SelectedItem.Text == "Page")
                {
                    obj.ReadMorePage = ddlPagesLoad.SelectedValue.ToString();
                    obj.LinkToImage = string.Empty;
                }
                if (rdbReadMorePageType.SelectedItem.Text == "Web Url")
                {
                    obj.LinkToImage = txtWebUrl.Text;
                    obj.ReadMorePage = string.Empty;
                }
                obj.UserModuleID = Int32.Parse(SageUserModuleID);
                obj.BannerID = BannerId;
                obj.ImageID = ImageId;
                obj.ReadButtonText = txtReadButtonText.Text;
                obj.Description = txtBannerDescriptionToBeShown.Text.Trim();
                obj.PortalID = GetPortalID;
                obj.CultureCode = GetCurrentCulture();
                string swfExt = System.IO.Path.GetExtension(fuFileUpload.PostedFile.FileName);
                if (swfExt == ".swf")
                {
                    if (fuFileUpload.FileContent.Length > 0)
                    {
                        string Path = GetUplaodImagePhysicalPath();
                        string fileName = fuFileUpload.PostedFile.FileName.Replace(" ", "_");
                        DirectoryInfo dirUploadImage = new DirectoryInfo(Path);
                        if (dirUploadImage.Exists == false)
                        {
                            dirUploadImage.Create();
                        }
                        string fileUrl = Path + fileName;
                        int i = 1;
                        while (File.Exists(fileUrl))
                        {

                            fileName = i + fileName;
                            fileUrl = Path + i + fileName;
                            i++;
                        }
                        fuFileUpload.PostedFile.SaveAs(fileUrl);
                        swfFileName = "Modules/Sage_Banner/images/" + fileName;
                        obj.ImagePath = fileName;
                        obj.NavigationImage = fileName;
                    }
                }
                else
                {
                    string target = Server.MapPath("~/Modules/Sage_Banner/images/OriginalImage/");
                    string thumbLarge = Server.MapPath("~/Modules/Sage_Banner/images/ThumbNail/Large/");
                    string thumbMedium = Server.MapPath("~/Modules/Sage_Banner/images/ThumbNail/Medium/");
                    string thumbSmall = Server.MapPath("~/Modules/Sage_Banner/images/ThumbNail/Small/");
                    string defaultImage = Server.MapPath("~/Modules/Sage_Banner/images/ThumbNail/Default/");
                    //System.Drawing.Image.GetThumbnailImageAbort thumbnailImageAbortDelegate = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
                    if (fuFileUpload.HasFile)
                    {
                        string fileName = fuFileUpload.PostedFile.FileName.Replace(" ", "_");
                        int i = 1;
                        while (File.Exists(target + "/" + fileName))
                        {
                            fileName = i + fileName;
                            i++;
                        }
                        fuFileUpload.SaveAs(Path.Combine(target, fileName));
                        fuFileUpload.SaveAs(Path.Combine(defaultImage, fileName));
                        string SourcePath = target + fileName;
                         //Resize Banner Images using Image Resizer
                        InterceptImageController.ResizeBannerImage(SourcePath, 320, thumbSmall, fileName);
                        InterceptImageController.ResizeBannerImage(SourcePath, 768, thumbMedium, fileName);
                        InterceptImageController.ResizeBannerImage(SourcePath, 965, thumbLarge, fileName);
                        obj.ImagePath = fileName;
                        obj.NavigationImage = fileName;
                    }
                }
                SageBannerController objcont = new SageBannerController();
                objcont.SaveBannerContent(obj);
                int userModuleID = Int32.Parse(SageUserModuleID);
                BannerCacheClear();
                ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Sage_Banner/ModuleLocalText", "BannerSavedsuccesfully"), "", SageMessageType.Success);
            }
            else
            {
                ShowMessage("Invalid File Extension", "Invalid File Extension", "The File you want to upload is invalid", SageMessageType.Error);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        
        Session["ImageName"] = null;
        Session["EditImageID"] = null;
    }
 protected void gdvBannerImages_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         int ImageId = Int32.Parse(e.CommandArgument.ToString());
         BannerId = int.Parse(ViewState["EditBannerID"].ToString());
         switch (e.CommandName.ToString())
         {
             case "Edit":
                 BannerEditByImageID(ImageId);
                 break;
             case "Delete":
                 DeleteBannerContentByID(ImageId);
                 break;
             case "Editimage":
                 divImageEditor.Attributes.Add("style", "display:block");
                 pnlBannercontainer.Attributes.Add("style", "display:none");
                 EditImageByImageID(ImageId);
                 break;
             case "SortUp":
                 SageBannerController obj = new SageBannerController();
                 obj.SortImageList(ImageId, true);
                 LoadBannerImagesOnGrid(BannerId, Int32.Parse(SageUserModuleID), GetPortalID);
                 ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("Banner", "TheBannerContentIsShiftedUpSuccessfully"), "", SageMessageType.Success);
                 break;
             case "SortDown":
                 SageBannerController objc = new SageBannerController();
                 objc.SortImageList(ImageId, false);
                 LoadBannerImagesOnGrid(BannerId, Int32.Parse(SageUserModuleID), GetPortalID);
                 ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("Banner", "TheBannerContentIsShiftedDownSuccessfully"), "", SageMessageType.Success);
                 break;
         }
         BannerCacheClear();
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
 public void DeleteBannerAndItsContentByBannerID(int BannerID)
 {
     SageBannerController objDelBanner = new SageBannerController();
     objDelBanner.DeleteBannerAndItsContentByBannerID(BannerID);
 }
 private void EditImageByImageID(int ImageId)
 {
     SageBannerInfo obj = new SageBannerInfo();
     SageBannerController objcnt = new SageBannerController();
     obj = objcnt.GetImageInformationByID(ImageId);
     _imageEditor.ImageUrl = modulePath + "images/OriginalImage/" + obj.ImagePath;
     divImageEditor.Attributes.Add("style", "display:block");
     ViewState["ImageToBeEdit"] = obj.ImagePath;
 }
 private void EditHTMLContentByID(int ImageId)
 {
     try
     {
         imgEditNavImage.Visible = true;
         SageBannerInfo objEHtmlContent = new SageBannerInfo();
         SageBannerController objHTMl = new SageBannerController();
         objEHtmlContent = objHTMl.GetHTMLContentForEditByID(ImageId);
         txtBody.Text = objEHtmlContent.HTMLBodyText;
         imgEditNavImage.ImageUrl = modulePath + "images/ThumbNail/" + objEHtmlContent.NavigationImage;
         Session["NavigationImage"] = objEHtmlContent.NavigationImage;
         divHtmlBannerContainer.Attributes.Add("style", "display:none");
         divEditWrapper.Attributes.Add("style", "display:block");
         int BannerId = Convert.ToInt32(ViewState["EditBannerID"]);
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
 private void BannerEditByImageID(int ImageId)
 {
     int BannerId = Convert.ToInt32(ViewState["EditBannerID"]);
     SageBannerInfo objEd = new SageBannerInfo();
     SageBannerController objEc = new SageBannerController();
     objEd = objEc.GetImageInformationByID(ImageId);
     txtCaption.Text = objEd.Caption;
     if (objEd.LinkToImage != null && objEd.LinkToImage != string.Empty)
     {
         rdbReadMorePageType.SelectedValue = "1";
         txtWebUrl.Text = objEd.LinkToImage;
         WebUrl = 1;
     }
     else if (objEd.ReadMorePage != null)
     {
         ddlPagesLoad.SelectedIndex = ddlPagesLoad.Items.IndexOf(ddlPagesLoad.Items.FindByValue(objEd.ReadMorePage));
         WebUrl = 0;
     }
     txtReadButtonText.Text = objEd.ReadButtonText;
     Session["ImageName"] = objEd.ImagePath;
     imgEditBannerImageImage.ImageUrl = modulePath + "images/Thumbnail/Large/" + objEd.ImagePath;
     txtBannerDescriptionToBeShown.Text = objEd.Description;
     imgEditBannerImageImage.Visible = true;
     divbannerImageContainer.Attributes.Add("style", "display:none");
     divEditBannerImage.Attributes.Add("style", "display:block");
     LoadBannerImagesOnGrid(BannerId, Int32.Parse(SageUserModuleID), GetPortalID);
     Session["EditImageID"] = ImageId;
 }
Esempio n. 20
0
 public SageBannerSettingInfo GetSageBannerSettingList(int PortalID, int UserModuleID)
 {
     try
     {
         SageBannerController objc = new SageBannerController();
         return objc.GetSageBannerSettingList(PortalID, UserModuleID);
     }
     catch(Exception ex)
     {
         throw ex;
     }
   
 }
    private void SaveBannerContent(int BannerId, int ImageId)
    {
        try
        {
            bool isEdit = false;
            SageBannerInfo obj = new SageBannerInfo();
            if (Session["EditImageID"] != null && Session["EditImageID"].ToString() != string.Empty)
            {
                obj.ImageID = Int32.Parse(Session["EditImageID"].ToString());
                if (fuFileUpload.HasFile)
                {
                    obj.ImagePath = fuFileUpload.PostedFile.FileName.Replace(" ", "_");
                    obj.NavigationImage = fuFileUpload.PostedFile.FileName.Replace(" ", "_");
                }
                else
                {
                    isEdit = true;
                    obj.ImagePath = Convert.ToString(Session["ImageName"]);
                    obj.NavigationImage = Convert.ToString(Session["ImageName"]);
                }
            }
            else
            {
                obj.ImageID = 0;
                obj.ImagePath = fuFileUpload.FileName.Replace(" ", "_");
                obj.NavigationImage = fuFileUpload.FileName.Replace(" ", "_");
            }
            obj.Caption = string.Empty;
            if (rdbReadMorePageType.SelectedItem.Text == "Page")
            {
                obj.ReadMorePage = ddlPagesLoad.SelectedValue.ToString();
                obj.LinkToImage = string.Empty;
            }
            if (rdbReadMorePageType.SelectedItem.Text == "Web Url")
            {
                obj.LinkToImage = txtWebUrl.Text;
                obj.ReadMorePage = string.Empty;
            }
            obj.UserModuleID = Int32.Parse(SageUserModuleID);
            obj.BannerID = BannerId;
            obj.ImageID = ImageId;
            obj.ReadButtonText = txtReadButtonText.Text;
            obj.Description = txtBannerDescriptionToBeShown.Text.Trim();
            obj.PortalID = GetPortalID;
            obj.CultureCode = GetCurrentCulture();
            string swfExt = System.IO.Path.GetExtension(fuFileUpload.PostedFile.FileName);
            if (swfExt == ".swf")
            {
                if (fuFileUpload.FileContent.Length > 0)
                {
                    string Path = GetUplaodImagePhysicalPath();
                    string fileName = fuFileUpload.PostedFile.FileName.Replace(" ", "_");
                    DirectoryInfo dirUploadImage = new DirectoryInfo(Path);
                    if (dirUploadImage.Exists == false)
                    {
                        dirUploadImage.Create();
                    }
                    string fileUrl = Path + fileName;
                    int i = 1;
                    while (File.Exists(fileUrl))
                    {

                        fileName = i + fileName;
                        fileUrl = Path + i + fileName;
                        i++;
                    }
                    fuFileUpload.PostedFile.SaveAs(fileUrl);
                    swfFileName = "Modules/Sage_Banner/images/" + fileName;
                    obj.ImagePath = fileName;
                    obj.NavigationImage = fileName;
                }
            }
            else
            {
                string target = Server.MapPath("~/Modules/Sage_Banner/images/OriginalImage");
                string CropImageTarget = Server.MapPath("~/Modules/Sage_banner/images/CroppedImages");
                string thumbTarget = Server.MapPath("~/Modules/Sage_Banner/images/ThumbNail");
                System.Drawing.Image.GetThumbnailImageAbort thumbnailImageAbortDelegate = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
                if (fuFileUpload.HasFile)
                {
                    string fileName = fuFileUpload.PostedFile.FileName.Replace(" ", "_");
                    int i = 1;
                    while (File.Exists(target + "/" + fileName))
                    {
                        fileName = i + fileName;
                        i++;
                    }
                    fuFileUpload.SaveAs(Path.Combine(target, fileName));
                    fuFileUpload.SaveAs(Path.Combine(CropImageTarget, fileName));
                    using (Bitmap originalImage = new Bitmap(fuFileUpload.PostedFile.InputStream))
                    {
                        using (System.Drawing.Image thumbnail = originalImage.GetThumbnailImage(80, 80, thumbnailImageAbortDelegate, IntPtr.Zero))
                        {
                            thumbnail.Save(Path.Combine(thumbTarget, fileName));
                        }
                    }
                    obj.ImagePath = fileName;
                    obj.NavigationImage = fileName;
                }
            }

            SageBannerController objcont = new SageBannerController();
            objcont.SaveBannerContent(obj);
            int userModuleID = Int32.Parse(SageUserModuleID);
            BannerCacheClear();
        }
        catch (Exception ex)
        {
            throw ex;
        }
        ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Sage_Banner/ModuleLocalText", "BannerSavedsuccesfully"), "", SageMessageType.Success);
        Session["ImageName"] = null;
        Session["EditImageID"] = null;
    }