Esempio n. 1
0
        public override bool Delete(string input)
        {
            var itemIds = JsonConvert.DeserializeObject <string[]>(input);

            var campaignIds = itemIds.Select(i => Protector.Unprotect(i)).ToList();

            var idTasks = "";

            foreach (var tasks in itemIds.Select(item => _taskCampaignBusiness.GetAlltasksByCampaignId(new Guid(Protector.Unprotect(item)), ApplicationUserCurrent.AccountId)))
            {
                foreach (var tsk in tasks)
                {
                    if ((idTasks.IndexOf(',') < 0) && (!(string.IsNullOrEmpty(idTasks))) ||
                        (idTasks.IndexOf(',') >= 0) && (!(string.IsNullOrEmpty(idTasks))))
                    {
                        idTasks += ",";
                    }
                    idTasks += "\"" + tsk.Id + "\"";
                }
                idTasks = "[" + idTasks + "]";

                var idsTask = JsonConvert.DeserializeObject <string[]>(idTasks);

                if (idsTask.Any())
                {
                    _commonBusiness.DeleteId(CTask.TableName, idsTask);
                }
            }

            return(base.Delete(JSonConvertUtil.Convert(campaignIds)));
        }