public Task <IHttpActionResult> Post([FromBody] SOFTTEK.SCMS.Entity.FA.Request modelInsert) { IHttpActionResult result = Conflict(); try { SOFTTEK.SCMS.Foundation.Business.BusinessContext ctx = new SOFTTEK.SCMS.Foundation.Business.BusinessContext { SecurityContext = new Foundation.Security.SecurityContext { DeviceID = GetDeviceIdentifier(), ClientID = GetToken().Identifier, AuthorizationTicket = GetToken().Identifier, AppID = new System.Configuration.AppSettingsReader().GetValue("S_SRA_APP_idENTIFIER", typeof(string)).ToString() } }; SOFTTEK.SCMS.Business.FA.RequestBO RequestBO = new Business.FA.RequestBO(ctx); SOFTTEK.SCMS.Entity.FA.Request registeredActivity = RequestBO.RegisterRequest(modelInsert); if (registeredActivity != null) { result = Json(registeredActivity); } } catch (Exception ex) { result = Error(ex); } return(Task.FromResult(result)); }
/// <summary> /// Register Request. /// </summary> /// <param name="modelRequest">modelRequest Insert Model information Request</param> /// <returns>Registered activity information.</returns> public SOFTTEK.SCMS.Entity.FA.Request RegisterRequest(SOFTTEK.SCMS.Entity.FA.Request modelRequest) { SOFTTEK.SCMS.Entity.FA.Request modelInsert = new SOFTTEK.SCMS.Entity.FA.Request(); return(context.Execute(() => { using (dataSource = new FAMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var result = dataSource.InsertRequest(modelRequest); modelInsert = result; } return modelInsert; }, "Register an Request in system")); }
public Task <IHttpActionResult> Get(string id) { IHttpActionResult result = NotFound(); if (id == null || id == "0") { result = Conflict(); return(Task.FromResult(result)); } var modelFilter = new SOFTTEK.SCMS.Entity.FA.Request(); modelFilter.Identifier = Convert.ToInt64(id); try { SOFTTEK.SCMS.Foundation.Business.BusinessContext ctx = new SOFTTEK.SCMS.Foundation.Business.BusinessContext { SecurityContext = new Foundation.Security.SecurityContext { DeviceID = GetDeviceIdentifier(), ClientID = GetToken().UserIS, AuthorizationTicket = GetToken().Identifier, AppID = new System.Configuration.AppSettingsReader().GetValue("S_SRA_APP_idENTIFIER", typeof(string)).ToString() } }; List <SOFTTEK.SCMS.Entity.FA.Request> listRequest = new List <SOFTTEK.SCMS.Entity.FA.Request>(); SOFTTEK.SCMS.Business.FA.RequestBO pRequestBO = new Business.FA.RequestBO(ctx); listRequest = pRequestBO.SearchRequests(modelFilter); if (listRequest.Count > 0) { result = Json(listRequest); } } catch (Exception ex) { result = Error(ex); } return(Task.FromResult(result)); }
/// <summary> /// Get all the modelRequest. /// </summary> /// <param name="modelRequest">modelRequest Identifier</param> /// <returns></returns> public List <SOFTTEK.SCMS.Entity.FA.Request> SearchRequests(SOFTTEK.SCMS.Entity.FA.Request modelRequest) { List <SOFTTEK.SCMS.Entity.FA.Request> listRequests = new List <SOFTTEK.SCMS.Entity.FA.Request>(); return(context.Execute(() => { using (dataSource = new FAMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var results = dataSource.GetRequests(modelRequest); listRequests = results; } return listRequests; }, "Retrieve the registered Requests in system.")); }
public Task <IHttpActionResult> Put([FromUri] string id, [FromBody] SOFTTEK.SCMS.Entity.FA.Request modelUpdate) { IHttpActionResult result = NotFound(); if ((id == null || id == "0") || (modelUpdate == null)) { result = Conflict(); return(Task.FromResult(result)); } var modelFilter = new SOFTTEK.SCMS.Entity.FA.Request(); modelFilter.Identifier = Convert.ToInt64(id); try { SOFTTEK.SCMS.Foundation.Business.BusinessContext ctx = new SOFTTEK.SCMS.Foundation.Business.BusinessContext { SecurityContext = new Foundation.Security.SecurityContext { DeviceID = GetDeviceIdentifier(), ClientID = GetToken().Identifier, AuthorizationTicket = GetToken().Identifier, AppID = new System.Configuration.AppSettingsReader().GetValue("S_SRA_APP_idENTIFIER", typeof(string)).ToString() } }; SOFTTEK.SCMS.Business.FA.RequestBO activitiesRegisterBO = new Business.FA.RequestBO(ctx); SOFTTEK.SCMS.Entity.FA.Request updatedActivity = activitiesRegisterBO.UpdateRequest(modelFilter, modelUpdate); if (updatedActivity != null) { result = Json(updatedActivity); } } catch (Exception ex) { result = Error(ex); } return(Task.FromResult(result)); }