public OneItemTimeTable(TimeTableInfoWithRtuOrGrpBandingInfo.TimeTableItem weektable) { LuxName = "无"; TimeDesc = weektable.TimeDesc; TimeTableId = weektable.TimeId; TimeTableName = weektable.TimeName; //LuxId = weektable.LuxId; LuxOnValue = weektable.LuxOnValue; LuxOffValue = weektable.LuxOffValue; LightOffOffset = weektable.LightOffOffset; LightOnOffset = weektable.LightOnOffset; LuxEffective = weektable.LuxEffective; }
public TimeTableInfoWithRtuOrGrpBandingInfo.TimeTableItem BackToWeekTimeTableInforemation() { var weekTimeTable = new TimeTableInfoWithRtuOrGrpBandingInfo.TimeTableItem(); weekTimeTable.TimeDesc = this.TimeDesc; weekTimeTable.TimeId = this.TimeTableId; weekTimeTable.TimeName = this.TimeTableName; //weekTimeTable.LuxId = this.LuxId; weekTimeTable.LuxOnValue = this.LuxOnValue; weekTimeTable.LuxOffValue = this.LuxOffValue; weekTimeTable.LightOffOffset = this.LightOffOffset; weekTimeTable.LightOnOffset = this.LightOnOffset; weekTimeTable.LuxEffective = this.LuxEffective; //foreach (var t in this.OneWeekTimeTable) //{ // weekTimeTable.LstOneWeekOpenCloseControl.Add(t.BackToWeekTimeTableItemInfomation()); //} return(weekTimeTable); }
public OneLoopOneWeekTimeViewModel(List <List <ZhaoCeInfo.ZhaoCeWeekSetYear> > oneLoopOneWeek, int maxsection, TimeTableInfoWithRtuOrGrpBandingInfo.TimeTableItem timeTableItem, int loopid) { try { DateTimeRecevie = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");; for (int i = 0; i < 7; i++) { this.ZhaoCeRtuItems.Add(new ZhaoCeRtuItemsStyle()); this.ZhaoCeRtuItems[i].ZhaoCeWeek = i; //this.ZhaoCeRtuItems[i].DateTimeRecevie = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); this.ZhaoCeRtuItems[i].ZhaoCeDate = DateTime.Now.AddDays(i - (int)DateTime.Now.DayOfWeek).ToString("yyyy.MM.dd"); } var str = new Dictionary <Tuple <int, int>, string>(); if (timeTableItem.RuleItems != null) { foreach (var t in timeTableItem.RuleItems) { for (int i = 0; i < 7; i++) { if (t.DayOfWeekUsed.Contains(i)) { int sunrise = Wlst.Sr.TimeTableSystem.Services.SunRiseSetInfoServices.GetSunRiseItemInfo( int.Parse(this.ZhaoCeRtuItems[i].ZhaoCeDate.Substring(5, 2)), int.Parse(this.ZhaoCeRtuItems[i].ZhaoCeDate.Substring(8, 2))).time_sunrise; int sunset = Wlst.Sr.TimeTableSystem.Services.SunRiseSetInfoServices.GetSunRiseItemInfo( int.Parse(this.ZhaoCeRtuItems[i].ZhaoCeDate.Substring(5, 2)), int.Parse(this.ZhaoCeRtuItems[i].ZhaoCeDate.Substring(8, 2))).time_sunset; var str1 = CalculateTimeOnOff(timeTableItem.LightOnOffset, timeTableItem.LightOffOffset, t.TimeOn, t.TimeOff, sunset, sunrise, t.TypeOn, t.TypeOff); var tu = new Tuple <int, int>(i, t.TimetableSectionId); str.Add(tu, str1); } } } } else { for (int i = 0; i < 7; i++) { var str1 = "25:00-25:00"; var tu = new Tuple <int, int>(i, 1); str.Add(tu, str1); } } var flg = 0; foreach (var t in oneLoopOneWeek) { if (t.Count > flg) { flg = t.Count; } } if (flg > 0) { this.LoopId = loopid; if (maxsection > 0) { for (int i = 0; i < 7; i++) { this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne = CalculateTimeAndBak(i, 1, oneLoopOneWeek, str).Item1; this.ZhaoCeRtuItems[i].ZhaoCeBak = new List <string>() { CalculateTimeAndBak(i, 1, oneLoopOneWeek, str).Item2 }; } this.ZhaoCeIsOverOne = new List <bool>() { false, false, false }; this.ZhaoCeType = 300; this.ZhaoCeScroll = "Disabled"; if (maxsection > 1) { for (int i = 0; i < 7; i++) { this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffTwo = CalculateTimeAndBak(i, 2, oneLoopOneWeek, str).Item1; this.ZhaoCeRtuItems[i].ZhaoCeBak.Add(CalculateTimeAndBak(i, 2, oneLoopOneWeek, str).Item2); } this.ZhaoCeIsOverOne = new List <bool>() { true, false, false }; this.ZhaoCeType = 150; this.ZhaoCeScroll = "Disabled"; if (maxsection > 2) { for (int i = 0; i < 7; i++) { this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffThree = CalculateTimeAndBak(i, 3, oneLoopOneWeek, str).Item1; this.ZhaoCeRtuItems[i].ZhaoCeBak.Add(CalculateTimeAndBak(i, 3, oneLoopOneWeek, str).Item2); } this.ZhaoCeIsOverOne = new List <bool>() { true, true, false }; this.ZhaoCeScroll = "Auto"; if (maxsection == 4) { for (int i = 0; i < 7; i++) { this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffFour = CalculateTimeAndBak(i, 4, oneLoopOneWeek, str).Item1; this.ZhaoCeRtuItems[i].ZhaoCeBak.Add(CalculateTimeAndBak(i, 4, oneLoopOneWeek, str).Item2); } this.ZhaoCeIsOverOne = new List <bool>() { true, true, true }; } } } } } else { for (int i = 0; i < 7; i++) { this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne = "25:00-25:00"; this.ZhaoCeRtuItems[i].ZhaoCeBak = new List <string>() { CalculateTimeAndBak(i, 1, oneLoopOneWeek, str).Item2 }; } this.ZhaoCeIsOverOne = new List <bool>() { false, false, false }; this.ZhaoCeType = 300; this.ZhaoCeScroll = "Disabled"; } } catch (Exception) { } }
public OneLoopOneWeekTimeViewModel(Wlst.client.ZhaoCeInfo.ZhaoCeOneLoopOneWeekTime oneLoopOneWeek, TimeTableInfoWithRtuOrGrpBandingInfo.TimeTableItem timeTableItem, bool flg) { this.LoopId = oneLoopOneWeek.LoopId; //this.MondayTime = oneLoopOneWeek.MondayTime.Insert(2, ":").Insert(8, ":"); //this.TuesdayTime = oneLoopOneWeek.TuesdayTime.Insert(2, ":").Insert(8, ":"); //this.WednesdayTime = oneLoopOneWeek.WednesdayTime.Insert(2, ":").Insert(8, ":"); //this.ThursdayTime = oneLoopOneWeek.ThursdayTime.Insert(2, ":").Insert(8, ":"); //this.FridayTime = oneLoopOneWeek.FridayTime.Insert(2, ":").Insert(8, ":"); //this.SaturdayTime = oneLoopOneWeek.SaturdayTime.Insert(2, ":").Insert(8, ":"); //this.SundayTime = oneLoopOneWeek.SundayTime.Insert(2, ":").Insert(8, ":"); DateTimeRecevie = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); for (int i = 0; i < 7; i++) { this.ZhaoCeRtuItems.Add(new ZhaoCeRtuItemsStyle()); this.ZhaoCeRtuItems[i].ZhaoCeWeek = i; //this.ZhaoCeRtuItems[i].DateTimeRecevie = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); this.ZhaoCeRtuItems[i].ZhaoCeDate = DateTime.Now.AddDays(i - (int)DateTime.Now.DayOfWeek).ToString("yyyy.MM.dd"); } this.ZhaoCeRtuItems[1].ZhaoCeTimeOnOffOne = oneLoopOneWeek.MondayTime.Insert(2, ":").Insert(8, ":"); this.ZhaoCeRtuItems[2].ZhaoCeTimeOnOffOne = oneLoopOneWeek.TuesdayTime.Insert(2, ":").Insert(8, ":"); this.ZhaoCeRtuItems[3].ZhaoCeTimeOnOffOne = oneLoopOneWeek.WednesdayTime.Insert(2, ":").Insert(8, ":"); this.ZhaoCeRtuItems[4].ZhaoCeTimeOnOffOne = oneLoopOneWeek.ThursdayTime.Insert(2, ":").Insert(8, ":"); this.ZhaoCeRtuItems[5].ZhaoCeTimeOnOffOne = oneLoopOneWeek.FridayTime.Insert(2, ":").Insert(8, ":"); this.ZhaoCeRtuItems[6].ZhaoCeTimeOnOffOne = oneLoopOneWeek.SaturdayTime.Insert(2, ":").Insert(8, ":"); this.ZhaoCeRtuItems[0].ZhaoCeTimeOnOffOne = oneLoopOneWeek.SundayTime.Insert(2, ":").Insert(8, ":"); this.ZhaoCeIsOverOne = new List <bool>() { false, false, false }; this.ZhaoCeType = 300; this.ZhaoCeScroll = "Disabled"; //var str1 = "25:00-25:00"; //var ruleitems = // new List<TimeTableInfoWithRtuOrGrpBandingInfo.TimeTableItem.TimeTableSectionRule>(); //if (flg == false) //{ // if (timeTableItem.RuleItems != null) // { // ruleitems = timeTableItem.RuleItems; // foreach (var t in ruleitems) // { // for (int i = 0; i < 7; i++) // { // this.ZhaoCeRtuItems[i].ZhaoCeBak = new List<string>(); // if (t.DayOfWeekUsed.Contains(i)) // { // int sunrise = Wlst.Sr.TimeTableSystem.Services.SunRiseSetInfoServices.GetSunRiseItemInfo( // int.Parse(this.ZhaoCeRtuItems[i].ZhaoCeDate.Substring(5, 2)), int.Parse(this.ZhaoCeRtuItems[i].ZhaoCeDate.Substring(8, 2))).time_sunrise; // int sunset = Wlst.Sr.TimeTableSystem.Services.SunRiseSetInfoServices.GetSunRiseItemInfo( // int.Parse(this.ZhaoCeRtuItems[i].ZhaoCeDate.Substring(5, 2)), int.Parse(this.ZhaoCeRtuItems[i].ZhaoCeDate.Substring(8, 2))).time_sunset; // str1 = CalculateTimeOnOff(timeTableItem.LightOnOffset, timeTableItem.LightOffOffset, t.TimeOn, t.TimeOff, sunset, sunrise, t.TypeOn, t.TypeOff); // } // else // { // str1 = "25:00-25:00"; // } // if (this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne == str1) // { // this.ZhaoCeRtuItems[i].ZhaoCeBak.Add(""); // } // else // { // this.ZhaoCeRtuItems[i].ZhaoCeBak.Add("Red"); // } // } // } // } // else // { // for (int i = 0; i < 7; i++) // { // this.ZhaoCeRtuItems[i].ZhaoCeBak = new List<string>(); // if (this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne == str1) // { // this.ZhaoCeRtuItems[i].ZhaoCeBak.Add(""); // } // else // { // this.ZhaoCeRtuItems[i].ZhaoCeBak.Add("Red"); // } // } // } //} //else //{ // for (int i = 0; i < 7; i++) // { // this.ZhaoCeRtuItems[i].ZhaoCeBak = new List<string>(); // this.ZhaoCeRtuItems[i].ZhaoCeBak.Add(""); // } //} //for (int i = 0; i < 7; i++) //{ // try // { // if (Convert.ToInt32(this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(0, 2)) * 100 + Convert.ToInt32(this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(3, 2)) // > Convert.ToInt32(this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(6, 2)) * 100 + Convert.ToInt32(this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(9, 2)) // && Convert.ToInt32(this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(6, 2)) != 25) // { // this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne = this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne + "(明)"; // } // } // catch (Exception) // {} // if (this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(0, 2) == "25") // { // this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne = "25:00-25:00" + // this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(5, 6); // } // if (this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(6, 2) == "25") // { // this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne = this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(0, 6) + "25:00-25:00"; // } //} var str1 = "25:00-25:00"; var ruleitems = new List <TimeTableInfoWithRtuOrGrpBandingInfo.TimeTableItem.TimeTableSectionRule>(); if (flg == false) { if (timeTableItem.RuleItems != null) { ruleitems = timeTableItem.RuleItems; var daylst = new List <int>() { 0, 1, 2, 3, 4, 5, 6 }; foreach (var t in ruleitems) { for (int i = 0; i < 7; i++) { this.ZhaoCeRtuItems[i].ZhaoCeBak = new List <string>(); if (t.DayOfWeekUsed.Contains(i)) { int sunrise = Wlst.Sr.TimeTableSystem.Services.SunRiseSetInfoServices.GetSunRiseItemInfo( int.Parse(this.ZhaoCeRtuItems[i].ZhaoCeDate.Substring(5, 2)), int.Parse(this.ZhaoCeRtuItems[i].ZhaoCeDate.Substring(8, 2))).time_sunrise; int sunset = Wlst.Sr.TimeTableSystem.Services.SunRiseSetInfoServices.GetSunRiseItemInfo( int.Parse(this.ZhaoCeRtuItems[i].ZhaoCeDate.Substring(5, 2)), int.Parse(this.ZhaoCeRtuItems[i].ZhaoCeDate.Substring(8, 2))).time_sunset; str1 = CalculateTimeOnOff(timeTableItem.LightOnOffset, timeTableItem.LightOffOffset, t.TimeOn, t.TimeOff, sunset, sunrise, t.TypeOn, t.TypeOff); if (this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne == str1) { this.ZhaoCeRtuItems[i].ZhaoCeBak.Add(""); } else { this.ZhaoCeRtuItems[i].ZhaoCeBak.Add("Red"); } if (daylst.Contains(i)) { daylst.Remove(i); } } } } foreach (var t in daylst) { str1 = "25:00-25:00"; if (this.ZhaoCeRtuItems[t].ZhaoCeTimeOnOffOne == str1) { this.ZhaoCeRtuItems[t].ZhaoCeBak.Add(""); } else { this.ZhaoCeRtuItems[t].ZhaoCeBak.Add("Red"); } } } else { for (int i = 0; i < 7; i++) { this.ZhaoCeRtuItems[i].ZhaoCeBak = new List <string>(); if (this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne == str1) { this.ZhaoCeRtuItems[i].ZhaoCeBak.Add(""); } else { this.ZhaoCeRtuItems[i].ZhaoCeBak.Add("Red"); } } } } else { for (int i = 0; i < 7; i++) { this.ZhaoCeRtuItems[i].ZhaoCeBak = new List <string>(); this.ZhaoCeRtuItems[i].ZhaoCeBak.Add(""); } } for (int i = 0; i < 7; i++) { try { if (Convert.ToInt32(this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(0, 2)) * 100 + Convert.ToInt32(this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(3, 2)) > Convert.ToInt32(this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(6, 2)) * 100 + Convert.ToInt32(this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(9, 2)) && Convert.ToInt32(this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(6, 2)) != 25) { this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne = this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne + "(明¡Â)"; } } catch (Exception) { } //if (this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(0, 2) == "25") //{ // this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne = "25:00-25:00" + // this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(5, 6); //} //if (this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(6, 2) == "25") //{ // this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne = this.ZhaoCeRtuItems[i].ZhaoCeTimeOnOffOne.Substring(0, 6) + "25:00-25:00"; //} } }