Пример #1
0
        public Task <IHttpActionResult> Post([FromBody] SOFTTEK.SCMS.Entity.FA.NoveltyRequest 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.NoveltyRequestBO NoveltyRequestBO   = new Business.FA.NoveltyRequestBO(ctx);
                SOFTTEK.SCMS.Entity.FA.NoveltyRequest     registeredActivity = NoveltyRequestBO.RegisterNoveltyRequest(modelInsert);
                if (registeredActivity != null)
                {
                    result = Json(registeredActivity);
                }
            }
            catch (Exception ex)
            {
                result = Error(ex);
            }

            return(Task.FromResult(result));
        }
Пример #2
0
        /// <summary>
        /// Register NoveltyRequest.
        /// </summary>
        /// <param name="modelNoveltyRequest">modelNoveltyRequest Insert Model information NoveltyRequest</param>
        /// <returns>Registered activity information.</returns>
        public SOFTTEK.SCMS.Entity.FA.NoveltyRequest RegisterNoveltyRequest(SOFTTEK.SCMS.Entity.FA.NoveltyRequest modelNoveltyRequest)
        {
            SOFTTEK.SCMS.Entity.FA.NoveltyRequest modelInsert = new SOFTTEK.SCMS.Entity.FA.NoveltyRequest();

            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.InsertNoveltyRequest(modelNoveltyRequest);
                    modelInsert = result;
                }
                return modelInsert;
            }, "Register an NoveltyRequest in system"));
        }
Пример #3
0
        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.NoveltyRequest();

            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.NoveltyRequest> listNoveltyRequest = new List <SOFTTEK.SCMS.Entity.FA.NoveltyRequest>();

                SOFTTEK.SCMS.Business.FA.NoveltyRequestBO pNoveltyRequestBO = new Business.FA.NoveltyRequestBO(ctx);
                listNoveltyRequest = pNoveltyRequestBO.SearchNoveltyRequests(modelFilter);

                if (listNoveltyRequest.Count > 0)
                {
                    result = Json(listNoveltyRequest);
                }
            }
            catch (Exception ex)
            {
                result = Error(ex);
            }

            return(Task.FromResult(result));
        }
Пример #4
0
        /// <summary>
        /// Get all the modelNoveltyRequest.
        /// </summary>
        /// <param name="modelNoveltyRequest">modelNoveltyRequest Identifier</param>
        /// <returns></returns>
        public List <SOFTTEK.SCMS.Entity.FA.NoveltyRequest> SearchNoveltyRequests(SOFTTEK.SCMS.Entity.FA.NoveltyRequest modelNoveltyRequest)
        {
            List <SOFTTEK.SCMS.Entity.FA.NoveltyRequest> listNoveltyRequests = new List <SOFTTEK.SCMS.Entity.FA.NoveltyRequest>();

            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.GetNoveltyRequests(modelNoveltyRequest);
                    listNoveltyRequests = results;
                }

                return listNoveltyRequests;
            }, "Retrieve the registered NoveltyRequests in system."));
        }
Пример #5
0
        public Task <IHttpActionResult> Put([FromUri] string id, [FromBody] SOFTTEK.SCMS.Entity.FA.NoveltyRequest modelUpdate)
        {
            IHttpActionResult result = NotFound();

            if ((id == null || id == "0") || (modelUpdate == null))
            {
                result = Conflict();
                return(Task.FromResult(result));
            }
            var modelFilter = new SOFTTEK.SCMS.Entity.FA.NoveltyRequest();

            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.NoveltyRequestBO activitiesRegisterBO = new Business.FA.NoveltyRequestBO(ctx);
                SOFTTEK.SCMS.Entity.FA.NoveltyRequest     updatedActivity      = activitiesRegisterBO.UpdateNoveltyRequest(modelFilter, modelUpdate);

                if (updatedActivity != null)
                {
                    result = Json(updatedActivity);
                }
            }
            catch (Exception ex)
            {
                result = Error(ex);
            }

            return(Task.FromResult(result));
        }