public Task <IHttpActionResult> Post([FromBody] SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTakingItem 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.PhysicalInventoryTakingItemBO PhysicalInventoryTakingItemBO = new Business.FA.PhysicalInventoryTakingItemBO(ctx); SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTakingItem registeredActivity = PhysicalInventoryTakingItemBO.RegisterPhysicalInventoryTakingItem(modelInsert); if (registeredActivity != null) { result = Json(registeredActivity); } } catch (Exception ex) { result = Error(ex); } return(Task.FromResult(result)); }
/// <summary> /// Register PhysicalInventoryTakingItem. /// </summary> /// <param name="modelPhysicalInventoryTakingItem">modelPhysicalInventoryTakingItem Insert Model information PhysicalInventoryTakingItem</param> /// <returns>Registered activity information.</returns> public SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTakingItem RegisterPhysicalInventoryTakingItem(SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTakingItem modelPhysicalInventoryTakingItem) { SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTakingItem modelInsert = new SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTakingItem(); 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.InsertPhysicalInventoryTakingItem(modelPhysicalInventoryTakingItem); modelInsert = result; } return modelInsert; }, "Register an PhysicalInventoryTakingItem 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.PhysicalInventoryTakingItem(); 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.PhysicalInventoryTakingItem> listPhysicalInventoryTakingItem = new List <SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTakingItem>(); SOFTTEK.SCMS.Business.FA.PhysicalInventoryTakingItemBO pPhysicalInventoryTakingItemBO = new Business.FA.PhysicalInventoryTakingItemBO(ctx); listPhysicalInventoryTakingItem = pPhysicalInventoryTakingItemBO.SearchPhysicalInventoryTakingItems(modelFilter); if (listPhysicalInventoryTakingItem.Count > 0) { result = Json(listPhysicalInventoryTakingItem); } } catch (Exception ex) { result = Error(ex); } return(Task.FromResult(result)); }
public Task <IHttpActionResult> Put([FromUri] string id, [FromBody] SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTakingItem modelUpdate) { IHttpActionResult result = NotFound(); if ((id == null || id == "0") || (modelUpdate == null)) { result = Conflict(); return(Task.FromResult(result)); } var modelFilter = new SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTakingItem(); 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.PhysicalInventoryTakingItemBO activitiesRegisterBO = new Business.FA.PhysicalInventoryTakingItemBO(ctx); SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTakingItem updatedActivity = activitiesRegisterBO.UpdatePhysicalInventoryTakingItem(modelFilter, modelUpdate); if (updatedActivity != null) { result = Json(updatedActivity); } } catch (Exception ex) { result = Error(ex); } return(Task.FromResult(result)); }
/// <summary> /// Get all the modelPhysicalInventoryTakingItem. /// </summary> /// <param name="modelPhysicalInventoryTakingItem">modelPhysicalInventoryTakingItem Identifier</param> /// <returns></returns> public List <SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTakingItem> SearchPhysicalInventoryTakingItems(SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTakingItem modelPhysicalInventoryTakingItem) { List <SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTakingItem> listPhysicalInventoryTakingItems = new List <SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTakingItem>(); 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.GetPhysicalInventoryTakingItems(modelPhysicalInventoryTakingItem); listPhysicalInventoryTakingItems = results; } return listPhysicalInventoryTakingItems; }, "Retrieve the registered PhysicalInventoryTakingItems in system.")); }