Пример #1
0
        public int CompareTo(object obj)
        {
            Headline headline = obj as Headline;

            if (obj == null)
            {
                throw new InvalidCastException("Not a valid Headline object.");
            }
            bool bAscending = (Headline.SortingOrder == SortOrder.Ascending);

            switch (Headline.SortingFilter)
            {
            case SortFilter.Title:
                return((bAscending) ? Title.CompareTo(headline.Title) : headline.Title.CompareTo(Title));

            case SortFilter.DatePublished:
                return((bAscending) ? DatePublished.CompareTo(headline.DatePublished) : headline.DatePublished.CompareTo(DatePublished));

            case SortFilter.DateReceived:
                return((bAscending) ? DateReceived.CompareTo(headline.DateReceived) : headline.DateReceived.CompareTo(DateReceived));

            case SortFilter.Author:
                return((bAscending) ? Author.CompareTo(headline.Author) : headline.Author.CompareTo(Author));
            }
            return(0);
        }
Пример #2
0
 public Complaint(CreateComplaintViewModel m)
 {
     // Received
     DateReceived = m.DateReceivedDate.Value.Date;
     if (m.DateReceivedTime.HasValue)
     {
         DateReceived = DateReceived.Add(m.DateReceivedTime.Value.TimeOfDay);
     }
     ReceivedById = m.ReceivedById;
     // Caller
     CallerName                 = m.CallerName;
     CallerRepresents           = m.CallerRepresents;
     CallerStreet               = m.CallerStreet;
     CallerStreet2              = m.CallerStreet2;
     CallerCity                 = m.CallerCity;
     CallerStateId              = m.CallerStateId;
     CallerPostalCode           = m.CallerPostalCode;
     CallerPhoneNumber          = m.CallerPhoneNumber;
     CallerPhoneType            = m.CallerPhoneType;
     CallerSecondaryPhoneNumber = m.CallerSecondaryPhoneNumber;
     CallerSecondaryPhoneType   = m.CallerSecondaryPhoneType;
     CallerTertiaryPhoneNumber  = m.CallerTertiaryPhoneNumber;
     CallerTertiaryPhoneType    = m.CallerTertiaryPhoneType;
     CallerEmail                = m.CallerEmail;
     // Complaint
     ComplaintNature     = m.ComplaintNature;
     ComplaintLocation   = m.ComplaintLocation;
     ComplaintDirections = m.ComplaintDirections;
     ComplaintCity       = m.ComplaintCity;
     ComplaintCountyId   = m.ComplaintCountyId;
     PrimaryConcernId    = m.PrimaryConcernId;
     SecondaryConcernId  = m.SecondaryConcernId;
     // Source
     SourceFacilityId           = m.SourceFacilityId;
     SourceContactName          = m.SourceContactName;
     SourceFacilityName         = m.SourceFacilityName;
     SourceStreet               = m.SourceStreet;
     SourceStreet2              = m.SourceStreet2;
     SourceCity                 = m.SourceCity;
     SourceStateId              = m.SourceStateId;
     SourcePostalCode           = m.SourcePostalCode;
     SourcePhoneNumber          = m.SourcePhoneNumber;
     SourcePhoneType            = m.SourcePhoneType;
     SourceSecondaryPhoneNumber = m.SourceSecondaryPhoneNumber;
     SourceSecondaryPhoneType   = m.SourceSecondaryPhoneType;
     SourceTertiaryPhoneNumber  = m.SourceTertiaryPhoneNumber;
     SourceTertiaryPhoneType    = m.SourceTertiaryPhoneType;
     SourceEmail                = m.SourceEmail;
     // Assignment
     CurrentOfficeId = m.CurrentOfficeId.Value;
     CurrentOwnerId  = m.CurrentOwnerId;
 }
Пример #3
0
 private void ReadPort()
 {
     while (_keepReading)
     {
         if (_serialPort.IsOpen)
         {
             int count = _serialPort.BytesToRead;
             if (count > 0)
             {
                 byte[] readBuffer = new byte[count];
                 try
                 {
                     //Application.DoEvents();
                     _serialPort.Read(readBuffer, 0, count);
                     DateReceived?.Invoke(readBuffer);//这句是收到数据后的方法调用,委托自己写
                 }
                 catch (TimeoutException)
                 {
                 }
             }
         }
     }
 }
Пример #4
0
    public override string ToString()
    {
        string dateDueString, dateFilledString;

        if (DateDue.HasValue)
        {
            dateDueString = DateDue.Value.ToString();
        }
        else
        {
            dateDueString = "<No due date>";
        }

        if (DateFilled.HasValue)
        {
            dateFilledString = DateFilled.Value.ToString();
        }
        else
        {
            dateFilledString = "<Not completed>";
        }

        return(string.Format("Customer: {0}; DateReceived: {1}; DateDue: {2}; Filled?: {3}; DateFilled: {4}; Open: {5}; Total Value: {6}; Total Quantities: {7}", Customer.FullName(), DateReceived.ToString(), dateDueString, Filled.ToString(), dateFilledString, Open.ToString(), TotalValue().ToString(), TotalQuantity().ToString()));
    }
Пример #5
0
        public String convertirAString()
        {
            /*String str = "328#" + LastEatYear.ToString("X") + "#" + LastEatTime.ToString("X") + "#"
             + LastEatHour.ToString("X") + "," + "3cb#0#0#" + Humour.ToString("X") + "," + "3cc#0#0#"
             + Masque.ToString("X") + "," + "3cd#0#0#" + Type.ToString("X") + "," + "3ca#0#0#"
             + TemplateReal.ToString("X") + "," + "3ce#0#0#" + EXP.ToString("X") + "," + "3d7#"
             + YearInter.ToString("X") + "#" + DateInter.ToString("X") + "#" + HourInter.ToString("X")
             + "," + "325#" + YearReceive.ToString("X") + "#" + DateReceived.ToString("X") + "#"
             + HourReceived.ToString("X");*/
            StringBuilder sb = new StringBuilder("328#").Append(LastEatYear.ToString("X")).Append("#").Append(LastEatTime.ToString("X")).Append("#");

            sb.Append(LastEatHour.ToString("X")).Append(',').Append("3cb#0#0#").Append(Humour.ToString("X")).Append(",").Append("3cc#0#0#");
            sb.Append(Masque.ToString("X")).Append(",").Append("3cd#0#0#").Append(Type.ToString("X")).Append(",").Append("3ca#0#0#");
            sb.Append(TemplateReal.ToString("X")).Append(",").Append("3ce#0#0#").Append(EXP.ToString("X")).Append(",").Append("3d7#");
            sb.Append(YearInter.ToString("X")).Append("#").Append(DateInter.ToString("X")).Append("#").Append(HourInter.ToString("X"));
            sb.Append(",").Append("325#").Append(YearReceive.ToString("X")).Append("#").Append(DateReceived.ToString("X")).Append("#").Append(HourReceived.ToString("X"));
            return(sb.ToString());
        }