public Task <IHttpActionResult> Post([FromBody] SOFTTEK.SCMS.Entity.FA.PurchaseRequest 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.PurchaseRequestBO PurchaseRequestBO = new Business.FA.PurchaseRequestBO(ctx); SOFTTEK.SCMS.Entity.FA.PurchaseRequest registeredActivity = PurchaseRequestBO.RegisterPurchaseRequest(modelInsert); if (registeredActivity != null) { result = Json(registeredActivity); } } catch (Exception ex) { result = Error(ex); } return(Task.FromResult(result)); }
/// <summary> /// Register PurchaseRequest. /// </summary> /// <param name="modelPurchaseRequest">modelPurchaseRequest Insert Model information PurchaseRequest</param> /// <returns>Registered activity information.</returns> public SOFTTEK.SCMS.Entity.FA.PurchaseRequest RegisterPurchaseRequest(SOFTTEK.SCMS.Entity.FA.PurchaseRequest modelPurchaseRequest) { SOFTTEK.SCMS.Entity.FA.PurchaseRequest modelInsert = new SOFTTEK.SCMS.Entity.FA.PurchaseRequest(); 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.InsertPurchaseRequest(modelPurchaseRequest); modelInsert = result; } return modelInsert; }, "Register an PurchaseRequest 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.PurchaseRequest(); 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.PurchaseRequest> listPurchaseRequest = new List <SOFTTEK.SCMS.Entity.FA.PurchaseRequest>(); SOFTTEK.SCMS.Business.FA.PurchaseRequestBO pPurchaseRequestBO = new Business.FA.PurchaseRequestBO(ctx); listPurchaseRequest = pPurchaseRequestBO.SearchPurchaseRequests(modelFilter); if (listPurchaseRequest.Count > 0) { result = Json(listPurchaseRequest); } } catch (Exception ex) { result = Error(ex); } return(Task.FromResult(result)); }
/// <summary> /// Get all the modelPurchaseRequest. /// </summary> /// <param name="modelPurchaseRequest">modelPurchaseRequest Identifier</param> /// <returns></returns> public List <SOFTTEK.SCMS.Entity.FA.PurchaseRequest> SearchPurchaseRequests(SOFTTEK.SCMS.Entity.FA.PurchaseRequest modelPurchaseRequest) { List <SOFTTEK.SCMS.Entity.FA.PurchaseRequest> listPurchaseRequests = new List <SOFTTEK.SCMS.Entity.FA.PurchaseRequest>(); 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.GetPurchaseRequests(modelPurchaseRequest); listPurchaseRequests = results; } return listPurchaseRequests; }, "Retrieve the registered PurchaseRequests in system.")); }
public Task <IHttpActionResult> Put([FromUri] string id, [FromBody] SOFTTEK.SCMS.Entity.FA.PurchaseRequest modelUpdate) { IHttpActionResult result = NotFound(); if ((id == null || id == "0") || (modelUpdate == null)) { result = Conflict(); return(Task.FromResult(result)); } var modelFilter = new SOFTTEK.SCMS.Entity.FA.PurchaseRequest(); 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.PurchaseRequestBO activitiesRegisterBO = new Business.FA.PurchaseRequestBO(ctx); SOFTTEK.SCMS.Entity.FA.PurchaseRequest updatedActivity = activitiesRegisterBO.UpdatePurchaseRequest(modelFilter, modelUpdate); if (updatedActivity != null) { result = Json(updatedActivity); } } catch (Exception ex) { result = Error(ex); } return(Task.FromResult(result)); }