private void AddUpdateRecord()
    {
        string imagefile          = string.Empty;
        TestimonialController clt = new TestimonialController();
        TestimonialInfo       obj = new TestimonialInfo();

        if (Session["TestimonialID"] != null && Session["TestimonialID"].ToString() != string.Empty)
        {
            obj.TestimonialID = Int32.Parse(Session["TestimonialID"].ToString());
        }
        else
        {
            obj.TestimonialID = 0;
        }

        obj.PortalID        = GetPortalID;
        obj.UserModuleID    = int.Parse(SageUserModuleID);
        obj.UserName        = txtName.Text;
        obj.Address         = txtAddress.Text;
        obj.WebUrl          = txtWeburl.Text;
        obj.Title           = txtTitle.Text;
        obj.Testimonial     = txtTestimonial.Value;
        obj.AddedBy         = GetUsername;
        obj.TestimonialDate = DateTime.Parse(txtDate.Text);
        string TargetFolder = Server.MapPath(basePath + "image/UploadedImages");

        if (!Directory.Exists(TargetFolder))
        {
            Directory.CreateDirectory(TargetFolder);
        }

        imagefile = ProfileImage.FileName.Replace(" ", "_");

        if (Session["Image"] == null && imagefile == "")
        {
            obj.Image = "";
        }
        else if (imagefile == "" && Session["Image"] != null)
        {
            obj.Image = Session["Image"].ToString();
        }
        else
        {
            if (ProfileImage.HasFile)
            {
                System.Drawing.Image.GetThumbnailImageAbort thumbnailImageAbortDelegate = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
                obj.Image = imagefile;
                using (System.Drawing.Bitmap originalImage = new System.Drawing.Bitmap(ProfileImage.PostedFile.InputStream))
                {
                    using (System.Drawing.Image thumbnail = originalImage.GetThumbnailImage(250, 150, thumbnailImageAbortDelegate, IntPtr.Zero))
                    {
                        thumbnail.Save(System.IO.Path.Combine(TargetFolder, imagefile));
                    }
                }
            }
        }
        clt.SaveRecord(obj);
        ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Testimonial/ModuleLocalText", "SaveRecordSuccessfully"), "", SageMessageType.Success);
        LoadRecordsOnGrid();
        divGrid.Visible = true;
        ClearField();
    }
Ejemplo n.º 2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            Pollinginfo objPoll = new Pollinginfo();
            if (Session["PollID"] == null)
            {
                pollID = 0;
            }
            else
            {
                pollID = Convert.ToInt32(Session["PollID"]);
            }

            string blockMode;
            if (rdoCookie.Checked)
            {
                blockMode = Pollinginfo.BlockMode.COOKIE.ToString();
            }
            else if (rdoIP.Checked)
            {
                blockMode = Pollinginfo.BlockMode.IP_ADDRESS.ToString();
            }
            else
            {
                blockMode = Pollinginfo.BlockMode.NONE.ToString();
            }


            if (pollID == 0) //INSERT
            {
                pollID = InsertPoll(txtQuestion.Text.Trim(), blockMode);

                //POLL INSERTED successfully
                if (pollID > 0)
                {
                    hidPollID.Value = pollID.ToString();
                    ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Polling/ModuleLocalText", "AddNewPollMessage"), "", SageMessageType.Success);
                }
            }
            else //UPDATE
            {
                UpdatePoll(pollID, txtQuestion.Text.Trim(), blockMode);
                ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Polling/ModuleLocalText", "UpdatePollSuccess"), "", SageMessageType.Success);
            }

            if (pollID > 0)
            {
                InsertUpdateChoices(pollID, Int32.Parse(SageUserModuleID), GetPortalID); //After inserting/Updateting the poll - call choice insert/update function
            }
            else
            {
                ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Polling/ModuleLocalText", "Error"), "", SageMessageType.Error);
            }
            Session["PollID"] = null;
        }
        txtQuestion.Text = string.Empty;
        divform.Attributes.Add("style", "display:none");
        divManipulateData.Attributes.Add("style", "display:block");
        listPolls();
    }
Ejemplo n.º 3
0
 private void InstallPaymentGateWay()
 {
     try
     {
         ArrayList arrColl = installhelp.Step0CheckLogic(fuPGModule);
         int       ReturnValue;
         if (arrColl != null && arrColl.Count > 0)
         {
             ReturnValue   = (int)arrColl[0];
             paymentModule = (PaymentGateWayModuleInfo)arrColl[1];
             ViewState["PaymentGateway"] = paymentModule.PaymentGatewayTypeID.ToString();
             if (ReturnValue == 0)
             {
                 ShowMessage(SageMessageTitle.Notification.ToString(),
                             SageMessage.GetSageModuleLocalMessageByVertualPath(
                                 "Modules/AspxCommerce/AspxPaymentGateWayManagement/ModuleLocalText",
                                 "YouNeedToSelectAFileToUploadFirst"), "", SageMessageType.Alert);
                 //lblLoadMessage.Text =
                 //    SageMessage.GetSageModuleLocalMessageByVertualPath(
                 //        "Modules/AspxCommerce/AspxPaymentGateWayManagement/ModuleLocalText",
                 //        "YouNeedToSelectAFileToUploadFirst");
                 lblLoadMessage.Visible = true;
                 ErrorCode = 1;
                 return;
             }
             else if (ReturnValue == -1)
             {
                 ShowMessage(SageMessageTitle.Exception.ToString(),
                             SageMessage.GetSageModuleLocalMessageByVertualPath(
                                 "Modules/AspxCommerce/AspxPaymentGateWayManagement/ModuleLocalText",
                                 "InvalidFileExtension") + this.fuPGModule.FileName, "", SageMessageType.Alert);
                 //lblLoadMessage.Text =
                 //    SageMessage.GetSageModuleLocalMessageByVertualPath(
                 //        "Modules/AspxCommerce/AspxPaymentGateWayManagement/ModuleLocalText", "InvalidFileExtension") +
                 //    this.fuPGModule.FileName;
                 lblLoadMessage.Visible = true;
                 ErrorCode = 1;
             }
             else if (ReturnValue == 1)
             {
                 installhelp.InstallPackage(paymentModule, 0);
                 ShowMessage(SageMessageTitle.Information.ToString(),
                             SageMessage.GetSageModuleLocalMessageByVertualPath(
                                 "Modules/AspxCommerce/AspxPaymentGateWayManagement/ModuleLocalText",
                                 "PaymentGatewayInstalledSuccessfully"), "", SageMessageType.Success);
                 ErrorCode = 0;
                 Response.Redirect(pageURL + "?installed=true", false);
             }
             else if (ReturnValue == 2)
             {
                 if (chkRepairInstall.Checked == true)
                 {
                     int gatewayID = int.Parse(ViewState["PaymentGateway"].ToString());
                     if (paymentModule != null)
                     {
                         UninstallPaymentGateway(paymentModule, true, gatewayID);
                         ViewState["PaymentGateway"] = null;
                         ShowMessage(SageMessageTitle.Information.ToString(),
                                     SageMessage.GetSageModuleLocalMessageByVertualPath(
                                         "Modules/AspxCommerce/AspxPaymentGateWayManagement/ModuleLocalText",
                                         "PaymentGatewayInstalledSuccessfully"), "", SageMessageType.Success);
                         ErrorCode = 0;
                         Response.Redirect(pageURL + "?installed=true", false);
                     }
                 }
                 else
                 {
                     ShowMessage(SageMessageTitle.Notification.ToString(),
                                 SageMessage.GetSageModuleLocalMessageByVertualPath(
                                     "Modules/AspxCommerce/AspxPaymentGateWayManagement/ModuleLocalText",
                                     "AlreadyExistPaymentGateway"), "", SageMessageType.Alert);
                     ErrorCode = 1;
                 }
             }
             else if (ReturnValue == 3)
             {
                 ShowMessage(SageMessageTitle.Notification.ToString(),
                             SageMessage.GetSageModuleLocalMessageByVertualPath(
                                 "Modules/AspxCommerce/AspxPaymentGateWayManagement/ModuleLocalText",
                                 "ThisPackageIsNotValid"), "", SageMessageType.Alert);
                 lblLoadMessage.Text =
                     SageMessage.GetSageModuleLocalMessageByVertualPath(
                         "Modules/AspxCommerce/AspxPaymentGateWayManagement/ModuleLocalText", "ThisPackageIsNotValid");
                 lblLoadMessage.Visible = true;
                 ErrorCode = 1;
             }
             else if (ReturnValue == 4)
             {
                 ShowMessage(SageMessageTitle.Notification.ToString(),
                             SageMessage.GetSageModuleLocalMessageByVertualPath(
                                 "Modules/AspxCommerce/AspxPaymentGateWayManagement/ModuleLocalText",
                                 "ThisPackageDoesNotAppearToBeValid"), "", SageMessageType.Alert);
                 lblLoadMessage.Text =
                     SageMessage.GetSageModuleLocalMessageByVertualPath(
                         "Modules/AspxCommerce/AspxPaymentGateWayManagement/ModuleLocalText",
                         "ThisPackageDoesNotAppearToBeValid");
                 lblLoadMessage.Visible = true;
                 ErrorCode = 1;
             }
             else
             {
                 ShowMessage(SageMessageTitle.Exception.ToString(),
                             SageMessage.GetSageModuleLocalMessageByVertualPath(
                                 "Modules/AspxCommerce/AspxPaymentGateWayManagement/ModuleLocalText",
                                 "ThereIsErrorWhileInstallingThisModule"), "", SageMessageType.Error);
                 lblLoadMessage.Text =
                     SageMessage.GetSageModuleLocalMessageByVertualPath(
                         "Modules/AspxCommerce/AspxPaymentGateWayManagement/ModuleLocalText",
                         "ThereIsErrorWhileInstallingThisModule");
                 lblLoadMessage.Visible = true;
                 ErrorCode = 1;
             }
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Ejemplo n.º 4
0
    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;
    }
    private void SaveBannerContent(int BannerId, int ImageId)
    {
        try
        {
            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.FileName.Replace(" ", "_");
                    obj.NavigationImage = fuFileUpload.FileName.Replace(" ", "_");
                }
                else
                {
                    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 = "";
            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.Value.Trim();
            obj.PortalID       = GetPortalID;


            string swfExt = System.IO.Path.GetExtension(fuFileUpload.PostedFile.FileName);
            if (swfExt == ".swf")
            {
                if (fuFileUpload.FileContent.Length > 0)
                {
                    string        Path           = GetUplaodImagePhysicalPath();
                    DirectoryInfo dirUploadImage = new DirectoryInfo(Path);
                    if (dirUploadImage.Exists == false)
                    {
                        dirUploadImage.Create();
                    }
                    string fileUrl = Path + fuFileUpload.PostedFile.FileName;
                    fuFileUpload.PostedFile.SaveAs(fileUrl);
                    swfFileName = "Modules/Sage_Banner/images/" + fuFileUpload.PostedFile.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");
                if (!Directory.Exists(target))
                {
                    Directory.CreateDirectory(target);
                }
                if (!Directory.Exists(CropImageTarget))
                {
                    Directory.CreateDirectory(CropImageTarget);
                }
                if (!Directory.Exists(thumbTarget))
                {
                    Directory.CreateDirectory(thumbTarget);
                }
                System.Drawing.Image.GetThumbnailImageAbort thumbnailImageAbortDelegate = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
                if (fuFileUpload.HasFile)
                {
                    fuFileUpload.SaveAs(System.IO.Path.Combine(target, fuFileUpload.FileName.Replace(" ", "_")));
                    fuFileUpload.SaveAs(System.IO.Path.Combine(CropImageTarget, fuFileUpload.FileName.Replace(" ", "_")));
                    using (System.Drawing.Bitmap originalImage = new System.Drawing.Bitmap(fuFileUpload.PostedFile.InputStream))
                    {
                        using (System.Drawing.Image thumbnail = originalImage.GetThumbnailImage(80, 80, thumbnailImageAbortDelegate, IntPtr.Zero))
                        {
                            thumbnail.Save(System.IO.Path.Combine(thumbTarget, fuFileUpload.FileName.Replace(" ", "_")));
                        }
                    }
                }
            }
            SageBannerController objcont = new SageBannerController();
            objcont.SaveBannerContent(obj);
            ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Sage_Banner/ModuleLocalText", "BannerSavedsuccesfully"), "", SageMessageType.Success);
            Session["ImageName"]   = null;
            Session["EditImageID"] = null;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    protected void btnShare_Click(object sender, EventArgs e)
    {
        string content = txtFeedContent.Text.Trim();

        if (content != string.Empty)
        {
            bool postedToLinkedIn = false;
            bool postedToFaceBook = false;
            bool postedToTwitter  = false;
            bool postedToGoogle   = false;
            try
            {
                if (cbFacebook.Checked)
                {
                    postedToFaceBook = PostFacebook();
                }

                if (cbTwitter.Checked)
                {
                    postedToTwitter = PostTwitter();
                }

                if (cbLinkedIn.Checked)
                {
                    postedToLinkedIn = PostLinkedIn();
                }

                if (isGooglePlusEnabled)
                {
                    postedToGoogle = PostLinkedIn();
                }


                if (postedToFaceBook || postedToTwitter || postedToLinkedIn || postedToGoogle)
                {
                    Session[SuccessMessageKey] = "You shares a new post at " + DateTime.Now + " successfully.";

                    ClearSessionKeys();
                    ReloadCurrentState();
                    //               ShowMessage(SageMessageTitle.Information.ToString(),
                    //SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/SocialFeedShare/ModuleLocalText",
                    //"ShareSuccessfull"), "", SageMessageType.Success);
                }
                else
                {
                    string fullMessage = string.Empty;

                    if (cbTwitter.Checked && !postedToTwitter) // Unable to post to twitter
                    {
                        if (twitterCallBackContent != string.Empty)
                        {
                            fullMessage += twitterCallBackContent;
                        }
                    }

                    if (cbFacebook.Checked && !postedToFaceBook) // Unable to post to twitter
                    {
                        fullMessage += " [ Unable to post to facebook ] ";
                    }

                    if (cbLinkedIn.Checked && !postedToLinkedIn) // Unable to post to twitter
                    {
                        fullMessage += " [ Unable to post to LinkedIn ] ";
                    }


                    ShowMessage(SageMessageTitle.Exception.ToString(), "Post failed", fullMessage, SageMessageType.Error);

                    ClearSessionKeys();
                    //       ShowMessage(SageMessageTitle.Information.ToString(),
                    //SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/SocialFeedShare/ModuleLocalText",
                    //"ContentNotFound"), "", SageMessageType.Error);
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
                ShowMessage(SageMessageTitle.Information.ToString(),
                            SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/SocialFeedShare/ModuleLocalText",
                                                                               "ShareFailed"), "", SageMessageType.Error);
            }
            finally
            {
                //ClearSessionKeys();
            }

            //            if (postedToFaceBook || postedToTwitter || postedToLinkedIn || postedToGoogle)
            //            {
            //                ShowMessage(SageMessageTitle.Information.ToString(),
            //SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/SocialFeedShare/ModuleLocalText",
            //"ShareSuccessfull"), "", SageMessageType.Success);

            //            }
            //            else
            //            {
            //                ShowMessage(SageMessageTitle.Information.ToString(),
            //             SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/SocialFeedShare/ModuleLocalText",
            //             "ContentNotFound"), "", SageMessageType.Error);
            //            }
        }
        else
        {
            ShowMessage(SageMessageTitle.Information.ToString(),
                        SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/SocialFeedShare/ModuleLocalText",
                                                                           "ContentNotFound"), "", SageMessageType.Error);
        }
    }