コード例 #1
0
        public string Post(LU_ASM _LU_ASM, string transactionType)
        {
            string ret = string.Empty;

            try
            {
                Parameters[] colparameters = new Parameters[8] {
                    new Parameters("@paramId", _LU_ASM.Id, DbType.Int32, ParameterDirection.Input),
                    new Parameters("@paramName", _LU_ASM.Name, DbType.String, ParameterDirection.Input),
                    new Parameters("@paramCreatorId", _LU_ASM.CreatorId, DbType.Int32, ParameterDirection.Input),
                    new Parameters("@paramCreationDate", _LU_ASM.CreationDate, DbType.DateTime, ParameterDirection.Input),
                    new Parameters("@paramModifierId", _LU_ASM.ModifierId, DbType.Int32, ParameterDirection.Input),
                    new Parameters("@paramModificationDate", _LU_ASM.ModificationDate, DbType.DateTime, ParameterDirection.Input),
                    new Parameters("@paramIsActive", _LU_ASM.IsActive, DbType.Boolean, ParameterDirection.Input),
                    new Parameters("@paramTransactionType", transactionType, DbType.String, ParameterDirection.Input)
                };
                dbExecutor.ManageTransaction(TransactionType.Open);
                ret = dbExecutor.ExecuteScalarString(true, CommandType.StoredProcedure, "wsp_LU_ASM_Post", colparameters, true);
                dbExecutor.ManageTransaction(TransactionType.Commit);
            }
            catch (DBConcurrencyException except)
            {
                dbExecutor.ManageTransaction(TransactionType.Rollback);
                throw except;
            }
            catch (Exception ex)
            {
                dbExecutor.ManageTransaction(TransactionType.Rollback);
                throw ex;
            }
            return(ret);
        }
コード例 #2
0
        public IHttpActionResult PutLU_ASM(int id, LU_ASM lU_ASM)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != lU_ASM.Id)
            {
                return(BadRequest());
            }

            db.Entry(lU_ASM).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LU_ASMExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public IHttpActionResult GetLU_ASM(int id)
        {
            LU_ASM lU_ASM = db.LU_ASM.Find(id);

            if (lU_ASM == null)
            {
                return(NotFound());
            }

            return(Ok(lU_ASM));
        }
コード例 #4
0
        public IHttpActionResult PostLU_ASM(LU_ASM lU_ASM)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.LU_ASM.Add(lU_ASM);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = lU_ASM.Id }, lU_ASM));
        }
コード例 #5
0
        public IHttpActionResult DeleteLU_ASM(int id)
        {
            LU_ASM lU_ASM = db.LU_ASM.Find(id);

            if (lU_ASM == null)
            {
                return(NotFound());
            }

            db.LU_ASM.Remove(lU_ASM);
            db.SaveChanges();

            return(Ok(lU_ASM));
        }
コード例 #6
0
        public string Post(LU_ASM obj, string transactionType)
        {
            string ret = string.Empty;

            try
            {
                obj.CreatorId        = 1;
                obj.ModifierId       = 1;
                obj.CreationDate     = DateTime.Now;
                obj.ModificationDate = DateTime.Now;
                ret = Facade.LU_ASMDAO.Post(obj, transactionType);
                return(ret);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }