示例#1
0
        public Task <IHttpActionResult> Post([FromBody] SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTaking 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.PhysicalInventoryTakingBO PhysicalInventoryTakingBO = new Business.FA.PhysicalInventoryTakingBO(ctx);
                SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTaking     registeredActivity        = PhysicalInventoryTakingBO.RegisterPhysicalInventoryTaking(modelInsert);
                if (registeredActivity != null)
                {
                    result = Json(registeredActivity);
                }
            }
            catch (Exception ex)
            {
                result = Error(ex);
            }

            return(Task.FromResult(result));
        }
示例#2
0
        /// <summary>
        /// Register PhysicalInventoryTaking.
        /// </summary>
        /// <param name="modelPhysicalInventoryTaking">modelPhysicalInventoryTaking Insert Model information PhysicalInventoryTaking</param>
        /// <returns>Registered activity information.</returns>
        public SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTaking RegisterPhysicalInventoryTaking(SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTaking modelPhysicalInventoryTaking)
        {
            SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTaking modelInsert = new SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTaking();

            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.InsertPhysicalInventoryTaking(modelPhysicalInventoryTaking);
                    modelInsert = result;
                }
                return modelInsert;
            }, "Register an PhysicalInventoryTaking 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.PhysicalInventoryTaking();

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

                SOFTTEK.SCMS.Business.FA.PhysicalInventoryTakingBO pPhysicalInventoryTakingBO = new Business.FA.PhysicalInventoryTakingBO(ctx);
                listPhysicalInventoryTaking = pPhysicalInventoryTakingBO.SearchPhysicalInventoryTakings(modelFilter);

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

            return(Task.FromResult(result));
        }
示例#4
0
        public Task <IHttpActionResult> Put([FromUri] string id, [FromBody] SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTaking modelUpdate)
        {
            IHttpActionResult result = NotFound();

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

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

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

            return(Task.FromResult(result));
        }
示例#5
0
        /// <summary>
        /// Get all the modelPhysicalInventoryTaking.
        /// </summary>
        /// <param name="modelPhysicalInventoryTaking">modelPhysicalInventoryTaking Identifier</param>
        /// <returns></returns>
        public List <SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTaking> SearchPhysicalInventoryTakings(SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTaking modelPhysicalInventoryTaking)
        {
            List <SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTaking> listPhysicalInventoryTakings = new List <SOFTTEK.SCMS.Entity.FA.PhysicalInventoryTaking>();

            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.GetPhysicalInventoryTakings(modelPhysicalInventoryTaking);
                    listPhysicalInventoryTakings = results;
                }

                return listPhysicalInventoryTakings;
            }, "Retrieve the registered PhysicalInventoryTakings in system."));
        }