diff --git a/Yavsc/ApiControllers/BookQueryApiController.cs b/Yavsc/ApiControllers/BookQueryApiController.cs index 7819434d..ead226c6 100644 --- a/Yavsc/ApiControllers/BookQueryApiController.cs +++ b/Yavsc/ApiControllers/BookQueryApiController.cs @@ -34,16 +34,16 @@ namespace Yavsc.Controllers /// returned Ids must be lower than this value /// book queries [HttpGet] - public IEnumerable GetCommands(long maxId=long.MaxValue) + public IEnumerable GetCommands(long maxId=long.MaxValue) { var uid = User.GetUserId(); var now = DateTime.Now; var result = _context.Commands.Include(c => c.Location). Include(c => c.Client).Where(c => c.PerformerId == uid && c.Id < maxId && c.EventDate > now). - Select(c => new BookQueryProviderView + Select(c => new BookQueryProviderInfo { - Client = new ClientProviderView { UserName = c.Client.UserName, UserId = c.ClientId }, + Client = new ClientProviderInfo { UserName = c.Client.UserName, UserId = c.ClientId }, Location = c.Location, EventDate = c.EventDate, Id = c.Id, diff --git a/Yavsc/Helpers/EventHelpers.cs b/Yavsc/Helpers/EventHelpers.cs index fbdb614a..610b1e47 100644 --- a/Yavsc/Helpers/EventHelpers.cs +++ b/Yavsc/Helpers/EventHelpers.cs @@ -12,7 +12,7 @@ namespace Yavsc.Helpers { var yaev = new BookQueryEvent { - Client = new ClientProviderView { UserName = query.Client.UserName , UserId = query.ClientId } , + Client = new ClientProviderInfo { UserName = query.Client.UserName , UserId = query.ClientId } , Previsional = query.Previsional, EventDate = query.EventDate, Location = query.Location, diff --git a/Yavsc/Interfaces/IBookQueryData.cs b/Yavsc/Interfaces/IBookQueryData.cs new file mode 100644 index 00000000..ab156929 --- /dev/null +++ b/Yavsc/Interfaces/IBookQueryData.cs @@ -0,0 +1,14 @@ +using System; +using Yavsc.Model; + +namespace Yavsc.Interfaces +{ + public interface IBookQueryData + { + ClientProviderInfo Client { get; set; } + DateTime EventDate { get; set; } + long Id { get; set; } + Location Location { get; set; } + decimal? Previsionnal { get; set; } + } +} \ No newline at end of file diff --git a/Yavsc/Interfaces/IEstimate.cs b/Yavsc/Interfaces/IEstimate.cs new file mode 100644 index 00000000..1c833cc6 --- /dev/null +++ b/Yavsc/Interfaces/IEstimate.cs @@ -0,0 +1,19 @@ +namespace Yavsc.Interfaces +{ + using System.Collections.Generic; + using Yavsc.Models.Billing; + public interface IEstimate + { + List AttachedFiles { get; set; } + List AttachedGraphics { get; } + List Bill { get; set; } + string ClientId { get; set; } + long? CommandId { get; set; } + string CommandType { get; set; } + string Description { get; set; } + long Id { get; set; } + string OwnerId { get; set; } + int? Status { get; set; } + string Title { get; set; } + } +} \ No newline at end of file diff --git a/Yavsc/Model/Billing/Estimate.cs b/Yavsc/Model/Billing/Estimate.cs index ecc0ecc4..c53e6899 100644 --- a/Yavsc/Model/Billing/Estimate.cs +++ b/Yavsc/Model/Billing/Estimate.cs @@ -1,13 +1,12 @@ - -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using Yavsc.Models.Booking; - namespace Yavsc.Models.Billing { - public partial class Estimate + using System.Collections.Generic; + using System.ComponentModel.DataAnnotations; + using System.ComponentModel.DataAnnotations.Schema; + using System.Linq; + using Yavsc.Interfaces; + using Yavsc.Models.Booking; + public partial class Estimate : IEstimate { [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] public long Id { get; set; } @@ -20,7 +19,7 @@ namespace Yavsc.Models.Billing /// /// [ForeignKey("CommandId")] - public BookQuery Query { get; set; } + public BookQuery Query { get; set; } public string Description { get; set; } public int? Status { get; set; } public string Title { get; set; } @@ -35,9 +34,10 @@ namespace Yavsc.Models.Billing [NotMapped] public List AttachedGraphics { get; set; } - public string AttachedGraphicsString { + public string AttachedGraphicsString + { get { return string.Join(":", AttachedGraphics); } - set { AttachedGraphics = value.Split(':').ToList(); } + set { AttachedGraphics = value.Split(':').ToList(); } } /// /// List of attached files @@ -48,9 +48,10 @@ namespace Yavsc.Models.Billing /// [NotMapped] public List AttachedFiles { get; set; } - public string AttachedFilesString { + public string AttachedFilesString + { get { return string.Join(":", AttachedFiles); } - set { AttachedFiles = value.Split(':').ToList(); } + set { AttachedFiles = value.Split(':').ToList(); } } [Required] @@ -58,5 +59,10 @@ namespace Yavsc.Models.Billing [Required] public string ClientId { get; set; } + + public string CommandType + { + get; set; + } } } diff --git a/Yavsc/Model/Messaging/BookQueryEvent.cs b/Yavsc/Model/Messaging/BookQueryEvent.cs index 060e2677..05a80b95 100644 --- a/Yavsc/Model/Messaging/BookQueryEvent.cs +++ b/Yavsc/Model/Messaging/BookQueryEvent.cs @@ -24,7 +24,7 @@ using Yavsc.Model; // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . -public class BookQueryEvent: BookQueryProviderView, IEvent +public class BookQueryEvent: BookQueryProviderInfo, IEvent { public BookQueryEvent() { diff --git a/Yavsc/Model/Messaging/ClientProviderInfo.cs b/Yavsc/Model/Messaging/ClientProviderInfo.cs index 7febd680..f1524266 100644 --- a/Yavsc/Model/Messaging/ClientProviderInfo.cs +++ b/Yavsc/Model/Messaging/ClientProviderInfo.cs @@ -3,8 +3,8 @@ using System; namespace Yavsc.Model { -public class BookQueryProviderView {  - public ClientProviderView Client { get; set; } +public class BookQueryProviderInfo {  + public ClientProviderInfo Client { get; set; } public Location Location { get; set; } public long Id { get; set; } @@ -12,7 +12,7 @@ public class BookQueryProviderView {  public DateTime EventDate { get ; set; } public decimal? Previsional { get; set; } } - public class ClientProviderView {  + public class ClientProviderInfo {  public string UserName { get; set; } public string UserId { get; set; } public int Rate { get; set; }