Esempio n. 1
0
        public Task <IHttpActionResult> Post([FromBody] SOFTTEK.SCMS.Entity.FA.AvailabilityForecast 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.AvailabilityForecastBO AvailabilityForecastBO = new Business.FA.AvailabilityForecastBO(ctx);
                SOFTTEK.SCMS.Entity.FA.AvailabilityForecast     registeredActivity     = AvailabilityForecastBO.RegisterAvailabilityForecast(modelInsert);
                if (registeredActivity != null)
                {
                    result = Json(registeredActivity);
                }
            }
            catch (Exception ex)
            {
                result = Error(ex);
            }

            return(Task.FromResult(result));
        }
Esempio n. 2
0
        /// <summary>
        /// Register AvailabilityForecast.
        /// </summary>
        /// <param name="modelAvailabilityForecast">modelAvailabilityForecast Insert Model information AvailabilityForecast</param>
        /// <returns>Registered activity information.</returns>
        public SOFTTEK.SCMS.Entity.FA.AvailabilityForecast RegisterAvailabilityForecast(SOFTTEK.SCMS.Entity.FA.AvailabilityForecast modelAvailabilityForecast)
        {
            SOFTTEK.SCMS.Entity.FA.AvailabilityForecast modelInsert = new SOFTTEK.SCMS.Entity.FA.AvailabilityForecast();

            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.InsertAvailabilityForecast(modelAvailabilityForecast);
                    modelInsert = result;
                }
                return modelInsert;
            }, "Register an AvailabilityForecast in system"));
        }
Esempio n. 3
0
        public Task <IHttpActionResult> Get([FromBody] SOFTTEK.SCMS.Entity.FA.AvailabilityForecast modelFilter)
        {
            IHttpActionResult result = NotFound();

            if (modelFilter == null)
            {
                result = Conflict();
                return(Task.FromResult(result));
            }

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

                SOFTTEK.SCMS.Business.FA.AvailabilityForecastBO pAvailabilityForecastBO = new Business.FA.AvailabilityForecastBO(ctx);
                listAvailabilityForecast = pAvailabilityForecastBO.SearchAvailabilityForecasts(modelFilter);

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

            return(Task.FromResult(result));
        }
Esempio n. 4
0
        /// <summary>
        /// Get all the modelAvailabilityForecast.
        /// </summary>
        /// <param name="modelAvailabilityForecast">modelAvailabilityForecast Identifier</param>
        /// <returns></returns>
        public List <SOFTTEK.SCMS.Entity.FA.AvailabilityForecast> SearchAvailabilityForecasts(SOFTTEK.SCMS.Entity.FA.AvailabilityForecast modelAvailabilityForecast)
        {
            List <SOFTTEK.SCMS.Entity.FA.AvailabilityForecast> listAvailabilityForecasts = new List <SOFTTEK.SCMS.Entity.FA.AvailabilityForecast>();

            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.GetAvailabilityForecasts(modelAvailabilityForecast);
                    listAvailabilityForecasts = results;
                }

                return listAvailabilityForecasts;
            }, "Retrieve the registered AvailabilityForecasts in system."));
        }