public static void CheckRequestId(this IRequestEntity request) { if (request.RequestID == default(Guid)) { request.RequestID = Guid.NewGuid(); ContextFactory.Current.Logger.WriteDebugEntry(request.RequestID.ToString(), () => $"RequestId Created:{request.RequestID}"); } }
public JsonResult Process(int objectTypeId, int objectId, bool active) { try { using (Entity db = new Entity()) { IRequestEntity entity = null; switch (Enumerations.Parse <RequestObjectType>(objectTypeId)) { case RequestObjectType.Activity: entity = db.t_activity.Find(objectId); break; case RequestObjectType.Aim: entity = db.t_aim.Find(objectId); break; case RequestObjectType.Country: entity = db.t_country.Find(objectId); break; case RequestObjectType.Indicator: entity = db.t_indicator.Find(objectId); break; case RequestObjectType.Project: entity = db.t_project.Find(objectId); break; case RequestObjectType.Site: entity = db.t_site.Find(objectId); break; case RequestObjectType.User: entity = db.t_user.Find(objectId); break; case RequestObjectType.Attachment: entity = db.t_observation_attachment.Find(objectId); break; } entity.active = active; entity.updatedby_userid = CurrentUser.Id; entity.updated_date = DateTime.Now; db.SaveChanges(); } return(GetJsonResult(true, String.Empty)); } catch (Exception ex) { return(GetJsonResult(ex)); } }
public void Insert(IRequestEntity request) { ConnectDB("ConnectionString"); string queryString = "Insert into Request([contractor_person_ref], [client_person_ref], [job_ref], [date_requested], [time_requested], [status_type]) values ('" + //request.RequestType + "','" + request.RequestContractorID + "','" + request.RequestClientID + "','" + request.RequestJobID + "','" + request.RequestDateRequested + "','" + request.RequestTimeRequested + "','" + request.RequestStatusType + "')"; SqlCommand sqlcmd = new SqlCommand(queryString, Connection); sqlcmd.Connection.Open(); sqlcmd.ExecuteNonQuery(); sqlcmd.Connection.Close(); }
/// <summary> /// /// </summary> /// <param name="entity"></param> /// <param name="flag">NOTE: The boolean flag is just to differentiate this overload from others with inherited types.</param> private Request(IRequestEntity entity, bool flag) { CreatedBy = entity.createdby.full_name; CreatedOn = entity.created_date; if (entity.updatedby == null) { LastUpdatedBy = entity.createdby.full_name; } else { LastUpdatedBy = entity.updatedby.full_name; } if (entity.updated_date == null) { UpdatedOn = entity.created_date; } else { UpdatedOn = entity.updated_date; } }
void IRequestInfoInitializer.Initialize(string key, ArraySegment <byte> data, IRequestEntity entity) { Key = key; Data = data; Entity = entity; }