Exemplo n.º 1
0
        public EventWrapper(Event @event)
        {
            Created = (ApiDateTime) @event.CreateOn;
            CreatedBy = EmployeeWraper.Get(@event.CreateBy);
            Updated = (ApiDateTime) @event.LastModifiedOn;

            if (@event.CreateBy != @event.LastModifiedBy)
                UpdatedBy = EmployeeWraper.Get(@event.LastModifiedBy);
            Id = @event.ID;
            Desription = @event.Description;
            Title = @event.Title;
            ProjectId = @event.Project.ID;
            From = (ApiDateTime) @event.FromDate;
            To = (ApiDateTime) @event.ToDate;
        }
Exemplo n.º 2
0
 public Event Save(Event ev)
 {
     var insert = Insert(table)
         .InColumnValue("id", ev.ID)
         .InColumnValue("project_id", ev.Project != null ? ev.Project.ID : 0)
         .InColumnValue("title", ev.Title)
         .InColumnValue("create_by", ev.CreateBy.ToString())
         .InColumnValue("create_on", TenantUtil.DateTimeToUtc(ev.CreateOn))
         .InColumnValue("last_modified_by", ev.LastModifiedBy.ToString())
         .InColumnValue("last_modified_on", TenantUtil.DateTimeToUtc(ev.LastModifiedOn))
         .InColumnValue("from_date", TenantUtil.DateTimeToUtc(ev.FromDate))
         .InColumnValue("to_date", TenantUtil.DateTimeToUtc(ev.ToDate))
         .Identity(1, 0, true);
     ev.ID = DbManager.ExecuteScalar<int>(insert);
     return ev;
 }