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


C# DB.AddToDowntimeDataSet方法代码示例

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


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

示例1: importExcel


//.........这里部分代码省略.........
                                        object oDate = currentWorksheet.Cells[rowNumber, 1].Value;
                                        object oEventStart = currentWorksheet.Cells[rowNumber, 3].Value;
                                        object oMinutes = currentWorksheet.Cells[rowNumber, 6].Value;//It's a Date in H:MM:SS format
                                        object oReason = currentWorksheet.Cells[rowNumber, 7].Value;
                                        object oStoppageOfNature = currentWorksheet.Cells[rowNumber, 9].Value;

                                        if ((oEventStart != null && oEventStart.ToString() != "") && (oStoppageOfNature != null && oStoppageOfNature.ToString() != ""))
                                        {
                                            decimal minutes = 0;

                                            if (oMinutes != null)
                                            {
                                                DateTime minTime = (DateTime)oMinutes;

                                                minutes = Convert.ToDecimal((minTime.TimeOfDay.TotalHours / 60) + minTime.TimeOfDay.TotalMinutes);
                                            }

                                            DateTime EventStart = DateTime.Now;

                                            try
                                            {
                                                EventStart = (DateTime)oEventStart;
                                            }
                                            catch (Exception e)
                                            {
                                                Console.Write(e.Message);
                                            }

                                            DateTime EventStop = EventStart.AddMinutes((double)minutes);
                                            string reason = oReason.ToString();
                                            string nos = oStoppageOfNature.ToString();

                                            Options opt = (from o in options
                                                            where o.Name.Equals(nos, StringComparison.InvariantCultureIgnoreCase)
                                                            select o).FirstOrDefault();

                                            if (opt != null)
                                            {
                                                DowntimeData dt = new DowntimeData();
                                                dt.Client = client;
                                                dt.Comment = reason;
                                                dt.EventStart = EventStart;
                                                dt.EventStop = EventStop;
                                                dt.Line = line;
                                                dt.Minutes = minutes;
                                                dt.IsCreatedByAcromag = true;

                                                dtData.Add(dt);

                                                db.AddToDowntimeDataSet(dt);

                                                db.SaveChanges();

                                                if (dt.ID > 0)
                                                {
                                                    NatureOfStoppage NOS = new NatureOfStoppage();
                                                    NOS.OptionId = opt.Id;
                                                    NOS.DowntimeId = dt.ID;

                                                    db.AddToNatureOfStoppages(NOS);
                                                }
                                            }
                                            else
                                            {
                                                Console.Write("NOS IS EMPTY");
                                            }

                                        }
                                    }

                                    index++;
                                }

                                Console.Write("DONE" + dtData.Count);
                            }
                        }
                    }
                }
            }
            catch (IOException ioEx)
            {
                if (!String.IsNullOrEmpty(ioEx.Message))
                {
                    if (ioEx.Message.Contains("because it is being used by another process."))
                    {
                        Console.WriteLine("Could not read example data. Please make sure it not open in Excel.");
                    }
                }
                Console.WriteLine("Could not read example data. " + ioEx.Message, ioEx);
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occured while reading example data. " + ex.Message, ex);
            }
            finally
            {
                Console.WriteLine();
                Console.WriteLine("press any key to exit.");
            }
        }
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:101,代码来源:Import.ashx.cs

示例2: InsertDowntimeData

        public bool InsertDowntimeData(DateTime eventStart, DateTime eventStop, decimal? minutes, string reasonCode, int? reasonCodeID, string comment, string line, string client, string str_eventStart, string str_eventStop)
        {
            bool result;
            using (DB db = new DB())
            {
                DowntimeData latestDowntime = (from o in db.DowntimeDataSet
                                               where o.Client == client && o.Line == line
                                               orderby o.EventStop.Value descending
                                               select o).FirstOrDefault();

                DateTime? latestDate = (latestDowntime != null ? latestDowntime.EventStop : null);

                bool create = !latestDate.HasValue;

                DowntimeData dd = new DowntimeData();
                //为了避免时区问题,用string转过来转换
                DateTime es, et;
                if (!DateTime.TryParse(str_eventStart, out es) || !DateTime.TryParse(str_eventStop, out et))
                {
                    return false;
                }

                if (latestDate.HasValue)
                {
                    create = latestDate.Value < et;
                }

                if (create)
                {
                    //dd.EventStart = eventStart;
                    //dd.EventStop = eventStop;
                    dd.EventStart = es;
                    dd.EventStop = et;

                    dd.Minutes = minutes;
                    dd.ReasonCodeID = reasonCodeID;
                    dd.ReasonCode = reasonCode;
                    dd.Line = line;
                    dd.Comment = comment;
                    dd.Client = client;
                    dd.IsCreatedByAcromag = true;
                    db.AddToDowntimeDataSet(dd);
                    result = db.SaveChanges() > 0;

                    if (result)
                    {
                        DBHelper.UpdateAscommPing(client, DateTime.Now, line, true);
                    }
                }
                else
                    result = false;

            }
            return result;
        }
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:55,代码来源:DSCWS.asmx.cs

示例3: LoginAndCreateDowntimeData

        public bool LoginAndCreateDowntimeData(DateTime? eventStart, DateTime? eventStop, decimal? minutes, string reasonCode, int? reasonCodeID, string comment, string line, string client, string password)
        {
            bool result;

            bool loggedIn = Login(client, password);

            if (!loggedIn) return false;

            if (eventStart.HasValue == false || eventStop.HasValue == false)
                return false;

            if (minutes.HasValue == false)
                minutes = Convert.ToInt32(eventStop.Value.Subtract(eventStart.Value).TotalMinutes);

            using (DB db = new DB())
            {
                DowntimeData latestDowntime = (from o in db.DowntimeDataSet
                    where o.Client == client && o.Line == line
                    orderby o.EventStop.Value descending
                    select o).FirstOrDefault();

                DateTime? latestDate = null;

                if (latestDowntime != null)
                    latestDate = latestDowntime.EventStop;

                bool create = !latestDate.HasValue;

                DowntimeData dd = new DowntimeData();

                if (latestDate.HasValue)
                {
                    create = !(latestDate.Value >= eventStop);
                }

                if (create)
                {
                    //dd.EventStart = eventStart;
                    //dd.EventStop = eventStop;
                    dd.EventStart = eventStart;
                    dd.EventStop = eventStop;

                    dd.Minutes = minutes;
                    dd.ReasonCodeID = reasonCodeID;
                    dd.ReasonCode = reasonCode;
                    dd.Line = line;
                    dd.Comment = comment;
                    dd.Client = client;
                    dd.IsCreatedByAcromag = true;
                    db.AddToDowntimeDataSet(dd);
                    result = db.SaveChanges() > 0;

                    if (result)
                    {
                        DBHelper.UpdateAscommPing(client, DateTime.Now, line, true);
                    }
                }
                else
                    result = false;

            }

            return result;
        }
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:64,代码来源:DSCWS.asmx.cs

示例4: CreateDowntimeEventWithTimeZone

        public int CreateDowntimeEventWithTimeZone(DateTime? eStart, DateTime? eStop, string strTimeZone, decimal? minutes, string reasonCode, int? reasonCodeID, string comment, string line, string client)
        {
            int result = 0;

            if (eStart.HasValue == false || eStop.HasValue == false)
                return 0;

            if (minutes.HasValue == false)
                minutes = Convert.ToInt32(eStop.Value.Subtract(eStart.Value).TotalMinutes);

            DateTime eventStart = eStart.Value;
            DateTime eventStop = eStop.Value;

            if (!string.IsNullOrEmpty(strTimeZone))
            {
                TimeZoneInfo timeZone = TimeZoneInfo.FromSerializedString(strTimeZone);

                eventStart = TimeZoneInfo.ConvertTime(eStart.Value, timeZone);
                eventStop = TimeZoneInfo.ConvertTime(eStop.Value, timeZone);
            }

            decimal totalMinutes = (decimal)eventStop.Subtract(eventStart).TotalMinutes;

            if (totalMinutes > 60 && minutes < 60)//If eventstop is greater than an hour or more, but the minute difference isn't, then assume timezone conversion or something is wrong for the times
            {
                //assume Event Start is correct
                eventStop = eventStart.AddMinutes((double)minutes);
            }

            using (DB db = new DB())
            {
                if (alreadyExists(client, line, eventStart, eventStop))
                    return -2;

                DowntimeData dd = new DowntimeData();

                dd.EventStart = eventStart;
                dd.EventStop = eventStop;

                dd.Minutes = minutes;
                dd.ReasonCodeID = reasonCodeID;
                dd.ReasonCode = reasonCode;
                dd.Line = line;
                dd.Comment = comment;
                dd.Client = client;
                dd.IsCreatedByAcromag = true;
                db.AddToDowntimeDataSet(dd);

                if (db.SaveChanges() > 0)
                {
                    result = dd.ID;
                    DBHelper.UpdateAscommPing(client, DateTime.Now, line, true);
                }

            }

            return result;
        }
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:58,代码来源:DSCWS.asmx.cs

示例5: CreateTComDowntimeEvent

        public int CreateTComDowntimeEvent(string eStart, string eStop, decimal? minutes, string client, string line, string comment = null)
        {
            int result = 0;

            if (string.IsNullOrEmpty(eStart) || string.IsNullOrEmpty(eStop))
                return -1;

            DateTime eventStart;
            DateTime eventStop;

            if (!DateTime.TryParse(eStart, out eventStart))
                return -1;

            if (!DateTime.TryParse(eStop, out eventStop))
                return -1;

            if (eventStop < eventStart)
                return -1;

            if (minutes.HasValue == false)
                minutes = Convert.ToInt32(eventStop.Subtract(eventStart).TotalMinutes);

            decimal totalMinutes = (decimal)eventStop.Subtract(eventStart).TotalMinutes;

            if (totalMinutes > 60 && minutes < 60)//If eventstop is greater than an hour or more, but the minute difference isn't, then assume timezone conversion or something is wrong for the times
            {
                //assume Event Start is correct
                eventStop = eventStart.AddMinutes((double)minutes);
            }

            using (DB db = new DB())
            {
                if (alreadyExists(client, line, eventStart, eventStop) == true)
                    return -2;

                DowntimeData dd = new DowntimeData();

                dd.EventStart = eventStart;
                dd.EventStop = eventStop;

                dd.Minutes = minutes;
                dd.ReasonCodeID = null;
                dd.ReasonCode = null;
                dd.Line = line;
                dd.Comment = comment;
                dd.Client = client;
                dd.IsCreatedByAcromag = true;
                db.AddToDowntimeDataSet(dd);

                if (db.SaveChanges() <= 0) return result;

                result = dd.ID;
                DBHelper.UpdateAscommPing(client, DateTime.Now, line, true);
            }

            return result;
        }
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:57,代码来源:DSCWS.asmx.cs

示例6: Stop

 private bool Stop(DateTime start,DateTime stop)
 {
     DowntimeData newdd = new DowntimeData() { EventStart = start, EventStop = stop, Minutes = Convert.ToDecimal(stop.Subtract(start).TotalSeconds) / 60 };
     using (DB db = new DB(DBHelper.GetConnectionString(_currentClient)))
     {
         db.AddToDowntimeDataSet(newdd);
         db.SaveChanges();
     }
     return true;
 }
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:10,代码来源:Service.ashx.cs

示例7: CreateDowntimeDataWithTimeZone

        public bool CreateDowntimeDataWithTimeZone(DateTime? eventStart, DateTime? eventStop, string strTimeZone, decimal? minutes, string reasonCode, int? reasonCodeID, string comment, string line, string client)
        {
            bool result = false;

            if (eventStart.HasValue == false || eventStop.HasValue == false)
                return false;

            if (minutes.HasValue == false)
                minutes = Convert.ToInt32(eventStop.Value.Subtract(eventStart.Value).TotalMinutes);

            if (!string.IsNullOrEmpty(strTimeZone))
            {
                TimeZoneInfo timeZone = TimeZoneInfo.FromSerializedString(strTimeZone);

                eventStart = TimeZoneInfo.ConvertTime(eventStart.Value, timeZone);
                eventStop = TimeZoneInfo.ConvertTime(eventStop.Value, timeZone);
            }

            using (DB db = new DB())
            {
                DowntimeData latestDowntime = (from o in db.DowntimeDataSet
                                               where o.Client == client && o.Line == line
                                               orderby o.EventStop.Value descending
                                               select o).FirstOrDefault();

                DateTime? latestDate = null;

                if (latestDowntime != null)
                    latestDate = latestDowntime.EventStop;

                bool create = !latestDate.HasValue;

                DowntimeData dd = new DowntimeData();

                if (latestDate.HasValue)
                {
                    create = !(latestDate.Value >= eventStop);
                }

                if (create)
                {
                    //dd.EventStart = eventStart;
                    //dd.EventStop = eventStop;
                    dd.EventStart = eventStart;
                    dd.EventStop = eventStop;

                    dd.Minutes = minutes;
                    dd.ReasonCodeID = reasonCodeID;
                    dd.ReasonCode = reasonCode;
                    dd.Line = line;
                    dd.Comment = comment;
                    dd.Client = client;
                    dd.IsCreatedByAcromag = true;
                    db.AddToDowntimeDataSet(dd);
                    result = db.SaveChanges() > 0;

                    if (result == true)
                    {
                        DBHelper.UpdateAscommPing(client, DateTime.Now, line, true);
                    }
                }

            }

            return result;
        }
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:66,代码来源:DSCWS.asmx.cs

示例8: SplitDowntime

        private string SplitDowntime(int downtimeId, decimal minutes)
        {
            using (var db = new DB(DBHelper.GetConnectionString(_currentClient)))
            {
                var q = from o in db.DowntimeDataSet
                    where o.ID == downtimeId
                    select o;

                DowntimeData dd = q.FirstOrDefault();
                if (dd == null) return "false";

                var seconds = Convert.ToInt32(minutes*60);
                if (dd.EventStop != null)
                {
                    dd.EventStop = dd.EventStop.Value.Subtract(new TimeSpan(0, 0, 0, seconds));
                    dd.Minutes -= minutes;

                    DowntimeData dd2 = new DowntimeData
                    {
                        Client = dd.Client,
                        ReasonCode = null,
                        ReasonCodeID = null,
                        Line = dd.Line,
                        Minutes = minutes,
                        Comment = string.Empty,
                        EventStart = dd.EventStop,
                        EventStop = dd.EventStop.Value.AddSeconds(Convert.ToInt32(minutes*60))
                    };

                    db.AddToDowntimeDataSet(dd2);
                }
                db.SaveChanges();
            }

            return "true";
        }
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:36,代码来源:Service.ashx.cs

示例9: Save


//.........这里部分代码省略.........
                var q = from o in db.DowntimeDataSet
                        where o.ID == id
                        select o;
                var dd = q.FirstOrDefault();
                if (dd == null) return false.ToString().ToLower();
                DowntimeReason reason = DCSDashboardDemoHelper.getReason(reasonId);

                if (dd.EventStop.HasValue == false)
                {

                    if (!DateTime.TryParse(request.Form["enddatetime"], out enddatetime))
                    {
                        context.Response.Write("end date time is empty.");
                        return "false";
                    }

                    dd.EventStop = enddatetime;
                    if (dd.EventStart != null)
                        dd.Minutes = Convert.ToDecimal(dd.EventStop.Value.Subtract(dd.EventStart.Value).TotalMinutes);

                    changeMinutes = false;

                    SwitchLineStatus(line, true);
                }

                dd.ReasonCodeID = reasonId;
                dd.ReasonCode = reasonCode;
                dd.Line = line;
                dd.Comment = comment;

                if(changeMinutes)
                    dd.Minutes = minutes;

                dd.Client = client;

                if (reason.HideReasonInReports && dd.Minutes > reason.Duration && reason.Duration > 0)//If Planned && duration is greater than 0
                {
                    DowntimeChild child1 = (from o in db.DowntimeChildren
                        where o.ParentDowntimeId == dd.ID
                        select o).FirstOrDefault();

                    if (child1 == null)
                    {
                        if (dd.EventStart != null)
                        {
                            dd.EventStop = dd.EventStart.Value.AddMinutes(reason.Duration);
                            // Tim mark

                            DowntimeData dd2 = new DowntimeData
                            {
                                Client = dd.Client,
                                ReasonCode = null,
                                ReasonCodeID = null,
                                Line = dd.Line,
                                Minutes = dd.Minutes - reason.Duration,
                                Comment = string.Empty,
                                EventStart = dd.EventStop
                            };
                            dd2.EventStop = dd.EventStop.Value.AddMinutes(Convert.ToDouble(dd2.Minutes));

                            child1 = new DowntimeChild {ParentDowntimeId = dd.ID};

                            dd.Minutes = reason.Duration;//Change after setting dd2's minutes

                            db.AddToDowntimeDataSet(dd2);
                            db.SaveChanges();

                            child1.DowntimeId = dd2.ID;
                            child1.ReasonCodeId = reason.ID;

                            db.AddToDowntimeChildren(child1);
                        }

                        db.SaveChanges();
                    }

                }
                else
                {
                    db.SaveChanges();
                }

                result = true;

                if (reason.IsChangeOver && throughputId > 0)
                {
                    DCSDashboardDemoHelper.CreateThroughPutHistory(throughputId, option1Id, option2Id, dd.EventStop.Value, line);
                }
                else if (option1Id > 0 || option2Id > 0)
                {
                    if (option1Id > 0)
                        DCSDashboardDemoHelper.CreateNOS(dd.ID, option1Id);

                    if (option2Id > 0)
                        DCSDashboardDemoHelper.CreateNOS(dd.ID, option2Id);
                }
            }

            return result.ToString().ToLower();
        }
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:101,代码来源:Service.ashx.cs

示例10: CreateDTWithNoStop

        public string CreateDTWithNoStop()
        {
            DateTime sd;

            if (!DateTime.TryParse(request.Params["sd"], out sd))
            {
                return null;
            }

            using (DB db = new DB(DBHelper.GetConnectionString(_currentClient)))
            {
                DowntimeData dt = new DowntimeData();

                dt.Client = _currentClient;
                dt.EventStart = sd;
                dt.EventStop = null;
                dt.Line = Line;
                dt.Minutes = 0;

                db.AddToDowntimeDataSet(dt);

                db.SaveChanges();

                SwitchLineStatus(Line, false);

                return ConvertToJsonString(new
                {
                    ID = dt.ID,
                    EventStart = (dt.EventStart.Value.ToString("MM/dd/yyyy hh:mm:ss tt")),
                    EventStop = "",
                    ReasonCodeID = dt.ReasonCodeID,
                    ReasonCode = dt.ReasonCode,
                    Minutes = (dt.Minutes.Value),
                    Line = dt.Line,
                    Comment = dt.Comment
                });
            }
        }
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:38,代码来源:Service.ashx.cs

示例11: addNewEvent

        private void addNewEvent(HttpContext context)
        {
            //reasonId&reasonCode&comment&startdatetime&minutes&line
            int reasonId, occurences;

            int throughputId, option1Id, option2Id = -1;

            DateTime startdatetime;
            decimal minutes;
            var reasonCode = request.Form["reasonCode"];
            var comment = request.Form["comment"];
            var line = request.Form["line"];

            line = line.Replace('#', ' ');

            var client = _currentClient;

            int.TryParse(request.Form["Occurences"], out occurences);
            if (occurences == 0) occurences = 1;

            int.TryParse(request.Form["throughput"], out throughputId);
            int.TryParse(request.Form["option1"], out option1Id);
            int.TryParse(request.Form["option2"], out option2Id);

            if(!DateTime.TryParse(request.Form["startdatetime"],out startdatetime))
            {
                context.Response.Write("start date time is empty.");
                return;
            }

            if(!int.TryParse(request.Form["reasonId"],out reasonId))
            {
                context.Response.Write("reason id is empty.");
                return;
            }

            if(!decimal.TryParse(request.Form["minutes"],out minutes))
            {
                context.Response.Write("minutes id is empty.");
                return;
            }

            if(string.IsNullOrEmpty(line))
            {
                context.Response.Write("line is empty.");
                return;
            }

            if(string.IsNullOrEmpty(reasonCode))
            {
                context.Response.Write("reasonCode is empty.");
                return;
            }

            var enddatetime = startdatetime.AddMinutes(Convert.ToDouble(minutes));

            bool result = false;
            using (DB db = new DB(DBHelper.GetConnectionString(_currentClient)))
            {
                int count = 0;

                DowntimeReason reason = (from o in db.DowntimeReasonSet
                                         where o.ID == reasonId
                                         select o).FirstOrDefault();

                if (reason == null)
                    context.Response.Write("Reason Code doesn't exist");

                if (throughputId > 0 && reason.IsChangeOver)
                {
                    var throughput = (from o in db.Throughput where o.Id == throughputId select o).FirstOrDefault();
                    reasonCode = string.Format("{0} [{1}]", reasonCode, throughput.Name);
                }

                List<DowntimeData> dts = new List<DowntimeData>();

                for (int cpnum = count; cpnum < occurences; cpnum++)
                {
                    DowntimeData dd = new DowntimeData();
                    dd.EventStart = startdatetime;
                    dd.EventStop = enddatetime;
                    dd.Minutes = minutes;
                    dd.ReasonCodeID = reasonId;
                    dd.ReasonCode = reasonCode;
                    dd.Line = line;
                    dd.Comment = comment;
                    dd.Client = client;
                    dd.IsCreatedByAcromag = false;
                    db.AddToDowntimeDataSet(dd);

                    dts.Add(dd);
                }

                int updatedRecords = db.SaveChanges();

                if (throughputId > 0 && reason.IsChangeOver)
                {
                    DCSDashboardDemoHelper.CreateThroughPutHistory(throughputId, option1Id, option2Id, enddatetime, line);
                }
                else if(option1Id > 0 || option2Id > 0)
//.........这里部分代码省略.........
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:101,代码来源:Service.ashx.cs

示例12: addNewEvent

        private void addNewEvent(HttpContext context)
        {
            //reasonId&reasonCode&comment&startdatetime&minutes&line
            int reasonId, occurences;

            int throughputId, option1Id, option2Id = -1;

            string reasonCode, comment, line,client;
            DateTime startdatetime, enddatetime;
            decimal minutes;
            reasonCode=request.Form["reasonCode"];
            comment=request.Form["comment"];
            line=request.Form["line"];

            line = line.Replace('#', ' ');

            client = _currentClient;

            int.TryParse(request.Form["Occurences"], out occurences);
            if (occurences == 0) occurences = 1;

            int.TryParse(request.Form["throughput"], out throughputId);
            int.TryParse(request.Form["option1"], out option1Id);
            int.TryParse(request.Form["option2"], out option2Id);

            if(!DateTime.TryParse(request.Form["startdatetime"],out startdatetime))
            {
                context.Response.Write("start date time is empty.");
                return;
            }

            if(!int.TryParse(request.Form["reasonId"],out reasonId))
            {
                context.Response.Write("reason id is empty.");
                return;
            }

            if(!decimal.TryParse(request.Form["minutes"],out minutes))
            {
                context.Response.Write("minutes id is empty.");
                return;
            }

            if(string.IsNullOrEmpty(line))
            {
                context.Response.Write("line is empty.");
                return;
            }

            if(string.IsNullOrEmpty(reasonCode))
            {
                context.Response.Write("reasonCode is empty.");
                return;
            }

            enddatetime=startdatetime.AddMinutes(Convert.ToDouble(minutes));

            bool result = false;
            using (DB db = new DB(DBHelper.GetConnectionString(_currentClient)))
            {
                int count = 0;

                /*
                if (id > 0)
                {
                    DowntimeData dt = (from o in db.DowntimeDataSet
                                       where o.ID == id
                                       select o).FirstOrDefault();

                    if (dt != null)
                    {
                        startdatetime = dt.EventStart.Value;//Update STartTime
                        dt.EventStop = enddatetime;
                        dt.Minutes = minutes;
                        dt.Comment = comment;
                        dt.ReasonCode = reasonCode;
                        dt.ReasonCodeID = reasonId;

                        SwitchLineStatus(line, true);

                        count = 1;//We already added a dt
                    }
                }
                 */

                for (int cpnum = count; cpnum < occurences; cpnum++)
                {
                    DowntimeData dd = new DowntimeData();
                    dd.EventStart = startdatetime;
                    dd.EventStop = enddatetime;
                    dd.Minutes = minutes;
                    dd.ReasonCodeID = reasonId;
                    dd.ReasonCode = reasonCode;
                    dd.Line = line;
                    dd.Comment = comment;
                    dd.Client = client;
                    db.AddToDowntimeDataSet(dd);
                }

                if (throughputId > 0)
//.........这里部分代码省略.........
开发者ID:bsimp6983,项目名称:BackupDashes,代码行数:101,代码来源:Service_bk.ashx.cs


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