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

            return(Task.FromResult(result));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Register Task.
        /// </summary>
        /// <param name="modelTask">modelTask Insert Model information Task</param>
        /// <returns>Registered Task information.</returns>
        public SOFTTEK.SCMS.Entity.PM.Task RegisterTask(SOFTTEK.SCMS.Entity.PM.Task modelTask)
        {
            SOFTTEK.SCMS.Entity.PM.Task modelInsert = new SOFTTEK.SCMS.Entity.PM.Task();

            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.InsertTask(modelTask);
                    modelInsert = result;
                }
                return modelInsert;
            }, "Register an Task in system"));
        }
Exemplo n.º 3
0
        public Task <IHttpActionResult> Get(int id)
        {
            IHttpActionResult result = NotFound();

            if (id == null || id == 0)
            {
                result = Conflict();
                return(Task.FromResult(result));
            }
            var modelTask = new SOFTTEK.SCMS.Entity.PM.Task();

            modelTask.Identifier = Convert.ToInt32(id);
            var modelFilter = new SOFTTEK.SCMS.Entity.PM.Material();

            modelFilter.Task = modelTask;
            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()
                    }
                };

                List <SOFTTEK.SCMS.Entity.PM.Material> listMaterial = new List <SOFTTEK.SCMS.Entity.PM.Material>();

                SOFTTEK.SCMS.Business.PM.MaterialBO pMaterialBO = new Business.PM.MaterialBO(ctx);
                listMaterial = pMaterialBO.SearchMaterial(modelFilter);

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

            return(Task.FromResult(result));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Update an Task.
        /// </summary>
        /// <param name="modelUpdate">model Update Model information Task</param>
        /// /// <param name="modelSearch">model filter information Task</param>
        /// <returns>Update Task information.</returns>
        public SOFTTEK.SCMS.Entity.PM.Task UpdateTask(SOFTTEK.SCMS.Entity.PM.Task modelUpdate, SOFTTEK.SCMS.Entity.PM.Task modelSearch)
        {
            SOFTTEK.SCMS.Entity.PM.Task modelRUpdate = new SOFTTEK.SCMS.Entity.PM.Task();

            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.UpdateTask(modelUpdate, modelSearch);
                    modelRUpdate = result;
                }
                return modelRUpdate;
            }, "Update an Task in system"));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Get all the Tasks.
        /// </summary>
        /// <param name="modelTask">Model Task</param>
        /// <returns></returns>
        public List <SOFTTEK.SCMS.Entity.PM.Task> SearchTask(SOFTTEK.SCMS.Entity.PM.Task modelTask)
        {
            List <SOFTTEK.SCMS.Entity.PM.Task> listTasks = new List <SOFTTEK.SCMS.Entity.PM.Task>();

            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.GetTasks(modelTask);
                    listTasks = results;
                }

                return listTasks;
            }, "Retrieve the registered Tasks in system."));
        }
Exemplo n.º 6
0
        public Task <IHttpActionResult> Put([FromUri] string id, [FromBody] SOFTTEK.SCMS.Entity.PM.Task modelUpdate)
        {
            IHttpActionResult result = NotFound();

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

            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.TaskBO activitiesRegisterBO = new Business.PM.TaskBO(ctx);
                SOFTTEK.SCMS.Entity.PM.Task     updatedActivity      = activitiesRegisterBO.UpdateTask(modelFilter, modelUpdate);

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

            return(Task.FromResult(result));
        }