当前位置: 首页>>代码示例>>C#>>正文


C# DB.DeleteObject方法代码示例

本文整理汇总了C#中DB.DeleteObject方法的典型用法代码示例。如果您正苦于以下问题:C# DB.DeleteObject方法的具体用法?C# DB.DeleteObject怎么用?C# DB.DeleteObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DB的用法示例。


在下文中一共展示了DB.DeleteObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: clearLine

        protected string clearLine()
        {
            bool result = false;
            string line = Request.Form["line"];

            if (!string.IsNullOrEmpty(line) && line != "all")
            {
                using (DB db = new DB())
                {
                    List<DowntimeData> list = (from o in db.DowntimeDataSet
                                               where o.Client == "admin"
                                               && o.Line == line
                                               select o).ToList();

                    if (list.Count() > 0)
                    {
                        foreach (DowntimeData dt in list)
                        {
                            db.DeleteObject(dt);
                        }
                    }

                    result = db.SaveChanges() > 0;
                }
            }

            return result.ToString();
        }
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:28,代码来源:TvDemoControl.aspx.cs

示例2: UpdateCC

        /*
        protected string UpdateCC()
        {
            int casecount = -1;

            DateTime d;
            DateTime? date = null;

            if(DateTime.TryParse(Request.Form["date"], out d))
                date = new DateTime(d.Year, d.Month, d.Day, d.Hour, d.Minute, 00);

            int.TryParse(Request.Form["counts"], out casecount);

            if (casecount > -1 && date.HasValue)
            {

                using (DB db = new DB())
                {
                    List<ThroughputHistory> thList = DCSDashboardDemoHelper.getThroughPutHistories();

                    ThroughputHistory th = (from o in thList
                                            where (o.Date.DayOfYear == date.Value.DayOfYear && o.Date.Year == date.Value.Year && o.Date.Hour == date.Value.Hour)
                                            orderby o.Date descending
                                            select o).FirstOrDefault();

                    DateTime tmpDate = new DateTime(d.Year, d.Month, d.Day, d.Hour, 00, 00);

                    tmpDate = tmpDate.AddHours(1d);

                    if (th != null)
                    {
                        if (th.Date != date)
                            tmpDate = th.Date;
                    }

                    List<CaseCount> cList = DCSDashboardDemoHelper.GetCaseCounts(date, tmpDate, "lebelge");

                    foreach (CaseCount cc in cList)
                    {
                        int id = cc.Id;

                        if (cc.EventStop.Value >= d && cc.EventStop.Value.Hour == d.Hour)
                        {
                            CaseCount tmpCase = (from o in db.CaseCountSet
                                                 where o.Id == id
                                                 select o).FirstOrDefault();

                            db.DeleteObject(tmpCase);
                        }
                    }

                    int diff = (int)d.Subtract(tmpDate).TotalMinutes;

                    if (diff < 0)
                        diff = diff * -1;

                    decimal val = (decimal)casecount / ((decimal)diff / 5M);

                    decimal total = 0;
                    decimal lastCC = 0;
                    decimal counter = 0;

                    CaseCount lastCaseCount = (from o in db.CaseCountSet
                                                where o.EventStop.Value < date
                                                orderby o.EventStop.Value descending
                                                select o).FirstOrDefault();

                    if (lastCaseCount != null)
                        lastCC = lastCaseCount.CaseCount1;

                    total = lastCC;

                    DateTime end = date.Value.AddHours(1d);

                    diff = diff / 5;

                    List<CaseCount> tmpList = new List<CaseCount>();

                    if (val > 0)
                    {
                        for (int x = 0; x < diff; x++)
                        {
                            if (date.Value.Hour == end.Hour)
                                break;

                            total += val;
                            counter += val;

                            CaseCount cc = new CaseCount();
                            cc.CaseCount1 = Convert.ToInt32(total);
                            cc.Client = "lebelge";
                            cc.EventStart = date;
                            cc.EventStop = date;
                            cc.Line = "company-demo";

                            tmpList.Add(cc);

                            date = date.Value.AddMinutes(5d);

                        }
//.........这里部分代码省略.........
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:101,代码来源:ManualCC.aspx.cs


注:本文中的DB.DeleteObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。