예제 #1
0
        public async Task <IActionResult> DeleteCampaign(long id)
        {
            var service  = new CampaignService(new HttpService($"{urlService}/{id}/4"));
            var response = await service.DeleteCampaign();

            return(this.Ok(response));
        }
예제 #2
0
        public async Task <IActionResult> DeleteCampaign([FromRoute] Guid campaignId)
        {
            var campaign = await CampaignService.GetCampaignById(campaignId);

            if (campaign == null)
            {
                return(NotFound());
            }
            await CampaignService.DeleteCampaign(campaignId);

            return(NoContent());
        }
예제 #3
0
        public bool DeleteCampaign(int campaignId)
        {
            CampaignService campaignService = new CampaignService();

            return(campaignService.DeleteCampaign(campaignId));
        }
        //-------------------------------------------------------------
        /// <summary>
        /// Deletes the campaign if not running
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        //-------------------------------------------------------------
        protected void btnDelete_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;
            CampaignService objCampService   = new CampaignService();
            string          shortDescription = campaignDetails.Substring(campaignDetails.IndexOf(",") + 1);
            Int64           iCampaignID      = Convert.ToInt64(campaignDetails.Substring(0, campaignDetails.IndexOf(",")));

            if (iCampaignID >= 0)
            {
                int result = objCampService.DeleteCampaign(iCampaignID, shortDescription);
                if (result != 0)
                {
                    DBCampaign dbCampaign = new DBCampaign();
                    bool       bCheck     = dbCampaign.bDelete(iCampaignID);
                    if (bCheck == true)
                    {
                        string strPath = shortDescription;
                        strPath = strPath.Trim();
                        strPath = Global.strRecordings + strPath;
                        string RecordingsPath = "";

                        string ismultiboxconfig = ConfigurationManager.AppSettings["IsMultiBoxConfig"];
                        strPath = shortDescription;

                        if (ismultiboxconfig == "yes" || ismultiboxconfig == "Yes" || ismultiboxconfig == "YES")
                        {
                            RecordingsPath = ConfigurationManager.AppSettings["RecordingsPathMulti"];
                            strPath        = strPath.Trim();
                            strPath        = RecordingsPath + strPath;
                        }
                        else
                        {
                            RecordingsPath = ConfigurationManager.AppSettings["RecordingsPath"];
                            strPath        = strPath.Trim();
                            strPath        = RecordingsPath + strPath;
                        }

                        if (Directory.Exists(strPath) == true)
                        {
                            Directory.Delete(strPath);
                        }

                        Response.Redirect("~\\Campaign\\CampaignDeleted.aspx");
                    }
                }
            }

            //---------------------------------------------------------
            // 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;
            // }
            //
            //---------------------------------------------------------
        }
 public async Task Delete([FromRoute] string companyId, [FromRoute] string campaignId)
 {
     await campaignService.DeleteCampaign(new ObjectId(companyId), new ObjectId(campaignId));
 }
예제 #6
0
        public async Task <ActionResult> Delete(long campaignId, CancellationToken cancellationToken)
        {
            await _service.DeleteCampaign(campaignId, cancellationToken);

            return(Ok());
        }