protected void B_delete_Click(object sender, EventArgs e)
    {
        string strApplicationID = MatrimonialMemberShip.GetApplicationID(Request.QueryString["matid"]);

        if (CB_P.Checked || CB_ALB_1.Checked || CB_ALB_2.Checked || CB_ALB_2.Checked)
        {
            if (CB_P.Checked)
            {
                MatrimonialAlbumManager.DeleteImage(strApplicationID, MatrimonialAlbumManager.ImageType.Photo);
            }

            if (CB_ALB_1.Checked)
            {
                MatrimonialAlbumManager.DeleteImage(strApplicationID, MatrimonialAlbumManager.ImageType.Photo);
            }

            if (CB_ALB_2.Checked)
            {
                MatrimonialAlbumManager.DeleteImage(strApplicationID, MatrimonialAlbumManager.ImageType.Photo);
            }

            if (CB_ALB_3.Checked)
            {
                MatrimonialAlbumManager.DeleteImage(strApplicationID, MatrimonialAlbumManager.ImageType.Photo);
            }

            L_Alart.Text    = " Image Deleted Successfully";
            L_Alart.Visible = true;
        }
        else
        {
            L_Alart.Text    = "Please Check the photo you need to delete";
            L_Alart.Visible = true;
        }
    }
Exemple #2
0
// Delete From DataBase
    protected void B_Delete_Click(object sender, EventArgs e)
    {
        if (CB_DEL.Checked)
        {
            if (MatrimonialAlbumManager.DeleteImage(MatrimonialMemberShip.GetApplicationID(TB_MatrimonialID.Text), MatrimonialAlbumManager.ImageType.Horoscope))
            {
                //Hide Controls
                L_State.Text     = "Horoscope sucessfully Deleted";
                HL_Horo.ImageUrl = "~/Resources/horonotFound.gif";
                CB_DEL.Visible   = false;
                D_Delete.Visible = false;
            }
            else
            {
                L_State.Text = "Error in Saving your file";
            }
        }
        else
        {
            CB_DEL.ForeColor = System.Drawing.Color.Red;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.Header.Title = "Delete Image From Album";

            L_PhotoMailID.Text = WebConfig.GetValues("emailPhoto");
            if (Request.QueryString["image"] != "")
            {
                switch (Request.QueryString["image"])
                {
                case "1":
                    L_PhotoID.Text = "Main Photo";
                    break;

                case "2":
                    L_PhotoID.Text = "Album - 1";
                    break;

                case "3":
                    L_PhotoID.Text = "Album - 2";
                    break;

                case "4":
                    L_PhotoID.Text = "Album - 3";
                    break;

                case "5":
                    L_PhotoID.Text = "Horescope";
                    break;

                default:
                    Server.Transfer("../../Extras/errorreport.aspx");
                    break;
                }
            }
            else
            {
                Server.Transfer("../../Extras/errorreport.aspx");
            }
        }
        else
        {
            if (CB_Delete.Checked)
            {
                //delete from data base
                bool boolFlag = false;

                string strApplicationID = MatrimonialMemberShip.GetApplicationID(Request.QueryString["matid"]);

                switch (L_PhotoID.Text)
                {
                case "Main Photo":
                    boolFlag = MatrimonialAlbumManager.DeleteImage(strApplicationID, MatrimonialAlbumManager.ImageType.Photo);
                    break;

                case "Album - 1":
                    boolFlag = MatrimonialAlbumManager.DeleteImage(strApplicationID, MatrimonialAlbumManager.ImageType.Album1);
                    break;

                case "Album - 2":
                    boolFlag = MatrimonialAlbumManager.DeleteImage(strApplicationID, MatrimonialAlbumManager.ImageType.Album2);
                    break;

                case "Album - 3":
                    boolFlag = MatrimonialAlbumManager.DeleteImage(strApplicationID, MatrimonialAlbumManager.ImageType.Album3);
                    break;

                case "Horescope":
                    boolFlag = MatrimonialAlbumManager.DeleteImage(strApplicationID, MatrimonialAlbumManager.ImageType.Horoscope);
                    break;

                default:
                    Server.Transfer("../../Extras/errorreport.aspx");
                    break;
                }
                if (boolFlag)
                {
                    Server.Transfer("../../extras/Sucess.aspx");
                }
                else
                {
                }
            }
            else
            {
                L_Warning.Visible = true;
            }
        }
    }