public Task <IHttpActionResult> Post([FromBody] SOFTTEK.SCMS.Entity.PM.Measure 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.PM.MeasureBO MeasureBO = new Business.PM.MeasureBO(ctx); SOFTTEK.SCMS.Entity.PM.Measure registeredActivity = MeasureBO.RegisterMeasure(modelInsert); if (registeredActivity != null) { result = Json(registeredActivity); } } catch (Exception ex) { result = Error(ex); } return(Task.FromResult(result)); }
/// <summary> /// Register Measure. /// </summary> /// <param name="modelMeasure">modelMeasure Insert Model information Measure</param> /// <returns>Registered Measure information.</returns> public SOFTTEK.SCMS.Entity.PM.Measure RegisterMeasure(SOFTTEK.SCMS.Entity.PM.Measure modelMeasure) { SOFTTEK.SCMS.Entity.PM.Measure modelInsert = new SOFTTEK.SCMS.Entity.PM.Measure(); return(context.Execute(() => { using (dataSource = new PMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var result = dataSource.InsertMeasure(modelMeasure); modelInsert = result; } return modelInsert; }, "Register an Measure in system")); }
/// <summary> /// Update an Measure. /// </summary> /// <param name="modelUpdate">model Update Model information Measure</param> /// /// <param name="modelSearch">model filter information Measure</param> /// <returns>Update Measure information.</returns> public SOFTTEK.SCMS.Entity.PM.Measure UpdateMeasure(SOFTTEK.SCMS.Entity.PM.Measure modelUpdate, SOFTTEK.SCMS.Entity.PM.Measure modelSearch) { SOFTTEK.SCMS.Entity.PM.Measure modelRUpdate = new SOFTTEK.SCMS.Entity.PM.Measure(); return(context.Execute(() => { using (dataSource = new PMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var result = dataSource.UpdateMeasure(modelUpdate, modelSearch); modelRUpdate = result; } return modelRUpdate; }, "Update an Measure 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.PM.Measure(); 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.PM.Measure> listMeasure = new List <SOFTTEK.SCMS.Entity.PM.Measure>(); SOFTTEK.SCMS.Business.PM.MeasureBO pMeasureBO = new Business.PM.MeasureBO(ctx); listMeasure = pMeasureBO.SearchMeasure(modelFilter); if (listMeasure.Count > 0) { result = Json(listMeasure); } } catch (Exception ex) { result = Error(ex); } return(Task.FromResult(result)); }
/// <summary> /// Get all the activities Measure. /// </summary> /// <param name="modelMeasure">Model Measure</param> /// <returns></returns> public List <SOFTTEK.SCMS.Entity.PM.Measure> SearchMeasure(SOFTTEK.SCMS.Entity.PM.Measure modelMeasure) { List <SOFTTEK.SCMS.Entity.PM.Measure> listMeasures = new List <SOFTTEK.SCMS.Entity.PM.Measure>(); return(context.Execute(() => { using (dataSource = new PMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var results = dataSource.GetMeasures(modelMeasure); listMeasures = results; } return listMeasures; }, "Retrieve the registered Measure in system.")); }
public Task <IHttpActionResult> Put([FromUri] string id, [FromBody] SOFTTEK.SCMS.Entity.PM.Measure modelUpdate) { IHttpActionResult result = NotFound(); if ((id == null || id == "0") || (modelUpdate == null)) { result = Conflict(); return(Task.FromResult(result)); } var modelFilter = new SOFTTEK.SCMS.Entity.PM.Measure(); 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.PM.MeasureBO activitiesRegisterBO = new Business.PM.MeasureBO(ctx); SOFTTEK.SCMS.Entity.PM.Measure updatedActivity = activitiesRegisterBO.UpdateMeasure(modelFilter, modelUpdate); if (updatedActivity != null) { result = Json(updatedActivity); } } catch (Exception ex) { result = Error(ex); } return(Task.FromResult(result)); }