Ejemplo n.º 1
0
        public override int GetHashCode()
        {
            var hashCode = 77621969;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Id);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(PriceFileId);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ExternalRefId);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ProductId);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(PartId);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Sku);

            hashCode = hashCode * -1521134295 + PriceNet.GetHashCode();
            hashCode = hashCode * -1521134295 + PriceNetFull.GetHashCode();
            hashCode = hashCode * -1521134295 + PriceRetail.GetHashCode();
            hashCode = hashCode * -1521134295 + PriceRetailFull.GetHashCode();
            hashCode = hashCode * -1521134295 + DateStart.GetHashCode();
            hashCode = hashCode * -1521134295 + DateEnd.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(PromoCode);

            hashCode = hashCode * -1521134295 + EqualityComparer <long?> .Default.GetHashCode(Priority);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Note);

            return(hashCode);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Agenda(string datestart = null)
        {
            DateTime DateStart;

            if (String.IsNullOrWhiteSpace(datestart) || !DateTime.TryParse(datestart, out DateStart) || DateStart == DateTime.MinValue)
            {
                DateStart = DateTime.Now;
            }

            try
            {
                List <AgendaResponse> agendaResponses = new List <AgendaResponse>();
                for (int i = 0; i <= 7; i++)
                {
                    agendaResponses.Add(new AgendaResponse()
                    {
                        Date   = DateStart.AddDays(i),
                        Wod    = await _wodService.GetWodByDate(DateStart.AddDays(i)),
                        IsRest = await _restdayService.IsRestDay(DateStart.AddDays(i))
                    });
                }

                agendaResponses = agendaResponses.OrderBy(x => x.Date).ToList();
                return(Ok(agendaResponses));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Agenda error: {ex.Message} - Date: {DateStart.ToLongDateString()}");
                return(BadRequest());
            }
        }
Ejemplo n.º 3
0
        //ToString returns string with info about the contract
        public override string ToString()
        {
            string result = "";

            result += string.Format("Number Of Contract:{0}\n", NumberOfContract);
            result += string.Format("Nunny ID:{0}\n", NunnyID);
            result += string.Format("Mother ID:{0}\n", MotherID);
            result += string.Format("Child ID:{0}\n", ChildID);
            result += string.Format("Was there Interview?{0}\n", IsInterview);
            result += string.Format("Rate for Hour: {0}\n", RateforHour);
            result += string.Format("Rate for Month: {0}\n", RateforMonth);
            result += string.Format("Is there any more children in the nunny? {0}\n", IsMorechilds);
            result += "Work Time:\n";
            foreach (var item in WorkTime)  //loop over days in week
            {
                result += "day: " + item.Key + "   \t";
                result += "hours " + ((((item.Value.Key) / 100) < 10) ? ("0") : (null)) + ((item.Value.Key) / 100);
                result += ":" + ((((item.Value.Key) % 100) < 10) ? "0" : (null)) + (item.Value.Key) % 100 + " - ";
                result += ((((item.Value.Value) / 100) < 10) ? ("0") : (null)) + (item.Value.Value) / 100;
                result += ":" + ((((item.Value.Value) % 100) < 10) ? "0" : (null)) + (item.Value.Value) % 100 + '\n';
            }
            result += string.Format("Date of Start:{0}\n", DateStart.ToShortDateString());
            result += string.Format("Date of End: {0}\n", DateEnd.ToShortDateString());
            result += string.Format("Hours Of Contract: {0}\n", HoursOfContractMonth);
            return(result);
        }
Ejemplo n.º 4
0
        private bool Validation()
        {
            bool result = true;

            if (result && (txtName.Text == null || txtName.Text.Trim() == string.Empty))
            {
                result = false;
                txtName.Focus();
                ClassLibrary.JMessages.Error("لطفاً عنوان را وارد کنید.", "");
            }

            if (result && DateStart.Date != DateTime.MinValue && !DateStart.IsValidDate())
            {
                result = false;
                DateStart.Focus();
                ClassLibrary.JMessages.Error("تاریخ آغاز معتبر نیست", "");
            }

            if (result && DateEnd.Date != DateTime.MinValue && !DateEnd.IsValidDate())
            {
                result = false;
                DateEnd.Focus();
                ClassLibrary.JMessages.Error("تاریخ پایان معتبر نیست", "");
            }

            if (DateEnd.Date != DateTime.MinValue && DateStart.Date > DateEnd.Date)
            {
                ClassLibrary.JMessages.Error("لطفا تاریخ شروع و پایان را بصورت صحیح وارد کنید", "خطا");
                return(false);
            }
            return(result);
        }
Ejemplo n.º 5
0
        public string exportAsICS()
        {
            //create a new stringbuilder instance
            StringBuilder sb = new StringBuilder();

            //start the calendar item
            sb.AppendLine("BEGIN:VCALENDAR");
            sb.AppendLine("VERSION:2.0");
            sb.AppendLine("PRODID:BilleterieEPITA");

            //add the event
            sb.AppendLine("BEGIN:VEVENT");

            //DTSTART: Date de début de l'événement
            sb.AppendLine("DTSTART;TZID=Europe/Paris:" + DateStart.ToString("yyyyMMddTHHmm00"));
            //sb.AppendLine("DTSTART:" + DateStart.ToString("yyyyMMddTHHmm00"));
            //DTEND: Date de fin de l'événement
            sb.AppendLine("DTEND;TZID=Europe/Paris:" + DateEnd.ToString("yyyyMMddTHHmm00"));
            //sb.AppendLine("DTEND:" + DateEnd.ToString("yyyyMMddTHHmm00"));

            sb.AppendLine("ORGANIZER:CN=" + Organizer + ":MAILTO:" + OrganizerEmail);

            //SUMMARY: Titre de l'événement
            sb.AppendLine("SUMMARY:" + Summary + "");
            //LOCATION: Lieu de l'événement
            sb.AppendLine("LOCATION:" + Location + "");
            //DESCRIPTION: Description de l'événement
            sb.AppendLine("DESCRIPTION:" + Description + "");

            //CATEGORIES: Catégorie de l'événement (ex: Conférence, Fête...)
            //STATUS: Statut de l'événement (TENTATIVE, CONFIRMED, CANCELLED)
            //TRANSP: Définit si la ressource affectée à l'événement est rendu indisponible (OPAQUE, TRANSPARENT)
            //SEQUENCE: Nombre de mises à jour, la première mise à jour est à 1


            sb.AppendLine("PRIORITY:" + Priority.ToString());

            sb.AppendLine("END:VEVENT");

            //end calendar item
            sb.AppendLine("END:VCALENDAR");

            //create a string from the stringbuilder
            string CalendarItem = sb.ToString();

            return(CalendarItem);
            //send the calendar item to the browser

            /*
             * Response.ClearHeaders();
             * Response.Clear();
             * Response.Buffer = true;
             * Response.ContentType = "text/calendar";
             * Response.AddHeader("content-length", CalendarItem.Length.ToString());
             * Response.AddHeader("content-disposition", "attachment; filename=\"" + FileName + ".ics\"");
             * Response.Write(CalendarItem);
             * Response.Flush();
             * HttpContext.Current.ApplicationInstance.CompleteRequest();
             */
        }
Ejemplo n.º 6
0
 public void ReadData()
 {
     Logger.info(String.Format("Чтение данных за {0} по объекту ", DateStart.ToString("dd.MM.yyyy")));
     foreach (KeyValuePair <string, string> de in Names)
     {
         try {
             SqlConnection con = getConnection();
             con.Open();
             string comSTR = "";
             comSTR = String.Format("SELECT DATA_DATE,VALUE0, SEASON FROM DATA WHERE OBJECT={0} AND OBJTYPE={1} AND ITEM={2} AND PARNUMBER=12 AND DATA_DATE>'{3}' AND DATA_DATE<='{4}'",
                                    Data[de.Key].Source.Obj, Data[de.Key].Source.ObjType, Data[de.Key].Source.Item, DateStart.ToString(DateFormat), DateEnd.ToString(DateFormat));
             SqlCommand    command = new SqlCommand(comSTR, con);
             SqlDataReader reader  = command.ExecuteReader();
             while (reader.Read())
             {
                 //Object dt=
                 DateTime date   = reader.GetDateTime(0);
                 double   val    = reader.GetDouble(1);
                 int      season = reader.GetInt32(2);
                 if (season >= CurrentSeason)
                 {
                     CurrentSeason = season;
                 }
                 try {
                     Data[de.Key].Values[date] = String.Format("{0:0.##}", val).Replace(",", ".");
                 } catch { }
             }
             reader.Close();
             con.Close();
         } catch (Exception e) {
             Logger.info("Ошибка при данных" + e.ToString());
         }
     }
 }
Ejemplo n.º 7
0
 private void UpdateDates()
 {
     layoutControlItemDateStart.Text = String.Format("<color=\"Gray\">Start: {0}</color>",
                                                     DateStart?.ToString("M/d/yy") ?? String.Empty);
     layoutControlItemDateEnd.Text = String.Format("<color=\"Gray\">End: {0}</color>",
                                                   DateEnd?.ToString("M/d/yy") ?? String.Empty);
 }
Ejemplo n.º 8
0
        //ValidateWithConfim (Email, Password)
        public void Validate(ModelStateDictionary modelState)
        {
            ValidationCheck.CheckErrors(this, modelState, true);

            //check start and end date
            if (DateStart.CompareTo(DateEnd) >= 0)
            {
                modelState.AddModelError("DateEnd", "End Date must be greater than Start Date.");
            }

            try
            {
                CategoriesList = new List <long>();
                if (!String.IsNullOrEmpty(Categories))
                {
                    CategoriesList.AddRange(Array.ConvertAll(Categories.Split(','), new Converter <string, long>(StringToLong)));
                }
            }
            catch (Exception ex)
            {
                modelState.AddModelError("Categories", ex.Message);
            }

            if (CategoriesList == null || CategoriesList.Count == 0)
            {
                modelState.AddModelError("CategoriesList", "Choose category(s) before updating this event.");
            }
        }
Ejemplo n.º 9
0
        public void sendDKData()
        {
            try
            {
                string header = "<tr><th>Дата<br/>получения</th><th>Время<br/>команды</th><th>ГОУ</th><th>Команда</th><th>Время<br/>начала</th><th>Время</br>окончания</th>";
                string table  = "";
                foreach (SDPMDKRecord rec in DKDataFull.Values)
                {
                    string s = "";
                    s     += String.Format("<td>{0}{1}</td>", rec.DKTrigger.ToString("dd.MM HH:mm:ss"), (rec.AutoDK?"":"<br/>Экспресс"));
                    s     += String.Format("<td>{0}</td>", rec.DKTime.ToString("dd.MM HH:mm"));
                    s     += String.Format("<td>{0}</td>", rec.GOU);
                    s     += String.Format("<td>{0}</td>", rec.DK);
                    s     += String.Format("<td>{0}</td>", rec.DKStartTime.ToString("dd.MM HH:mm"));
                    s     += String.Format("<td>{0}</td>", rec.DKEndTime.ToString("dd.MM HH:mm"));
                    s      = string.Format("<tr>{0}</tr>", s);
                    table += s;
                }
                table = string.Format("<table border='1'>{0}{1}</table></html>", header, table);


                //FileInfo file = new FileInfo("c:/int/ftpfolder/"+fn);
                System.Net.Mail.MailMessage mess = new System.Net.Mail.MailMessage();

                mess.From = new MailAddress(Settings.Single.SMTPFrom);

                mess.Subject = String.Format("Диспетчерские команды {0} - {1}", DateStart.ToString("dd.MM.yyyy"), DateEnd.ToString("dd.MM.yyyy"));
                mess.Body    = String.Format("<html><h1>{0}</h1>{1}</html>", mess.Subject, table);

                string[] mails = Settings.Single.DKMail.Split(';');
                foreach (string mail in mails)
                {
                    mess.To.Add(mail);
                }

                //mess.Attachments.Add(new Attachment(fn));

                mess.SubjectEncoding = System.Text.Encoding.UTF8;
                mess.BodyEncoding    = System.Text.Encoding.UTF8;
                mess.IsBodyHtml      = true;
                System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(Settings.Single.SMTPServer, Settings.Single.SMTPPort);
                client.EnableSsl = false;
                if (string.IsNullOrEmpty(Settings.Single.SMTPUser))
                {
                    client.UseDefaultCredentials = true;
                }
                else
                {
                    client.Credentials = new System.Net.NetworkCredential(Settings.Single.SMTPUser, Settings.Single.SMTPPassword, Settings.Single.SMTPDomain);
                }
                // Отправляем письмо
                client.Send(mess);
                Logger.Info("Данные в автооператор отправлены успешно");
            }
            catch (Exception e)
            {
                Logger.Error(String.Format("Ошибка при отправке почты: {0}", e.ToString()), Logger.LoggerSource.server);
                Logger.Info("Данные в автооператор не отправлены");
            }
        }
Ejemplo n.º 10
0
        protected bool validData()
        {
            bool result = true;

            if (txtDep.Text == "")
            {
                ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('查詢明細表時,部門編號不能為空!');", true);
                txtDep.Focus();
                result = false;
            }

            if (DateStart.Value.Trim() != "" && StrHlp.CheckDateFormat(DateStart.Value.Trim()) == false)
            {
                ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('批準日期格式不正確!');", true);
                DateStart.Focus();
                result = false;
            }
            else
            {
                if (DateEnd.Value.Trim() != "" && StrHlp.CheckDateFormat(DateEnd.Value.Trim()) == false)
                {
                    StrHlp.WebMessageBox(this.Page, "批準日期格式錯誤!");
                    DateEnd.Focus();
                    result = false;
                }
            }


            return(result);
        }
Ejemplo n.º 11
0
        public async Task <bool> ReadData(string GG)
        {
            report   = new EDSReport(DateStart.AddSeconds(0), DateEnd, EDSReportPeriod.minute);
            recF     = report.addRequestField(AllPoints[GG + "VT_GC01A-16.MCR@GRARM"], EDSReportFunction.val);
            recL_OGA = report.addRequestField(AllPoints[GG + "VT_PS00A-03.MCR@GRARM"], EDSReportFunction.val);
            recL_AGA = report.addRequestField(AllPoints[GG + "VT_PS00A-11.MCR@GRARM"], EDSReportFunction.val);
            recL_SB  = report.addRequestField(AllPoints[GG + "VT_PS00A-05.MCR@GRARM"], EDSReportFunction.val);
            recL_LB  = report.addRequestField(AllPoints[GG + "VT_PS00AI-07.MCR@GRARM"], EDSReportFunction.val);
            recL_NA  = report.addRequestField(AllPoints[GG + "VT_GC02A-86.MCR@GRARM"], EDSReportFunction.val);
            recL_RK  = report.addRequestField(AllPoints[GG + "VT_GC02A-68.MCR@GRARM"], EDSReportFunction.val);

            recD_MNU1 = report.addRequestField(AllPoints[GG + "VT_PS01DI-01.MCR@GRARM"], EDSReportFunction.max);
            recD_MNU2 = report.addRequestField(AllPoints[GG + "VT_PS02DI-01.MCR@GRARM"], EDSReportFunction.max);
            recD_MNU3 = report.addRequestField(AllPoints[GG + "VT_PS03DI-01.MCR@GRARM"], EDSReportFunction.max);

            recD_LA1 = report.addRequestField(AllPoints[GG + "VT_PS04DI-01.MCR@GRARM"], EDSReportFunction.max);
            recD_LA2 = report.addRequestField(AllPoints[GG + "VT_PS05DI-01.MCR@GRARM"], EDSReportFunction.max);

            recT_SB = report.addRequestField(AllPoints[GG + "VT_PS00A-21.MCR@GRARM"], EDSReportFunction.val);



            bool ok = await report.ReadData();

            if (!ok)
            {
                return(false);
            }


            return(ok);
        }
Ejemplo n.º 12
0
 private void T_Elapsed(object sender, ElapsedEventArgs e)
 {
     new Action(() =>
     {
         Seconds += 2;
         DateStart.AddMilliseconds(e.SignalTime.Millisecond);
     }).Invoke();
 }
Ejemplo n.º 13
0
        public override async Task ExecuteAsync(CBListPacket packet, ClientSession clientSession)
        {
            var itemssearch = packet.ItemVNumFilter.FirstOrDefault() == 0 ? new List <short>() : packet.ItemVNumFilter;

            var bzlist = await _bazaarHttpClient.GetBazaarLinksAsync(-1, packet.Index, 50, packet.TypeFilter, packet.SubTypeFilter,
                                                                     packet.LevelFilter, packet.RareFilter, packet.UpgradeFilter, null).ConfigureAwait(false);

            var bzlistsearched = bzlist.Where(s => itemssearch !.Contains(s.ItemInstance !.ItemVNum)).ToList();

            //price up price down quantity up quantity down
            var definitivelist = itemssearch.Any() ? bzlistsearched : bzlist;

            definitivelist = packet.OrderFilter switch
            {
                0 => definitivelist
                .OrderBy(s => _items.First(o => o.VNum == s.ItemInstance !.ItemVNum).Name[clientSession.Account.Language])
                .ThenBy(s => s.BazaarItem !.Price)
                .ToList(),
                1 => definitivelist
                .OrderBy(s => _items.First(o => o.VNum == s.ItemInstance !.ItemVNum).Name[clientSession.Account.Language])
                .ThenByDescending(s => s.BazaarItem !.Price)
                .ToList(),
                2 => definitivelist
                .OrderBy(s => _items.First(o => o.VNum == s.ItemInstance !.ItemVNum).Name[clientSession.Account.Language])
                .ThenBy(s => s.BazaarItem !.Amount)
                .ToList(),
                3 => definitivelist
                .OrderBy(s => _items.First(o => o.VNum == s.ItemInstance !.ItemVNum).Name[clientSession.Account.Language])
                .ThenByDescending(s => s.BazaarItem !.Amount)
                .ToList(),
                _ => definitivelist.OrderBy(s => _items.First(o => o.VNum == s.ItemInstance !.ItemVNum).Name[clientSession.Account.Language])
                .ToList()
            };

            await clientSession.SendPacketAsync(new RcbListPacket
            {
                PageIndex = packet.Index,
                Items     = definitivelist
                            .Where(s => ((s.BazaarItem !.DateStart.AddHours(s.BazaarItem.Duration) - SystemTime.Now())
                                         .TotalMinutes > 0) && (s.ItemInstance !.Amount > 0))
                            .Select(bzlink => new RcbListElementPacket
                {
                    AuctionId   = bzlink.BazaarItem !.BazaarItemId,
                    OwnerId     = bzlink.BazaarItem.SellerId,
                    OwnerName   = bzlink.SellerName,
                    ItemId      = bzlink.ItemInstance !.ItemVNum,
                    Amount      = bzlink.ItemInstance.Amount,
                    IsPackage   = bzlink.BazaarItem.IsPackage,
                    Price       = bzlink.BazaarItem.Price,
                    MinutesLeft =
                        (long)(bzlink.BazaarItem.DateStart.AddHours(bzlink.BazaarItem.Duration) - SystemTime.Now())
                        .TotalMinutes,
                    Unknown1 = false,
                    Unknown  = 2,
                    Rarity   = bzlink.ItemInstance.Rare,
                    Upgrade  = bzlink.ItemInstance.Upgrade,
                    EInfo    = new EInfoPacket()
                }).ToList() as List <RcbListElementPacket?>
Ejemplo n.º 14
0
		public void ReadNames() {
			Logger.info(String.Format("Чтение наименований за {0} по объекту [{1}-{2}]", DateStart.ToString("dd.MM.yyyy"), Source.Obj, Source.ObjType));
			Names = new Dictionary<string, string>();
			Data = new Dictionary<string, DataRecord>();
			/*for (int i = 0; i <= 50; i++) {
				string name = "Parametr" + i.ToString();
				string codeStr = String.Format("{0}_{1}_{2}", Source.Obj, Source.ObjType, i);
				Names.Add(codeStr, name);

				DataRecord rec = new DataRecord();
				rec.Key = codeStr;
				rec.Name = name;
				rec.Source = SourceInfo.getFullInfo(codeStr);
				rec.Values = new Dictionary<DateTime, string>();
				foreach (DateTime date in Dates) {
					rec.Values.Add(date, "---");
				}
				Data.Add(codeStr, rec);
			}
			return;*/
			try {
				SqlConnection con = getConnection();
				con.Open();
				string comSTR = "";
				if (Source.ObjType == 0) {
					int stationID = Source.Obj == 8737 ? 2 : Source.Obj == 8738 ? 1 : Source.Obj == 8739 ? 3 : Source.Obj == 8740 ? 4 : -1;
					comSTR = String.Format("SELECT NAME,CODE FROM SENSORS WHERE STATIONID={0} order by code", stationID);
				} else {
					comSTR = String.Format("SELECT NAME,CODE FROM CLIENTS order by code");
				}
				SqlCommand command = new SqlCommand(comSTR, con);
				SqlDataReader reader = command.ExecuteReader();
				while (reader.Read()) {
					string name = reader.GetString(0);
					int code = reader.GetInt32(1);
					name = String.Format("{0}: {1}", code, name);
					string codeStr = String.Format("{0}_{1}_{2}", Source.Obj, Source.ObjType, code);
					Names.Add(codeStr, name);

					DataRecord rec = new DataRecord();
					rec.Key = codeStr;
					rec.Name = name;
					rec.Source = SourceInfo.getFullInfo(codeStr);
					rec.Values = new Dictionary<DateTime, string>();
					foreach (DateTime date in Dates) {
						rec.Values.Add(date, "---");
					}
					Data.Add(codeStr, rec);

				}
				reader.Close();
				con.Close();
			} catch (Exception e) {
				Logger.info("Ошибка при чтении наименований источника " + e.ToString());
			}
			
		}
Ejemplo n.º 15
0
        }         // DueCurrencyCode

        public override string ToString()
        {
            return(string.Format("{0} - {1}: {2} {3}, {4} {5}",
                                 DateStart.ToString("MMM d yyyy", CultureInfo.InvariantCulture),
                                 DateEnd.ToString("MMM d yyyy", CultureInfo.InvariantCulture),
                                 PaidAmount, PaidCurrencyCode,
                                 DueAmount, DueCurrencyCode
                                 ));
        }         // ToString
Ejemplo n.º 16
0
 public override int GetHashCode()
 {
     {
         var hashCode = DateStart.GetHashCode();
         hashCode = (hashCode * 397) ^ (TriggerId.GetHashCode());
         hashCode = (hashCode * 397) ^ ((int)RepeatType);
         hashCode = (hashCode * 397) ^ (ConsumerNotificationSettingIds != null ? ConsumerNotificationSettingIds.Sum() + ConsumerNotificationSettingIds.Count() : 0);
         return(hashCode);
     }
 }
 public virtual string PrintTicket()
 {
     return(String.Format(
                "ID: {0}\n" +
                "Event: {1}\n" +
                "Location: {2}\n" +
                "Price: {3:C}\n" +
                "Date: {4} - {5}\n",
                TicketID, EventName, Location, Price, DateStart.ToShortDateString(), DateEnd.ToShortDateString()
                ));
 }
Ejemplo n.º 18
0
 public int CompareTo(CompanyCalenderEntity other)
 {
     if (CompanyId == other.CompanyId)
     {
         return(DateStart.CompareTo(other.DateStart));
     }
     else
     {
         return(CompanyId.CompareTo(other.CompanyId));
     }
 }
Ejemplo n.º 19
0
 public int CompareTo(SchedulingEntity other)
 {
     if (CompanyId == other.CompanyId)
     {
         return(DateStart.CompareTo(other.DateStart));
     }
     else
     {
         return(CompanyId.CompareTo(other.CompanyId));
     }
 }
Ejemplo n.º 20
0
        public bool ReadData(String type, int nasosCount, string typeCalcRun = "GG_UST")
        {
            NasosType = type;
            DataGG    = new Dictionary <string, List <PuskStopData> >();
            DataGG.Add("GG_RUN", new List <PuskStopData>());
            DataGG.Add("GG_STOP", new List <PuskStopData>());
            DataGG.Add("GG_UST", new List <PuskStopData>());

            DataNasos = new Dictionary <string, List <PuskStopData> >();
            Date      = DateStart.ToString("dd.MM");

            for (int nasos = 1; nasos <= nasosCount; nasos++)
            {
                DataNasos.Add(String.Format("{0}_{1}", type, nasos), new List <PuskStopData>());
            }

            FullGGData    = createPuskStopData("GG", DataGG);
            FullNasosData = createPuskStopData(type, DataNasos);
            CreateComments();

            timeGGRun       = 0;
            timeGGStop      = 0;
            OneTimeWorkInfo = new SortedList <DateTime, PuskStopData>();

            IEnumerable <PuskStopData> req = from gg in DataGG[typeCalcRun] where gg.TimeOn <= DateEnd && gg.TimeOff >= DateStart select gg;

            foreach (PuskStopData rec in req)
            {
                DateTime start = rec.TimeOn > DateStart ? rec.TimeOn : DateStart;
                DateTime end   = rec.TimeOff < DateEnd ? rec.TimeOff : DateEnd;
                timeGGRun += (end - start).TotalSeconds;
            }

            req = from gg in DataGG["GG_STOP"] where gg.TimeOn <= DateEnd && gg.TimeOff >= DateStart select gg;
            foreach (PuskStopData rec in req)
            {
                DateTime start = rec.TimeOn > DateStart ? rec.TimeOn : DateStart;
                DateTime end   = rec.TimeOff < DateEnd ? rec.TimeOff : DateEnd;
                timeGGStop += (end - start).TotalSeconds;
            }

            NasosRunGG  = processNasosData(typeCalcRun);
            NasosStopGG = processNasosData("GG_STOP");
            NasosGG     = processNasosData("");



            /*NasosRunGG.cntPuskRel = NasosRunGG.cntPusk / timeGGRun;
             * NasosStopGG.cntPuskRel = NasosStopGG.cntPusk / (timeGGStop);*/


            return(true);
        }
Ejemplo n.º 21
0
		public AISClass(String source, DateTime dateStart) {
			Source = new SourceInfo(source);

			DateStart = dateStart.Date;
			DateEnd = DateStart.AddHours(24);
			Dates = new List<DateTime>();
			DateTime date = DateStart.AddMinutes(30);
			while (date <= DateEnd) {
				Dates.Add(date);
				date = date.AddMinutes(30);
			}
		}
Ejemplo n.º 22
0
        public bool SetStatus(DateTime date)
        {
            //полпути
            var halfPath = (DateDestination - DateStart).TotalMinutes / 2;

            bool result = false;

            if (date >= DateStart.AddMinutes(-60) && date < DateStart.AddMinutes(-30))
            {
                if (Status != 0)
                {
                    result = true; Status = 0; OnPropertyChanged("Status");
                }
            }
            else if (date >= DateStart.AddMinutes(-30) && date < DateStart)
            {
                if (Status != 1)
                {
                    result = true; Status = 1; OnPropertyChanged("Status");
                }
            }
            else if (date >= DateStart && date < DateDestination.AddMinutes(-(halfPath + halfPath / 2)))
            {
                if (Status != 2)
                {
                    result = true; Status = 2; OnPropertyChanged("Status");
                }
            }
            else if (date >= DateStart.AddMinutes(halfPath / 2) && date < DateDestination.AddMinutes(-(halfPath / 2)))
            {
                if (Status != 3)
                {
                    result = true; Status = 3; OnPropertyChanged("Status");
                }
            }
            else if (date >= DateDestination.AddMinutes(-(halfPath / 2)) && date < DateDestination)
            {
                if (Status != 4)
                {
                    result = true; Status = 4; OnPropertyChanged("Status");
                }
            }
            else if (date >= DateDestination)
            {
                if (Status != 5)
                {
                    result = true; Status = 5; OnPropertyChanged("Status");
                }
            }

            return(result);
        }
Ejemplo n.º 23
0
        private void BtnAddCalculatedMetrics_Click(object sender, EventArgs e)
        {
            string DeviceID, MetricValue;
            //int MetricID;
            DateTime DateStart, DateEnd;

            DeviceID = MetricValue = default;
            // MetricID = default;
            DateStart = DateEnd = default;


            if (String.IsNullOrEmpty(textBox3.Text))
            {
                MessageBox.Show("Gngn vraies valeurs svp");
                return; //Arrete tout si jamais c'est le cas
            }
            else
            {
                MetricValue = textBox3.Text; //On est dans le cas ou c'est good
            }
            //if (MetricID == default)
            //{
            //    MetricID = "";
            //}
            if (DeviceID == default)
            {
                //DeviceID = GetRandomMacAddress();
                var random = new Random();
                DeviceID = (1 + random.Next(100)).ToString();
            }
            else if (MetricValue == default)
            {
                var random = new Random();
                MetricValue = (1 + random.Next()).ToString();
            }
            else if (DateStart == default)
            {
                DateStart = DateTime.Now;
                string formatForMySql = DateStart.ToString("yyyy-MM-dd HH:mm:ss");
            }
            else if (DateEnd == default)
            {
                DateEnd = DateTime.Now;
                string formatForMySql = DateEnd.ToString("yyyy-MM-dd HH:mm:ss");
            }

            if (DeviceID == default && MetricValue == default)
            {
            }
            DAL.PostCalculatedMetrics(DeviceID, MetricValue, DateStart, DateEnd, 0);
        }
Ejemplo n.º 24
0
        public override string ToString()
        {
            string line =
                " " + StringUtil.FillSpaceLeft(SiteCode, 4)
                + " " + StringUtil.FillSpaceLeft(PointCode, 2)
                + " " + StringUtil.FillSpaceLeft(SolutionID, 4)
                + " " + ObservationCode
                + " " + DateStart.ToYdsString()
                + " " + DateEnd.ToYdsString()
                + " " + DateMean.ToYdsString()
            ;

            return(line);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// *SITE PT SOLN TProduct DATA_START__ DATA_END____ DESCRIPTION_________ S/N__ FIRMWARE___
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string line =
                " " + StringUtil.FillSpaceLeft(SiteCode, 4)
                + " " + StringUtil.FillSpaceLeft(PointCode, 2)
                + " " + StringUtil.FillSpaceLeft(SolutionID, 4)
                + " " + ObservationCode
                + " " + DateStart.ToYdsString()
                + " " + DateEnd.ToYdsString()
                + " " + StringUtil.FillSpaceLeft(AntennaType, 20)
                + " " + StringUtil.FillSpaceLeft(AntennaSerialNumber, 5)
            ;

            return(line);
        }
Ejemplo n.º 26
0
        public override string ToString()
        {
            string line =
                " " + StringUtil.FillSpaceLeft(SiteCode, 4)
                + " " + StringUtil.FillSpaceLeft(PointCode, 2)
                + " " + StringUtil.FillSpaceLeft(SolutionID, 4)
                + " " + ObservationCode
                + " " + DateStart.ToYdsString()
                + " " + DateEnd.ToYdsString()
                + " " + StringUtil.FillSpaceLeft(EccentricityReferenceSystem, 3)
                + " " + Une.ToRnxString(8.4)
            ;

            return(line);
        }
Ejemplo n.º 27
0
 public TaskBox(Task task)
 {
     InitializeComponent();
     DateStart       = task.StartDate;
     DateFinish      = task.Deadline;
     TaskName        = task.Name;
     taskName.Text   = TaskName;
     dateFinish.Text = DateFinish.ToString();
     dateStart.Text  = DateStart.ToString();
     BackColor       = SystemColors.ActiveCaption;
     Dock            = DockStyle.Top;
     //Location = new Point(0, 60);
     Name = $"taskBoxItem{task.Id}";
     Size = new Size(477, 36);
 }
Ejemplo n.º 28
0
        public string exportAsICS(Models.Event ev)
        {
            DateStart   = ev.Begin;
            DateEnd     = ev.End;
            Organizer   = ev.Assoc;
            Summary     = ev.Name;
            Description = ev.Description;
            Location    = "FIXME";
            try
            {
                object email = Database.Database.database.RequestObject("f_email", ev.Owner);
                OrganizerEmail = (string)email;
            }
            catch (Exception) { }


            //create a new stringbuilder instance
            StringBuilder sb = new StringBuilder();

            //start the calendar item
            sb.AppendLine("BEGIN:VCALENDAR");
            sb.AppendLine("VERSION:2.0");
            sb.AppendLine("PRODID:BilleterieEPITA");

            sb.AppendLine("BEGIN:VEVENT");
            sb.AppendLine("DTSTART;TZID=Europe/Paris:" + DateStart.ToString("yyyyMMddTHHmm00"));
            sb.AppendLine("DTEND;TZID=Europe/Paris:" + DateEnd.ToString("yyyyMMddTHHmm00"));

            sb.AppendLine("ORGANIZER:CN=" + Organizer + ":MAILTO:" + OrganizerEmail);

            sb.AppendLine("SUMMARY:" + Summary);
            sb.AppendLine("LOCATION:" + Location);
            sb.AppendLine("DESCRIPTION:" + Description);

            //CATEGORIES: Catégorie de l'événement (ex: Conférence, Fête...)
            //STATUS: Statut de l'événement (TENTATIVE, CONFIRMED, CANCELLED)
            //TRANSP: Définit si la ressource affectée à l'événement est rendu indisponible (OPAQUE, TRANSPARENT)
            //SEQUENCE: Nombre de mises à jour, la première mise à jour est à 1

            sb.AppendLine("PRIORITY:" + Priority.ToString());
            sb.AppendLine("END:VEVENT");
            sb.AppendLine("END:VCALENDAR");

            //create a string from the stringbuilder
            string CalendarItem = sb.ToString();

            return(CalendarItem);
        }
Ejemplo n.º 29
0
        void dotBig_MouseEnter(object sender, MouseEventArgs e)
        {
            if (IsHovering)
            {
                return;                //don't jump when two big dots overlap
            }
            int idxPath = -1;
            int idxDot  = -1;

            for (int i = 0; i < ListDotsBig.Count; i++)
            {
                if (visibleIndices != null && visibleIndices.Count > 0 && !visibleIndices.Contains(i))
                {
                    continue;
                }
                if (ListDotsBig[i].IndexOf((Ellipse)sender) == -1)
                {
                    continue;
                }
                idxPath = i;
                idxDot  = ListDotsBig[i].IndexOf((Ellipse)sender);
            }
            if (idxDot == -1)
            {
                return;
            }
            labelHover.Opacity = 1;
            string numFormat = "n0";

            if (YMultFactor == 1000)
            {
                numFormat = "c0";
            }
            string content = DateStart.AddMonths(idxDot).ToString("MMM") + ": " + ListData[idxPath][idxDot].ToString(numFormat);

            labelHover.Content = content;
            double        xCenter  = Canvas.GetLeft((Ellipse)sender) + 7;
            double        yCenter  = Canvas.GetTop((Ellipse)sender) + 7;
            Typeface      typeface = new Typeface(FontFamily, FontStyle, FontWeight, FontStretch);
            FormattedText ft       = new FormattedText(labelHover.Content.ToString(),
                                                       CultureInfo.CurrentCulture, FlowDirection.LeftToRight, typeface, FontSize, Foreground);
            double wText = ft.Width;

            Canvas.SetLeft(labelHover, xCenter - wText / 2d - 1);
            Canvas.SetTop(labelHover, yCenter - 23);
            Panel.SetZIndex(labelHover, 8);           //bring to front of other element
            IsHovering = true;
        }
Ejemplo n.º 30
0
    public void DrawVertivalLines(IList<DateTime> times) {
      var times0 = times.Select(t => dateAxis.ConvertToDouble(GetPriceStartDateContinuous(t))).ToArray();
      var timeSelectedDouble = dateAxis.ConvertToDouble(GetPriceStartDateContinuous(DateStart.GetValueOrDefault()));
      var newLines = times0.Except(otherVLines.Select(vl => vl.Value)).ToArray();
      var startDateDouble = dateAxis.ConvertToDouble(animatedTimeX[0]);
      var endDateDouble = dateAxis.ConvertToDouble(animatedTimeX.Last());
      newLines.Where(nl => nl.Between(startDateDouble,endDateDouble)).ForEach(nl =>
        otherVLines.Add(new VerticalLine() { Value = nl, StrokeDashArray = { 2 }, Stroke = new SolidColorBrush(Colors.MediumVioletRed), StrokeThickness = 1 })
      );

      otherVLines.Where(vl => !vl.Value.Between(startDateDouble,endDateDouble)).ToList().ForEach(vl => otherVLines.Remove(vl));

      var lines = otherVLines.Select(t => new { l = t, d = t.Value.Abs(timeSelectedDouble) }).OrderBy(t => t.d).ToArray();
      lines.Where(l => l.d == 0).Take(1).ForEach(l => l.l.StrokeThickness = 2);
      lines.Where(l => l.d != 0).ForEach(l => l.l.StrokeThickness = 1);
    }