protected void LinqDataSource1_Deleting(object sender, LinqDataSourceDeleteEventArgs e)
    {
        lblError.Visible = true;
        PersonInfo p = e.OriginalObject as PersonInfo;

        if (p.PersonID == 0)
        {
            e.Cancel = true;
            return;
        }

        if (p.SpouseID != null && p.SpouseID > 0)
        {
            e.Cancel      = true;
            lblError.Text = "Remove Spouse of the person before deleting.";
            return;
        }

        using (MyFamilyDatabaseDataContext db = new MyFamilyDatabaseDataContext())
        {
            PersonInfo spouse = db.PersonInfos.Where(o => o.SpouseID == p.PersonID).FirstOrDefault();
            if (spouse != null && spouse.PersonID != 0)
            {
                e.Cancel      = true;
                lblError.Text = "Person is already marked as Spouse for " + spouse.PersonID + ", update Person first.";
                return;
            }
            if (db.PersonInfos.Where(c => c.FatherID == p.PersonID).Count() > 0)
            {
                e.Cancel      = true;
                lblError.Text = "Person is already father.";
                return;
            }
        }
    }
示例#2
0
    protected void adsPlace_Deleting(object sender, LinqDataSourceDeleteEventArgs e)
    {
        DBSCMDataContext dc = new DBSCMDataContext();


        Place place = dc.Place.First(p => p.Placeid == (e.OriginalObject as Place).Placeid);

        if (place.Placestatus == 1)
        {
            place.Placestatus = 0;
            dc.SubmitChanges();
        }

        //ListDictionary keyValues = new ListDictionary();
        //ListDictionary newValues = new ListDictionary();
        //ListDictionary oldValues = new ListDictionary();
        //keyValues.Add("Placeid", ((GhtnTech.SEP.DAL.Place)e.OriginalObject).Placeid;

        //oldValues.Add("ProductName", ((Label)DetailsView1.FindControl("NameLabel")).Text);
        //oldValues.Add("ProductCategory", ((Label)DetailsView1.FindControl("CategoryLabel")).Text);
        //oldValues.Add("Color", ((Label)DetailsView1.FindControl("ColorLabel")).Text);

        //newValues.Add("ProductName", "New Product");
        //newValues.Add("ProductCategory", "General");
        //newValues.Add("Color", "Not assigned");


        //adsPlace.Update(keyValues, newValues, oldValues);
        e.Cancel = true;
    }
示例#3
0
    //<Snippet1>
    protected void LinqDataSource_Deleting(object sender, LinqDataSourceDeleteEventArgs e)
    {
        Product product = (Product)e.OriginalObject;

        if (product.OnSale && !confirmCheckBox.Checked)
        {
            e.Cancel = true;
        }
    }
        protected void LinqDataSource1_Deleting(object sender, LinqDataSourceDeleteEventArgs e)
        {
            var db     = new ZkDataContext();
            var unlock = db.Unlocks.Single(x => x.UnlockID == ((Unlock)e.OriginalObject).UnlockID);

            db.CommanderModules.DeleteAllOnSubmit(db.CommanderModules.Where(x => x.ModuleUnlockID == unlock.UnlockID));
            db.Unlocks.DeleteOnSubmit(unlock);
            db.SubmitChanges();
        }
示例#5
0
 protected void dsScoreCardDashboard_Deleting(object sender, LinqDataSourceDeleteEventArgs e)
 {
     if (MyDashboardMode)
     {
         MetricTrac.Bll.ScoreCardDashboard d = (MetricTrac.Bll.ScoreCardDashboard)e.OriginalObject;
         d.InstanceId = MetricTrac.Bll.LinqMicajahDataContext.InstanceId;
         d.UserId     = (Guid)MetricTrac.Bll.LinqMicajahDataContext.LogedUserId;
     }
 }
示例#6
0
 protected void UsuariosLinqData_Deleting(object sender, LinqDataSourceDeleteEventArgs e)
 {
     using (SomScDataContext context = new SomScDataContext())
     {
         if (context.Usuarios.Count() <= 1)
         {
             logger.Error("Potencial exclusão de TODOS os usuários encontrada. Abortando!");
             e.Cancel = true;
         }
     }
 }
示例#7
0
        protected void lqContentFiles_Deleting(object sender, LinqDataSourceDeleteEventArgs e)
        {
            e.Cancel = true;
            if ((bool?)Session["login"] == true)
            {
                var db    = new ZkDataContext();
                var todel = db.ResourceContentFiles.Single(x => x.Md5 == ((ResourceContentFile)e.OriginalObject).Md5);
                Utils.SafeDelete(PlasmaServer.GetTorrentPath(todel));

                db.ResourceContentFiles.DeleteOnSubmit(todel);
                db.SaveChanges();

                MessageBox.Show("Deleted " + todel.FileName);
            }
            else
            {
                MessageBox.Show("Not logged in");
            }
        }
        protected void lqResources_Deleting(object sender, LinqDataSourceDeleteEventArgs e)
        {
            e.Cancel = true;
            if ((bool?)Session["login"] == true)
            {
                var db    = new ZkDataContext();
                var todel = db.Resources.Single(x => x.InternalName == ((Resource)e.OriginalObject).InternalName);
                PlasmaServer.RemoveResourceFiles(todel);


                db.Resources.DeleteOnSubmit(todel);
                db.SubmitChanges();

                MessageBox.Show("Deleted " + todel.InternalName);
            }
            else
            {
                MessageBox.Show("Not logged in");
            }
        }
示例#9
0
        protected void ldsPerformanceIndicatorFormPerformanceIndicators_Deleting(object sender, LinqDataSourceDeleteEventArgs e)
        {
            string _AddedPI = String.Empty;

            if (Session[MetricTrac.Utils.MetricUtils.SessionObjectNameForAddedPIs] != null)
            {
                _AddedPI = (string)Session[MetricTrac.Utils.MetricUtils.SessionObjectNameForAddedPIs];
            }
            string delPerformanceIndicator = ((Bll.PerformanceIndicatorFormPerformanceIndicatorJunc)e.OriginalObject).PerformanceIndicatorID.ToString();

            if (_AddedPI.Contains(delPerformanceIndicator))
            {
                _AddedPI = _AddedPI.Replace(delPerformanceIndicator, "");
                _AddedPI = _AddedPI.Replace("||", "|");
                _AddedPI = _AddedPI.TrimStart('|');
                _AddedPI = _AddedPI.TrimEnd('|');
                if (String.IsNullOrEmpty(_AddedPI))
                {
                    Session[MetricTrac.Utils.MetricUtils.SessionObjectNameForAddedPIs] = null;
                }
                else
                {
                    Session[MetricTrac.Utils.MetricUtils.SessionObjectNameForAddedPIs] = _AddedPI;
                }
            }
            else
            {
                string _DeletedPI = String.Empty;
                if (Session[MetricTrac.Utils.MetricUtils.SessionObjectNameForDeletedPIs] != null)
                {
                    _DeletedPI = (string)Session[MetricTrac.Utils.MetricUtils.SessionObjectNameForDeletedPIs];
                }
                if (String.IsNullOrEmpty(_DeletedPI))
                {
                    _DeletedPI = delPerformanceIndicator;
                }
                else
                {
                    _DeletedPI = _DeletedPI + "|" + delPerformanceIndicator;
                }
                Session[MetricTrac.Utils.MetricUtils.SessionObjectNameForDeletedPIs] = _DeletedPI;
            }
            e.Cancel = true;
        }
示例#10
0
 protected void ldsCollectorRule_Deleting(object sender, LinqDataSourceDeleteEventArgs e)
 {
     Bll.DataRule.Delete(((Bll.DataRule)e.OriginalObject).DataRuleID);
     e.Cancel = true;
 }