コード例 #1
0
ファイル: BaseAdoDAO.cs プロジェクト: gigiogodoi/W-Project
        public void DbCommandProcedure(ProcedureTO to)
        {
            using (var connection = CreateDbConnection())
            {
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = "FXUSER." + to.Name;
                    command.CommandType = CommandType.StoredProcedure;
                    connection.Open();

                    foreach (var item in to.Parameters)
                    {
                        switch (item.Direction)
                        {
                        case ProcedureParameterDirection.In:
                            command.AddInputParameter(item.Name, item.Value, item.Type);
                            break;

                        case ProcedureParameterDirection.Out:
                            command.AddOutputParameter(item.Name, item.Type);
                            break;
                        }
                    }
                    command.ExecuteNonQuery();
                }
            }
        }
コード例 #2
0
ファイル: BaseDAO.cs プロジェクト: gigiogodoi/Z-Project
        protected ResultTO DbCommandProcedure(ProcedureTO to)
        {
            var resultTO = new ResultTO();

            using (var connection = CreateDbConnection())
            {
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = "FXUSER." + to.Name;
                    command.CommandType = CommandType.StoredProcedure;
                    connection.Open();

                    foreach (var item in to.Parameters)
                    {
                        switch (item.Direction)
                        {
                        case ProcedureParameterDirection.In:
                            command.AddInputParameter(item.Name, item.Value, item.Type);
                            break;

                        case ProcedureParameterDirection.Out:
                            command.AddOutputParameter(item.Name, item.Type);
                            break;
                        }
                    }
                    command.ExecuteNonQuery();

                    resultTO.Message = command.Parameters[to.Parameters
                                                          .Where(i => i.Direction == ProcedureParameterDirection.Out)
                                                          .FirstOrDefault().Name].Value.ToString();

                    resultTO.Result = (resultTO.Message == "OK") ? Result.Pass : Result.Fail;
                }
            }
            return(resultTO);
        }
コード例 #3
0
 public ResultTO Execute(ProcedureTO procedure)
 {
     return(base.DbCommandProcedure(procedure));
 }