コード例 #1
0
 internal TestHost(GameObject go, float sp)
 {
     Attach(new FixRenderer(go, go.GetComponentInChildren <Animator>()));
     MoveTo(go.transform.position);
     collideBody = new ModelBody(this, new SpeedRetriever {
         speed = sp
     });
 }
コード例 #2
0
        public ModelBody ModelBodyGet(int id)
        {
            ModelBody retVal = null;

            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();
                    para.Add("@p_Id", id, dbType: DbType.Int32);
                    retVal = conn.Query <ModelBody>("dbo.OXO_ModelBody_Get", para, commandType: CommandType.StoredProcedure).FirstOrDefault();
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }

            return(retVal);
        }
コード例 #3
0
        public bool ModelBodySave(ModelBody obj)
        {
            bool   retVal   = true;
            string procName = (obj.IsNew ? "dbo.OXO_ModelBody_New" : "dbo.OXO_ModelBody_Edit");

            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    obj.Save(this.CurrentCDSID);

                    var para = new DynamicParameters();
                    para.Add("@p_Programme_Id", obj.ProgrammeId, dbType: DbType.Int32);
                    para.Add("@p_Shape", obj.Shape, dbType: DbType.String, size: 50);
                    para.Add("@p_Doors", obj.Doors, dbType: DbType.String, size: 50);
                    para.Add("@p_Wheelbase", obj.Wheelbase, dbType: DbType.String, size: 50);
                    para.Add("@p_Active", obj.Active, dbType: DbType.Boolean);
                    if (obj.IsNew)
                    {
                        para.Add("@p_Created_By", obj.CreatedBy, dbType: DbType.String, size: 8);
                        para.Add("@p_Created_On", obj.CreatedOn, dbType: DbType.DateTime);
                    }
                    para.Add("@p_Updated_By", obj.UpdatedBy, dbType: DbType.String, size: 8);
                    para.Add("@p_Last_Updated", obj.LastUpdated, dbType: DbType.DateTime);
                    para.Add("@p_Id", obj.Id, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
                    conn.Execute(procName, para, commandType: CommandType.StoredProcedure);
                    if (obj.Id == 0)
                    {
                        obj.Id = para.Get <int>("@p_Id");
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }

            return(retVal);
        }