//-------------------------------------------------------------
        /// <summary>
        /// Restores a compaign which has been marked for deletion.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        //-------------------------------------------------------------
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            int   iIndex      = 0;
            Int64 iCampaignID = -1;
            bool  bCheck      = false;

            iIndex = GridView1.SelectedIndex;

            iCampaignID = Convert.ToInt16(GridView1.Rows[iIndex].Cells[1].Text);
            if (iCampaignID >= 0)
            {
                DBCampaign dbCampaign = new DBCampaign();
                bCheck = dbCampaign.bSet_IsDeleted(iCampaignID, false);
                if (bCheck == true)
                {
                    Response.Redirect("~\\Campaign\\CampaignDeleted.aspx");
                }
            }
        }
Esempio n. 2
0
        //-------------------------------------------------------------
        /// <summary>
        /// Deletes the campaign if not running
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        //-------------------------------------------------------------
        protected void lbtnDelete_Click(object sender, EventArgs e)
        {
            //---------------------------------------------------------
            //  We only mark the campign as deleted but the data is
            //  kept in the database.
            //---------------------------------------------------------
            LinkButton lbtnDelete       = (LinkButton)sender;
            string     campaignDetails  = lbtnDelete.CommandArgument;
            string     shortDescription = campaignDetails.Substring(campaignDetails.IndexOf(",") + 1);
            Int64      iCampaignID      = Convert.ToInt64(campaignDetails.Substring(0, campaignDetails.IndexOf(",")));
            long       StatusID         = Convert.ToInt64(lbtnDelete.CommandName);

            if (iCampaignID >= 0 && StatusID != (long)CampaignStatus.Run)
            {
                DBCampaign dbCampaign = new DBCampaign();
                bool       bCheck     = dbCampaign.bSet_IsDeleted(iCampaignID, true);
                if (bCheck == true)
                {
                    Response.Redirect("~\\Campaign\\CampaignList.aspx");
                }
            }
            else
            {
                PageMessage = "The current Campaign is running please stop the Campaign to delete!";
            }


            //---------------------------------------------------------
            // Old code, the delete in the WebService drops the tables
            // which should be preserved.
            //---------------------------------------------------------
            //
            // LinkButton lbtnDelete = (LinkButton)sender;
            // CampaignService objCampService = new CampaignService();
            //
            // string sampaignDetails = lbtnDelete.CommandArgument;
            // string shortDescription = sampaignDetails.Substring(sampaignDetails.IndexOf(",") + 1);
            // long CampaignID = Convert.ToInt64(sampaignDetails.Substring(0, sampaignDetails.IndexOf(",")));
            // long StatusID = Convert.ToInt64(lbtnDelete.CommandName);
            // try
            // {
            //     if (StatusID != (long)CampaignStatus.Run)
            //     {
            //         int result = objCampService.DeleteCampaign(CampaignID,shortDescription);
            //         if (result != 0)
            //         {
            //             GetCampaignList();
            //         }
            //     }
            //     else
            //     {
            //         PageMessage = "The current Campaign is running please stop the Campaign to delete!";
            //     }
            // }
            // catch (Exception ex)
            // {
            //     PageMessage = ex.Message;
            // }
            //
            //---------------------------------------------------------
        }